Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
fix up server crash
Browse files Browse the repository at this point in the history
  • Loading branch information
huoji120 committed Oct 10, 2023
1 parent d55d0f5 commit b36738a
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions csgo2/hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,29 @@ void __fastcall hook_GameFrame(void* rcx, bool simulating, bool bFirstTick,
* true | game is ticking
* false | game is not ticking
*/
if (simulating && global::HasTicked) {
global::m_flUniversalTime +=
global::GlobalVars->curtime - global::m_flLastTickedTime;
} else {
global::m_flUniversalTime += global::GlobalVars->interval_per_tick;
if (global::GlobalVars == nullptr) {
global::GlobalVars = GetGameGlobals();
}
if (global::GlobalVars != nullptr) {
if (simulating && global::HasTicked) {
global::m_flUniversalTime +=
global::GlobalVars->curtime - global::m_flLastTickedTime;
}
else {
global::m_flUniversalTime += global::GlobalVars->interval_per_tick;
}

global::m_flLastTickedTime = global::GlobalVars->curtime;
global::HasTicked = true;
global::m_flLastTickedTime = global::GlobalVars->curtime;
global::HasTicked = true;

if (global::EntitySystem == nullptr) {
global::EntitySystem = CGameEntitySystem::GetInstance();
}
if (global::EntitySystem == nullptr) {
global::EntitySystem = CGameEntitySystem::GetInstance();
}

GameTimer::ExcuteTimers();
GameTickRunTime::ExcuteTickFunctions();
GameTimer::ExcuteTimers();
GameTickRunTime::ExcuteTickFunctions();
}

return origin_GameFrame(rcx, simulating, bFirstTick, bLastTick);
}
void __fastcall hook_StartServer(void* rcx,
Expand Down

0 comments on commit b36738a

Please sign in to comment.