From d02ae7cffe5e7fd30dcab6750829c1b7f889ffe6 Mon Sep 17 00:00:00 2001 From: Clover Johnson <95094165+callmeclover@users.noreply.github.com> Date: Wed, 29 May 2024 23:01:22 -0400 Subject: [PATCH] bug fixes, make pre-release for first major version! (further testing is still required) --- .gitignore | 11 +++++++---- CHANGELOG.md | 7 +++++++ Cargo.lock | 6 +++--- Cargo.toml | 2 +- TODO.md | 8 ++++++++ src/func.rs | 5 +++-- src/lists.rs | 27 +++++++++++++-------------- src/main.rs | 3 ++- src/model.rs | 18 +++++++++--------- 9 files changed, 53 insertions(+), 34 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 TODO.md diff --git a/.gitignore b/.gitignore index 4c3e6bb..d44a666 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ -/target -/build -/screenshots /.vscode -config.toml \ No newline at end of file + +# cargo files +/target + +# jerry's files +config.toml +/screenshots \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9d62fcc --- /dev/null +++ b/CHANGELOG.md @@ -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) \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 1fa3b33..9813092 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -297,9 +297,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.8.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +checksum = "f803f94ecf597339c7a34eed2036ef83f86aaba937f001f7c5b5e251f043f1f9" dependencies = [ "glob", "libc", @@ -1133,7 +1133,7 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jerry" -version = "0.4.1" +version = "1.0.0" dependencies = [ "ansi_term", "cached", diff --git a/Cargo.toml b/Cargo.toml index b067dff..6e8c38e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "jerry" description = "stupid robot nuisance" -version = "0.4.1" +version = "1.0.0" authors = ["Clover Johnson "] license = "MIT" repository = "https://github.com/callmeclover/jerry" diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..7645303 --- /dev/null +++ b/TODO.md @@ -0,0 +1,8 @@ +- [ ] testing + - [x] windows tests + - [ ] linux tests + - [ ] macos tests +- [ ] platform parity + - [x] windows + - [ ] linux + - [ ] macos \ No newline at end of file diff --git a/src/func.rs b/src/func.rs index 0bb42e8..eadee74 100644 --- a/src/func.rs +++ b/src/func.rs @@ -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}; diff --git a/src/lists.rs b/src/lists.rs index eaa135d..de537d5 100644 --- a/src/lists.rs +++ b/src/lists.rs @@ -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), @@ -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), @@ -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), @@ -211,7 +211,7 @@ 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), @@ -219,7 +219,7 @@ pub static QUOTES_POSITIVE: [(&str, usize); 5] = [ ("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), @@ -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), @@ -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), @@ -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), @@ -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)]; diff --git a/src/main.rs b/src/main.rs index d18f0df..ead6443 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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; diff --git a/src/model.rs b/src/model.rs index 3222c45..ebee441 100644 --- a/src/model.rs +++ b/src/model.rs @@ -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, } -#[cfg(target_os = "windows")] +#[cfg(all(feature = "advanced", target_os = "windows"))] impl GamepadInjector { pub fn new() -> Self { let abs_buttons: HashMap = HashMap::from([ @@ -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, } -#[cfg(target_os = "windows")] +#[cfg(all(feature = "advanced", target_os = "windows"))] impl PenInjector { pub fn new() -> Self { let abs_buttons: HashMap = HashMap::from([ @@ -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();