Update library

This commit is contained in:
xavo95 2025-01-22 03:37:47 +01:00
parent 57e6f43142
commit 58f8f2b1c5
Signed by: xavo95
GPG key ID: CBF8ADED6DEBB783
5 changed files with 25 additions and 21 deletions

6
Cargo.lock generated
View file

@ -13,9 +13,9 @@ dependencies = [
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "2.7.0" version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be" checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
[[package]] [[package]]
name = "iced-x86" name = "iced-x86"
@ -44,7 +44,7 @@ dependencies = [
[[package]] [[package]]
name = "interceptor-rs" name = "interceptor-rs"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.xeondev.com/xavo95/interceptor-rs.git#282da6f98b8e4a4e9844422343d4ce11606c9de6" source = "git+https://git.xeondev.com/xavo95/interceptor-rs.git#418aef083cc6768201f0512fdbdca5c03aa4f787"
dependencies = [ dependencies = [
"ilhook", "ilhook",
] ]

View file

@ -12,13 +12,13 @@ advanced = []
cn_beta_2_1_0 = [] cn_beta_2_1_0 = []
enable-sdk = [] enable-sdk = []
only-sig-bypass = [] only-sig-bypass = []
regular = ["dep:regex", "dep:unreal-niggery-rs", "dep:widestring"] regular = ["dep:regex", "dep:widestring"]
[dependencies] [dependencies]
ilhook = "2.1.1" ilhook = "2.1.1"
interceptor-rs = { git = "https://git.xeondev.com/xavo95/interceptor-rs.git" } interceptor-rs = { git = "https://git.xeondev.com/xavo95/interceptor-rs.git" }
regex = { version = "1.11.1", optional = true } regex = { version = "1.11.1", optional = true }
unreal-niggery-rs = { git = "https://git.xeondev.com/xavo95/unreal-niggery-rs.git", optional = true } unreal-niggery-rs = { git = "https://git.xeondev.com/xavo95/unreal-niggery-rs.git" }
widestring = { version = "1.1.0", optional = true } widestring = { version = "1.1.0", optional = true }
windows = { version = "0.59.0", features = [ windows = { version = "0.59.0", features = [
"Win32_Foundation", "Win32_Foundation",

View file

@ -13,9 +13,7 @@ EXIT /B 0
:buildAllVariants :buildAllVariants
SETLOCAL ENABLEDELAYEDEXPANSION SETLOCAL ENABLEDELAYEDEXPANSION
call:cargoReleaseBuild "cn_live_2_0_2,%~1" %~1 call:cargoReleaseBuild "cn_beta_2_1_0,%~1" %~1
call:cargoReleaseBuild "cn_live_bilibili_2_0_2,%~1" %~1
call:cargoReleaseBuild "os_live_2_0_2,%~1" %~1
ENDLOCAL ENDLOCAL
EXIT /B 0 EXIT /B 0

View file

@ -11,7 +11,7 @@ use windows::core::PCSTR;
use windows::Win32::System::LibraryLoader::GetModuleHandleA; use windows::Win32::System::LibraryLoader::GetModuleHandleA;
use crate::{config, curl_utils}; use crate::{config, curl_utils};
use crate::config::CONFIG; use crate::config::{CONFIG, CurlConfig};
use crate::replacer::{AbstractReplacer, GenericReplacer, Replacer}; use crate::replacer::{AbstractReplacer, GenericReplacer, Replacer};
type CurlEasySetStr = fn(handle: usize, tag: u64, value: *const c_char); type CurlEasySetStr = fn(handle: usize, tag: u64, value: *const c_char);
@ -59,8 +59,11 @@ pub(crate) fn configure_extras(interceptor: &mut interceptor_rs::Interceptor) {
let _ = UE_CURL_EASY_SETOPT_FUNC.set(module.0 as usize + CONFIG.ue_curl_config.curl_easy_setopt); let _ = UE_CURL_EASY_SETOPT_FUNC.set(module.0 as usize + CONFIG.ue_curl_config.curl_easy_setopt);
interceptor interceptor
.attach((module.0 as usize) + CONFIG.ue_curl_config.curl_easy_perform, on_ue_curl_easy_perform) .attach(
.unwrap(); (module.0 as usize) + CONFIG.ue_curl_config.curl_easy_perform,
on_curl_easy_perform,
Some(&CONFIG.ue_curl_config as *const _ as usize)
).unwrap();
let krsdk_ex = loop { let krsdk_ex = loop {
match unsafe { GetModuleHandleA(CONFIG.disable_sdk.sdk_dll) } { match unsafe { GetModuleHandleA(CONFIG.disable_sdk.sdk_dll) } {
@ -70,11 +73,11 @@ pub(crate) fn configure_extras(interceptor: &mut interceptor_rs::Interceptor) {
}; };
interceptor interceptor
.replace((krsdk_ex.0 as usize) + CONFIG.disable_sdk.eula_accept, dummy) .replace((krsdk_ex.0 as usize) + CONFIG.disable_sdk.eula_accept, dummy, None)
.unwrap(); .unwrap();
interceptor interceptor
.replace((krsdk_ex.0 as usize) + CONFIG.disable_sdk.sdk_go_away, dummy) .replace((krsdk_ex.0 as usize) + CONFIG.disable_sdk.sdk_go_away, dummy, None)
.unwrap(); .unwrap();
} }
@ -82,22 +85,25 @@ unsafe extern "win64" fn dummy(_: *mut Registers, _: usize, _: usize) -> usize {
1 1
} }
unsafe extern "win64" fn on_ue_curl_easy_perform(reg: *mut Registers, _: usize) { unsafe extern "win64" fn on_curl_easy_perform(reg: *mut Registers, user_data: usize) {
let config = std::ptr::read(user_data as *const CurlConfig);
let curl_handle = unsafe { let curl_handle = unsafe {
*(((*reg).rcx + CONFIG.ue_curl_config.handle_rcx_relative_offset) as *const usize) *(((*reg).rcx + config.handle_rcx_relative_offset) as *const usize)
}; };
let url_ptr = unsafe { let url_ptr = unsafe {
*((curl_handle + CONFIG.ue_curl_config.url_handle_relative_offset) as *const usize) *((curl_handle + config.url_handle_relative_offset) as *const usize)
}; };
let url = unsafe { CStr::from_ptr(url_ptr as *const i8) }.to_str().unwrap(); let url = unsafe { CStr::from_ptr(url_ptr as *const i8) }.to_str().unwrap();
println!("[ue_curl_easy_perform] Original URL: {url}"); println!("[curl_easy_perform] Original URL: {url}");
for replacer in unsafe { URL_REPLACER.get_mut().unwrap() } { for replacer in unsafe { URL_REPLACER.get_mut().unwrap() } {
match replacer.replace(url) { match replacer.replace(url) {
Ok(result) => { Ok(result) => {
println!("[ue_curl_easy_perform] Replacement URL: {result}"); println!("[curl_easy_perform] Replacement URL: {result}");
let url = CString::new(result.as_str()).unwrap(); let url = CString::new(result.as_str()).unwrap();
unsafe { unsafe {
// TODO: Rethink this for other curl interceptors
std::mem::transmute::<usize, CurlEasySetStr>(*UE_CURL_EASY_SETOPT_FUNC.get().unwrap())( std::mem::transmute::<usize, CurlEasySetStr>(*UE_CURL_EASY_SETOPT_FUNC.get().unwrap())(
curl_handle, curl_handle,
curl_utils::CURL_OPT_URL, curl_utils::CURL_OPT_URL,

View file

@ -43,7 +43,7 @@ fn thread_func() {
let mut interceptor = Interceptor::new(); let mut interceptor = Interceptor::new();
interceptor interceptor
.replace((module.0 as usize) + CONFIG.f_pak_file_check, fpakfile_check_replacement) .replace((module.0 as usize) + CONFIG.f_pak_file_check, fpakfile_check_replacement, None)
.unwrap(); .unwrap();
TArray::set_t_array_resize_grow_ptr(module.0 as usize + CONFIG.resize_grow); TArray::set_t_array_resize_grow_ptr(module.0 as usize + CONFIG.resize_grow);
@ -53,10 +53,10 @@ fn thread_func() {
println!("Found custom location for pak files: {value}"); println!("Found custom location for pak files: {value}");
let _ = CUSTOM_PAK_FOLDER.set(value).unwrap(); let _ = CUSTOM_PAK_FOLDER.set(value).unwrap();
interceptor interceptor
.attach((module.0 as usize) + CONFIG.add_pak_folders_entry, add_pak_folders) .attach((module.0 as usize) + CONFIG.add_pak_folders_entry, add_pak_folders, None)
.unwrap(); .unwrap();
interceptor interceptor
.attach((module.0 as usize) + CONFIG.add_pak_folders_ret, debug_get_pak_folders) .attach((module.0 as usize) + CONFIG.add_pak_folders_ret, debug_get_pak_folders, None)
.unwrap(); .unwrap();
} }