Skip to content

Commit 73bd38f

Browse files
committed
Fix FSR 4 on Lunyx again
1 parent 9c62155 commit 73bd38f

File tree

2 files changed

+10
-27
lines changed

2 files changed

+10
-27
lines changed

OptiScaler/fsr4/FSR4Upgrade.h

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -458,43 +458,23 @@ inline static HRESULT STDMETHODCALLTYPE hkAmdExtD3DCreateInterface(IUnknown* pOu
458458
{
459459
CheckForGPU();
460460

461-
if (!Config::Instance()->Fsr4Update.value_or_default())
461+
if (!Config::Instance()->Fsr4Update.value_or_default() && o_AmdExtD3DCreateInterface != nullptr)
462462
return o_AmdExtD3DCreateInterface(pOuter, riid, ppvObject);
463463

464-
// If querying IAmdExtFfxApi
465-
if (riid == __uuidof(IAmdExtFfxApi))
466-
{
467-
if (_amdExtFfxApi == nullptr)
468-
_amdExtFfxApi = new AmdExtFfxApi();
469-
470-
// Return custom one
471-
*ppvObject = _amdExtFfxApi;
472-
473-
LOG_INFO("IAmdExtFfxApi queried, returning custom AmdExtFfxApi");
474-
475-
return S_OK;
476-
}
477-
478-
if (o_AmdExtD3DCreateInterface != nullptr)
479-
return o_AmdExtD3DCreateInterface(pOuter, riid, ppvObject);
480-
481-
return E_NOINTERFACE;
482-
}
483-
484-
inline static HRESULT STDMETHODCALLTYPE customAmdExtD3DCreateInterface(IUnknown* pOuter, REFIID riid, void** ppvObject)
485-
{
486-
if (riid == __uuidof(IAmdExtFfxFirst))
464+
// Proton bleeding edge ships amdxc64 that is missing some required functions
465+
else if (riid == __uuidof(IAmdExtFfxFirst) && State::Instance().isRunningOnLinux)
487466
{
488467
// Required for the custom AmdExtFfxApi, lack of it triggers visual glitches
489468
if (_amdExtFfxFirst == nullptr)
490469
_amdExtFfxFirst = new AmdExtFfxFirst();
491470

492471
*ppvObject = _amdExtFfxFirst;
493472

494-
LOG_INFO("Custom IAmdExtFfxFirst queried, returning custom AmdExtFfxFirst");
473+
LOG_INFO("IAmdExtFfxFirst queried, returning custom AmdExtFfxFirst");
495474

496475
return S_OK;
497476
}
477+
498478
else if (riid == __uuidof(IAmdExtFfxApi))
499479
{
500480
if (_amdExtFfxApi == nullptr)
@@ -503,11 +483,14 @@ inline static HRESULT STDMETHODCALLTYPE customAmdExtD3DCreateInterface(IUnknown*
503483
// Return custom one
504484
*ppvObject = _amdExtFfxApi;
505485

506-
LOG_INFO("Custom IAmdExtFfxApi queried, returning custom AmdExtFfxApi");
486+
LOG_INFO("IAmdExtFfxApi queried, returning custom AmdExtFfxApi");
507487

508488
return S_OK;
509489
}
510490

491+
else if (o_AmdExtD3DCreateInterface != nullptr)
492+
return o_AmdExtD3DCreateInterface(pOuter, riid, ppvObject);
493+
511494
return E_NOINTERFACE;
512495
}
513496

OptiScaler/hooks/Kernel_Hooks.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,7 @@ class KernelHooks
17481748
if (lpProcName != nullptr && (hModule == amdxc64Mark || hModule == nullptr) &&
17491749
lstrcmpA(lpProcName, "AmdExtD3DCreateInterface") == 0 && Config::Instance()->Fsr4Update.value_for_config())
17501750
{
1751-
return (FARPROC) &customAmdExtD3DCreateInterface;
1751+
return (FARPROC) &hkAmdExtD3DCreateInterface;
17521752
}
17531753

17541754
if (State::Instance().isRunningOnLinux && lpProcName != nullptr &&

0 commit comments

Comments
 (0)