See description

Fixed rare crash in CMDLCache when buffer itteration returns invalid pointer (not null!) for handle.

Made all variables and functions used by BuildPropStaticFrustumCullMap searched dynamically (these should also work on s0, s1 and s2, they are compared but at the moment untested).

TODO: Fix deref crash properly (see bsplib.cpp l291).
This commit is contained in:
Kawe Mazidjatari
2022-05-01 05:38:51 +02:00
parent f8f2ce6fa4
commit a479b4ac78
9 changed files with 155 additions and 139 deletions

View File

@@ -45,6 +45,8 @@ public:
static_assert(sizeof(CMaterialGlue) == 0x130);
#pragma pack(pop)
inline void* g_pMaterialGlueVTable = nullptr;;
/* ==== CMATERIALGLUE ================================================================================================================================================== */
inline CMemory p_GetMaterialAtCrossHair;
inline auto GetMaterialAtCrossHair = p_GetMaterialAtCrossHair.RCast<CMaterialGlue* (*)(void)>();
@@ -57,6 +59,7 @@ class HCMaterialGlue : public IDetour
virtual void GetAdr(void) const
{
std::cout << "| FUN: CMaterialGlue::GetMaterialAtCrossHair: 0x" << std::hex << std::uppercase << p_GetMaterialAtCrossHair.GetPtr() << std::setw(nPad) << " |" << std::endl;
std::cout << "| CON: g_pMaterialGlueVTable : 0x" << std::hex << std::uppercase << g_pMaterialGlueVTable << std::setw(0) << " |" << std::endl;
std::cout << "+----------------------------------------------------------------+" << std::endl;
}
virtual void GetFun(void) const
@@ -65,7 +68,11 @@ class HCMaterialGlue : public IDetour
GetMaterialAtCrossHair = p_GetMaterialAtCrossHair.RCast<CMaterialGlue* (*)(void)>(); /*48 8B C4 48 83 EC 58 48 83 3D ? ? ? ? ?*/
}
virtual void GetVar(void) const { }
virtual void GetCon(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 ? ? ? ?*/
}
virtual void Attach(void) const { }
virtual void Detach(void) const { }
};