Fix more sdktools crash on 64 bits (#2152)

* fix sdktools crash on 64 bits

* remove other 32bit-isms from sdktools

* Swap sizeof(intptr_t) for sizeof(void *)

---------

Co-authored-by: Nick Hastings <nshastings@gmail.com>
This commit is contained in:
bottiger1 2024-06-09 10:17:29 -07:00 committed by GitHub
parent b6d98c762c
commit 5edfa79543
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -234,7 +234,7 @@ void CHookManager::OnClientConnected(int client)
}
}
int hookid = SH_ADD_VPHOOK(IClientMessageHandler, ProcessVoiceData, (IClientMessageHandler *)((intptr_t)(pClient) + 4), SH_MEMBER(this, &CHookManager::ProcessVoiceData), true);
int hookid = SH_ADD_VPHOOK(IClientMessageHandler, ProcessVoiceData, (IClientMessageHandler *)((intptr_t)(pClient) + sizeof(void *)), SH_MEMBER(this, &CHookManager::ProcessVoiceData), true);
hook.SetHookID(hookid);
netProcessVoiceData.push_back(new CVTableHook(hook));
}
@ -584,7 +584,7 @@ bool CHookManager::SendFile(const char *filename, unsigned int transferID)
#if !defined CLIENTVOICE_HOOK_SUPPORT
bool CHookManager::ProcessVoiceData(CLC_VoiceData *msg)
{
IClient *pClient = (IClient *)((intptr_t)(META_IFACEPTR(IClient)) - 4);
IClient *pClient = (IClient *)((intptr_t)(META_IFACEPTR(IClient)) - sizeof(void *));
if (pClient == NULL)
{
return true;

View File

@ -753,8 +753,8 @@ CEntityFactoryDictionary *GetEntityFactoryDictionary()
int32_t funcOffset = *(int32_t *)((intptr_t)addr + offset);
// Get real address of function
// Address of signature + offset of relative offset + sizeof(int32_t) offset + relative offset
addr = (void *)((intptr_t)addr + offset + 4 + funcOffset);
// Address of signature + offset of relative offset + pointer size + relative offset
addr = (void *)((intptr_t)addr + offset + sizeof(void *) + funcOffset);
}
pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retData, NULL, 0);