Compare commits

..

2 commits

Author SHA1 Message Date
08f58b968c censorship patch: add check for BigScene 2025-06-08 02:26:48 +03:00
fa4231edfe 2.0 PROD (#1)
Co-authored-by: traffic95 <traffic95@xeondev.com>
Reviewed-on: #1
2025-06-03 20:56:44 +03:00
15 changed files with 57 additions and 42 deletions

20
Cargo.lock generated
View file

@ -239,16 +239,6 @@ version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
[[package]]
name = "vivian"
version = "0.0.1"
dependencies = [
"ilhook",
"num_enum",
"thiserror 2.0.11",
"windows",
]
[[package]] [[package]]
name = "windows" name = "windows"
version = "0.59.0" version = "0.59.0"
@ -441,3 +431,13 @@ checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "yixuan"
version = "0.0.1"
dependencies = [
"ilhook",
"num_enum",
"thiserror 2.0.11",
"windows",
]

View file

@ -1,5 +1,5 @@
[workspace] [workspace]
members = ["launcher", "vivian"] members = ["launcher", "yixuan"]
resolver = "2" resolver = "2"
[workspace.package] [workspace.package]

View file

@ -1,2 +1,2 @@
# vivian-patch # yixuan-patch

View file

@ -12,8 +12,8 @@ use windows::Win32::System::Threading::{
PROCESS_INFORMATION, STARTUPINFOA, PROCESS_INFORMATION, STARTUPINFOA,
}; };
const GAME_EXECUTABLE: PCSTR = s!("ZenlessZoneZeroBeta.exe"); const GAME_EXECUTABLE: PCSTR = s!("ZenlessZoneZero.exe");
const INJECT_DLL: &str = "vivian.dll"; const INJECT_DLL: &str = "yixuan.dll";
fn inject_standard(h_target: HANDLE, dll_path: &str) -> bool { fn inject_standard(h_target: HANDLE, dll_path: &str) -> bool {
unsafe { unsafe {

View file

@ -1,10 +1,10 @@
[package] [package]
name = "vivian" name = "yixuan"
edition = "2021" edition = "2021"
version.workspace = true version.workspace = true
[lib] [lib]
name = "vivian" name = "yixuan"
crate-type = ["cdylib"] crate-type = ["cdylib"]
[dependencies] [dependencies]

View file

@ -32,10 +32,10 @@ unsafe fn thread_fn() {
thread::sleep(Duration::from_secs(5)); thread::sleep(Duration::from_secs(5));
util::disable_memory_protection(); util::disable_memory_protection();
println!("vivian-patch (2.0.12 KOL) is initializing"); println!("yixuan-patch (2.0.0 PROD) is initializing");
println!( println!(
"to work with vivian-rs: https://git.xeondev.com/vivian-rs/vivian-rs/src/branch/2.0_beta" "to work with yixuan-rs: https://git.xeondev.com/yixuan-rs/yixuan-rs"
); );
println!("\nJoin us on Discord at https://discord.gg/reversedrooms\n\n\n"); println!("\nJoin us on Discord at https://discord.gg/reversedrooms\n\n\n");

View file

@ -3,12 +3,13 @@ use std::sync::atomic::{AtomicU32, Ordering};
use super::{ModuleInitError, NapModule, NapModuleContext}; use super::{ModuleInitError, NapModule, NapModuleContext};
const SET_DITHER_CONFIG: usize = 0xAC49A20; const SET_DITHER_CONFIG: usize = 0x8CA93D0;
const DITHER_CONFIG_AVATAR_USING_DITHER_ALPHA: usize = 0x41; const DITHER_CONFIG_AVATAR_USING_DITHER_ALPHA: usize = 0x49;
const ON_ENTER_SCENE_SC_NOTIFY: usize = 0xCC97000; const ON_ENTER_BIG_SCENE_SC_NOTIFY: usize = 0x104721E0;
const ENTER_SCENE_SC_NOTIFY_SCENE_DATA: usize = 0x20; const ON_ENTER_SCENE_SC_NOTIFY: usize = 0x86E6F80;
const SCENE_DATA_SCENE_TYPE: usize = 0x6C; const ENTER_SCENE_SC_NOTIFY_SCENE_DATA: usize = 0x10;
const SCENE_DATA_SCENE_TYPE: usize = 0x74;
const SCENE_TYPE_HALL: u32 = 1; const SCENE_TYPE_HALL: u32 = 1;
static LAST_ENTER_SCENE_TYPE: AtomicU32 = AtomicU32::new(0); static LAST_ENTER_SCENE_TYPE: AtomicU32 = AtomicU32::new(0);
@ -27,6 +28,11 @@ impl NapModule for NapModuleContext<CensorshipPatch> {
CensorshipPatch::on_enter_scene_sc_notify, CensorshipPatch::on_enter_scene_sc_notify,
)?; )?;
self.interceptor.attach(
self.base.wrapping_add(ON_ENTER_BIG_SCENE_SC_NOTIFY),
CensorshipPatch::on_enter_big_scene_sc_notify,
)?;
Ok(()) Ok(())
} }
} }
@ -36,7 +42,8 @@ impl CensorshipPatch {
if LAST_ENTER_SCENE_TYPE.load(Ordering::SeqCst) == SCENE_TYPE_HALL { if LAST_ENTER_SCENE_TYPE.load(Ordering::SeqCst) == SCENE_TYPE_HALL {
if (*reg).rdx != 0 { if (*reg).rdx != 0 {
println!("SetDitherConfig: disabling dither alpha"); println!("SetDitherConfig: disabling dither alpha");
*(((*reg).rdx as *mut u8).wrapping_add(DITHER_CONFIG_AVATAR_USING_DITHER_ALPHA)) = 0; *(((*reg).rdx as *mut u8).wrapping_add(DITHER_CONFIG_AVATAR_USING_DITHER_ALPHA)) =
0;
} }
} else { } else {
println!("SetDitherConfig: not in hall, ignoring"); println!("SetDitherConfig: not in hall, ignoring");
@ -56,4 +63,10 @@ impl CensorshipPatch {
LAST_ENTER_SCENE_TYPE.store(scene_type, Ordering::SeqCst); LAST_ENTER_SCENE_TYPE.store(scene_type, Ordering::SeqCst);
} }
pub unsafe extern "win64" fn on_enter_big_scene_sc_notify(_: *mut Registers, _: usize) {
println!("EnterBigSceneScNotify");
LAST_ENTER_SCENE_TYPE.store(0, Ordering::SeqCst);
}
} }

