forked from yixuan-rs/yixuan-patch
CNBeta2.0.4 support
This commit is contained in:
parent
77fe6df724
commit
a7b4174ffb
5 changed files with 31 additions and 15 deletions
|
@ -12,7 +12,7 @@ use windows::Win32::System::Threading::{
|
|||
PROCESS_INFORMATION, STARTUPINFOA,
|
||||
};
|
||||
|
||||
const GAME_EXECUTABLE: PCSTR = s!("ZenlessZoneZero.exe");
|
||||
const GAME_EXECUTABLE: PCSTR = s!("ZenlessZoneZeroBeta.exe");
|
||||
const INJECT_DLL: &str = "vivian.dll";
|
||||
|
||||
fn inject_standard(h_target: HANDLE, dll_path: &str) -> bool {
|
||||
|
|
|
@ -31,8 +31,8 @@ unsafe fn thread_fn() {
|
|||
thread::sleep(Duration::from_secs(5));
|
||||
util::disable_memory_protection();
|
||||
|
||||
println!("vivian-patch (1.7.0 PROD) is initializing");
|
||||
println!("to work with vivian-rs: https://git.xeondev.com/vivian-rs/vivian-rs");
|
||||
println!("vivian-patch (2.0.4 BETA) is initializing");
|
||||
println!("to work with vivian-rs: https://git.xeondev.com/traffic95/vivian-rs/src/branch/CNBeta2.0.4");
|
||||
|
||||
let mut module_manager = NapModuleManager::default();
|
||||
module_manager.add::<Network>();
|
||||
|
|
|
@ -7,14 +7,14 @@ use crate::{
|
|||
util::{import, GAME_ASSEMBLY_BASE},
|
||||
};
|
||||
|
||||
import!(rsa_create() -> usize = 0x19034F20);
|
||||
import!(rsa_from_xml_string(instance: usize, xml_string: usize) -> usize = 0x19035160);
|
||||
import!(il2cpp_string_new(cstr: *const u8) -> usize = 0x1242D60);
|
||||
import!(rsa_create() -> usize = 0x1B56B2E0);
|
||||
import!(rsa_from_xml_string(instance: usize, xml_string: usize) -> usize = 0x1B56B520);
|
||||
import!(il2cpp_string_new(cstr: *const u8) -> usize = 0x115F1B0);
|
||||
|
||||
pub unsafe fn initialize_rsa_public_key() {
|
||||
const SERVER_PUBLIC_KEY: &str = include_str!("../../server_public_key.xml");
|
||||
let rsa_public_key_backdoor_field =
|
||||
((*(GAME_ASSEMBLY_BASE.wrapping_add(0x4E072F0) as *const usize)) + 235872) as *mut usize;
|
||||
((*(GAME_ASSEMBLY_BASE.wrapping_add(0x5552100) as *const usize)) + 252792) as *mut usize;
|
||||
|
||||
let rsa = rsa_create();
|
||||
rsa_from_xml_string(
|
||||
|
@ -44,7 +44,7 @@ pub unsafe fn replace_sdk_public_key_string_literal() {
|
|||
pub unsafe fn monitor_network_state(interceptor: &mut Interceptor) {
|
||||
interceptor
|
||||
.attach(
|
||||
GAME_ASSEMBLY_BASE.wrapping_add(0xAE84F80),
|
||||
GAME_ASSEMBLY_BASE.wrapping_add(0xD8AAEC0),
|
||||
on_network_state_change,
|
||||
)
|
||||
.unwrap();
|
||||
|
|
|
@ -4,10 +4,10 @@ use crate::util::GAME_ASSEMBLY_BASE;
|
|||
|
||||
use super::{ModuleInitError, NapModule, NapModuleContext};
|
||||
|
||||
const ON_COMBO_INIT_SUCCESS: usize = 0x18AE4030;
|
||||
const STATICS: usize = 0x4E072F0;
|
||||
const STATIC_ID: usize = 34344;
|
||||
const FIELD_OFFSET: usize = 0x48;
|
||||
const ON_COMBO_INIT_SUCCESS: usize = 0x1ACA72F0;
|
||||
const STATICS: usize = 0x5552100;
|
||||
const STATIC_ID: usize = 34512;
|
||||
const FIELD_OFFSET: usize = 64;
|
||||
|
||||
pub struct HoyopassPatch;
|
||||
|
||||
|
|
|
@ -2,11 +2,12 @@ use std::ffi::CString;
|
|||
|
||||
use ilhook::x64::Registers;
|
||||
|
||||
use crate::util::{self, import};
|
||||
use crate::util::{self, import, read_csharp_string};
|
||||
|
||||
use super::{ModuleInitError, NapModule, NapModuleContext};
|
||||
|
||||
const MAKE_INITIAL_URL: usize = 0x1ACB6C70;
|
||||
const MAKE_INITIAL_URL: usize = 0x1D1458E0;
|
||||
const WEB_REQUEST_CREATE: usize = 0x1CC2D2A0;
|
||||
|
||||
pub struct Network;
|
||||
|
||||
|
@ -17,11 +18,26 @@ impl NapModule for NapModuleContext<Network> {
|
|||
Network::on_make_initial_url,
|
||||
)?;
|
||||
|
||||
self.interceptor.attach(
|
||||
self.base.wrapping_add(WEB_REQUEST_CREATE),
|
||||
on_web_request_create,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
import!(il2cpp_string_new(cstr: *const u8) -> usize = 0x1242D60);
|
||||
unsafe extern "win64" fn on_web_request_create(reg: *mut Registers, _: usize) {
|
||||
let s = read_csharp_string((*reg).rcx as usize);
|
||||
if s.contains("StandaloneWindows64/cn/") {
|
||||
let s = s.replace("StandaloneWindows64/cn/", "StandaloneWindows64/oversea/");
|
||||
println!("replaced: {s}");
|
||||
(*reg).rcx =
|
||||
il2cpp_string_new(CString::new(s).unwrap().to_bytes_with_nul().as_ptr()) as u64;
|
||||
}
|
||||
}
|
||||
|
||||
import!(il2cpp_string_new(cstr: *const u8) -> usize = 0x115F1B0);
|
||||
|
||||
impl Network {
|
||||
const SDK_URL: &str = "http://127.0.0.1:20100";
|
||||
|
|
Loading…
Reference in a new issue