Fix selectstringtableentryindvar

This commit is contained in:
momo5502 2016-08-07 17:52:13 +02:00
parent 2aee48bffa
commit 799a7583ef
4 changed files with 27 additions and 1 deletions

View File

@ -10,7 +10,7 @@ namespace Components
return &id;
}
void QuickPatch::OnShutdown(QuickPatch::Callback callback)
void QuickPatch::OnShutdown(QuickPatch::Callback* callback)
{
QuickPatch::ShutdownSignal.connect(callback);
}
@ -114,6 +114,23 @@ namespace Components
}
}
void QuickPatch::SelectStringTableEntryInDvarStub()
{
Command::Params args;
if (args.Length() >= 4)
{
Game::dvar_t* dvar = Game::Dvar_FindVar(args[3]);
if (!dvar || dvar->flags & Game::DVAR_FLAG_WRITEPROTECTED || dvar->flags & Game::DVAR_FLAG_CHEAT || dvar->flags & Game::DVAR_FLAG_READONLY)
{
return;
}
}
Game::CL_SelectStringTableEntryInDvar_f();
}
QuickPatch::QuickPatch()
{
// protocol version (workaround for hacks)
@ -335,6 +352,9 @@ namespace Components
Utils::Hook(0x4A9F56, QuickPatch::MsgReadBitsCompressCheckCL, HOOK_CALL).Install()->Quick(); // CL_ParseServerMessage
Utils::Hook(0x5AA009, QuickPatch::CL_HandleRelayPacketCheck, HOOK_CALL).Install()->Quick(); // CL_HandleRelayPacket
// Patch selectStringTableEntryInDvar
Utils::Hook::Set(0x405959, QuickPatch::SelectStringTableEntryInDvarStub);
Command::Add("unlockstats", [] (Command::Params params)
{
QuickPatch::UnlockStats();

View File

@ -21,6 +21,8 @@ namespace Components
static int64_t* GetStatsID();
static void ShutdownStub(int channel, const char* message);
static void SelectStringTableEntryInDvarStub();
static int MsgReadBitsCompressCheckSV(const char *from, char *to, int size);
static int MsgReadBitsCompressCheckCL(const char *from, char *to, int size);
static void CL_HandleRelayPacketCheck(Game::msg_t* msg, int client);

View File

@ -15,6 +15,7 @@ namespace Game
CL_DrawStretchPicPhysical_t CL_DrawStretchPicPhysical = (CL_DrawStretchPicPhysical_t)0x4FC120;
CL_HandleRelayPacket_t CL_HandleRelayPacket = (CL_HandleRelayPacket_t)0x5A8C70;
CL_ResetViewport_t CL_ResetViewport = (CL_ResetViewport_t)0x4A8830;
CL_SelectStringTableEntryInDvar_f_t CL_SelectStringTableEntryInDvar_f = (CL_SelectStringTableEntryInDvar_f_t)0x4A4560;
Cmd_AddCommand_t Cmd_AddCommand = (Cmd_AddCommand_t)0x470090;
Cmd_AddServerCommand_t Cmd_AddServerCommand = (Cmd_AddServerCommand_t)0x4DCE00;

View File

@ -30,6 +30,9 @@ namespace Game
typedef void(__cdecl * CL_ResetViewport_t)();
extern CL_ResetViewport_t CL_ResetViewport;
typedef void(__cdecl * CL_SelectStringTableEntryInDvar_f_t)();
extern CL_SelectStringTableEntryInDvar_f_t CL_SelectStringTableEntryInDvar_f;
typedef void(__cdecl * Cmd_AddCommand_t)(const char* name, void(*callback), cmd_function_t* data, char);
extern Cmd_AddCommand_t Cmd_AddCommand;