Skip to content

Commit

Permalink
Cleanup and factor dependencies (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
veeenu authored Mar 8, 2024
1 parent a89eb80 commit 07e2c9a
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 92 deletions.
74 changes: 10 additions & 64 deletions Cargo.lock

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

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ codegen-units = 1
opt-level = 3

[workspace.dependencies]
hudhook = "0.6.1"
hudhook = "0.6.3"
imgui = "0.11.0"
once_cell = "1.19.0"
parking_lot = "0.12.1"
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.114"
practice-tool-core = { git = "https://github.com/veeenu/practice-tool-core", version = "0.1.0" }
practice-tool-tasks = { git = "https://github.com/veeenu/practice-tool-core", version = "0.1.0" }

Expand All @@ -42,6 +44,7 @@ features = [
"Win32_System_Diagnostics_Debug",
"Win32_System_ProcessStatus",
"Win32_System_SystemInformation",
"Win32_System_SystemServices",
"Win32_System_Threading",
]

Expand Down
8 changes: 0 additions & 8 deletions justfile

This file was deleted.

2 changes: 1 addition & 1 deletion lib/libds3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ edition = "2021"
log = "0.4.14"
widestring = "0.5.1"
macro-param = { path = "../macro-param" }
serde_json = "1.0.73"
serde_json.workspace = true
parking_lot.workspace = true
once_cell.workspace = true
windows.workspace = true
2 changes: 1 addition & 1 deletion lib/no-logo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ crate-type = ["cdylib"]

[dependencies]
libds3 = { path = "../libds3" }
windows = { workspace = true, features = ["Win32_System_SystemServices"] }
windows.workspace = true
once_cell.workspace = true
2 changes: 1 addition & 1 deletion lib/param-mod/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ crate-type = ["cdylib"]

[dependencies]
libds3 = { path = "../libds3" }
serde = { version = "1.0.147", features = ["derive"] }
toml = "0.5.9"
serde.workspace = true
windows.workspace = true
once_cell.workspace = true
1 change: 1 addition & 0 deletions lib/param-mod/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ unsafe impl Send for State {}
unsafe impl Sync for State {}

static STATE: Lazy<State> = Lazy::new(|| unsafe {
// TODO use GetSystemDirectory
let dinput8 = LoadLibraryA(PCSTR(b"C:\\Windows\\System32\\dinput8.dll\0".as_ptr())).unwrap();
let directinput8create =
std::mem::transmute(GetProcAddress(dinput8, PCSTR(b"DirectInput8Create\0".as_ptr())));
Expand Down
1 change: 0 additions & 1 deletion lib/param-tinkerer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ name = "jdsd_dsiii_param_tinkerer"

[dependencies]
libds3 = { path = "../libds3" }
windows = { version = "0.42.0", features = ["Win32_System_LibraryLoader", "Win32_Foundation"] }
hudhook.workspace = true
imgui.workspace = true
4 changes: 2 additions & 2 deletions practice-tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ parking_lot = "0.11.2"
pkg-version = "1.0.0"
regex = "1"
semver = "0.11.0"
serde = { version = "1.0.130", features = ["derive"] }
serde_json = "1.0.57"
toml = "0.5.6"
tracing-subscriber = "0.3.17"
ureq = { version = "2.8.0", features = ["json"] }
widestring = "0.5.1"

libds3 = { path = "../lib/libds3" }

serde.workspace = true
serde_json.workspace = true
hudhook.workspace = true
imgui.workspace = true
once_cell.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion practice-tool/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fn main() {
embed_resource::compile("./src/practice-tool.rc", embed_resource::NONE);
embed_resource::compile("./src/resources.rc", embed_resource::NONE);
println!("cargo:rustc-cdylib-link-arg=/DEF:lib/no-logo/exports.def");
}
21 changes: 11 additions & 10 deletions practice-tool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,7 @@ static DIRECTINPUT8CREATE: Lazy<FDirectInput8Create> = Lazy::new(|| unsafe {
let dinput8 = LoadLibraryW(PCWSTR(dinput8_path.as_ptr())).unwrap();
let directinput8create = std::mem::transmute(GetProcAddress(dinput8, s!("DirectInput8Create")));

// This is evaluated twice: here and in [`PracticeTool::new()`]. No big deal,
// but might want to refactor that eventually.
let pointer_chains = PointerChains::new();
pointer_chains
.no_logo
.write([
0x48, 0x31, 0xC0, 0x48, 0x89, 0x02, 0x49, 0x89, 0x04, 0x24, 0x90, 0x90, 0x90, 0x90,
0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
])
.unwrap();
apply_no_logo();

directinput8create
});
Expand All @@ -86,6 +77,16 @@ unsafe extern "stdcall" fn DirectInput8Create(
(DIRECTINPUT8CREATE)(hinst, dwversion, riidltf, ppvout, punkouter)
}

fn apply_no_logo() {
// This is evaluated twice: here and in [`PracticeTool::new()`]. No big deal,
// but might want to refactor that eventually.
let pointer_chains = PointerChains::new();
pointer_chains.no_logo.write([
0x48, 0x31, 0xC0, 0x48, 0x89, 0x02, 0x49, 0x89, 0x04, 0x24, 0x90, 0x90, 0x90, 0x90, 0x90,
0x90, 0x90, 0x90, 0x90, 0x90,
]);
}

fn start_practice_tool(hmodule: HINSTANCE) {
let practice_tool = PracticeTool::new();

Expand Down
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion practice-tool/src/widgets/savefile_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use practice_tool_core::widgets::savefile_manager::SavefileManager;
use practice_tool_core::widgets::Widget;

pub(crate) fn savefile_manager(key_load: Option<Key>, key_close: Key) -> Box<dyn Widget> {
// TODO
Box::new(SavefileManager::new(key_load, Some(key_close), get_savefile_path().unwrap()))
}

Expand Down
2 changes: 1 addition & 1 deletion xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ dotenv = "0.15.0"
heck = "0.4.0"
pelite = "0.10.0"
regex = "1.5.5"
serde_json = "1.0.73"
textwrap = "0.15.0"
zip = "0.6"

serde_json.workspace = true
practice-tool-tasks.workspace = true

0 comments on commit 07e2c9a

Please sign in to comment.