Almost finish dedi

This commit is contained in:
Federico Cecchetto 2022-05-19 02:27:46 +02:00
parent c47340b5e8
commit fa37ac92c4
3 changed files with 30 additions and 26 deletions

View File

@ -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<uint8_t>(0x17F470_b, 0xC3); // don't save config file
utils::hook::set<uint8_t>(0x351AA0_b, 0xC3); // disable self-registration
utils::hook::set<uint8_t>(0x5BF4E0_b, 0xC3); // init sound system (1)
utils::hook::set<uint8_t>(0x701820_b, 0xC3); // init sound system (2) (Skull says 0x702650, I say otherwise)
utils::hook::set<uint8_t>(0x701820_b, 0xC3); // init sound system (2)
utils::hook::set<uint8_t>(0x701850_b, 0xC3); // init sound system (3)
utils::hook::set<uint8_t>(0x6C9B10_b, 0xC3); // render thread
utils::hook::set<uint8_t>(0x343950_b, 0xC3); // called from Com_Frame, seems to do renderer stuff
utils::hook::set<uint8_t>(0x12CCA0_b, 0xC3); // CL_CheckForResend, which tries to connect to the local server constantly
utils::hook::set<uint8_t>(0x67ADCE_b, 0x00); // r_loadForRenderer default to 0 NOT SURE
utils::hook::set<uint8_t>(0x5B7AF0_b, 0xC3); // recommended settings check - TODO: Check hook
utils::hook::set<uint8_t>(0x67ADCE_b, 0x00); // r_loadForRenderer default to 0
utils::hook::set<uint8_t>(0x5B7AF0_b, 0xC3); // recommended settings check
utils::hook::set<uint8_t>(0x5BE850_b, 0xC3); // some mixer-related function called on shutdown
utils::hook::set<uint8_t>(0x4DEA50_b, 0xC3); // dont load ui gametype stuff
@ -242,14 +243,14 @@ namespace dedicated
utils::hook::set<uint8_t>(0x690F30_b, 0xC3); // gfx stuff during fastfile loading
utils::hook::set<uint8_t>(0x690E00_b, 0xC3); // ^
utils::hook::set<uint8_t>(0x690ED0_b, 0xC3); // ^
utils::hook::set<uint8_t>(0x39C610_b, 0xC3); // ^
utils::hook::set<uint8_t>(0x39B980_b, 0xC3); // ^
utils::hook::set<uint8_t>(0x690E50_b, 0xC3); // ^
utils::hook::set<uint8_t>(0x651BA0_b, 0xC3); // directx stuff
utils::hook::set<uint8_t>(0x681950_b, 0xC3); // ^
utils::hook::set<uint8_t>(0x6CE390_b, 0xC3); // ^ - mutex
utils::hook::set<uint8_t>(0x681ED0_b, 0xC3); // ^
utils::hook::set<uint8_t>(0xA3CD0_b, 0xC3); // rendering stuff
utils::hook::set<uint8_t>(0x0A3CD0_b, 0xC3); // rendering stuff
utils::hook::set<uint8_t>(0x682150_b, 0xC3); // ^
utils::hook::set<uint8_t>(0x682260_b, 0xC3); // ^
utils::hook::set<uint8_t>(0x6829C0_b, 0xC3); // ^
@ -257,8 +258,8 @@ namespace dedicated
utils::hook::set<uint8_t>(0x683B40_b, 0xC3); // ^
// shaders
utils::hook::set<uint8_t>(0xAA090_b, 0xC3); // ^
utils::hook::set<uint8_t>(0xA9FE0_b, 0xC3); // ^
utils::hook::set<uint8_t>(0x0AA090_b, 0xC3); // ^
utils::hook::set<uint8_t>(0x0A9FE0_b, 0xC3); // ^
utils::hook::set<uint8_t>(0x6C38D0_b, 0xC3); // ^ - mutex
utils::hook::set<uint8_t>(0x5BFD10_b, 0xC3); // idk
@ -267,16 +268,18 @@ namespace dedicated
utils::hook::set<uint8_t>(0x687D20_b, 0xC3); // R_Shutdown
utils::hook::set<uint8_t>(0x652BA0_b, 0xC3); // shutdown stuff
utils::hook::set<uint8_t>(0x687DF0_b, 0xC3); // ^
utils::hook::set<uint8_t>(0x686DE0_b, 0xC3); // ^
utils::hook::set<uint8_t>(0x686DE0_b, 0xC3); // ^ COULDN'T FOUND
// utils::hook::set<uint8_t>(0x1404B67E0, 0xC3); // sound crashes (H1 - questionable, function looks way different)
utils::hook::set<uint8_t>(0x556250_b, 0xC3); // disable host migration
utils::hook::set<uint8_t>(0x4F7C10_b, 0xC3); // render synchronization lock
utils::hook::set<uint8_t>(0x42B210_b, 0xC3); // render synchronization unlock
utils::hook::set<uint8_t>(0x4F7B40_b, 0xC3); // render synchronization unlock
utils::hook::set<uint8_t>(0x27AA9D_b, 0xEB); // LUI: Unable to start the LUI system due to errors in main.lua
utils::hook::set<uint8_t>(0x27AAC5_b, 0xEB); // LUI: Unable to start the LUI system due to errors in depot.lua
utils::hook::set<uint8_t>(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<uint64_t>(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)
REGISTER_COMPONENT(dedicated::component)

View File

@ -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)

View File

@ -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)