Use GetVirtualMethodTable for VTable consts.

This commit is contained in:
PixieCore 2022-07-21 20:36:47 +02:00
parent 2d25c504fb
commit 178aeeb3fd
3 changed files with 5 additions and 8 deletions

View File

@ -81,10 +81,8 @@ class HMM_Heartbeat : public IDetour
virtual void GetVar(void) const
{
// We get the actual address of the vtable here, not the class instance.
g_pSVC_Print_VTable = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x74\x1E\x48\x8D\x05\x00\x00\x00\x00\x89\x5F\x08"), "xxxxx????xxx").FindPatternSelf("48 8D").ResolveRelativeAddressSelf(0x3, 0x7);
// 74 1E 48 8D 05 ? ? ? ? 89 5F 08
g_pSVC_UserMessage_VTable = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\xE8\x00\x00\x00\x00\x48\x85\xFF\x74\x65"), "x????xxxxx").FindPatternSelf("48 8D").ResolveRelativeAddressSelf(0x3, 0x7);
// E8 ? ? ? ? 48 85 FF 74 65
g_pSVC_Print_VTable = g_mGameDll.GetVirtualMethodTable(".?AVSVC_Print@@");
g_pSVC_UserMessage_VTable = g_mGameDll.GetVirtualMethodTable(".?AVSVC_UserMessage@@");
}
virtual void GetCon(void) const { }
virtual void Attach(void) const { }

View File

@ -72,8 +72,7 @@ class VMaterialGlue : public IDetour
virtual void GetVar(void) const { }
virtual void GetCon(void) const
{
g_pMaterialGlueVTable = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\xB9\x00\x00\x00\x00\x48\x8D\x05\x00\x00\x00\x00\x48\x8D\x15\x00\x00\x00\x00"), "x????xxx????xxx????")
.FindPatternSelf("48 8D ?? ?? ?? ?? 01").ResolveRelativeAddressSelf(0x3, 0x7).RCast<void*>(); /*B9 ? ? ? ? 48 8D 05 ? ? ? ? 48 8D 15 ? ? ? ?*/
g_pMaterialGlueVTable = g_mGameDll.GetVirtualMethodTable(".?AVCMaterialGlue@@");
}
virtual void Attach(void) const { }
virtual void Detach(void) const { }

View File

@ -45,8 +45,8 @@ class VShaderGlue : public IDetour
virtual void GetFun(void) const
{
// We get it here in GetFun because we grab other functions with it, it's more efficient.
CShaderGlue_VTable = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x8D\x05\x00\x00\x00\x00\x48\x89\x01\xC3\xCC\xCC\xCC\xCC\xCC\x48\x85\xD2"), "xxx????xxxxxxxxxxxx").ResolveRelativeAddressSelf(0x3, 0x7);
g_pCShaderGlue_VTable = CShaderGlue_VTable.RCast<void*>(); /*48 8D 05 ? ? ? ? 48 89 01 C3 CC CC CC CC CC 48 85 D2*/
CShaderGlue_VTable = g_mGameDll.GetVirtualMethodTable(".?AVCShaderGlue@@");
g_pCShaderGlue_VTable = CShaderGlue_VTable.RCast<void*>();
CShaderGlue_SetupShader = CShaderGlue_VTable.WalkVTable(4).RCast<int(*)(CShaderGlue*, uint64_t, uint64_t, void*)>();
}