2.0 PROD #1
3 changed files with 64 additions and 1 deletions
|
@ -2,6 +2,7 @@ use std::{thread, time::Duration};
|
|||
|
||||
use interceptor::Interceptor;
|
||||
use modules::{
|
||||
censorship_patch::CensorshipPatch,
|
||||
crypto::{
|
||||
initialize_rsa_public_key, monitor_network_state, replace_sdk_public_key_string_literal,
|
||||
},
|
||||
|
@ -32,11 +33,15 @@ unsafe fn thread_fn() {
|
|||
util::disable_memory_protection();
|
||||
|
||||
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");
|
||||
|
||||
println!(
|
||||
"to work with vivian-rs: https://git.xeondev.com/vivian-rs/vivian-rs/src/branch/2.0_beta"
|
||||
);
|
||||
|
||||
let mut module_manager = NapModuleManager::default();
|
||||
module_manager.add::<Network>();
|
||||
module_manager.add::<HoyopassPatch>();
|
||||
module_manager.add::<CensorshipPatch>();
|
||||
module_manager.init().expect("failed to initialize modules");
|
||||
|
||||
initialize_rsa_public_key();
|
||||
|
|
57
vivian/src/modules/censorship_patch.rs
Normal file
57
vivian/src/modules/censorship_patch.rs
Normal file
|
@ -0,0 +1,57 @@
|
|||
use ilhook::x64::Registers;
|
||||
use std::sync::atomic::{AtomicU32, Ordering};
|
||||
|
||||
use super::{ModuleInitError, NapModule, NapModuleContext};
|
||||
|
||||
const SET_DITHER_CONFIG: usize = 0x8DF8980;
|
||||
const DITHER_CONFIG_AVATAR_USING_DITHER_ALPHA: usize = 0x41;
|
||||
|
||||
const ON_ENTER_SCENE_SC_NOTIFY: usize = 0x83862A0;
|
||||
const ENTER_SCENE_SC_NOTIFY_SCENE_DATA: usize = 0x18;
|
||||
const SCENE_DATA_SCENE_TYPE: usize = 0x6C;
|
||||
const SCENE_TYPE_HALL: u32 = 1;
|
||||
|
||||
static LAST_ENTER_SCENE_TYPE: AtomicU32 = AtomicU32::new(0);
|
||||
|
||||
pub struct CensorshipPatch;
|
||||
|
||||
impl NapModule for NapModuleContext<CensorshipPatch> {
|
||||
unsafe fn init(&mut self) -> Result<(), ModuleInitError> {
|
||||
self.interceptor.attach(
|
||||
self.base.wrapping_add(SET_DITHER_CONFIG),
|
||||
CensorshipPatch::on_set_dither_config,
|
||||
)?;
|
||||
|
||||
self.interceptor.attach(
|
||||
self.base.wrapping_add(ON_ENTER_SCENE_SC_NOTIFY),
|
||||
CensorshipPatch::on_enter_scene_sc_notify,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl CensorshipPatch {
|
||||
pub unsafe extern "win64" fn on_set_dither_config(reg: *mut Registers, _: usize) {
|
||||
if LAST_ENTER_SCENE_TYPE.load(Ordering::SeqCst) == SCENE_TYPE_HALL {
|
||||
println!("SetDitherConfig: disabling dither alpha");
|
||||
*(((*reg).rdx as *mut u8).wrapping_add(DITHER_CONFIG_AVATAR_USING_DITHER_ALPHA)) = 0;
|
||||
} else {
|
||||
println!("SetDitherConfig: not in hall, ignoring");
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe extern "win64" fn on_enter_scene_sc_notify(reg: *mut Registers, _: usize) {
|
||||
let scene_data = *((*reg).rdx as *const u8)
|
||||
.wrapping_add(ENTER_SCENE_SC_NOTIFY_SCENE_DATA)
|
||||
.cast::<usize>();
|
||||
|
||||
let scene_type = *(scene_data as *const u8)
|
||||
.wrapping_add(SCENE_DATA_SCENE_TYPE)
|
||||
.cast::<u32>();
|
||||
|
||||
println!("EnterSceneScNotify scene_type: {scene_type}");
|
||||
|
||||
LAST_ENTER_SCENE_TYPE.store(scene_type, Ordering::SeqCst);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ use std::marker::PhantomData;
|
|||
|
||||
use crate::{interceptor::Interceptor, util};
|
||||
|
||||
pub mod censorship_patch;
|
||||
pub mod crypto;
|
||||
pub mod hoyopass_patch;
|
||||
pub mod network;
|
||||
|
|
Loading…
Reference in a new issue