Skip to content

Commit

Permalink
bug fixes, make pre-release for first major version! (further testing…
Browse files Browse the repository at this point in the history
… is still required)
  • Loading branch information
callmeclover committed May 30, 2024
1 parent 446d5a3 commit d02ae7c
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 34 deletions.
11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/target
/build
/screenshots
/.vscode
config.toml

# cargo files
/target

# jerry's files
config.toml
/screenshots
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## [1.0.0-pre1] - 2024-05-29

- [x] move away from `rsautogui` so we can use the mouse better
- [x] generally use windows dependent crates less
- [x] so many more things

10:56:42 PM, 5/29/2024 (UTC-5)
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "jerry"
description = "stupid robot nuisance"
version = "0.4.1"
version = "1.0.0"
authors = ["Clover Johnson <[email protected]>"]
license = "MIT"
repository = "https://github.com/callmeclover/jerry"
Expand Down
8 changes: 8 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- [ ] testing
- [x] windows tests
- [ ] linux tests
- [ ] macos tests
- [ ] platform parity
- [x] windows
- [ ] linux
- [ ] macos
5 changes: 3 additions & 2 deletions src/func.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{get_config, lists::{ALPHANUMERIC_KEYS, FUNCTION_KEYS, MODIFIER_KEYS, MOUSE_CLICKS, MOUSE_MOVE, MOUSE_SCROLL, QUOTES_NEGATIVE, QUOTES_POSITIVE, QUOTES_QUESTION, QUOTES_STATEMENT, SPECIAL_KEYS}, Speed, SPEED_WEIGHTED_LISTS_SLOW, SPEED_WEIGHTED_LISTS_FAST, SPEED_WEIGHTED_LISTS_NORMAL};
#[cfg(feature = "advanced")]
#[allow(clippy::wildcard_imports)]
use crate::{get_config, lists::*, Speed, SPEED_WEIGHTED_LISTS_SLOW, SPEED_WEIGHTED_LISTS_FAST, SPEED_WEIGHTED_LISTS_NORMAL};
#[cfg(all(feature = "advanced", target_os = "windows"))]
use crate::{GamepadInjector, PenInjector};
use cgisf_lib::{gen_sentence, SentenceConfigBuilder};
use chrono::{prelude::*, DateTime};
Expand Down
27 changes: 13 additions & 14 deletions src/lists.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ pub static SPECIAL_KEYS: &[(Key, usize)] = &[
];

