finish dedi addresses

This commit is contained in:
m 2022-02-28 14:21:22 -06:00
parent 8eabfbdc7c
commit 21c0a6be4f
2 changed files with 27 additions and 26 deletions

View File

@ -6,6 +6,8 @@
#include "command.hpp" #include "command.hpp"
#include "game/game.hpp" #include "game/game.hpp"
#include "game/dvars.hpp" #include "game/dvars.hpp"
#include "dvars.hpp"
#include "console.hpp"
#include <utils/hook.hpp> #include <utils/hook.hpp>
#include <utils/string.hpp> #include <utils/string.hpp>
@ -178,6 +180,10 @@ namespace dedicated
return; return;
} }
#ifdef DEBUG
printf("Starting dedicated server\n");
#endif
// Register dedicated dvar // Register dedicated dvar
dvars::register_bool("dedicated", true, game::DVAR_FLAG_READ); dvars::register_bool("dedicated", true, game::DVAR_FLAG_READ);
@ -191,8 +197,7 @@ namespace dedicated
dvars::override::register_bool("r_preloadShaders", false, game::DVAR_FLAG_READ); dvars::override::register_bool("r_preloadShaders", false, game::DVAR_FLAG_READ);
// Don't allow sv_hostname to be changed by the game // Don't allow sv_hostname to be changed by the game
const auto sv_hostname = std::to_string(game::generateHashValue("sv_hostname")).c_str(); dvars::disable::set_string("sv_hostname");
dvars::disable::Dvar_SetString(sv_hostname);
// Stop crashing from sys_errors // Stop crashing from sys_errors
utils::hook::jump(0x140511520, sys_error_stub); utils::hook::jump(0x140511520, sys_error_stub);
@ -260,35 +265,30 @@ namespace dedicated
utils::hook::set<uint8_t>(0x140091610, 0xC3); // ^ utils::hook::set<uint8_t>(0x140091610, 0xC3); // ^
utils::hook::set<uint8_t>(0x14061ACC0, 0xC3); // ^ - mutex utils::hook::set<uint8_t>(0x14061ACC0, 0xC3); // ^ - mutex
/* utils::hook::set<uint8_t>(0x140516080, 0xC3); // idk
everything above has some sort of addresses, they are prob wrong : | utils::hook::set<uint8_t>(0x1405AE5F0, 0xC3); // ^
*/
utils::hook::set<uint8_t>(0x1404DAF30, 0xC3); // idk utils::hook::set<uint8_t>(0x1405E0B30, 0xC3); // R_Shutdown
utils::hook::set<uint8_t>(0x1405736B0, 0xC3); // ^ utils::hook::set<uint8_t>(0x1405AE400, 0xC3); // shutdown stuff
utils::hook::set<uint8_t>(0x1405E0C00, 0xC3); // ^
utils::hook::set<uint8_t>(0x1405DFE50, 0xC3); // ^
utils::hook::set<uint8_t>(0x1405A6E70, 0xC3); // R_Shutdown utils::hook::set<uint8_t>(0x1404B67E0, 0xC3); // sound crashes (H1 - questionable, function looks way different)
utils::hook::set<uint8_t>(0x1405732D0, 0xC3); // shutdown stuff
utils::hook::set<uint8_t>(0x1405A6F40, 0xC3); // ^
utils::hook::set<uint8_t>(0x1405A61A0, 0xC3); // ^
utils::hook::set<uint8_t>(0x14062C550, 0xC3); // sound crashes utils::hook::set<uint8_t>(0x14048B660, 0xC3); // disable host migration
utils::hook::set<uint8_t>(0x140445070, 0xC3); // disable host migration utils::hook::set<uint8_t>(0x14042B2E0, 0xC3); // render synchronization lock
utils::hook::set<uint8_t>(0x14042B210, 0xC3); // render synchronization unlock
utils::hook::set<uint8_t>(0x1403E1A50, 0xC3); // render synchronization lock utils::hook::set<uint8_t>(0x140176D2D, 0xEB);
utils::hook::set<uint8_t>(0x1403E1990, 0xC3); // render synchronization unlock
utils::hook::set<uint8_t>(0x1400E517B, 0xEB);
// LUI: Unable to start the LUI system due to errors in main.lua // LUI: Unable to start the LUI system due to errors in main.lua
utils::hook::nop(0x1404CC482, 5); // Disable sound pak file loading utils::hook::nop(0x140506ECE, 5); // Disable sound pak file loading
utils::hook::nop(0x1404CC471, 2); // ^ utils::hook::nop(0x140506ED6, 2); // ^
utils::hook::set<uint8_t>(0x140279B80, 0xC3); // Disable image pak file loading utils::hook::set<uint8_t>(0x1402C5910, 0xC3); // Disable image pak file loading
// Reduce min required memory // Reduce min required memory
utils::hook::set<uint64_t>(0x1404D140D, 0x80000000); utils::hook::set<uint64_t>(0x14050C715, 0x80000000);
utils::hook::set<uint64_t>(0x1404D14BF, 0x80000000);
// initialize the game after onlinedataflags is 32 (workaround) // initialize the game after onlinedataflags is 32 (workaround)
scheduler::schedule([=]() scheduler::schedule([=]()
@ -310,9 +310,9 @@ namespace dedicated
{ {
initialize(); initialize();
printf("==================================\n"); console::info("==================================\n");
printf("Server started!\n"); console::info("Server started!\n");
printf("==================================\n"); console::info("==================================\n");
// remove disconnect command // remove disconnect command
game::Cmd_RemoveCommand(reinterpret_cast<const char*>(751)); game::Cmd_RemoveCommand(reinterpret_cast<const char*>(751));
@ -327,7 +327,7 @@ namespace dedicated
}, scheduler::pipeline::main, 1s); }, scheduler::pipeline::main, 1s);
command::add("killserver", kill_server); command::add("killserver", kill_server);
com_quit_f_hook.create(0x1403D08C0, &kill_server); com_quit_f_hook.create(0x1400DA640, &kill_server);
} }
}; };
} }

View File

@ -14,6 +14,7 @@ namespace game
WEAK symbol<void(const char* message)> Conbuf_AppendText{0x1403E3300, 0x140513FF0}; WEAK symbol<void(const char* message)> Conbuf_AppendText{0x1403E3300, 0x140513FF0};
WEAK symbol<void(int localClientNum, int controllerIndex, const char* text)> Cmd_ExecuteSingleCommand{0x140343980, 0x140403F60}; WEAK symbol<void(int localClientNum, int controllerIndex, const char* text)> Cmd_ExecuteSingleCommand{0x140343980, 0x140403F60};
WEAK symbol<void(const char* cmdName, void(), cmd_function_s* allocedCmd)> Cmd_AddCommandInternal{0x1403433E0, 0x140403950}; WEAK symbol<void(const char* cmdName, void(), cmd_function_s* allocedCmd)> Cmd_AddCommandInternal{0x1403433E0, 0x140403950};
WEAK symbol<void(const char*)> Cmd_RemoveCommand{0x140343FF0, 0x1403AFEF0};
WEAK symbol<void(const char* text_in)> Cmd_TokenizeString{0x140344110, 0x1404046F0}; WEAK symbol<void(const char* text_in)> Cmd_TokenizeString{0x140344110, 0x1404046F0};
WEAK symbol<void()> Cmd_EndTokenizeString{0x140343630, 0x140403C20}; WEAK symbol<void()> Cmd_EndTokenizeString{0x140343630, 0x140403C20};