Add temporary whitelist address for materialsystem crash case

This is required as we still have a very hacky approach for running 'custom' BSP files. Even though we are pretty much ready to move over the proper approach, we haven't been able to update all files yet. This is kept in place but will have to be deprecated and removed among with the MaterialSystem hack before the next release.
This commit is contained in:
Kawe Mazidjatari 2022-12-27 23:10:51 +01:00
parent d2fc2405c3
commit 1376e1be82

View File

@ -5,9 +5,11 @@
//===========================================================================//
#include "core/stdafx.h"
#include "tier1/cvar.h"
#include "public/utility/crashhandler.h"
#include "vpc/keyvalues.h"
#include "rtech/rtech_utils.h"
#include "engine/cmodel_bsp.h"
#include "bsplib/bsplib.h"
#include "materialsystem/cmaterialglue.h"
#include "materialsystem/cmaterialsystem.h"
@ -130,6 +132,16 @@ Vector2D CMaterialSystem::GetScreenSize(CMaterialSystem* pMatSys)
///////////////////////////////////////////////////////////////////////////////
void CMaterialSystem_Attach()
{
// TODO: This has to be removed!!!
#ifndef _DEBUG
vector<CMemory> find_IMI_ref = CMemory(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->AddToWhitelist(imiRetAddr);
}
#endif // !_DEBUG
#ifndef DEDICATED
DetourAttach((LPVOID*)&v_StreamDB_Init, &StreamDB_Init);
DetourAttach((LPVOID*)&v_DispatchDrawCall, &DispatchDrawCall);