Skip to content

Commit

Permalink
sync some YaLTeR#55 changes and add Windows patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
khanghugo committed Dec 8, 2022
1 parent 92064eb commit 62ab287
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/hooks/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ pub static cls_demos: Pointer<*mut client_static_s_demos> = Pointer::empty(
// Not a real symbol name.
b"cls_demos\0",
);
pub static cls_demoframecount: Pointer<*mut c_int> = Pointer::empty(b"cls_demoframecount\0");
pub static Cmd_AddMallocCommand: Pointer<
unsafe extern "C" fn(*const c_char, unsafe extern "C" fn(), c_int),
> = Pointer::empty_patterns(
Expand Down Expand Up @@ -841,6 +842,7 @@ static POINTERS: &[&dyn PointerTrait] = &[
&ClientDLL_UpdateClientData,
&cls,
&cls_demos,
&cls_demoframecount,
&Cmd_AddMallocCommand,
&Cmd_Argc,
&Cmd_Argv,
Expand Down Expand Up @@ -1162,6 +1164,7 @@ unsafe fn find_pointers(marker: MainThreadMarker) {
}

cls_demos.set(marker, cls.offset(marker, 15960));
cls_demoframecount.set(marker, cls.offset(marker, 16776));
frametime_remainder.set(marker, CL_Move.by_offset(marker, 452));
idum.set(marker, ran1.by_offset(marker, 2));
ran1_iy.set(marker, ran1.by_offset(marker, 13));
Expand Down Expand Up @@ -1215,6 +1218,13 @@ pub unsafe fn find_pointers(marker: MainThreadMarker, base: *mut c_void, size: u
_ => (),
}

let ptr = &CL_PlayDemo_f;
match ptr.pattern_index(marker) {
// 8684
Some(0) => cls_demoframecount.set(marker, ptr.by_offset(marker, 792)),
_ => ()
}

let ptr = &Cmd_AddMallocCommand;
match ptr.pattern_index(marker) {
// 6153
Expand Down

0 comments on commit 62ab287

Please sign in to comment.