Skip to content

Commit

Permalink
refactor: safe frametime deref
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisAMJ committed Sep 25, 2024
1 parent 6639c4d commit c6d2893
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Modules/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1110,8 +1110,10 @@ bool Engine::Init() {
#endif

Host_AccumulateTime = (void (*)(float))Memory::Scan(this->Name(), Offsets::Host_AccumulateTime);
host_frametime = *(float **)((uintptr_t)Host_AccumulateTime + Offsets::host_frametime);
host_frametime_unbounded = host_frametime + Offsets::host_frametime_unbounded;
if (Host_AccumulateTime) {
host_frametime = Memory::Deref<float *>((uintptr_t)Host_AccumulateTime + Offsets::host_frametime);
host_frametime_unbounded = host_frametime + Offsets::host_frametime_unbounded;
}

Host_AccumulateTime_Hook.SetFunc(Host_AccumulateTime);

Expand Down

0 comments on commit c6d2893

Please sign in to comment.