initial commit
This commit is contained in:
12
mhypbase/Cargo.toml
Normal file
12
mhypbase/Cargo.toml
Normal file
@@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "mhypbase"
|
||||
edition = "2024"
|
||||
version.workspace = true
|
||||
|
||||
[lib]
|
||||
name = "mhypbase"
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
windows.workspace = true
|
||||
hkrpg.workspace = true
|
||||
7
mhypbase/build.rs
Normal file
7
mhypbase/build.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
fn main() {
|
||||
println!(
|
||||
"cargo:rustc-link-search=native={}",
|
||||
std::env::var("OUT_DIR").unwrap()
|
||||
);
|
||||
println!("cargo:rustc-link-arg=/DEF:mhypbase/mhypbase.def");
|
||||
}
|
||||
3
mhypbase/mhypbase.def
Normal file
3
mhypbase/mhypbase.def
Normal file
@@ -0,0 +1,3 @@
|
||||
LIBRARY MHYPBASE
|
||||
EXPORTS
|
||||
Initialize @1
|
||||
27
mhypbase/src/lib.rs
Normal file
27
mhypbase/src/lib.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
use windows::Win32::{
|
||||
Foundation::HINSTANCE,
|
||||
System::{
|
||||
SystemServices::DLL_PROCESS_ATTACH,
|
||||
Threading::{GetCurrentThread, TerminateThread},
|
||||
},
|
||||
};
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
#[allow(non_snake_case, unused_variables)]
|
||||
extern "cdecl" fn Initialize() -> bool {
|
||||
std::thread::sleep(std::time::Duration::from_secs(2));
|
||||
|
||||
unsafe {
|
||||
TerminateThread(GetCurrentThread(), 0).unwrap();
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[unsafe(no_mangle)]
|
||||
unsafe extern "system" fn DllMain(_: HINSTANCE, call_reason: u32, _: *mut ()) {
|
||||
if call_reason == DLL_PROCESS_ATTACH {
|
||||
std::thread::spawn(hkrpg::main);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user