Also add quit to mp & sp

This commit is contained in:
FutureRave 2022-03-15 15:41:51 +00:00
parent eb3198f700
commit 8b4b63f3cc
No known key found for this signature in database
GPG Key ID: E883E2BC9657D955
3 changed files with 15 additions and 4 deletions

View File

@ -73,6 +73,8 @@ namespace game
Cmd_ExecuteSingleCommand_t Cmd_ExecuteSingleCommand;
Com_Quit_f_t Com_Quit_f;
decltype(longjmp)* _longjmp;
CmdArgs* sv_cmd_args;
@ -685,6 +687,8 @@ namespace game
native::Cmd_ExecuteSingleCommand = native::Cmd_ExecuteSingleCommand_t(
SELECT_VALUE(0x4D6960, 0x5462B0, 0x4CC360));
native::Com_Quit_f = native::Com_Quit_f_t(SELECT_VALUE(0x4F48B0, 0x5556B0, 0x4D95B0));
native::_longjmp = reinterpret_cast<decltype(longjmp)*>(SELECT_VALUE(0x73AC20, 0x7363BC, 0x655558));
native::sv_cmd_args = reinterpret_cast<native::CmdArgs*>(SELECT_VALUE(0x1757218, 0x1CAA998, 0x1B5E7D8));

View File

@ -120,6 +120,9 @@ namespace game
typedef void (*Cmd_ExecuteSingleCommand_t)(LocalClientNum_t localClientNum, int controllerIndex, const char* text);
extern Cmd_ExecuteSingleCommand_t Cmd_ExecuteSingleCommand;
typedef void (*Com_Quit_f_t)();
extern Com_Quit_f_t Com_Quit_f;
extern decltype(longjmp)* _longjmp;
constexpr auto CMD_MAX_NESTING = 8;

View File

@ -323,14 +323,18 @@ void command::add_sp_commands()
void command::post_load()
{
if (game::is_dedi())
{
utils::hook(0x4F96B5, &command::client_command_dedi_stub, HOOK_CALL).install()->quick(); // SV_ExecuteClientCommand
return;
}
add("quit", game::native::Com_Quit_f);
if (game::is_mp())
{
utils::hook(0x57192A, &command::client_command_stub, HOOK_CALL).install()->quick(); // SV_ExecuteClientCommand
}
else if (game::is_dedi())
{
utils::hook(0x4F96B5, &command::client_command_dedi_stub, HOOK_CALL).install()->quick(); // SV_ExecuteClientCommand
}
else
{
utils::hook(0x44BB50, &command::client_command_sp_stub, HOOK_JUMP).install()->quick();