aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-05-26 23:09:15 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-05-26 23:09:15 +0100
commit2171d95e1221442081bade7929c05b82ca0f2a08 (patch)
tree78e2d33c13fb0353e3869b08b15c3a6cc3c60393 /NorthstarDedicatedTest/dedicatedmaterialsystem.cpp
parentcc7b0ded08e3dc26fc970169a79c74c54e4f923b (diff)
downloadNorthstarLauncher-2171d95e1221442081bade7929c05b82ca0f2a08.tar.gz
NorthstarLauncher-2171d95e1221442081bade7929c05b82ca0f2a08.zip
update more stuff to new hook macros
Diffstat (limited to 'NorthstarDedicatedTest/dedicatedmaterialsystem.cpp')
-rw-r--r--NorthstarDedicatedTest/dedicatedmaterialsystem.cpp50
1 files changed, 6 insertions, 44 deletions
diff --git a/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp b/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp
index d01d381f..3f1bf323 100644
--- a/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp
+++ b/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp
@@ -4,20 +4,10 @@
#include "tier0.h"
#include "NSMem.h"
-typedef HRESULT (*__stdcall D3D11CreateDeviceType)(
- void* pAdapter,
- int DriverType,
- HMODULE Software,
- UINT Flags,
- int* pFeatureLevels,
- UINT FeatureLevels,
- UINT SDKVersion,
- void** ppDevice,
- int* pFeatureLevel,
- void** ppImmediateContext);
-D3D11CreateDeviceType D3D11CreateDevice;
+AUTOHOOK_INIT()
-HRESULT __stdcall D3D11CreateDeviceHook(
+AUTOHOOK(D3D11CreateDevice, materialsystem_dx11.dll + 0xD9A0E,
+HRESULT, __stdcall, (
void* pAdapter,
int DriverType,
HMODULE Software,
@@ -27,7 +17,7 @@ HRESULT __stdcall D3D11CreateDeviceHook(
UINT SDKVersion,
void** ppDevice,
int* pFeatureLevel,
- void** ppImmediateContext)
+ 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
@@ -41,41 +31,13 @@ HRESULT __stdcall D3D11CreateDeviceHook(
return D3D11CreateDevice(
pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext);
-}
+})
ON_DLL_LOAD_DEDI("materialsystem_dx11.dll", DedicatedServerMaterialSystem, [](HMODULE baseAddress)
{
- HookEnabler hook;
- ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0xD9A0E, &D3D11CreateDeviceHook, reinterpret_cast<LPVOID*>(&D3D11CreateDevice));
-
- // not using these for now since they're related to nopping renderthread/gamewindow i.e. very hard
- //{
- // // function that launches renderthread
- // char* ptr = (char*)baseAddress + 0x87047;
- // TempReadWrite rw(ptr);
- //
- // // make it not launch renderthread
- // *ptr = (char)0x90;
- // *(ptr + 1) = (char)0x90;
- // *(ptr + 2) = (char)0x90;
- // *(ptr + 3) = (char)0x90;
- // *(ptr + 4) = (char)0x90;
- // *(ptr + 5) = (char)0x90;
- //}
- //
- //{
- // // some function that waits on renderthread job
- // char* ptr = (char*)baseAddress + 0x87d00;
- // TempReadWrite rw(ptr);
- //
- // // return immediately
- // *ptr = (char)0xC3;
- //}
+ AUTOHOOK_DISPATCH()
// CMaterialSystem::FindMaterial
// make the game always use the error material
NSMem::BytePatch((uintptr_t)baseAddress + 0x5F0F1, {0xE9, 0x34, 0x03, 0x00});
-
- // previously had DisableDedicatedWindowCreation stuff here, removing for now since shit and unstable
- // check commit history if needed
}) \ No newline at end of file