mirror of
https://git.neonteam.dev/amizing/hkrpg-patch.git
synced 2025-09-25 05:54:30 -04:00
Compare commits
3 Commits
3f6933c096
...
cc2f1865fc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc2f1865fc | ||
|
|
0c87252394 | ||
|
|
61928b9269 |
@ -4,27 +4,21 @@ use windows::{Win32::System::LibraryLoader::GetModuleHandleA, core::s};
|
||||
|
||||
use crate::util::scan_il2cpp_section;
|
||||
|
||||
const PTR_TO_STRING_ANSI: &str = "E8 ? ? ? ? 48 ? ? 48 85 C0 75 ? 48 8D 4C 24";
|
||||
const MAKE_INITIAL_URL: &str = "55 41 56 56 57 53 48 83 EC ? 48 8D 6C 24 ? 48 C7 45 ? ? ? ? ? 48 89 D6 48 89 CF E8 ? ? ? ? 84 C0"; // TODO
|
||||
const SET_ELEVATION_DITHER: &str = "E9 ? ? ? ? 0F 28 74 24 ? 48 83 C4 ? 5B 5F 5E 41 5E 41 5F C3 31 F6"; // TODO
|
||||
const SET_DISTANCE_DITHER: &str = "E8 ? ? ? ? 49 8B 46 ? 48 85 C0 0F 84 ? ? ? ? 48 8B 4D"; // TODO
|
||||
const SET_DITHER_ALPHA: &str = "56 57 48 83 EC ? 0F 29 74 24 ? 44 89 C6 0F 28 F1 48 89 CF 80 3D ? ? ? ? ? 75 ? 80 7F"; // TODO
|
||||
const SET_DITHER_ALPHA_ANIM: &str = "56 57 55 53 48 83 EC ? 44 0F 29 44 24 ? 0F 29 7C 24 ? 0F 29 74 24 ? 44 0F 28 C3 0F 28 F2 0F 28 F9"; // TODO
|
||||
const SDK_PUBLIC_KEY_LITERAL: &str = "48 8B 0D ? ? ? ? 4C 89 FA E8 ? ? ? ? 48 89 C1 E8 ? ? ? ? 48 8B 15 ? ? ? ? 48 89 F1";
|
||||
const IL2CPP_STRING_NEW_LEN: &str = "E8 ? ? ? ? EB ? 31 C0 48 89 06 48 8B 47 ? 48 89 46 ? F2 0F 10 47";
|
||||
const MAKE_INITIAL_URL: &str = "E8 ? ? ? ? 48 89 D9 48 89 C2 E8 ? ? ? ? 48 89 D9 4C 89 FA E8 ? ? ? ? 49 89 5D"; // TODO
|
||||
const SET_DITHER: &str = "E8 ? ? ? ? 84 C0 75 ? C7 43";
|
||||
const SDK_PUBLIC_KEY_LITERAL: &str = "48 8B 0D ? ? ? ? 4C 89 E2 E8 ? ? ? ? 48 89 C6 48 8B 0D ? ? ? ? E8 ? ? ? ? 48 89 C7 48 8B 0D";
|
||||
// const HK_CHECK1: &str = "55 41 56 56 57 53 48 81 EC 00 01 00 00 48 8D AC 24 80 00 00 00 C7 45 7C 00 00 00 00";
|
||||
// const HK_CHECK2: &str = "55 41 57 41 56 41 55 41 54 56 57 53 48 81 EC B8 02 00 00";
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct RVAConfig {
|
||||
pub ptr_to_string_ansi: usize,
|
||||
pub il2cpp_string_new_len: usize,
|
||||
pub make_initial_url: usize,
|
||||
pub set_elevation_dither: usize,
|
||||
pub set_distance_dither: usize,
|
||||
pub set_dither_alpha: usize,
|
||||
pub set_dither_alpha_anim: usize,
|
||||
pub set_dither: usize,
|
||||
pub sdk_public_key: usize,
|
||||
pub hk_check1: usize,
|
||||
pub hk_check2: usize,
|
||||
pub sdk_public_key: usize,
|
||||
}
|
||||
|
||||
#[allow(static_mut_refs)]
|
||||
@ -65,13 +59,13 @@ macro_rules! set_rva {
|
||||
pub unsafe fn init_rvas() {
|
||||
let config = rva_config();
|
||||
|
||||
// ptr_to_string_ansi
|
||||
// il2cpp_string_new_len
|
||||
set_rva!(
|
||||
GAME_ASSEMBLY_BASE,
|
||||
config,
|
||||
ptr_to_string_ansi,
|
||||
il2cpp_string_new_len,
|
||||
scan_il2cpp_section,
|
||||
PTR_TO_STRING_ANSI,
|
||||
IL2CPP_STRING_NEW_LEN,
|
||||
0x0
|
||||
);
|
||||
|
||||
@ -85,40 +79,13 @@ pub unsafe fn init_rvas() {
|
||||
0x0
|
||||
);
|
||||
|
||||
// set_elevation_dither
|
||||
// set_dither
|
||||
set_rva!(
|
||||
GAME_ASSEMBLY_BASE,
|
||||
config,
|
||||
set_elevation_dither,
|
||||
set_dither,
|
||||
scan_il2cpp_section,
|
||||
SET_ELEVATION_DITHER,
|
||||
0x0
|
||||
);
|
||||
// set_distance_dither
|
||||
set_rva!(
|
||||
GAME_ASSEMBLY_BASE,
|
||||
config,
|
||||
set_distance_dither,
|
||||
scan_il2cpp_section,
|
||||
SET_DISTANCE_DITHER,
|
||||
0x0
|
||||
);
|
||||
// set_dither_alpha
|
||||
set_rva!(
|
||||
GAME_ASSEMBLY_BASE,
|
||||
config,
|
||||
set_dither_alpha,
|
||||
scan_il2cpp_section,
|
||||
SET_DITHER_ALPHA,
|
||||
0x0
|
||||
);
|
||||
// set_dither_alpha_anim
|
||||
set_rva!(
|
||||
GAME_ASSEMBLY_BASE,
|
||||
config,
|
||||
set_dither_alpha_anim,
|
||||
scan_il2cpp_section,
|
||||
SET_DITHER_ALPHA_ANIM,
|
||||
SET_DITHER,
|
||||
0x0
|
||||
);
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ impl Il2cppString {
|
||||
pub fn new(string: &str) -> Self {
|
||||
let func = unsafe {
|
||||
std::mem::transmute::<usize, fn(*const u8, usize) -> usize>(
|
||||
*GAME_ASSEMBLY_BASE + rva_config().ptr_to_string_ansi,
|
||||
*GAME_ASSEMBLY_BASE + rva_config().il2cpp_string_new_len,
|
||||
)
|
||||
};
|
||||
let len = string.len();
|
||||
|
||||
@ -27,10 +27,7 @@ impl HkrpgModule for HkrpgModuleContext<CensorshipPatch> {
|
||||
replace!(
|
||||
self,
|
||||
config,
|
||||
set_distance_dither,
|
||||
set_elevation_dither,
|
||||
set_dither_alpha,
|
||||
set_dither_alpha_anim
|
||||
set_dither
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ pub struct Network;
|
||||
impl HkrpgModule for HkrpgModuleContext<Network> {
|
||||
unsafe fn init(&mut self) -> Result<(), ilhook::HookError> {
|
||||
let config = rva_config();
|
||||
if config.make_initial_url != 0 && config.ptr_to_string_ansi != 0 {
|
||||
if config.make_initial_url != 0 && config.il2cpp_string_new_len != 0 {
|
||||
self.interceptor.attach(
|
||||
self.base.wrapping_add(config.make_initial_url),
|
||||
Network::on_make_initial_url,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user