/* Mouse action lists */
pub static MOUSE_CLICKS: [(&str, usize); 6] = [
pub static MOUSE_CLICKS: &[(&str, usize)] = &[
("mouse_down_left", 1),
("mouse_down_right", 1),
("mouse_down_middle", 1),
Expand All @@ -179,7 +179,7 @@ pub static MOUSE_CLICKS: [(&str, usize); 6] = [
("mouse_click_middle", 5),
];

pub static MOUSE_MOVE: [(&str, usize); 8] = [
pub static MOUSE_MOVE: &[(&str, usize)] = &[
("mouse_move_abs", 1),
("mouse_move_rel", 1),
("mouse_drag_abs_std", 5),
Expand All @@ -190,14 +190,14 @@ pub static MOUSE_MOVE: [(&str, usize); 8] = [
("mouse_drag_rel_slw", 3),
];

pub static MOUSE_SCROLL: [(&str, usize); 3] = [
pub static MOUSE_SCROLL: &[(&str, usize)] = &[
("mouse_scroll_x", 2),
("mouse_scroll_y", 2),
("mouse_scroll_xy", 1),
];

/* Quotes */
pub static QUOTES_NEGATIVE: [(&str, usize); 11] = [
pub static QUOTES_NEGATIVE: &[(&str, usize)] = &[
("i don't like you", 1),
("you have no friends", 1),
("loser", 1),
Expand All @@ -211,15 +211,15 @@ pub static QUOTES_NEGATIVE: [(&str, usize); 11] = [
("are you caseoh junior, mr. fatass?", 1),
];

pub static QUOTES_POSITIVE: [(&str, usize); 5] = [
pub static QUOTES_POSITIVE: &[(&str, usize)] = &[
("nice computer you have here", 1),
("you seem cool", 1),
("wowza", 1),
("you're doing great", 1),
("nice wifi", 1),
];

pub static QUOTES_QUESTION: [(&str, usize); 7] = [
pub static QUOTES_QUESTION: &[(&str, usize)] = &[
("what graphics card is this?", 1),
("what games you got?", 1),
("where's your father, huh?", 1),
Expand All @@ -229,7 +229,7 @@ pub static QUOTES_QUESTION: [(&str, usize); 7] = [
("did you know that in terms of male human and female pokémon breeding, vaporeon is the most compatible Pokémon for humans?", 1)
];

pub static QUOTES_STATEMENT: [(&str, usize); 9] = [
pub static QUOTES_STATEMENT: &[(&str, usize)] = &[
("i'm bored", 1),
("i am chaos", 1),
("what a mess", 1),
Expand All @@ -243,7 +243,7 @@ pub static QUOTES_STATEMENT: [(&str, usize); 9] = [

/* Gamepad action lists */
#[allow(dead_code)]
pub static GAMEPAD_BUTTONS: [(&str, usize); 12] = [
pub static GAMEPAD_BUTTONS: &[(&str, usize)] = &[
("A", 3),
("B", 3),
("X", 3),
Expand All @@ -259,11 +259,10 @@ pub static GAMEPAD_BUTTONS: [(&str, usize); 12] = [
];

#[allow(dead_code)]
pub static GAMEPAD_MOVE: [(&str, usize); 2] =
[("LeftThumbstickMove", 3), ("RightThumbstickMove", 1)];
pub static GAMEPAD_MOVE: &[(&str, usize)] = &[("LeftThumbstickMove", 3), ("RightThumbstickMove", 1)];

#[allow(dead_code)]
pub static GAMEPAD_SPECIAL: [(&str, usize); 4] = [
pub static GAMEPAD_SPECIAL: &[(&str, usize)] = &[
("LeftThumbstick", 1),
("Menu", 1),
("RightThumbstick", 1),
Expand All @@ -272,10 +271,10 @@ pub static GAMEPAD_SPECIAL: [(&str, usize); 4] = [

/* Pen action lists */
#[allow(dead_code)]
pub static PEN_BUTTONS: [(&str, usize); 3] = [("Barrel", 1), ("Eraser", 1), ("Inverted", 1)];
pub static PEN_BUTTONS: &[(&str, usize)] = &[("Barrel", 1), ("Eraser", 1), ("Inverted", 1)];

#[allow(dead_code)]
pub static PEN_MOVE: [(&str, usize); 3] = [("XY_Move", 2), ("X_Move", 1), ("Y_Move", 1)];
pub static PEN_MOVE: &[(&str, usize)] = &[("XY_Move", 2), ("X_Move", 1), ("Y_Move", 1)];

#[allow(dead_code)]
pub static PEN_SPECIAL: [(&str, usize); 3] = [("Pressure", 1), ("Tilt", 1), ("Rotation", 1)];
pub static PEN_SPECIAL: &[(&str, usize)] = &[("Pressure", 1), ("Tilt", 1), ("Rotation", 1)];
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ use config::{Config, get_config, get_options};
use enigo::{Enigo, Settings};
#[allow(clippy::wildcard_imports)]
use func::*;
use model::{SPEED_WEIGHTED_LISTS_FAST, SPEED_WEIGHTED_LISTS_NORMAL, SPEED_WEIGHTED_LISTS_SLOW, Speed};
#[allow(clippy::wildcard_imports)]
use model::*;
use std::fs::{create_dir, metadata};
use tts::Tts;

Expand Down
18 changes: 9 additions & 9 deletions src/model.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#[cfg(target_os = "windows")]
#[cfg(all(feature = "advanced", target_os = "windows"))]
use std::collections::HashMap;
#[cfg(target_os = "windows")]
#[cfg(all(feature = "advanced", target_os = "windows"))]
use windows::Gaming::Input::GamepadButtons;
#[cfg(target_os = "windows")]
#[cfg(all(feature = "advanced", target_os = "windows"))]
use windows::UI::Input::Preview::Injection::{
InjectedInputGamepadInfo, InjectedInputPenButtons, InjectedInputPenInfo, InputInjector,
};

#[cfg(target_os = "windows")]
#[cfg(all(feature = "advanced", target_os = "windows"))]
pub struct GamepadInjector {
gamepad_state: InjectedInputGamepadInfo,
injector: InputInjector,
abs_buttons: HashMap<String, bool>,
}

#[cfg(target_os = "windows")]
#[cfg(all(feature = "advanced", target_os = "windows"))]
impl GamepadInjector {
pub fn new() -> Self {
let abs_buttons: HashMap<String, bool> = HashMap::from([
Expand Down Expand Up @@ -120,21 +120,21 @@ impl GamepadInjector {
}
}

#[cfg(target_os = "windows")]
#[cfg(all(feature = "advanced", target_os = "windows"))]
impl Drop for GamepadInjector {
fn drop(&mut self) {
self.injector.UninitializeGamepadInjection().unwrap();
}
}

#[cfg(target_os = "windows")]
#[cfg(all(feature = "advanced", target_os = "windows"))]
pub struct PenInjector {
pen_state: InjectedInputPenInfo,
injector: InputInjector,
abs_buttons: HashMap<String, bool>,
}

#[cfg(target_os = "windows")]
#[cfg(all(feature = "advanced", target_os = "windows"))]
impl PenInjector {
pub fn new() -> Self {
let abs_buttons: HashMap<String, bool> = HashMap::from([
Expand Down Expand Up @@ -214,7 +214,7 @@ impl PenInjector {
}
}

#[cfg(target_os = "windows")]
#[cfg(all(feature = "advanced", target_os = "windows"))]
impl Drop for PenInjector {
fn drop(&mut self) {
self.injector.UninitializePenInjection().unwrap();
Expand Down

0 comments on commit d02ae7c

Please sign in to comment.