diff --git a/src/client/component/command.cpp b/src/client/component/command.cpp index 4ed2b282..a8771df2 100644 --- a/src/client/component/command.cpp +++ b/src/client/component/command.cpp @@ -63,8 +63,8 @@ namespace command static std::string comand_line_buffer = GetCommandLineA(); auto* command_line = comand_line_buffer.data(); - auto& com_num_console_lines = *reinterpret_cast(0x142623FB4); - auto* com_console_lines = reinterpret_cast(0x142623FC0); + auto& com_num_console_lines = *reinterpret_cast(0x35634B8_b); + auto* com_console_lines = reinterpret_cast(0x35634C0_b); auto inq = false; com_console_lines[0] = command_line; @@ -96,7 +96,7 @@ namespace command void parse_commandline_stub() { parse_command_line(); - utils::hook::invoke(0x1400D8210); + utils::hook::invoke(0x15A4F0_b); } game::dvar_t* dvar_command_stub() @@ -127,9 +127,9 @@ namespace command } else { - char command[0x1000] = { 0 }; - game::Dvar_GetCombinedString(command, 1); - game::Dvar_SetCommand(dvar->hash, "", command); + //char command[0x1000] = { 0 }; <-- CRASHES??!?!?!?! + //game::Dvar_GetCombinedString(command, 1); + //game::Dvar_SetCommand(dvar->hash, "", command); } return dvar; @@ -340,12 +340,12 @@ namespace command // parse the commandline if it's not parsed parse_command_line(); - auto& com_num_console_lines = *reinterpret_cast(0x142623FB4); - auto* com_console_lines = reinterpret_cast(0x142623FC0); + auto& com_num_console_lines = *reinterpret_cast(0x35634B8_b); + auto* com_console_lines = reinterpret_cast(0x35634C0_b); for (int i = 0; i < com_num_console_lines; i++) { - game::Cmd_TokenizeString(com_console_lines[i]); + game::Cmd_TokenizeString(com_console_lines[i]); // need to re-create this function // only +set dvar value if (game::Cmd_Argc() >= 3 && game::Cmd_Argv(0) == "set"s && game::Cmd_Argv(1) == dvar) @@ -353,7 +353,7 @@ namespace command game::Dvar_SetCommand(game::generateHashValue(game::Cmd_Argv(1)), "", game::Cmd_Argv(2)); } - game::Cmd_EndTokenizeString(); + game::Cmd_EndTokenizeString(); // need to re-create this function } } @@ -508,8 +508,8 @@ namespace command } else { - utils::hook::call(0x1400D728F, parse_commandline_stub); - utils::hook::jump(0x14041D750, dvar_command_stub); + utils::hook::call(0x157D8F_b, parse_commandline_stub); + //utils::hook::jump(0x4E9F40_b, dvar_command_stub); add_commands_mp(); } @@ -723,7 +723,7 @@ namespace command static void add_commands_mp() { - client_command_hook.create(0x140336000, &client_command); + client_command_hook.create(0x4132E0_b, &client_command); add_sv("god", [](const int client_num, const params_sv&) { @@ -818,4 +818,4 @@ namespace command }; } -//REGISTER_COMPONENT(command::component) +REGISTER_COMPONENT(command::component) diff --git a/src/client/game/game.cpp b/src/client/game/game.cpp index 95fb0793..980d3ad1 100644 --- a/src/client/game/game.cpp +++ b/src/client/game/game.cpp @@ -36,6 +36,14 @@ namespace game return !game::environment::is_sp() && *mp::virtualLobby_loaded == 1; } + void SV_GameSendServerCommand(int clientNum, svscmd_type type, const char* text) + { + if (clientNum == -1) + SV_SendServerCommand(0, type, "%s", text); + else + SV_SendServerCommand(&mp::svs_clients[clientNum], type, "%s", text); + } + namespace environment { launcher::mode mode = launcher::mode::none; diff --git a/src/client/game/game.hpp b/src/client/game/game.hpp index d1e623af..0d261d36 100644 --- a/src/client/game/game.hpp +++ b/src/client/game/game.hpp @@ -68,6 +68,8 @@ namespace game const char* SV_Cmd_Argv(int index); bool VirtualLobby_Loaded(); + + void SV_GameSendServerCommand(int clientNum, svscmd_type type, const char* text); } uintptr_t operator"" _b(const uintptr_t ptr); diff --git a/src/client/game/symbols.hpp b/src/client/game/symbols.hpp index d6650edc..fd70192e 100644 --- a/src/client/game/symbols.hpp +++ b/src/client/game/symbols.hpp @@ -20,11 +20,11 @@ namespace game void (int, int, const char*))> Cbuf_ExecuteBufferInternal{0x0, 0x155BC0}; WEAK symbol Conbuf_AppendText{0x0, 0x0}; WEAK symbol ConcatArgs{0x0, 0x413050}; - WEAK symbol Cmd_ExecuteSingleCommand{0x0, 0x0}; + WEAK symbol Cmd_ExecuteSingleCommand{0x0, 0x156E90}; WEAK symbol Cmd_AddCommandInternal{0x0, 0x156880}; WEAK symbol Cmd_RemoveCommand{0x0, 0x157690}; - WEAK symbol Cmd_TokenizeString{0x0, 0x0}; - WEAK symbol Cmd_EndTokenizeString{0x0, 0x0}; + WEAK symbol Cmd_TokenizeString{0x0, 0x0}; // not a function + WEAK symbol Cmd_EndTokenizeString{0x0, 0x0}; // not a function WEAK symbol AimAssist_AddToTargetList{0x0, 0xE66C0}; @@ -39,7 +39,7 @@ namespace game WEAK symbol Com_Quit_f{0x0, 0x1F9280}; WEAK symbol Com_Shutdown{0x0, 0x0}; - WEAK symbol Quit{0x0, 0x1F9280}; + WEAK symbol Quit{0x0, 0x17CF50}; WEAK symbol CG_GameMessage{0x0, 0x316210}; WEAK symbol CG_GameMessageBold{0x0, 0x3122F0}; @@ -55,7 +55,7 @@ namespace game WEAK symbol Dvar_FindVar{0x0, 0x183EB0}; WEAK symbol Dvar_ClearModified{0x0, 0x0}; WEAK symbol Dvar_GetCombinedString{0x0, 0x4EA020}; - WEAK symbol Dvar_ValueToString{0x0, 0x0}; + WEAK symbol Dvar_ValueToString{0x0, 0x187000}; WEAK symbol Dvar_Reset{0x0, 0x185390}; WEAK symbol Dvar_SetFromStringByNameFromSource{0x0, 0x185BD0}; @@ -86,7 +86,7 @@ namespace game WEAK symbol GetEntityFieldValue{0x0, 0x0}; - WEAK symbol generateHashValue{0x0, 0x0}; + WEAK symbol generateHashValue{0x0, 0x183F80}; WEAK symbol G_Glass_Update{0x0, 0x0}; WEAK symbol G_GetClientScore{0x0, 0x0}; @@ -186,7 +186,7 @@ namespace game WEAK symbol SV_MapExists{0x0, 0x0}; WEAK symbol SV_ExecuteClientCommand{0x0, 0x0}; WEAK symbol SV_FastRestart{0x0, 0x0}; - WEAK symbol SV_GameSendServerCommand{0x0, 0x0}; + WEAK symbol SV_SendServerCommand{0x0, 0x1CC040}; WEAK symbol Sys_ShowConsole{0x0, 0x0}; WEAK symbol Sys_Error{0x0, 0x0}; @@ -221,7 +221,7 @@ namespace game WEAK symbol command_whitelist{0x0, 0x0}; WEAK symbol cmd_functions{0x0, 0x344DF18}; - WEAK symbol cmd_args{0x0, 0x0}; + WEAK symbol cmd_args{0x0, 0x2ED1E00}; WEAK symbol g_poolSize{0x0, 0x0}; WEAK symbol g_classMap{0x0, 0x0}; @@ -248,15 +248,15 @@ namespace game namespace mp { WEAK symbol g_entities{0x0, 0x71F19E0}; - WEAK symbol svs_clients{0x0, 0x0}; - WEAK symbol svs_numclients{0x0, 0x0}; + WEAK symbol svs_clients{0x0, 0x2DC3390}; + WEAK symbol svs_numclients{0x0, 0x2DC338C}; WEAK symbol gameTime{0x0, 0x0}; WEAK symbol ping{0x0, 0x0}; WEAK symbol sv_serverId_value{0x0, 0x0}; - WEAK symbol virtualLobby_loaded{0x0, 0x0}; + WEAK symbol virtualLobby_loaded{0x0, 0x2E6EC9D}; } namespace sp