Updated to OS Live 1.3.0 #1

Merged
xavo95 merged 1 commit from :os-live-1-3-0-support into master 2024-09-27 21:08:49 +00:00
5 changed files with 91 additions and 17 deletions

49
Cargo.lock generated
View file

@ -153,9 +153,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "windows"
version = "0.54.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49"
checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
dependencies = [
"windows-core",
"windows-targets",
@ -163,20 +163,55 @@ dependencies = [
[[package]]
name = "windows-core"
version = "0.54.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65"
checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
dependencies = [
"windows-implement",
"windows-interface",
"windows-result",
"windows-strings",
"windows-targets",
]
[[package]]
name = "windows-result"
version = "0.1.2"
name = "windows-implement"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8"
checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "windows-interface"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "windows-result"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-strings"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
dependencies = [
"windows-result",
"windows-targets",
]

View file

@ -7,9 +7,13 @@ edition = "2021"
name = "shorekeeper"
crate-type = ["cdylib"]
[features]
cn_beta_1_3_0 = []
os_live_1_3_0 = []
[dependencies]
ilhook = "2.1.0"
windows = { version = "0.54.0", features = [
ilhook = "2.1.1"
windows = { version = "0.58.0", features = [
"Win32_Foundation",
"Win32_System_LibraryLoader",
"Win32_System_SystemServices",

4
build.bat Normal file
View file

@ -0,0 +1,4 @@
: Build for cn_beta_1_3_0
cargo build --release --no-default-features -F cn_beta_1_3_0
: Build for os_live_1_3_0
cargo build --release --no-default-features -F os_live_1_3_0

View file

@ -3,15 +3,19 @@ use std::time::Duration;
use ilhook::x64::Registers;
use interceptor::Interceptor;
use windows::core::{s, w, PCSTR, PCWSTR};
use windows::core::{w, PCSTR, PCWSTR};
use windows::Win32::System::Console;
use windows::Win32::System::SystemServices::DLL_PROCESS_ATTACH;
use windows::Win32::{Foundation::HINSTANCE, System::LibraryLoader::GetModuleHandleA};
mod interceptor;
mod offsets;
const FPAKFILE_CHECK: usize = 0x3D2F460;
const KUROHTTP_GET: usize = 0xFC8CF0;
#[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;
unsafe fn thread_func() {
Console::AllocConsole().unwrap();
@ -24,28 +28,28 @@ unsafe fn thread_func() {
let mut interceptor = Interceptor::new();
interceptor
.replace(
(module.0 as usize) + FPAKFILE_CHECK,
(module.0 as usize) + CONFIG.f_pak_file_check,
fpakfile_check_replacement,
)
.unwrap();
interceptor
.attach((module.0 as usize) + KUROHTTP_GET, on_kurohttp_get)
.attach((module.0 as usize) + CONFIG.kuro_http_get, on_kurohttp_get)
.unwrap();
let krsdk_ex = loop {
match GetModuleHandleA(s!("KRSDKEx.dll")) {
match GetModuleHandleA(CONFIG.sdk_dll) {
Ok(handle) => break handle,
Err(_) => thread::sleep(Duration::from_millis(1)),
}
};
interceptor
.replace((krsdk_ex.0 as usize) + 0x4A690, dummy)
.replace((krsdk_ex.0 as usize) + CONFIG.eula_accept, dummy)
.unwrap();
interceptor
.replace((krsdk_ex.0 as usize) + 0x8BB80, dummy)
.replace((krsdk_ex.0 as usize) + CONFIG.sdk_go_away, dummy)
.unwrap();
println!("Successfully initialized!");

27
src/offsets.rs Normal file
View file

@ -0,0 +1,27 @@
use windows::core::{PCSTR, s};
pub(crate) struct InjectConfiguration {
pub(crate) f_pak_file_check: usize,
pub(crate) kuro_http_get: usize,
pub(crate) sdk_dll: PCSTR,
pub(crate) eula_accept: usize,
pub(crate) sdk_go_away: usize,
}
#[cfg(feature = "cn_beta_1_3_0")]
pub(crate) const CN_BETA_1_3_0_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(feature = "os_live_1_3_0")]
pub(crate) const OS_LIVE_1_3_0_CONFIG: InjectConfiguration = InjectConfiguration {
f_pak_file_check: 0x3CDC430,
kuro_http_get: 0xFC6C20,
sdk_dll: s!("KRSDK.dll"),
eula_accept: 0x94710,
sdk_go_away: 0x9FE10
};