diff --git a/Cargo.toml b/Cargo.toml index 0155ced..f6b53c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,9 @@ crate-type = ["cdylib"] [features] cn_beta_1_3_0 = [] +cn_live_1_3_0 = [] os_live_1_3_0 = [] +enable-sdk = [] [dependencies] ilhook = "2.1.1" diff --git a/build.bat b/build.bat index 789954f..2a0bee2 100644 --- a/build.bat +++ b/build.bat @@ -1,4 +1,6 @@ : Build for cn_beta_1_3_0 cargo build --release --no-default-features -F cn_beta_1_3_0 +: Build for cn_live_1_3_0 +cargo build --release --no-default-features -F cn_live_1_3_0 : Build for os_live_1_3_0 cargo build --release --no-default-features -F os_live_1_3_0 \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 4c7baf9..95536d1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,11 +11,7 @@ use windows::Win32::{Foundation::HINSTANCE, System::LibraryLoader::GetModuleHand mod interceptor; mod offsets; -#[cfg(feature = "cn_beta_1_3_0")] -use offsets::CN_BETA_1_3_0_CONFIG as CONFIG; - -#[cfg(feature = "os_live_1_3_0")] -use offsets::OS_LIVE_1_3_0_CONFIG as CONFIG; +use offsets::CONFIG; unsafe fn thread_func() { Console::AllocConsole().unwrap(); @@ -38,18 +34,18 @@ unsafe fn thread_func() { .unwrap(); let krsdk_ex = loop { - match GetModuleHandleA(CONFIG.sdk_dll) { + match GetModuleHandleA(CONFIG.disable_sdk.sdk_dll) { Ok(handle) => break handle, Err(_) => thread::sleep(Duration::from_millis(1)), } }; interceptor - .replace((krsdk_ex.0 as usize) + CONFIG.eula_accept, dummy) + .replace((krsdk_ex.0 as usize) + CONFIG.disable_sdk.eula_accept, dummy) .unwrap(); interceptor - .replace((krsdk_ex.0 as usize) + CONFIG.sdk_go_away, dummy) + .replace((krsdk_ex.0 as usize) + CONFIG.disable_sdk.sdk_go_away, dummy) .unwrap(); println!("Successfully initialized!"); diff --git a/src/offsets.rs b/src/offsets.rs index 490014b..41d935f 100644 --- a/src/offsets.rs +++ b/src/offsets.rs @@ -1,27 +1,52 @@ +#[cfg(not(feature = "enable-sdk"))] use windows::core::{PCSTR, s}; -pub(crate) struct InjectConfiguration { - pub(crate) f_pak_file_check: usize, - pub(crate) kuro_http_get: usize, +#[cfg(not(feature = "enable-sdk"))] +pub(crate) struct DisableSdkConfiguration { pub(crate) sdk_dll: PCSTR, pub(crate) eula_accept: usize, pub(crate) sdk_go_away: usize, } +pub(crate) struct InjectConfiguration { + pub(crate) f_pak_file_check: usize, + pub(crate) kuro_http_get: usize, + #[cfg(not(feature = "enable-sdk"))] + pub(crate) disable_sdk: DisableSdkConfiguration, +} + #[cfg(feature = "cn_beta_1_3_0")] -pub(crate) const CN_BETA_1_3_0_CONFIG: InjectConfiguration = InjectConfiguration { +pub(crate) const CONFIG: InjectConfiguration = InjectConfiguration { f_pak_file_check: 0x3D2F460, kuro_http_get: 0xFC8CF0, - sdk_dll: s!("KRSDKEx.dll"), - eula_accept: 0x4A690, - sdk_go_away: 0x8BB80 + #[cfg(not(feature = "enable-sdk"))] + disable_sdk: DisableSdkConfiguration{ + sdk_dll: s!("KRSDKEx.dll"), + eula_accept: 0x4A690, + sdk_go_away: 0x8BB80, + } +}; + +#[cfg(feature = "cn_live_1_3_0")] +pub(crate) const CONFIG: InjectConfiguration = InjectConfiguration { + f_pak_file_check: 0x3D35DF0, + kuro_http_get: 0xFC9900, + #[cfg(not(feature = "enable-sdk"))] + disable_sdk: DisableSdkConfiguration{ + sdk_dll: s!("KRSDKEx.dll"), + eula_accept: 0x4A690, + sdk_go_away: 0x8B9F0, + } }; #[cfg(feature = "os_live_1_3_0")] -pub(crate) const OS_LIVE_1_3_0_CONFIG: InjectConfiguration = InjectConfiguration { +pub(crate) const CONFIG: InjectConfiguration = InjectConfiguration { f_pak_file_check: 0x3CDC430, kuro_http_get: 0xFC6C20, - sdk_dll: s!("KRSDK.dll"), - eula_accept: 0x94710, - sdk_go_away: 0x9FE10 + #[cfg(not(feature = "enable-sdk"))] + disable_sdk: DisableSdkConfiguration{ + sdk_dll: s!("KRSDK.dll"), + eula_accept: 0x94710, + sdk_go_away: 0x9FE10 + } }; \ No newline at end of file