diff --git a/src/game/game.cpp b/src/game/game.cpp index a6b4263..95a777b 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -65,6 +65,7 @@ namespace game SV_ClientEnterWorld_t SV_ClientEnterWorld; SV_Cmd_TokenizeString_t SV_Cmd_TokenizeString; SV_Cmd_EndTokenizedString_t SV_Cmd_EndTokenizedString; + SV_SpawnServer_t SV_SpawnServer; XUIDToString_t XUIDToString; @@ -750,6 +751,7 @@ namespace game native::SV_ClientEnterWorld = native::SV_ClientEnterWorld_t(SELECT_VALUE(0x0, 0x571100)); native::SV_Cmd_TokenizeString = native::SV_Cmd_TokenizeString_t(SELECT_VALUE(0x0, 0x545D40)); native::SV_Cmd_EndTokenizedString = native::SV_Cmd_EndTokenizedString_t(SELECT_VALUE(0x0, 0x545D70)); + native::SV_SpawnServer = native::SV_SpawnServer_t(SELECT_VALUE(0x0, 0x575020)); native::mp::SV_GameSendServerCommand = native::mp::SV_GameSendServerCommand_t(0x573220); native::mp::SV_GetGuid = native::mp::SV_GetGuid_t(0x573990); diff --git a/src/game/game.hpp b/src/game/game.hpp index 3a9e08e..3ef8baa 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -136,6 +136,9 @@ namespace game typedef void (*SV_Cmd_EndTokenizedString_t)(); extern SV_Cmd_EndTokenizedString_t SV_Cmd_EndTokenizedString; + typedef void (*SV_SpawnServer_t)(const char* server, int mapIsPreloaded, int savegame); + extern SV_SpawnServer_t SV_SpawnServer; + typedef void (*XUIDToString_t)(const unsigned __int64* xuid, char* str); extern XUIDToString_t XUIDToString; diff --git a/src/module/command.cpp b/src/module/command.cpp index 7e139d9..5690be1 100644 --- a/src/module/command.cpp +++ b/src/module/command.cpp @@ -11,8 +11,8 @@ static utils::memory::allocator allocator; std::unordered_map> command::handlers; -std::unordered_map> command::handlers_sv; -std::unordered_map> command::handlers_sp_sv; +std::unordered_map> command::handlers_sv; +std::unordered_map> command::handlers_sp_sv; command::params::params() : nesting_(game::native::cmd_args->nesting) @@ -87,7 +87,7 @@ void command::add_raw(const char* name, void (*callback)()) game::native::Cmd_AddCommand(name, callback, allocator.allocate()); } -void command::add(const char* name, const std::function& callback) +void command::add(const char* name, const std::function& callback) { const auto command = utils::string::to_lower(name); @@ -107,7 +107,7 @@ void command::add(const char* name, const std::function& callback) }); } -void command::add_sv(const char* name, std::function callback) +void command::add_sv(const char* name, std::function callback) { // Since the game console is not usable there is no point in calling add_raw const auto command = utils::string::to_lower(name); @@ -144,7 +144,7 @@ void command::execute(std::string command, bool sync) void command::main_handler() { - params params; + const params params; const auto command = utils::string::to_lower(params[0]); @@ -163,7 +163,7 @@ void command::client_command_stub(int client_num) return; } - params_sv params; + const params_sv params; const auto command = utils::string::to_lower(params[0]); @@ -182,7 +182,7 @@ void command::client_command_sp(int client_num, const char* s) assert(entity->client); // On sp it should only be an assertion - params_sv params; + const params_sv params; const auto command = utils::string::to_lower(params[0]); diff --git a/src/module/command.hpp b/src/module/command.hpp index fbb6fc0..68bd992 100644 --- a/src/module/command.hpp +++ b/src/module/command.hpp @@ -51,15 +51,14 @@ public: private: static std::unordered_map> handlers; - static std::unordered_map> handlers_sv; - static std::unordered_map> handlers_sp_sv; + static std::unordered_map> handlers_sv; + static std::unordered_map> handlers_sp_sv; static void main_handler(); static void client_command_stub(int client_num); static void client_command_sp(int client_num, const char* s); static void client_command_sp_stub(); - static void client_command_dedi_stub(); static void add_raw(const char* name, void (*callback)());