diff --git a/OptiScaler/Config.h b/OptiScaler/Config.h index ab7b27cb..91cb3225 100644 --- a/OptiScaler/Config.h +++ b/OptiScaler/Config.h @@ -285,6 +285,9 @@ public: IFeature* CurrentFeature = nullptr; + ID3D12Device* lastCreatedD3D12Device = nullptr; + ID3D11Device* lastCreatedD3D11Device = nullptr; + bool Reload(std::filesystem::path iniPath); bool LoadFromPath(const wchar_t* InPath); bool SaveIni(); diff --git a/OptiScaler/hooks/HooksDx.cpp b/OptiScaler/hooks/HooksDx.cpp index 7bfdc770..3158167a 100644 --- a/OptiScaler/hooks/HooksDx.cpp +++ b/OptiScaler/hooks/HooksDx.cpp @@ -3331,6 +3331,8 @@ static HRESULT hkD3D11CreateDevice(IDXGIAdapter* pAdapter, D3D_DRIVER_TYPE Drive LOG_FUNC_RESULT(result); + Config::Instance()->lastCreatedD3D11Device = *ppDevice; + return result; } @@ -3411,6 +3413,8 @@ static HRESULT hkD3D11CreateDeviceAndSwapChain(IDXGIAdapter* pAdapter, D3D_DRIVE LOG_FUNC_RESULT(result); + Config::Instance()->lastCreatedD3D11Device = *ppDevice; + return result; } @@ -3481,6 +3485,8 @@ static HRESULT hkD3D12CreateDevice(IDXGIAdapter* pAdapter, D3D_FEATURE_LEVEL Min #endif } + Config::Instance()->lastCreatedD3D12Device = (ID3D12Device*)*ppDevice; + LOG_FUNC_RESULT(result); return result;