From b4e78484b8a46d11ac39d7e17efe1307e3310579 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Thu, 19 May 2022 02:27:46 +0200 Subject: [PATCH] Almost finish dedi --- src/client/component/dedicated.cpp | 44 ++++++++++++++++-------------- src/client/component/fastfiles.cpp | 4 +-- src/client/component/stats.cpp | 8 +++--- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/client/component/dedicated.cpp b/src/client/component/dedicated.cpp index e1558865..5ff6fa3c 100644 --- a/src/client/component/dedicated.cpp +++ b/src/client/component/dedicated.cpp @@ -197,34 +197,35 @@ namespace dedicated dvars::override::register_bool("r_preloadShaders", false, game::DVAR_FLAG_READ); // Stop crashing from sys_errors - utils::hook::jump(0x1D8710_b, sys_error_stub); + utils::hook::jump(0x1D8710_b, sys_error_stub, true); // Hook R_SyncGpu - utils::hook::jump(0x688620_b, sync_gpu_stub); + utils::hook::jump(0x688620_b, sync_gpu_stub, true); - utils::hook::jump(0x135600_b, init_dedicated_server); + utils::hook::jump(0x135600_b, init_dedicated_server, true); // delay startup commands until the initialization is done - utils::hook::call(0x157DDA_b, execute_startup_command); + // utils::hook::call(0x157DDA_b, execute_startup_command); - // delay console commands until the initialization is done - //utils::hook::call(0x1400D808C, execute_console_command); // Cbuf_AddText is inlined - //utils::hook::nop(0x1400D80A4, 5); // ^ + // delay console commands until the initialization is done // COULDN'T FOUND + // utils::hook::call(0x1400D808C, execute_console_command); + // utils::hook::nop(0x1400D80A4, 5); // patch GScr_SetDynamicDvar to behave better gscr_set_dynamic_dvar_hook.create(0x43CF60_b, &gscr_set_dynamic_dvar); - //utils::hook::nop(0x1404ED90E, 5); // don't load config file (NOTE: Cbuf_AddText is inlined) - utils::hook::nop(0x156C46_b, 5); // ^ + utils::hook::nop(0x189514_b, 248); // don't load config file + utils::hook::nop(0x156C46_b, 5); // ^ // NOT SURE utils::hook::set(0x17F470_b, 0xC3); // don't save config file utils::hook::set(0x351AA0_b, 0xC3); // disable self-registration utils::hook::set(0x5BF4E0_b, 0xC3); // init sound system (1) - utils::hook::set(0x701820_b, 0xC3); // init sound system (2) (Skull says 0x702650, I say otherwise) + utils::hook::set(0x701820_b, 0xC3); // init sound system (2) + utils::hook::set(0x701850_b, 0xC3); // init sound system (3) utils::hook::set(0x6C9B10_b, 0xC3); // render thread utils::hook::set(0x343950_b, 0xC3); // called from Com_Frame, seems to do renderer stuff utils::hook::set(0x12CCA0_b, 0xC3); // CL_CheckForResend, which tries to connect to the local server constantly - utils::hook::set(0x67ADCE_b, 0x00); // r_loadForRenderer default to 0 NOT SURE - utils::hook::set(0x5B7AF0_b, 0xC3); // recommended settings check - TODO: Check hook + utils::hook::set(0x67ADCE_b, 0x00); // r_loadForRenderer default to 0 + utils::hook::set(0x5B7AF0_b, 0xC3); // recommended settings check utils::hook::set(0x5BE850_b, 0xC3); // some mixer-related function called on shutdown utils::hook::set(0x4DEA50_b, 0xC3); // dont load ui gametype stuff @@ -242,14 +243,14 @@ namespace dedicated utils::hook::set(0x690F30_b, 0xC3); // gfx stuff during fastfile loading utils::hook::set(0x690E00_b, 0xC3); // ^ utils::hook::set(0x690ED0_b, 0xC3); // ^ - utils::hook::set(0x39C610_b, 0xC3); // ^ + utils::hook::set(0x39B980_b, 0xC3); // ^ utils::hook::set(0x690E50_b, 0xC3); // ^ utils::hook::set(0x651BA0_b, 0xC3); // directx stuff utils::hook::set(0x681950_b, 0xC3); // ^ utils::hook::set(0x6CE390_b, 0xC3); // ^ - mutex utils::hook::set(0x681ED0_b, 0xC3); // ^ - utils::hook::set(0xA3CD0_b, 0xC3); // rendering stuff + utils::hook::set(0x0A3CD0_b, 0xC3); // rendering stuff utils::hook::set(0x682150_b, 0xC3); // ^ utils::hook::set(0x682260_b, 0xC3); // ^ utils::hook::set(0x6829C0_b, 0xC3); // ^ @@ -257,8 +258,8 @@ namespace dedicated utils::hook::set(0x683B40_b, 0xC3); // ^ // shaders - utils::hook::set(0xAA090_b, 0xC3); // ^ - utils::hook::set(0xA9FE0_b, 0xC3); // ^ + utils::hook::set(0x0AA090_b, 0xC3); // ^ + utils::hook::set(0x0A9FE0_b, 0xC3); // ^ utils::hook::set(0x6C38D0_b, 0xC3); // ^ - mutex utils::hook::set(0x5BFD10_b, 0xC3); // idk @@ -267,16 +268,18 @@ namespace dedicated utils::hook::set(0x687D20_b, 0xC3); // R_Shutdown utils::hook::set(0x652BA0_b, 0xC3); // shutdown stuff utils::hook::set(0x687DF0_b, 0xC3); // ^ - utils::hook::set(0x686DE0_b, 0xC3); // ^ + utils::hook::set(0x686DE0_b, 0xC3); // ^ COULDN'T FOUND // utils::hook::set(0x1404B67E0, 0xC3); // sound crashes (H1 - questionable, function looks way different) utils::hook::set(0x556250_b, 0xC3); // disable host migration utils::hook::set(0x4F7C10_b, 0xC3); // render synchronization lock - utils::hook::set(0x42B210_b, 0xC3); // render synchronization unlock + utils::hook::set(0x4F7B40_b, 0xC3); // render synchronization unlock utils::hook::set(0x27AA9D_b, 0xEB); // LUI: Unable to start the LUI system due to errors in main.lua + utils::hook::set(0x27AAC5_b, 0xEB); // LUI: Unable to start the LUI system due to errors in depot.lua + utils::hook::set(0x27AADC_b, 0xEB); // ^ utils::hook::nop(0x5B25BE_b, 5); // Disable sound pak file loading utils::hook::nop(0x5B25C6_b, 2); // ^ @@ -286,7 +289,8 @@ namespace dedicated utils::hook::set(0x5B7F37_b, 0x80000000); utils::hook::set(0x399E10_b, 0xC3); // some loop - utils::hook::set(0x1D48B0_b, 0xC3); // related to shader caching / techsets / fastfiles + utils::hook::set(0x1D48B0_b, 0xC3); // related to shader caching / techsets / fastfilesc + utils::hook::set(0x3A1940_b, 0xC3); // DB_ReadPackedLoadedSounds // initialize the game after onlinedataflags is 32 (workaround) scheduler::schedule([=]() @@ -330,4 +334,4 @@ namespace dedicated }; } -//REGISTER_COMPONENT(dedicated::component) \ No newline at end of file +REGISTER_COMPONENT(dedicated::component) \ No newline at end of file diff --git a/src/client/component/fastfiles.cpp b/src/client/component/fastfiles.cpp index 2cb5ace4..f7fb38c5 100644 --- a/src/client/component/fastfiles.cpp +++ b/src/client/component/fastfiles.cpp @@ -51,9 +51,9 @@ namespace fastfiles void post_unpack() override { db_try_load_x_file_internal_hook.create( - SELECT_VALUE(0x1401CDDD0, 0x1402BFFE0), &db_try_load_x_file_internal); + SELECT_VALUE(0, 0x39A620_b), &db_try_load_x_file_internal); } }; } -//REGISTER_COMPONENT(fastfiles::component) +REGISTER_COMPONENT(fastfiles::component) diff --git a/src/client/component/stats.cpp b/src/client/component/stats.cpp index af886473..8da3fa78 100644 --- a/src/client/component/stats.cpp +++ b/src/client/component/stats.cpp @@ -69,9 +69,9 @@ namespace stats if (game::environment::is_dedi()) { - utils::hook::jump(0x19E6E0_b, is_item_unlocked); - utils::hook::jump(0x19E070_b, is_item_unlocked); - utils::hook::jump(0x19D390_b, is_item_unlocked); + utils::hook::jump(0x19E6E0_b, is_item_unlocked, true); + utils::hook::jump(0x19E070_b, is_item_unlocked, true); + utils::hook::jump(0x19D390_b, is_item_unlocked, true); } else { @@ -88,4 +88,4 @@ namespace stats }; } -REGISTER_COMPONENT(stats::component) +// REGISTER_COMPONENT(stats::component)