diff options
author | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2022-07-07 21:31:41 +0100 |
---|---|---|
committer | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2022-07-07 21:31:41 +0100 |
commit | 2ae34b67e36b8ba05132d481876eb4ed7a826283 (patch) | |
tree | 63f44c8e2dcdc959d7a5317a3a7b36efedbd7d38 /NorthstarDLL/dedicatedmaterialsystem.cpp | |
parent | 3406de7aaaf52cbef20b1549f2d7da0255d30f51 (diff) | |
download | NorthstarLauncher-2ae34b67e36b8ba05132d481876eb4ed7a826283.tar.gz NorthstarLauncher-2ae34b67e36b8ba05132d481876eb4ed7a826283.zip |
almost fully replaced hooking lib
Diffstat (limited to 'NorthstarDLL/dedicatedmaterialsystem.cpp')
-rw-r--r-- | NorthstarDLL/dedicatedmaterialsystem.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/NorthstarDLL/dedicatedmaterialsystem.cpp b/NorthstarDLL/dedicatedmaterialsystem.cpp index 3f1bf323..14c15bbb 100644 --- a/NorthstarDLL/dedicatedmaterialsystem.cpp +++ b/NorthstarDLL/dedicatedmaterialsystem.cpp @@ -1,43 +1,43 @@ -#pragma once -#include "pch.h" -#include "dedicated.h" -#include "tier0.h" -#include "NSMem.h" - -AUTOHOOK_INIT() - -AUTOHOOK(D3D11CreateDevice, materialsystem_dx11.dll + 0xD9A0E, -HRESULT, __stdcall, ( - void* pAdapter, - int DriverType, - HMODULE Software, - UINT Flags, - int* pFeatureLevels, - UINT FeatureLevels, - UINT SDKVersion, - void** ppDevice, - int* pFeatureLevel, - 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 - // really call gpu much even with renderthread still being a thing will be using this hook for actual d3d stubbing and stuff later - - // atm, i think the play might be to run d3d in software, and then just stub out any calls that allocate memory/use alot of resources - // (e.g. createtexture and that sorta thing) - // note: this has been succeeded by the d3d11 and gfsdk stubs, and is only being kept around for posterity and as a fallback option - if (Tier0::CommandLine()->CheckParm("-softwared3d11")) - DriverType = 5; // D3D_DRIVER_TYPE_WARP - - return D3D11CreateDevice( - pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext); -}) - -ON_DLL_LOAD_DEDI("materialsystem_dx11.dll", DedicatedServerMaterialSystem, [](HMODULE baseAddress) -{ - AUTOHOOK_DISPATCH() - - // CMaterialSystem::FindMaterial - // make the game always use the error material - NSMem::BytePatch((uintptr_t)baseAddress + 0x5F0F1, {0xE9, 0x34, 0x03, 0x00}); +#pragma once
+#include "pch.h"
+#include "dedicated.h"
+#include "tier0.h"
+#include "NSMem.h"
+
+AUTOHOOK_INIT()
+
+AUTOHOOK(D3D11CreateDevice, materialsystem_dx11.dll + 0xD9A0E,
+HRESULT, __stdcall, (
+ void* pAdapter,
+ int DriverType,
+ HMODULE Software,
+ UINT Flags,
+ int* pFeatureLevels,
+ UINT FeatureLevels,
+ UINT SDKVersion,
+ void** ppDevice,
+ int* pFeatureLevel,
+ 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
+ // really call gpu much even with renderthread still being a thing will be using this hook for actual d3d stubbing and stuff later
+
+ // atm, i think the play might be to run d3d in software, and then just stub out any calls that allocate memory/use alot of resources
+ // (e.g. createtexture and that sorta thing)
+ // note: this has been succeeded by the d3d11 and gfsdk stubs, and is only being kept around for posterity and as a fallback option
+ if (Tier0::CommandLine()->CheckParm("-softwared3d11"))
+ DriverType = 5; // D3D_DRIVER_TYPE_WARP
+
+ return D3D11CreateDevice(
+ pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext);
+}
+
+ON_DLL_LOAD_DEDI("materialsystem_dx11.dll", DedicatedServerMaterialSystem, [](HMODULE baseAddress)
+{
+ AUTOHOOK_DISPATCH()
+
+ // CMaterialSystem::FindMaterial
+ // make the game always use the error material
+ NSMem::BytePatch((uintptr_t)baseAddress + 0x5F0F1, {0xE9, 0x34, 0x03, 0x00});
})
\ No newline at end of file |