mirror of
https://github.com/rei-kes/Amalgam.git
synced 2025-06-15 02:37:23 +08:00
Add safety checks in core for renderer.
This commit is contained in:
parent
682654fcf8
commit
c95bc96585
@ -8,6 +8,31 @@
|
|||||||
#include "../Features/Visuals/Visuals.h"
|
#include "../Features/Visuals/Visuals.h"
|
||||||
#include "../Hooks/Direct3DDevice9_Present.h"
|
#include "../Hooks/Direct3DDevice9_Present.h"
|
||||||
|
|
||||||
|
__forceinline bool CheckRenderIsCompatible()
|
||||||
|
{
|
||||||
|
// Check for if we are running in DXVK mode.
|
||||||
|
if(GetModuleHandleA("dxvk_d3d9.dll"))
|
||||||
|
{
|
||||||
|
MessageBoxA(nullptr, "You are running with graphics options that Amalgam does not support.\n"
|
||||||
|
"Please remove -vulkan from your launch options and reinject.", "Error", MB_ICONERROR);
|
||||||
|
U::Core.bUnload = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for if we are running in DirectX 8.
|
||||||
|
auto cvDXLevel = I::CVar->FindVar("mat_dxlevel");
|
||||||
|
auto iLevel = cvDXLevel->GetInt();
|
||||||
|
if(iLevel < 90)
|
||||||
|
{
|
||||||
|
std::string fmt = std::format("You are running with graphics options that Amalgam does not support.\nPlease remove -dxlevel {} from your launch options and reinject.\0", iLevel);
|
||||||
|
MessageBox(nullptr, fmt.c_str(), "Error", MB_ICONERROR);
|
||||||
|
U::Core.bUnload = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void CCore::Load()
|
void CCore::Load()
|
||||||
{
|
{
|
||||||
// Check the DirectX version
|
// Check the DirectX version
|
||||||
@ -15,11 +40,16 @@ void CCore::Load()
|
|||||||
U::Signatures.Initialize();
|
U::Signatures.Initialize();
|
||||||
U::Interfaces.Initialize();
|
U::Interfaces.Initialize();
|
||||||
|
|
||||||
|
U::ConVars.Initialize();
|
||||||
|
|
||||||
|
if(!CheckRenderIsCompatible())
|
||||||
|
return;
|
||||||
|
|
||||||
MH_Initialize();
|
MH_Initialize();
|
||||||
DirectX::Startup();
|
DirectX::Startup();
|
||||||
U::Hooks.Initialize();
|
U::Hooks.Initialize();
|
||||||
DirectX::bIsReady.store(true);
|
DirectX::bIsReady.store(true);
|
||||||
U::ConVars.Initialize();
|
|
||||||
F::Materials.LoadMaterials();
|
F::Materials.LoadMaterials();
|
||||||
F::Commands.Initialize();
|
F::Commands.Initialize();
|
||||||
|
|
||||||
@ -30,6 +60,8 @@ void CCore::Load()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CCore::Unload()
|
void CCore::Unload()
|
||||||
|
{
|
||||||
|
if(!bUnload)
|
||||||
{
|
{
|
||||||
G::Unload = true;
|
G::Unload = true;
|
||||||
DirectX::bIsReady.store(false);
|
DirectX::bIsReady.store(false);
|
||||||
@ -55,7 +87,7 @@ void CCore::Unload()
|
|||||||
cl_wpn_sway_scale->SetValue(0.f);
|
cl_wpn_sway_scale->SetValue(0.f);
|
||||||
|
|
||||||
Sleep(250);
|
Sleep(250);
|
||||||
|
}
|
||||||
SDK::Output("Amalgam", "Unloaded", {175, 150, 255, 255});
|
SDK::Output("Amalgam", "Unloaded", {175, 150, 255, 255});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user