diff --git a/src/client/component/network.cpp b/src/client/component/network.cpp index bd755523..88be4f39 100644 --- a/src/client/component/network.cpp +++ b/src/client/component/network.cpp @@ -291,8 +291,8 @@ namespace network utils::hook::nop(0x54E168_b, 4); // this crashes when reconnecting for some reason // allow server owner to modify net_port before the socket bind - // utils::hook::call(0x5BD2B5_b, register_netport_stub); - // utils::hook::call(0x5BD3F0_b, register_netport_stub); + utils::hook::call(0x5BD2B5_b, register_netport_stub); + utils::hook::call(0x5BD3F0_b, register_netport_stub); // increase allowed packet size const auto max_packet_size = 0x20000; diff --git a/src/client/game/game.cpp b/src/client/game/game.cpp index 0b63ccc2..2905d7c9 100644 --- a/src/client/game/game.cpp +++ b/src/client/game/game.cpp @@ -65,6 +65,33 @@ namespace game } } + void Cmd_TokenizeString(const char* text) + { + if (game::environment::is_sp()) + { + sp::Cmd_TokenizeString(text); + } + else + { + const auto a2 = 512 - *reinterpret_cast(0x3516F40_b); + mp::Cmd_TokenizeStringWithLimit(text, a2); + } + } + + void Cmd_EndTokenizeString() + { + if (game::environment::is_sp()) + { + return sp::Cmd_EndTokenizeString(); + } + + const auto nesting = cmd_args->nesting; + const auto argc = cmd_args->argc[nesting]; + --cmd_args->nesting; + cmd_argsPrivate->totalUsedArgvPool -= argc; + cmd_argsPrivate->totalUsedTextPool -= cmd_argsPrivate->usedTextPool[nesting]; + } + namespace environment { launcher::mode mode = launcher::mode::none; diff --git a/src/client/game/game.hpp b/src/client/game/game.hpp index ceb95690..61241e3e 100644 --- a/src/client/game/game.hpp +++ b/src/client/game/game.hpp @@ -72,6 +72,9 @@ namespace game void SV_GameSendServerCommand(int clientNum, svscmd_type type, const char* text); void Cbuf_AddText(int local_client_num, int controller_index, const char* cmd); + + void Cmd_TokenizeString(const char* text); + void Cmd_EndTokenizeString(); } uintptr_t operator"" _b(const uintptr_t ptr); diff --git a/src/client/game/structs.hpp b/src/client/game/structs.hpp index db37f353..a5954baf 100644 --- a/src/client/game/structs.hpp +++ b/src/client/game/structs.hpp @@ -850,6 +850,15 @@ namespace game const char** argv[8]; }; + struct CmdArgsPrivate + { + char textPool[8192]; + const char* argvPool[512]; + int usedTextPool[8]; + int totalUsedArgvPool; + int totalUsedTextPool; + }; + struct cmd_function_s { cmd_function_s* next; diff --git a/src/client/game/symbols.hpp b/src/client/game/symbols.hpp index 791b9004..099d3e46 100644 --- a/src/client/game/symbols.hpp +++ b/src/client/game/symbols.hpp @@ -32,8 +32,17 @@ namespace game WEAK symbol Cmd_ExecuteSingleCommand{0x376FF0, 0x156E90}; WEAK symbol Cmd_AddCommandInternal{0x376A40, 0x156880}; WEAK symbol Cmd_RemoveCommand{0x377670, 0x157690}; - WEAK symbol Cmd_TokenizeString{0x377790, 0x0}; // not a function - WEAK symbol Cmd_EndTokenizeString{0x0, 0x0}; // not a function + + namespace sp + { + WEAK symbol Cmd_TokenizeString{0x377790, 0x0}; + WEAK symbol Cmd_EndTokenizeString{0x376C90, 0x0}; + } + + namespace mp + { + WEAK symbol Cmd_TokenizeStringWithLimit{0x0, 0x157A40}; + } WEAK symbol AimAssist_AddToTargetList{0x0, 0xE66C0}; @@ -230,6 +239,7 @@ namespace game WEAK symbol command_whitelist{0x115ADF0, 0x10ACB70}; WEAK symbol cmd_functions{0xB490038, 0x344DF18}; WEAK symbol cmd_args{0xB48FEE0, 0x2ED1E00}; + WEAK symbol cmd_argsPrivate{0, 0x3513F20}; WEAK symbol g_poolSize{0x0, 0x0};