Merge pull request #44 from VVLNT/client-score-fix

[QuickPatch] Fix crash in G_GetClientScore
This commit is contained in:
Dss0 2020-11-13 14:51:08 +01:00 committed by GitHub
commit 5ec469b117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 15 deletions

View File

@ -119,23 +119,23 @@ namespace Components
}
}
__declspec(naked) int QuickPatch::SVGameClientNum()
__declspec(naked) int QuickPatch::G_GetClientScore()
{
_asm
__asm
{
mov eax, [esp + 4] // index
mov ecx, 1A831A8h
mov ecx, [ecx]
imul eax, 366Ch
lea edx, [eax + ecx + 3134h]
cmp edx, 0
jnz valid_player_state
mov eax, 0
ret
mov eax, [esp + 4] // index
mov ecx, ds : 1A831A8h // level: &g_clients
valid_player_state:
test ecx, ecx;
jz invalid_ptr;
imul eax, 366Ch
mov eax, [eax + ecx + 3134h]
ret
invalid_ptr:
xor eax, eax
ret
}
}
@ -680,8 +680,8 @@ namespace Components
// Patch selectStringTableEntryInDvar
Utils::Hook::Set(0x405959, QuickPatch::SelectStringTableEntryInDvarStub);
// Patch SV_GameClientNum for edge case generating status
Utils::Hook(0x624DE2, QuickPatch::SVGameClientNum, HOOK_CALL).install()->quick();
// Patch G_GetClientScore for uninitialised game
Utils::Hook(0x469AC0, QuickPatch::G_GetClientScore, HOOK_JUMP).install()->quick();
// Ignore call to print 'Offhand class mismatch when giving weapon...'
Utils::Hook(0x5D9047, 0x4BB9B0, HOOK_CALL).install()->quick();

View File

@ -19,7 +19,7 @@ namespace Components
static void SelectStringTableEntryInDvarStub();
static int SVCanReplaceServerCommand(Game::client_t *client, const char *cmd);
static int SVGameClientNum();
static int G_GetClientScore();
static int MsgReadBitsCompressCheckSV(const char *from, char *to, int size);
static int MsgReadBitsCompressCheckCL(const char *from, char *to, int size);