aboutsummaryrefslogtreecommitdiff
path: root/primedev/dedicated
diff options
context:
space:
mode:
authorJack <66967891+ASpoonPlaysGames@users.noreply.github.com>2024-09-17 16:08:47 +0100
committerGitHub <noreply@github.com>2024-09-17 17:08:47 +0200
commitba485e9826c13a37945e06f3c00101ea16089266 (patch)
treebe5c4a9f1419334be8ff3290c0d58f51cdd1ab07 /primedev/dedicated
parent1f4765d4a82d2ae3a17f66330f30d16f2eab2be7 (diff)
downloadNorthstarLauncher-ba485e9826c13a37945e06f3c00101ea16089266.tar.gz
NorthstarLauncher-ba485e9826c13a37945e06f3c00101ea16089266.zip
dedicated: Remove uses of Autohook from `dedicatedmaterialsystem.cpp` (#800)
Removes AUTOHOOK macro from dedicatedmaterialsystem.cpp
Diffstat (limited to 'primedev/dedicated')
-rw-r--r--primedev/dedicated/dedicatedmaterialsystem.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/primedev/dedicated/dedicatedmaterialsystem.cpp b/primedev/dedicated/dedicatedmaterialsystem.cpp
index 01078086..f74cbfe3 100644
--- a/primedev/dedicated/dedicatedmaterialsystem.cpp
+++ b/primedev/dedicated/dedicatedmaterialsystem.cpp
@@ -1,11 +1,18 @@
#include "dedicated.h"
#include "core/tier0.h"
-AUTOHOOK_INIT()
-
-// clang-format off
-AUTOHOOK(D3D11CreateDevice, materialsystem_dx11.dll + 0xD9A0E,
-HRESULT, __stdcall, (
+static HRESULT(__stdcall* o_pD3D11CreateDevice)(
+ void* pAdapter,
+ int DriverType,
+ HMODULE Software,
+ UINT Flags,
+ int* pFeatureLevels,
+ UINT FeatureLevels,
+ UINT SDKVersion,
+ void** ppDevice,
+ int* pFeatureLevel,
+ void** ppImmediateContext) = nullptr;
+static HRESULT __stdcall h_D3D11CreateDevice(
void* pAdapter,
int DriverType,
HMODULE Software,
@@ -15,8 +22,7 @@ HRESULT, __stdcall, (
UINT SDKVersion,
void** ppDevice,
int* pFeatureLevel,
- void** ppImmediateContext))
-// clang-format on
+ void** ppImmediateContext)
{
// note: this is super duper temp pretty much just messing around with it
// does run surprisingly well on dedi for a software driver tho if you ignore the +1gb ram usage at times, seems like dedi doesn't
@@ -26,13 +32,14 @@ HRESULT, __stdcall, (
if (CommandLine()->CheckParm("-softwared3d11"))
DriverType = 5; // D3D_DRIVER_TYPE_WARP
- return D3D11CreateDevice(
+ return o_pD3D11CreateDevice(
pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext);
}
ON_DLL_LOAD_DEDI("materialsystem_dx11.dll", DedicatedServerMaterialSystem, (CModule module))
{
- AUTOHOOK_DISPATCH()
+ o_pD3D11CreateDevice = module.Offset(0xD9A0E).RCast<decltype(o_pD3D11CreateDevice)>();
+ HookAttach(&(PVOID&)o_pD3D11CreateDevice, (PVOID)h_D3D11CreateDevice);
// CMaterialSystem::FindMaterial
// make the game always use the error material