This commit is contained in:
cdozdil
2025-01-16 17:37:00 +03:00
5 changed files with 18 additions and 16 deletions
+10 -8
View File
@@ -904,9 +904,9 @@ void HookFSR2ExeInputs()
o_ffxFsr2GetRenderResolutionFromQualityMode_Dx12 = (PFN_ffxFsr2GetRenderResolutionFromQualityMode)DetourFindFunction(exeName.c_str(), "?ffxFsr2GetRenderResolutionFromQualityMode@@YAHPEAH0HHW4FfxFsr2QualityMode@@@Z");
//ffxFsr2GetInterfaceDX12
o_ffxFsr2GetInterfaceDX12 = (PFN_ffxFsr2GetInterfaceDX12)DetourFindFunction(exeName.c_str(), "ffxFsr2GetInterfaceDX12");
if (o_ffxFsr2GetInterfaceDX12 == nullptr)
o_ffxFsr2GetInterfaceDX12 = (PFN_ffxFsr2GetInterfaceDX12)DetourFindFunction(exeName.c_str(), "?ffxFsr2GetInterfaceDX12@@YAHPEAUFfxFsr2Interface@@PEAUID3D12Device@@PEAX_K@Z");
//o_ffxFsr2GetInterfaceDX12 = (PFN_ffxFsr2GetInterfaceDX12)DetourFindFunction(exeName.c_str(), "ffxFsr2GetInterfaceDX12");
//if (o_ffxFsr2GetInterfaceDX12 == nullptr)
// o_ffxFsr2GetInterfaceDX12 = (PFN_ffxFsr2GetInterfaceDX12)DetourFindFunction(exeName.c_str(), "?ffxFsr2GetInterfaceDX12@@YAHPEAUFfxFsr2Interface@@PEAUID3D12Device@@PEAX_K@Z");
// Pattern matching
{
@@ -1001,8 +1001,8 @@ void HookFSR2ExeInputs()
if (o_ffxFsr2GetRenderResolutionFromQualityMode_Dx12 != nullptr)
DetourAttach(&(PVOID&)o_ffxFsr2GetRenderResolutionFromQualityMode_Dx12, ffxFsr2GetRenderResolutionFromQualityMode_Dx12);
if (o_ffxFsr2GetInterfaceDX12 != nullptr)
DetourAttach(&(PVOID&)o_ffxFsr2GetInterfaceDX12, hk_ffxFsr2GetInterfaceDX12);
//if (o_ffxFsr2GetInterfaceDX12 != nullptr)
// DetourAttach(&(PVOID&)o_ffxFsr2GetInterfaceDX12, hk_ffxFsr2GetInterfaceDX12);
Config::Instance()->fsrHooks = true;
@@ -1019,7 +1019,7 @@ void HookFSR2ExeInputs()
LOG_DEBUG("ffxFsr2ContextDestroy_Pattern_Dx12: {:X}", (size_t)o_ffxFsr2ContextDestroy_Pattern_Dx12);
LOG_DEBUG("ffxFsr2GetUpscaleRatioFromQualityMode_Dx12: {:X}", (size_t)o_ffxFsr2GetUpscaleRatioFromQualityMode_Dx12);
LOG_DEBUG("ffxFsr2GetRenderResolutionFromQualityMode_Dx12: {:X}", (size_t)o_ffxFsr2GetRenderResolutionFromQualityMode_Dx12);
LOG_DEBUG("ffxFsr2GetInterfaceDX12: {:X}", (size_t)o_ffxFsr2GetInterfaceDX12);
//LOG_DEBUG("ffxFsr2GetInterfaceDX12: {:X}", (size_t)o_ffxFsr2GetInterfaceDX12);
}
void HookFSR2Inputs(HMODULE module)
@@ -1074,6 +1074,8 @@ void HookFSR2Inputs(HMODULE module)
void HookFSR2Dx12Inputs(HMODULE module)
{
return;
LOG_INFO("Trying to hook FSR2 methods");
if (o_ffxFsr2GetInterfaceDX12 != nullptr)
@@ -1091,8 +1093,8 @@ void HookFSR2Dx12Inputs(HMODULE module)
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
if (o_ffxFsr2GetInterfaceDX12 != nullptr)
DetourAttach(&(PVOID&)o_ffxFsr2GetInterfaceDX12, hk_ffxFsr2GetInterfaceDX12);
//if (o_ffxFsr2GetInterfaceDX12 != nullptr)
// DetourAttach(&(PVOID&)o_ffxFsr2GetInterfaceDX12, hk_ffxFsr2GetInterfaceDX12);
DetourTransactionCommit();
}
-2
View File
@@ -225,8 +225,6 @@ ffxReturnCode_t ffxDestroyContext_Dx12(ffxContext* context, const ffxAllocationC
LOG_DEBUG("context: {:X}", (size_t)*context);
auto contextId = (size_t)*context;
if (!_initParams.contains(*context))
{
LOG_INFO("Not upscaler context: {:X}", (size_t)*context);
+3 -1
View File
@@ -82,7 +82,7 @@
<IncludePath>$(SolutionDir)external\vulkan\include;$(SolutionDir)external\nvngx_dlss_sdk;$(SolutionDir)external\xess\inc\xess;$(SolutionDir)external\FidelityFX-SDK\ffx-api\include\ffx_api;$(SolutionDir)external\simpleini;$(SolutionDir)external\unordered_dense\include;$(SolutionDir)external\spdlog\include;$(SolutionDir)external\freetype;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)fsr2\lib;$(ProjectDir)fsr2_212\lib;$(ProjectDir)fsr31\lib;$(ProjectDir)vulkan;$(ProjectDir)d3dx;$(ProjectDir)detours;$(SolutionDir)external\xess\lib;$(SolutionDir)external\freetype;$(LibraryPath)</LibraryPath>
<TargetName>dxgi</TargetName>
<OutDir>E:\Games\Deep Rock Galactic\FSD\Binaries\Win64\</OutDir>
<OutDir>D:\Games\Steam\steamapps\common\Warhammer 40,000 DARKTIDE\binaries\</OutDir>
<IntDir>.\x64\Debug</IntDir>
<TargetExt>.dll</TargetExt>
</PropertyGroup>
@@ -284,6 +284,7 @@ copy NUL "$(SolutionDir)x64\Release\a\!! EXTRACT ALL FILES TO GAME FOLDER !!"</C
<ClInclude Include="rcas\RCAS_Dx12.h" />
<ClInclude Include="nvapi\ReflexHooks.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="scanner\scanner.h" />
<ClInclude Include="Streamline_Proxy.h" />
<ClInclude Include="Util.h" />
<ClInclude Include="backends\xess\XeSSFeature_Dx11.h" />
@@ -359,6 +360,7 @@ copy NUL "$(SolutionDir)x64\Release\a\!! EXTRACT ALL FILES TO GAME FOLDER !!"</C
<ClCompile Include="output_scaling\OS_Dx11.cpp" />
<ClCompile Include="rcas\RCAS_Dx11.cpp" />
<ClCompile Include="rcas\RCAS_Dx12.cpp" />
<ClCompile Include="scanner\scanner.cpp" />
<ClCompile Include="Util.cpp" />
<ClCompile Include="XeSS_Debug.cpp" />
<ClCompile Include="XeSS_Dx12.cpp" />
+4 -4
View File
@@ -3347,7 +3347,7 @@ static HRESULT hkD3D11On12CreateDevice(IUnknown* pDevice, UINT Flags, D3D_FEATUR
HookToDevice(d3d11on12Device);
}
if (*ppDevice != nullptr)
if (result == S_OK && *ppDevice != nullptr)
Config::Instance()->d3d11Devices.push_back(*ppDevice);
LOG_FUNC_RESULT(result);
@@ -3397,7 +3397,7 @@ static HRESULT hkD3D11CreateDevice(IDXGIAdapter* pAdapter, D3D_DRIVER_TYPE Drive
LOG_FUNC_RESULT(result);
if (*ppDevice != nullptr)
if (result == S_OK && ppDevice != nullptr && *ppDevice != nullptr)
Config::Instance()->d3d11Devices.push_back(*ppDevice);
return result;
@@ -3450,7 +3450,7 @@ static HRESULT hkD3D11CreateDeviceAndSwapChain(IDXGIAdapter* pAdapter, D3D_DRIVE
HookToDevice(d3d11Device);
}
if (*ppDevice != nullptr)
if (result == S_OK && ppDevice != nullptr && *ppDevice != nullptr)
Config::Instance()->d3d11Devices.push_back(*ppDevice);
LOG_FUNC_RESULT(result);
@@ -3489,7 +3489,7 @@ static HRESULT hkD3D12CreateDevice(IDXGIAdapter* pAdapter, D3D_FEATURE_LEVEL Min
auto result = o_D3D12CreateDevice(pAdapter, MinimumFeatureLevel, riid, ppDevice);
//Config::Instance()->skipSpoofing = false;
if (result == S_OK && *ppDevice != nullptr)
if (result == S_OK && ppDevice != nullptr && *ppDevice != nullptr)
{
LOG_DEBUG("Device captured: {0:X}", (size_t)*ppDevice);
g_pd3dDeviceParam = (ID3D12Device*)*ppDevice;
+1 -1
View File
@@ -21,7 +21,7 @@
#define VER_MAJOR_VERSION 0
#define VER_MINOR_VERSION 7
#define VER_HOTFIX_VERSION 7
#define VER_BUILD_NUMBER 1
#define VER_BUILD_NUMBER 2
#define VER_PRE_RELEASE