View file

@ -7,14 +7,14 @@ use crate::{
util::{import, GAME_ASSEMBLY_BASE}, util::{import, GAME_ASSEMBLY_BASE},
}; };
import!(rsa_create() -> usize = 0x1B583DD0); import!(rsa_create() -> usize = 0x1B56F0F0);
import!(rsa_from_xml_string(instance: usize, xml_string: usize) -> usize = 0x1B584010); import!(rsa_from_xml_string(instance: usize, xml_string: usize) -> usize = 0x1B56F330);
import!(il2cpp_string_new(cstr: *const u8) -> usize = 0x1162FC0); import!(il2cpp_string_new(cstr: *const u8) -> usize = 0x115CCC0);
pub unsafe fn initialize_rsa_public_key() { pub unsafe fn initialize_rsa_public_key() {
const SERVER_PUBLIC_KEY: &str = include_str!("../../server_public_key.xml"); const SERVER_PUBLIC_KEY: &str = include_str!("../../server_public_key.xml");
let rsa_public_key_backdoor_field = let rsa_public_key_backdoor_field =
((*(GAME_ASSEMBLY_BASE.wrapping_add(0x55594B8) as *const usize)) + 252856) as *mut usize; ((*(GAME_ASSEMBLY_BASE.wrapping_add(0x5550778) as *const usize)) + 252784) as *mut usize;
let rsa = rsa_create(); let rsa = rsa_create();
rsa_from_xml_string( rsa_from_xml_string(
@ -33,18 +33,20 @@ pub unsafe fn initialize_rsa_public_key() {
pub unsafe fn replace_sdk_public_key_string_literal() { pub unsafe fn replace_sdk_public_key_string_literal() {
const SDK_PUBLIC_KEY: &str = include_str!("../../sdk_public_key.xml"); const SDK_PUBLIC_KEY: &str = include_str!("../../sdk_public_key.xml");
*(GAME_ASSEMBLY_BASE.wrapping_add(0x595BC00) as *mut usize) = il2cpp_string_new( *(GAME_ASSEMBLY_BASE.wrapping_add(0x5952CA8) as *mut usize) = il2cpp_string_new(
CString::new(SDK_PUBLIC_KEY) CString::new(SDK_PUBLIC_KEY)
.unwrap() .unwrap()
.to_bytes_with_nul() .to_bytes_with_nul()
.as_ptr(), .as_ptr(),
) as usize; ) as usize;
*(GAME_ASSEMBLY_BASE.wrapping_add(0x597F010) as *mut usize) = il2cpp_string_new( *(GAME_ASSEMBLY_BASE.wrapping_add(0x59760D0) as *mut usize) = il2cpp_string_new(
[27818, 40348, 47410, 27936, 51394, 33172, 51987, 8709, 44748, [
23705, 45753, 21092, 57054, 52661, 369, 62630, 11725, 7496, 36921, 28271, 27818, 40348, 47410, 27936, 51394, 33172, 51987, 8709, 44748, 23705, 45753, 21092,
34880, 52645, 31515, 18214, 3108, 2077, 13490, 25459, 58590, 47504, 15163, 57054, 52661, 369, 62630, 11725, 7496, 36921, 28271, 34880, 52645, 31515, 18214, 3108,
8951, 44748, 23705, 45753, 29284, 57054, 52661] 2077, 13490, 25459, 58590, 47504, 15163, 8951, 44748, 23705, 45753, 29284, 57054,
52661, 43266, 17556, 17415, 52254, 32830,
]
.into_iter() .into_iter()
.enumerate() .enumerate()
.flat_map(|(i, v)| { .flat_map(|(i, v)| {
@ -62,7 +64,7 @@ pub unsafe fn replace_sdk_public_key_string_literal() {
pub unsafe fn monitor_network_state(interceptor: &mut Interceptor) { pub unsafe fn monitor_network_state(interceptor: &mut Interceptor) {
interceptor interceptor
.attach( .attach(
GAME_ASSEMBLY_BASE.wrapping_add(0xD952A20), GAME_ASSEMBLY_BASE.wrapping_add(0xDE28090),
on_network_state_change, on_network_state_change,
) )
.unwrap(); .unwrap();

View file

@ -4,10 +4,10 @@ use crate::util::GAME_ASSEMBLY_BASE;
use super::{ModuleInitError, NapModule, NapModuleContext}; use super::{ModuleInitError, NapModule, NapModuleContext};
const ON_COMBO_INIT_SUCCESS: usize = 0x1ACEFC40; const ON_COMBO_INIT_SUCCESS: usize = 0x1ACAB470;
const STATICS: usize = 0x55594B8; const STATICS: usize = 0x5550778;
const STATIC_ID: usize = 34496; const STATIC_ID: usize = 34512;
const FIELD_OFFSET: usize = 0x44; const FIELD_OFFSET: usize = 0x40;
pub struct HoyopassPatch; pub struct HoyopassPatch;

View file

@ -6,8 +6,8 @@ use crate::util::{self, import, read_csharp_string};
use super::{ModuleInitError, NapModule, NapModuleContext}; use super::{ModuleInitError, NapModule, NapModuleContext};
const MAKE_INITIAL_URL: usize = 0x1D17D450; const MAKE_INITIAL_URL: usize = 0x1D14BCE0;
const WEB_REQUEST_CREATE: usize = 0x1CC6BD90; const WEB_REQUEST_CREATE: usize = 0x1CC33EF0;
pub struct Network; pub struct Network;
@ -37,7 +37,7 @@ unsafe extern "win64" fn on_web_request_create(reg: *mut Registers, _: usize) {
} }
} }
import!(il2cpp_string_new(cstr: *const u8) -> usize = 0x1162FC0); import!(il2cpp_string_new(cstr: *const u8) -> usize = 0x115CCC0);
impl Network { impl Network {
const SDK_URL: &str = "http://127.0.0.1:20100"; const SDK_URL: &str = "http://127.0.0.1:20100";