Better dedi fix

This commit is contained in:
Federico Cecchetto 2022-05-21 19:16:14 +02:00
parent b0d453c05c
commit 34ec408205

View File

@ -177,17 +177,6 @@ namespace dedicated
ui_set_active_menu_hook.invoke<void>(a1, a2);
}
utils::hook::detour sub_552830_hook;
void* sub_552830_stub()
{
// sub_554D00 svs_clients along with other svs stuff
// Upon loading a 2nd map (ex. doing map mp_bog; map mp_crash) sub_552830 is called instead of sub_554D00
// But svs stuff is already deallocated so it will read bad memory -> crash
// Calling sub_554D00 makes sure it reallocates that stuff first
utils::hook::invoke<void>(0x554D00_b);
return sub_552830_hook.invoke<void*>();
}
}
void initialize()
@ -327,7 +316,8 @@ namespace dedicated
// Workaround for server spamming 'exec default_xboxlive.cfg' when not running
ui_set_active_menu_hook.create(0x1E4D80_b, ui_set_active_menu_stub);
sub_552830_hook.create(0x552830_b, sub_552830_stub);
// Dont free server client memory on asset loading
utils::hook::nop(0x132474_b, 5);
// initialize the game after onlinedataflags is 32 (workaround)
scheduler::schedule([=]()