Skip to content

Commit 4f13350

Browse files
committed
Switch to proxy_dll
1 parent 9338d5b commit 4f13350

File tree

3 files changed

+38
-43
lines changed

3 files changed

+38
-43
lines changed

Cargo.lock

Lines changed: 32 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hook/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ bitflags = "2.6.0"
3333
widestring = "1.1.0"
3434
tokio = { workspace = true, features = ["full"] }
3535
tracing-appender = "0.2.3"
36+
proxy_dll = { git = "https://github.com/trumank/proxy_dll.git", version = "0.1.0" }

hook/src/lib.rs

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,13 @@ use fs_err as fs;
88
use hooks::{FnLoadGameFromMemory, FnSaveGameToMemory};
99
use mint_lib::mod_info::Meta;
1010
use tracing::{info, warn};
11-
use windows::Win32::{
12-
Foundation::HMODULE,
13-
System::{
14-
SystemServices::*,
15-
Threading::{GetCurrentThread, QueueUserAPC},
16-
},
17-
};
18-
19-
// x3daudio1_7.dll
20-
#[no_mangle]
21-
#[allow(non_snake_case, unused_variables)]
22-
extern "system" fn X3DAudioCalculate() {}
23-
#[no_mangle]
24-
#[allow(non_snake_case, unused_variables)]
25-
extern "system" fn X3DAudioInitialize() {}
26-
27-
// d3d9.dll
28-
#[no_mangle]
29-
#[allow(non_snake_case, unused_variables)]
30-
extern "system" fn D3DPERF_EndEvent() {}
31-
#[no_mangle]
32-
#[allow(non_snake_case, unused_variables)]
33-
extern "system" fn D3DPERF_BeginEvent() {}
34-
35-
#[no_mangle]
36-
#[allow(non_snake_case, unused_variables)]
37-
extern "system" fn DllMain(dll_module: HMODULE, call_reason: u32, _: *mut ()) -> bool {
38-
unsafe {
39-
match call_reason {
40-
DLL_PROCESS_ATTACH => {
41-
QueueUserAPC(Some(init), GetCurrentThread(), 0);
42-
}
43-
DLL_PROCESS_DETACH => (),
44-
_ => (),
45-
}
4611

47-
true
48-
}
49-
}
12+
proxy_dll::proxy_dll!([x3daudio1_7, d3d9], init);
5013

51-
unsafe extern "system" fn init(_: usize) {
52-
patch().ok();
14+
fn init() {
15+
unsafe {
16+
patch().ok();
17+
}
5318
}
5419

5520
static mut GLOBALS: Option<Globals> = None;

0 commit comments

Comments
 (0)