Added HoYoPass patch module

This commit is contained in:
traffic95 2025-05-09 09:40:00 +02:00
parent c264b37593
commit 8c1ea6605f
3 changed files with 36 additions and 5 deletions

View file

@ -4,12 +4,9 @@ use std::{thread, time::Duration};
use interceptor::Interceptor;
use modules::{
censorship_patch::CensorshipPatch,
crypto::{
censorship_patch::CensorshipPatch, crypto::{
initialize_rsa_public_key, monitor_network_state, replace_sdk_public_key_string_literal,
},
network::Network,
NapModuleManager,
}, hoyopass_patch::HoyopassPatch, network::Network, NapModuleManager
};
use windows::{
core::s,
@ -36,6 +33,7 @@ unsafe fn thread_fn() {
let mut module_manager = NapModuleManager::default();
module_manager.add::<Network>();
module_manager.add::<CensorshipPatch>();
module_manager.add::<HoyopassPatch>();
module_manager.init().expect("failed to initialize modules");
initialize_rsa_public_key();

View file

@ -0,0 +1,32 @@
use ilhook::x64::Registers;
use crate::util::GAME_ASSEMBLY_BASE;
use super::{ModuleInitError, NapModule, NapModuleContext};
const ON_COMBO_INIT_SUCCESS: usize = 0x18FAD620;
const STATICS: usize = 0x4EB7100;
const STATIC_ID: usize = 34352;
const FIELD_OFFSET: usize = 67;
pub struct HoyopassPatch;
impl NapModule for NapModuleContext<HoyopassPatch> {
unsafe fn init(&mut self) -> Result<(), ModuleInitError> {
self.interceptor.attach(
self.base.wrapping_add(ON_COMBO_INIT_SUCCESS),
HoyopassPatch::on_combo_init_success,
)?;
Ok(())
}
}
impl HoyopassPatch {
pub unsafe extern "win64" fn on_combo_init_success(_: *mut Registers, _: usize) {
let statics = *(GAME_ASSEMBLY_BASE.wrapping_add(STATICS) as *mut usize);
let config_manager = *(statics.wrapping_add(STATIC_ID) as *mut usize);
*(config_manager.wrapping_add(FIELD_OFFSET) as *mut bool) = false;
println!("HoYoPassPatch - OnComboInitSuccess()");
}
}

View file

@ -4,6 +4,7 @@ use crate::{interceptor::Interceptor, util};
pub mod censorship_patch;
pub mod crypto;
pub mod hoyopass_patch;
pub mod network;
#[derive(thiserror::Error, Debug)]