Remove deprecated workaround

No longer required as of commit f520cab4.
This commit is contained in:
Kawe Mazidjatari 2023-04-18 18:41:06 +02:00
parent f520cab44b
commit 5a90e2cff3
2 changed files with 0 additions and 41 deletions

View File

@ -62,36 +62,6 @@ void* __fastcall DispatchDrawCall(int64_t a1, uint64_t a2, int a3, int a4, int64
}
#endif // !DEDICATED
//-----------------------------------------------------------------------------
// Purpose: checks if ptr is valid, and checks for equality against CMaterial vftable
// Input : **pCandidate -
// Output : true if valid and material, false otherwise
//-----------------------------------------------------------------------------
FORCENOINLINE bool CMaterialSystem::IsMaterialInternal(void** pCandidate)
{
// NOTE: this is a dirty fix, but for running technically broken BSP's, this is the only fix
// besides going bare metal inline assembly (which on its own isn't directly the problem, but
// portability wise it will be a problem as the majority of the code in r5apex.exe is declared inline).
// In the future, do not fix anything like this unless there is absolutely no other choice!
// The context of the problem is that we fix the missing models defined in the game_lump of a
// BSP by swapping missing models out for existing models, which will in many cases, end up with
// 2 or more model name duplicates within a single BSP's game_lump, which is illegal and causes
// unpredictable behavior, which in this case causes a register to be assigned to an invalid CMaterial
// address. The pointer can still be dereferenced in many cases, which is why we do an equality test.
// The first member of the CMaterial data structure should be its VFTable pointer, anything else is invalid.
__try
{
if (*pCandidate == g_pMaterialVFTable ||
*pCandidate == g_pMaterialGlueVFTable)
return true;
}
__except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
{
return false;
}
return false;
}
#ifndef DEDICATED
//-----------------------------------------------------------------------------
// Purpose: finds a material
@ -131,16 +101,6 @@ Vector2D CMaterialSystem::GetScreenSize(CMaterialSystem* pMatSys)
///////////////////////////////////////////////////////////////////////////////
void VMaterialSystem::Attach() const
{
// TODO: This has to be removed!!!
#ifndef _DEBUG
vector<CMemory> find_IMI_ref = CMemory(CMaterialSystem::IsMaterialInternal).FindAllCallReferences(reinterpret_cast<uintptr_t>(BuildPropStaticFrustumCullMap), 1000);
if (!find_IMI_ref.empty())
{
void* imiRetAddr = find_IMI_ref.at(0).Offset(0x5).RCast<void*>();
g_CrashHandler->AddWhitelist(imiRetAddr);
}
#endif // !_DEBUG
#ifndef DEDICATED
DetourAttach((LPVOID*)&v_StreamDB_Init, &StreamDB_Init);
DetourAttach((LPVOID*)&v_DispatchDrawCall, &DispatchDrawCall);

View File

@ -7,7 +7,6 @@
class CMaterialSystem
{
public:
FORCENOINLINE static bool IsMaterialInternal(void** pCandidate);
#ifndef DEDICATED
static CMaterialGlue* FindMaterialEx(CMaterialSystem* pMatSys, const char* pMaterialName, uint8_t nMaterialType, int nUnk, bool bComplain);
static Vector2D GetScreenSize(CMaterialSystem* pMatSys = nullptr);