Skip to content

Commit

Permalink
Tweaked hook initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaldaien committed Sep 29, 2023
1 parent bf8ef6a commit 9c43d99
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
23.9.29.1
23.9.29.2
=========
+ Implicitly override a game's Reflex settings if DLSS-G is active and
a framerate limit is set, but user has not requested Reflex override.
+ Correctly handle Reflex overrides in games (i.e. The Witcher 3) that set
NvSleep parameters EVERY frame despite documented performance penalties.

23.9.29.1
=========
+ Run all of Starfield's Steam callbacks on its main thread

Expand Down
4 changes: 2 additions & 2 deletions include/SpecialK/DLL_VERSION.H
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#define SK_YEAR 23
#define SK_MONTH 9
#define SK_DATE 29
#define SK_REV_N 1
#define SK_REV 1
#define SK_REV_N 2
#define SK_REV 2

#ifndef _A2
#define _A2(a) #a
Expand Down
6 changes: 6 additions & 0 deletions src/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,12 @@ void BasicInit (void)

if (SK_COMPAT_IsFrapsPresent ())
SK_COMPAT_UnloadFraps ();

bool bEnable = SK_EnableApplyQueuedHooks ();
{
SK_ApplyQueuedHooks ();
}
if (! bEnable) SK_DisableApplyQueuedHooks ();
}

DWORD
Expand Down
21 changes: 9 additions & 12 deletions src/render/dxgi/dxgi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5489,11 +5489,9 @@ SK_DXGI_WrapSwapChain ( IUnknown *pDevice,
IDXGISwapChain **ppDest,
DXGI_FORMAT original_format )
{
if (pDevice == nullptr || pSwapChain == nullptr || ppDest == nullptr)
return nullptr;

const bool bDontWrap =
SK_GetModuleHandleW (L"sl.interposer.dll") != nullptr;
bool bDontWrap = SK_IsInjected () &&
SK_GetModuleHandleW (L"sl.dlss_g.dll") != nullptr &&
config.system.global_inject_delay == 0.0f;

static auto& rb =
SK_GetCurrentRenderBackend ();
Expand Down Expand Up @@ -5576,8 +5574,9 @@ SK_DXGI_WrapSwapChain1 ( IUnknown *pDevice,
if (pDevice == nullptr || pSwapChain == nullptr || ppDest == nullptr)
return nullptr;

bool bDontWrap =
SK_GetModuleHandleW (L"sl.interposer.dll") != nullptr;
bool bDontWrap = SK_IsInjected () &&
SK_GetModuleHandleW (L"sl.dlss_g.dll") != nullptr &&
config.system.global_inject_delay == 0.0f;

static auto& rb =
SK_GetCurrentRenderBackend ();
Expand Down Expand Up @@ -7654,7 +7653,7 @@ SK_HookDXGI (void)
SK_GetProcAddress (L"dxgi.dll", "DXGIDisableVBlankVirtualization");
}

SK_ApplyQueuedHooks ();
SK_ApplyQueuedHooks ();

if (config.apis.dxgi.d3d11.hook)
{
Expand Down Expand Up @@ -8797,8 +8796,6 @@ HookDXGI (LPVOID user)
LoadLibraryExW (L"d3d11.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32),
"D3D11CoreCreateDevice" );

SK_D3D11_Init ();

//// Favor this codepath because it bypasses many things like ReShade, but
//// it's necessary to skip this path if NVIDIA's Vk/DXGI interop layer is active
if (D3D11CoreCreateDevice != nullptr && (! ( SK_GetModuleHandle (L"vulkan-1.dll") ||
Expand Down Expand Up @@ -8856,6 +8853,8 @@ HookDXGI (LPVOID user)

if (sl::Result::eOk == SK_slUpgradeInterface ((void **)&pCmdQueue.p))
SK_LOGi0 (L"Upgraded D3D12 Command Queue to Streamline Proxy...");

pDevice12.p->AddRef ();
}
}

Expand Down Expand Up @@ -8928,8 +8927,6 @@ HookDXGI (LPVOID user)
//
else
{
SK_D3D11_Init ();

hr =
D3D11CreateDevice_Import (
nullptr,
Expand Down

0 comments on commit 9c43d99

Please sign in to comment.