mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-23 20:38:07 +01:00
Fixed typo in DX12 & reorder hook call.
Should call the Present function before hooking DX cause DX also hook Present even if the hook is disabled by Renderer_Detector before initializing the DX hook.
This commit is contained in:
parent
78e57f0693
commit
622c435cb7
2 changed files with 5 additions and 6 deletions
|
@ -58,9 +58,6 @@ void DX12_Hook::resetRenderState()
|
||||||
void DX12_Hook::prepareForOverlay(IDXGISwapChain* pSwapChain)
|
void DX12_Hook::prepareForOverlay(IDXGISwapChain* pSwapChain)
|
||||||
{
|
{
|
||||||
pSwapChain->GetDesc(&sc_desc);
|
pSwapChain->GetDesc(&sc_desc);
|
||||||
|
|
||||||
IDXGISwapChain3* pSwapChain3;
|
|
||||||
pSwapChain->QueryInterface(IID_PPV_ARGS(&pSwapChain3));
|
|
||||||
|
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
{
|
{
|
||||||
|
@ -204,7 +201,7 @@ void DX12_Hook::loadFunctions(ID3D12CommandQueue* pCommandQueue, ID3D12GraphicsC
|
||||||
{
|
{
|
||||||
void** vTable;
|
void** vTable;
|
||||||
|
|
||||||
vTable = *reinterpret_cast<void***>(pCommandList);
|
vTable = *reinterpret_cast<void***>(pCommandQueue);
|
||||||
#define LOAD_FUNC(X) (void*&)X = vTable[(int)ID3D12CommandQueueVTable::X]
|
#define LOAD_FUNC(X) (void*&)X = vTable[(int)ID3D12CommandQueueVTable::X]
|
||||||
LOAD_FUNC(ExecuteCommandLists);
|
LOAD_FUNC(ExecuteCommandLists);
|
||||||
#undef LOAD_FUNC
|
#undef LOAD_FUNC
|
||||||
|
|
|
@ -84,6 +84,8 @@ HRESULT STDMETHODCALLTYPE Renderer_Detector::MyIDXGISwapChain_Present(IDXGISwapC
|
||||||
{
|
{
|
||||||
Renderer_Detector& inst = Renderer_Detector::Inst();
|
Renderer_Detector& inst = Renderer_Detector::Inst();
|
||||||
Hook_Manager& hm = Hook_Manager::Inst();
|
Hook_Manager& hm = Hook_Manager::Inst();
|
||||||
|
|
||||||
|
auto res = (_this->*_IDXGISwapChain_Present)(SyncInterval, Flags);
|
||||||
if (!inst.stop_retry())
|
if (!inst.stop_retry())
|
||||||
{
|
{
|
||||||
IUnknown* pDevice = nullptr;
|
IUnknown* pDevice = nullptr;
|
||||||
|
@ -111,7 +113,7 @@ HRESULT STDMETHODCALLTYPE Renderer_Detector::MyIDXGISwapChain_Present(IDXGISwapC
|
||||||
if (pDevice) pDevice->Release();
|
if (pDevice) pDevice->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (_this->*_IDXGISwapChain_Present)(SyncInterval, Flags);
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE Renderer_Detector::MyPresent(IDirect3DDevice9* _this, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion)
|
HRESULT STDMETHODCALLTYPE Renderer_Detector::MyPresent(IDirect3DDevice9* _this, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion)
|
||||||
|
@ -433,7 +435,7 @@ void Renderer_Detector::hook_dx12()
|
||||||
}//if (pDevice != nullptr)
|
}//if (pDevice != nullptr)
|
||||||
}//if (D3D12CreateDevice != nullptr)
|
}//if (D3D12CreateDevice != nullptr)
|
||||||
}//if (library != nullptr)
|
}//if (library != nullptr)
|
||||||
if (pSwapChain != nullptr && pCommandList != nullptr)
|
if (pCommandQueue != nullptr && pCommandList != nullptr && pSwapChain != nullptr)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Hooked IDXGISwapChain::Present to detect DX Version\n");
|
PRINT_DEBUG("Hooked IDXGISwapChain::Present to detect DX Version\n");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue