diff --git a/Dllmain/BuildNo.rc b/Dllmain/BuildNo.rc index bc95503e..32d6be02 100644 --- a/Dllmain/BuildNo.rc +++ b/Dllmain/BuildNo.rc @@ -1 +1 @@ -#define BUILD_NUMBER 7109 +#define BUILD_NUMBER 7110 diff --git a/d3d9/AddressLookupTable.h b/d3d9/AddressLookupTable.h index b1b98243..8532ea80 100644 --- a/d3d9/AddressLookupTable.h +++ b/d3d9/AddressLookupTable.h @@ -139,6 +139,10 @@ class AddressLookupTableD3d9 template void SaveAddress(T *Wrapper, void *Proxy) { + while (ClearFlag) + { + Sleep(0); + } constexpr UINT CacheIndex = AddressCacheIndex::CacheIndex; if (Wrapper && Proxy) { @@ -149,7 +153,7 @@ class AddressLookupTableD3d9 template void DeleteAddress(T *Wrapper) { - if (!Wrapper || ConstructorFlag) + if (!Wrapper || ConstructorFlag || ClearFlag) { return; } @@ -173,8 +177,26 @@ class AddressLookupTableD3d9 return g_map[AddressCacheIndex::CacheIndex].size(); } + void ClearInterfaces() + { + ClearFlag = true; + for (UINT x = 0; x < MaxIndex; x++) + { + if (x != AddressCacheIndex::CacheIndex) + { + for (const auto& entry : g_map[x]) + { + entry.second->DeleteMe(); + } + g_map[x].clear(); + } + } + ClearFlag = false; + } + private: bool ConstructorFlag = false; + bool ClearFlag = false; std::unordered_map g_map[MaxIndex]; }; diff --git a/d3d9/IDirect3D9Ex.cpp b/d3d9/IDirect3D9Ex.cpp index 0a7f16a3..b04437a3 100644 --- a/d3d9/IDirect3D9Ex.cpp +++ b/d3d9/IDirect3D9Ex.cpp @@ -20,19 +20,8 @@ // WndProc hook bool EnableWndProcHook = false; -AddressLookupTableD3d9 ProxyAddressLookupTableD3d9(nullptr); // Just used for m_IDirect3D9Ex interfaces only - void AdjustWindow(HWND MainhWnd, LONG displayWidth, LONG displayHeight, bool isWindowed); -void m_IDirect3D9Ex::InitInterface() -{ - ProxyAddressLookupTableD3d9.SaveAddress(this, ProxyInterface); -} -void m_IDirect3D9Ex::ReleaseInterface() -{ - ProxyAddressLookupTableD3d9.DeleteAddress(this); -} - HRESULT m_IDirect3D9Ex::QueryInterface(REFIID riid, void** ppvObj) { Logging::LogDebug() << __FUNCTION__ << " (" << this << ") " << riid; @@ -52,7 +41,7 @@ HRESULT m_IDirect3D9Ex::QueryInterface(REFIID riid, void** ppvObj) { if (riid == IID_IDirect3D9 || riid == IID_IDirect3D9Ex) { - *ppvObj = ProxyAddressLookupTableD3d9.FindAddress(*ppvObj, nullptr, riid); + *ppvObj = ProxyAddressLookupTable9.FindAddress(*ppvObj, nullptr, riid); } else { @@ -306,14 +295,6 @@ HRESULT m_IDirect3D9Ex::CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND h DeviceDetails.DeviceMultiSampleQuality = pPresentationParameters->MultiSampleQuality; *ppReturnedDeviceInterface = new m_IDirect3DDevice9Ex((LPDIRECT3DDEVICE9EX)*ppReturnedDeviceInterface, this, IID_IDirect3DDevice9); - - // Create the object and add it to the vector - ADDRESSTABLE newAddressTable = { new AddressLookupTableD3d9(nullptr) }; - - // Add the newTable to the AddressDeviceMap vector - AddressDeviceMap.push_back(newAddressTable); - - ((m_IDirect3DDevice9Ex*)(*ppReturnedDeviceInterface))->SetProxyLookupTable(newAddressTable.ProxyAddressLookupTable); ((m_IDirect3DDevice9Ex*)(*ppReturnedDeviceInterface))->SetDeviceDetails(DeviceDetails); return D3D_OK; @@ -385,14 +366,6 @@ HRESULT m_IDirect3D9Ex::CreateDeviceEx(THIS_ UINT Adapter, D3DDEVTYPE DeviceType DeviceDetails.DeviceMultiSampleQuality = pPresentationParameters->MultiSampleQuality; *ppReturnedDeviceInterface = new m_IDirect3DDevice9Ex(*ppReturnedDeviceInterface, this, IID_IDirect3DDevice9Ex); - - // Create the object and add it to the vector - ADDRESSTABLE newAddressTable = { new AddressLookupTableD3d9(nullptr) }; - - // Add the newTable to the AddressDeviceMap vector - AddressDeviceMap.push_back(newAddressTable); - - ((m_IDirect3DDevice9Ex*)(*ppReturnedDeviceInterface))->SetProxyLookupTable(newAddressTable.ProxyAddressLookupTable); ((m_IDirect3DDevice9Ex*)(*ppReturnedDeviceInterface))->SetDeviceDetails(DeviceDetails); return D3D_OK; diff --git a/d3d9/IDirect3D9Ex.h b/d3d9/IDirect3D9Ex.h index 366604ed..937f8f19 100644 --- a/d3d9/IDirect3D9Ex.h +++ b/d3d9/IDirect3D9Ex.h @@ -17,18 +17,8 @@ class m_IDirect3D9Ex : public IDirect3D9Ex, public AddressLookupTableD3d9Object HRESULT CreateDeviceT(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, D3DDISPLAYMODEEX* pFullscreenDisplayMode, IDirect3DDevice9Ex** ppReturnedDeviceInterface) { return (ProxyInterfaceEx) ? ProxyInterfaceEx->CreateDeviceEx(Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, pFullscreenDisplayMode, ppReturnedDeviceInterface) : D3DERR_INVALIDCALL; } - // AddressTable Structure - struct ADDRESSTABLE { - AddressLookupTableD3d9* ProxyAddressLookupTable = nullptr; - }; - - // AddressDeviceMap as a vector of ADDRESSTABLE - std::vector AddressDeviceMap; - // Other helper functions void LogAdapterNames(); - void InitInterface(); - void ReleaseInterface(); public: m_IDirect3D9Ex(LPDIRECT3D9EX pDirect3D, REFIID DeviceID) : ProxyInterface(pDirect3D), WrapperID(DeviceID) @@ -42,31 +32,13 @@ class m_IDirect3D9Ex : public IDirect3D9Ex, public AddressLookupTableD3d9Object LogAdapterNames(); - InitInterface(); + ProxyAddressLookupTable9.SaveAddress(this, ProxyInterface); } ~m_IDirect3D9Ex() { LOG_LIMIT(3, __FUNCTION__ << " (" << this << ")" << " deleting interface!"); - for (auto& entry : AddressDeviceMap) - { - delete entry.ProxyAddressLookupTable; - } - - ReleaseInterface(); - } - void ClearAddressTable(AddressLookupTableD3d9* ProxyAddressLookupTable) - { - // Remove device from the map - for (auto it = AddressDeviceMap.begin(); it != AddressDeviceMap.end(); ++it) - { - if (it->ProxyAddressLookupTable == ProxyAddressLookupTable) - { - AddressDeviceMap.erase(it); - delete ProxyAddressLookupTable; - break; - } - } + ProxyAddressLookupTable9.DeleteAddress(this); } /*** IUnknown methods ***/ diff --git a/d3d9/IDirect3DCubeTexture9.cpp b/d3d9/IDirect3DCubeTexture9.cpp index 1332e91b..a89a6678 100644 --- a/d3d9/IDirect3DCubeTexture9.cpp +++ b/d3d9/IDirect3DCubeTexture9.cpp @@ -33,7 +33,7 @@ HRESULT m_IDirect3DCubeTexture9::QueryInterface(THIS_ REFIID riid, void** ppvObj if (SUCCEEDED(hr)) { - D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx, ProxyAddressLookupTable); + D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx); } return hr; @@ -175,7 +175,7 @@ HRESULT m_IDirect3DCubeTexture9::GetCubeMapSurface(THIS_ D3DCUBEMAP_FACES FaceTy if (SUCCEEDED(hr) && ppCubeMapSurface) { - *ppCubeMapSurface = ProxyAddressLookupTable->FindAddress(*ppCubeMapSurface, m_pDeviceEx, IID_IDirect3DTexture9); + *ppCubeMapSurface = ProxyAddressLookupTable9.FindAddress(*ppCubeMapSurface, m_pDeviceEx, IID_IDirect3DTexture9); } return hr; diff --git a/d3d9/IDirect3DCubeTexture9.h b/d3d9/IDirect3DCubeTexture9.h index f742a97d..fa28a8e6 100644 --- a/d3d9/IDirect3DCubeTexture9.h +++ b/d3d9/IDirect3DCubeTexture9.h @@ -6,15 +6,12 @@ class m_IDirect3DCubeTexture9 : public IDirect3DCubeTexture9, public AddressLook LPDIRECT3DCUBETEXTURE9 ProxyInterface; m_IDirect3DDevice9Ex* m_pDeviceEx; - AddressLookupTableD3d9* ProxyAddressLookupTable; - public: - m_IDirect3DCubeTexture9(LPDIRECT3DCUBETEXTURE9 pTexture9, m_IDirect3DDevice9Ex* pDevice) : - ProxyInterface(pTexture9), m_pDeviceEx(pDevice), ProxyAddressLookupTable(pDevice->ProxyAddressLookupTable) + m_IDirect3DCubeTexture9(LPDIRECT3DCUBETEXTURE9 pTexture9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pTexture9), m_pDeviceEx(pDevice) { LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ")"); - ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); + ProxyAddressLookupTable9.SaveAddress(this, ProxyInterface); } ~m_IDirect3DCubeTexture9() { diff --git a/d3d9/IDirect3DDevice9Ex.cpp b/d3d9/IDirect3DDevice9Ex.cpp index 3ada0d14..29280493 100644 --- a/d3d9/IDirect3DDevice9Ex.cpp +++ b/d3d9/IDirect3DDevice9Ex.cpp @@ -43,14 +43,12 @@ HRESULT m_IDirect3DDevice9Ex::QueryInterface(REFIID riid, void** ppvObj) { if (riid == IID_IDirect3DDevice9 || riid == IID_IDirect3DDevice9Ex) { - *ppvObj = ProxyAddressLookupTable->FindAddress(*ppvObj, m_pD3DEx, riid); - - ((m_IDirect3DDevice9Ex*)(*ppvObj))->SetProxyLookupTable(ProxyAddressLookupTable); + *ppvObj = ProxyAddressLookupTable9.FindAddress(*ppvObj, m_pD3DEx, riid); ((m_IDirect3DDevice9Ex*)(*ppvObj))->SetDeviceDetails(DeviceDetails); } else { - D3d9Wrapper::genericQueryInterface(riid, ppvObj, this, ProxyAddressLookupTable); + D3d9Wrapper::genericQueryInterface(riid, ppvObj, this); } } @@ -508,7 +506,7 @@ HRESULT m_IDirect3DDevice9Ex::EndStateBlock(THIS_ IDirect3DStateBlock9** ppSB) if (SUCCEEDED(hr) && ppSB) { - *ppSB = ProxyAddressLookupTable->FindAddress(*ppSB, this, IID_IDirect3DStateBlock9); + *ppSB = ProxyAddressLookupTable9.FindAddress(*ppSB, this, IID_IDirect3DStateBlock9); } return hr; @@ -543,7 +541,7 @@ HRESULT m_IDirect3DDevice9Ex::GetRenderTarget(THIS_ DWORD RenderTargetIndex, IDi if (SUCCEEDED(hr) && ppRenderTarget) { - *ppRenderTarget = ProxyAddressLookupTable->FindAddress(*ppRenderTarget, this, IID_IDirect3DSurface9); + *ppRenderTarget = ProxyAddressLookupTable9.FindAddress(*ppRenderTarget, this, IID_IDirect3DSurface9); } return hr; @@ -646,7 +644,7 @@ HRESULT m_IDirect3DDevice9Ex::GetIndices(THIS_ IDirect3DIndexBuffer9** ppIndexDa if (SUCCEEDED(hr) && ppIndexData) { - *ppIndexData = ProxyAddressLookupTable->FindAddress(*ppIndexData, this, IID_IDirect3DIndexBuffer9); + *ppIndexData = ProxyAddressLookupTable9.FindAddress(*ppIndexData, this, IID_IDirect3DIndexBuffer9); } return hr; @@ -839,7 +837,7 @@ HRESULT m_IDirect3DDevice9Ex::GetPixelShader(THIS_ IDirect3DPixelShader9** ppSha if (SUCCEEDED(hr) && ppShader) { - *ppShader = ProxyAddressLookupTable->FindAddress(*ppShader, this, IID_IDirect3DPixelShader9); + *ppShader = ProxyAddressLookupTable9.FindAddress(*ppShader, this, IID_IDirect3DPixelShader9); } return hr; @@ -995,7 +993,7 @@ HRESULT m_IDirect3DDevice9Ex::GetStreamSource(THIS_ UINT StreamNumber, IDirect3D if (SUCCEEDED(hr) && ppStreamData) { - *ppStreamData = ProxyAddressLookupTable->FindAddress(*ppStreamData, this, IID_IDirect3DVertexBuffer9); + *ppStreamData = ProxyAddressLookupTable9.FindAddress(*ppStreamData, this, IID_IDirect3DVertexBuffer9); } return hr; @@ -1021,7 +1019,7 @@ HRESULT m_IDirect3DDevice9Ex::GetBackBuffer(THIS_ UINT iSwapChain, UINT iBackBuf if (SUCCEEDED(hr) && ppBackBuffer) { - *ppBackBuffer = ProxyAddressLookupTable->FindAddress(*ppBackBuffer, this, IID_IDirect3DSurface9); + *ppBackBuffer = ProxyAddressLookupTable9.FindAddress(*ppBackBuffer, this, IID_IDirect3DSurface9); } return hr; @@ -1035,7 +1033,7 @@ HRESULT m_IDirect3DDevice9Ex::GetDepthStencilSurface(IDirect3DSurface9 **ppZSten if (SUCCEEDED(hr) && ppZStencilSurface) { - *ppZStencilSurface = ProxyAddressLookupTable->FindAddress(*ppZStencilSurface, this, IID_IDirect3DSurface9); + *ppZStencilSurface = ProxyAddressLookupTable9.FindAddress(*ppZStencilSurface, this, IID_IDirect3DSurface9); } return hr; @@ -1052,13 +1050,13 @@ HRESULT m_IDirect3DDevice9Ex::GetTexture(DWORD Stage, IDirect3DBaseTexture9 **pp switch ((*ppTexture)->GetType()) { case D3DRTYPE_TEXTURE: - *ppTexture = ProxyAddressLookupTable->FindAddress(*ppTexture, this, IID_IDirect3DTexture9); + *ppTexture = ProxyAddressLookupTable9.FindAddress(*ppTexture, this, IID_IDirect3DTexture9); break; case D3DRTYPE_VOLUMETEXTURE: - *ppTexture = ProxyAddressLookupTable->FindAddress(*ppTexture, this, IID_IDirect3DVolumeTexture9); + *ppTexture = ProxyAddressLookupTable9.FindAddress(*ppTexture, this, IID_IDirect3DVolumeTexture9); break; case D3DRTYPE_CUBETEXTURE: - *ppTexture = ProxyAddressLookupTable->FindAddress(*ppTexture, this, IID_IDirect3DCubeTexture9); + *ppTexture = ProxyAddressLookupTable9.FindAddress(*ppTexture, this, IID_IDirect3DCubeTexture9); break; default: return D3DERR_INVALIDCALL; @@ -1282,7 +1280,7 @@ HRESULT m_IDirect3DDevice9Ex::GetVertexShader(THIS_ IDirect3DVertexShader9** ppS if (SUCCEEDED(hr) && ppShader) { - *ppShader = ProxyAddressLookupTable->FindAddress(*ppShader, this, IID_IDirect3DVertexShader9); + *ppShader = ProxyAddressLookupTable9.FindAddress(*ppShader, this, IID_IDirect3DVertexShader9); } return hr; @@ -1474,7 +1472,7 @@ HRESULT m_IDirect3DDevice9Ex::GetVertexDeclaration(THIS_ IDirect3DVertexDeclarat if (SUCCEEDED(hr) && ppDecl) { - *ppDecl = ProxyAddressLookupTable->FindAddress(*ppDecl, this, IID_IDirect3DVertexDeclaration9); + *ppDecl = ProxyAddressLookupTable9.FindAddress(*ppDecl, this, IID_IDirect3DVertexDeclaration9); } return hr; @@ -2055,7 +2053,7 @@ HRESULT m_IDirect3DDevice9Ex::GetSwapChain(THIS_ UINT iSwapChain, IDirect3DSwapC if (SUCCEEDED(hr)) { - *ppSwapChain = ProxyAddressLookupTable->FindAddress(*ppSwapChain, this, IID_IDirect3DSwapChain9); + *ppSwapChain = ProxyAddressLookupTable9.FindAddress(*ppSwapChain, this, IID_IDirect3DSwapChain9); } return hr; diff --git a/d3d9/IDirect3DDevice9Ex.h b/d3d9/IDirect3DDevice9Ex.h index 24a64c91..2e6c6960 100644 --- a/d3d9/IDirect3DDevice9Ex.h +++ b/d3d9/IDirect3DDevice9Ex.h @@ -60,6 +60,8 @@ class m_IDirect3DDevice9Ex : public IDirect3DDevice9Ex, public AddressLookupTabl ProxyInterfaceEx = pDevice; } + ProxyAddressLookupTable9.SaveAddress(this, ProxyInterface); + ReInitDevice(); } ~m_IDirect3DDevice9Ex() @@ -72,20 +74,11 @@ class m_IDirect3DDevice9Ex : public IDirect3DDevice9Ex, public AddressLookupTabl WndProc::RemoveWndProc(DeviceDetails.DeviceWindow); } - ProxyAddressLookupTable->DeleteAddress(this); + ProxyAddressLookupTable9.DeleteAddress(this); - if (ProxyAddressLookupTable->GetDeviceCount() == 0) + if (ProxyAddressLookupTable9.GetDeviceCount() == 0) { - m_pD3DEx->ClearAddressTable(ProxyAddressLookupTable); - } - } - void SetProxyLookupTable(AddressLookupTableD3d9* LookupTable) - { - if (!ProxyAddressLookupTable) - { - ProxyAddressLookupTable = LookupTable; - - ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); + ProxyAddressLookupTable9.ClearInterfaces(); } } void SetDeviceDetails(DEVICEDETAILS& NewDeviceDetails) @@ -107,8 +100,6 @@ class m_IDirect3DDevice9Ex : public IDirect3DDevice9Ex, public AddressLookupTabl } } - AddressLookupTableD3d9* ProxyAddressLookupTable = nullptr; - /*** IUnknown methods ***/ STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); STDMETHOD_(ULONG, AddRef)(THIS); diff --git a/d3d9/IDirect3DIndexBuffer9.cpp b/d3d9/IDirect3DIndexBuffer9.cpp index 495222a5..acc3cb7a 100644 --- a/d3d9/IDirect3DIndexBuffer9.cpp +++ b/d3d9/IDirect3DIndexBuffer9.cpp @@ -33,7 +33,7 @@ HRESULT m_IDirect3DIndexBuffer9::QueryInterface(THIS_ REFIID riid, void** ppvObj if (SUCCEEDED(hr)) { - D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx, ProxyAddressLookupTable); + D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx); } return hr; diff --git a/d3d9/IDirect3DIndexBuffer9.h b/d3d9/IDirect3DIndexBuffer9.h index 308dc02a..1d933d42 100644 --- a/d3d9/IDirect3DIndexBuffer9.h +++ b/d3d9/IDirect3DIndexBuffer9.h @@ -6,15 +6,12 @@ class m_IDirect3DIndexBuffer9 : public IDirect3DIndexBuffer9, public AddressLook LPDIRECT3DINDEXBUFFER9 ProxyInterface; m_IDirect3DDevice9Ex* m_pDeviceEx; - AddressLookupTableD3d9* ProxyAddressLookupTable; - public: - m_IDirect3DIndexBuffer9(LPDIRECT3DINDEXBUFFER9 pBuffer9, m_IDirect3DDevice9Ex* pDevice) : - ProxyInterface(pBuffer9), m_pDeviceEx(pDevice), ProxyAddressLookupTable(pDevice->ProxyAddressLookupTable) + m_IDirect3DIndexBuffer9(LPDIRECT3DINDEXBUFFER9 pBuffer9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pBuffer9), m_pDeviceEx(pDevice) { LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ")"); - ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); + ProxyAddressLookupTable9.SaveAddress(this, ProxyInterface); } ~m_IDirect3DIndexBuffer9() { diff --git a/d3d9/IDirect3DPixelShader9.cpp b/d3d9/IDirect3DPixelShader9.cpp index cb8e6d20..1761b164 100644 --- a/d3d9/IDirect3DPixelShader9.cpp +++ b/d3d9/IDirect3DPixelShader9.cpp @@ -33,7 +33,7 @@ HRESULT m_IDirect3DPixelShader9::QueryInterface(THIS_ REFIID riid, void** ppvObj if (SUCCEEDED(hr)) { - D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx, ProxyAddressLookupTable); + D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx); } return hr; diff --git a/d3d9/IDirect3DPixelShader9.h b/d3d9/IDirect3DPixelShader9.h index 01450acc..7ccd4d08 100644 --- a/d3d9/IDirect3DPixelShader9.h +++ b/d3d9/IDirect3DPixelShader9.h @@ -6,15 +6,12 @@ class m_IDirect3DPixelShader9 : public IDirect3DPixelShader9, public AddressLook LPDIRECT3DPIXELSHADER9 ProxyInterface; m_IDirect3DDevice9Ex* m_pDeviceEx; - AddressLookupTableD3d9* ProxyAddressLookupTable; - public: - m_IDirect3DPixelShader9(LPDIRECT3DPIXELSHADER9 pShader9, m_IDirect3DDevice9Ex* pDevice) : - ProxyInterface(pShader9), m_pDeviceEx(pDevice), ProxyAddressLookupTable(pDevice->ProxyAddressLookupTable) + m_IDirect3DPixelShader9(LPDIRECT3DPIXELSHADER9 pShader9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pShader9), m_pDeviceEx(pDevice) { LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ")"); - ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); + ProxyAddressLookupTable9.SaveAddress(this, ProxyInterface); } ~m_IDirect3DPixelShader9() { diff --git a/d3d9/IDirect3DQuery9.cpp b/d3d9/IDirect3DQuery9.cpp index 0c3d3e54..a0aa8685 100644 --- a/d3d9/IDirect3DQuery9.cpp +++ b/d3d9/IDirect3DQuery9.cpp @@ -33,7 +33,7 @@ HRESULT m_IDirect3DQuery9::QueryInterface(THIS_ REFIID riid, void** ppvObj) if (SUCCEEDED(hr)) { - D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx, ProxyAddressLookupTable); + D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx); } return hr; diff --git a/d3d9/IDirect3DQuery9.h b/d3d9/IDirect3DQuery9.h index 59b7c2a1..b5c5d89f 100644 --- a/d3d9/IDirect3DQuery9.h +++ b/d3d9/IDirect3DQuery9.h @@ -6,15 +6,12 @@ class m_IDirect3DQuery9 : public IDirect3DQuery9, public AddressLookupTableD3d9O LPDIRECT3DQUERY9 ProxyInterface; m_IDirect3DDevice9Ex* m_pDeviceEx; - AddressLookupTableD3d9* ProxyAddressLookupTable; - public: - m_IDirect3DQuery9(LPDIRECT3DQUERY9 pQuery9, m_IDirect3DDevice9Ex* pDevice) : - ProxyInterface(pQuery9), m_pDeviceEx(pDevice), ProxyAddressLookupTable(pDevice->ProxyAddressLookupTable) + m_IDirect3DQuery9(LPDIRECT3DQUERY9 pQuery9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pQuery9), m_pDeviceEx(pDevice) { LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ")"); - ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); + ProxyAddressLookupTable9.SaveAddress(this, ProxyInterface); } ~m_IDirect3DQuery9() { diff --git a/d3d9/IDirect3DStateBlock9.cpp b/d3d9/IDirect3DStateBlock9.cpp index 93653208..a0e74278 100644 --- a/d3d9/IDirect3DStateBlock9.cpp +++ b/d3d9/IDirect3DStateBlock9.cpp @@ -33,7 +33,7 @@ HRESULT m_IDirect3DStateBlock9::QueryInterface(THIS_ REFIID riid, void** ppvObj) if (SUCCEEDED(hr)) { - D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx, ProxyAddressLookupTable); + D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx); } return hr; diff --git a/d3d9/IDirect3DStateBlock9.h b/d3d9/IDirect3DStateBlock9.h index 41399c86..7c047095 100644 --- a/d3d9/IDirect3DStateBlock9.h +++ b/d3d9/IDirect3DStateBlock9.h @@ -6,15 +6,12 @@ class m_IDirect3DStateBlock9 : public IDirect3DStateBlock9, public AddressLookup LPDIRECT3DSTATEBLOCK9 ProxyInterface; m_IDirect3DDevice9Ex* m_pDeviceEx; - AddressLookupTableD3d9* ProxyAddressLookupTable; - public: - m_IDirect3DStateBlock9(LPDIRECT3DSTATEBLOCK9 pBlock9, m_IDirect3DDevice9Ex* pDevice) : - ProxyInterface(pBlock9), m_pDeviceEx(pDevice), ProxyAddressLookupTable(pDevice->ProxyAddressLookupTable) + m_IDirect3DStateBlock9(LPDIRECT3DSTATEBLOCK9 pBlock9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pBlock9), m_pDeviceEx(pDevice) { LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ")"); - ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); + ProxyAddressLookupTable9.SaveAddress(this, ProxyInterface); } ~m_IDirect3DStateBlock9() { diff --git a/d3d9/IDirect3DSurface9.cpp b/d3d9/IDirect3DSurface9.cpp index 6f959efe..55cacc83 100644 --- a/d3d9/IDirect3DSurface9.cpp +++ b/d3d9/IDirect3DSurface9.cpp @@ -33,7 +33,7 @@ HRESULT m_IDirect3DSurface9::QueryInterface(THIS_ REFIID riid, void** ppvObj) if (SUCCEEDED(hr)) { - D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx, ProxyAddressLookupTable); + D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx); } return hr; @@ -135,7 +135,7 @@ HRESULT m_IDirect3DSurface9::GetContainer(THIS_ REFIID riid, void** ppContainer) if (SUCCEEDED(hr)) { - D3d9Wrapper::genericQueryInterface(riid, ppContainer, m_pDeviceEx, ProxyAddressLookupTable); + D3d9Wrapper::genericQueryInterface(riid, ppContainer, m_pDeviceEx); } return hr; diff --git a/d3d9/IDirect3DSurface9.h b/d3d9/IDirect3DSurface9.h index 70df5ac6..a2176b42 100644 --- a/d3d9/IDirect3DSurface9.h +++ b/d3d9/IDirect3DSurface9.h @@ -18,11 +18,8 @@ class m_IDirect3DSurface9 : public IDirect3DSurface9, public AddressLookupTableD m_IDirect3DSurface9* m_GetNonMultiSampledSurface(const RECT* pSurfaceRect, DWORD Flags); - AddressLookupTableD3d9* ProxyAddressLookupTable; - public: - m_IDirect3DSurface9(LPDIRECT3DSURFACE9 pSurface9, m_IDirect3DDevice9Ex* pDevice) : - ProxyInterface(pSurface9), m_pDeviceEx(pDevice), pDeviceEx(pDevice->GetProxyInterface()), ProxyAddressLookupTable(pDevice->ProxyAddressLookupTable) + m_IDirect3DSurface9(LPDIRECT3DSURFACE9 pSurface9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pSurface9), m_pDeviceEx(pDevice), pDeviceEx(pDevice->GetProxyInterface()) { LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ")"); @@ -31,7 +28,7 @@ class m_IDirect3DSurface9 : public IDirect3DSurface9, public AddressLookupTableD LOG_LIMIT(3, __FUNCTION__ << " Failed to GetDesc()!" << this << ")"); } - ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); + ProxyAddressLookupTable9.SaveAddress(this, ProxyInterface); } ~m_IDirect3DSurface9() { diff --git a/d3d9/IDirect3DSwapChain9Ex.cpp b/d3d9/IDirect3DSwapChain9Ex.cpp index d60fcc67..03e90964 100644 --- a/d3d9/IDirect3DSwapChain9Ex.cpp +++ b/d3d9/IDirect3DSwapChain9Ex.cpp @@ -33,7 +33,7 @@ HRESULT m_IDirect3DSwapChain9Ex::QueryInterface(THIS_ REFIID riid, void** ppvObj if (SUCCEEDED(hr)) { - D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx, ProxyAddressLookupTable); + D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx); } return hr; @@ -80,7 +80,7 @@ HRESULT m_IDirect3DSwapChain9Ex::GetBackBuffer(THIS_ UINT BackBuffer, D3DBACKBUF if (SUCCEEDED(hr) && ppBackBuffer) { - *ppBackBuffer = ProxyAddressLookupTable->FindAddress(*ppBackBuffer, m_pDeviceEx, IID_IDirect3DSurface9); + *ppBackBuffer = ProxyAddressLookupTable9.FindAddress(*ppBackBuffer, m_pDeviceEx, IID_IDirect3DSurface9); } return hr; diff --git a/d3d9/IDirect3DSwapChain9Ex.h b/d3d9/IDirect3DSwapChain9Ex.h index 8e2ae18d..6e860678 100644 --- a/d3d9/IDirect3DSwapChain9Ex.h +++ b/d3d9/IDirect3DSwapChain9Ex.h @@ -8,11 +8,8 @@ class m_IDirect3DSwapChain9Ex : public IDirect3DSwapChain9Ex, public AddressLook m_IDirect3DDevice9Ex* m_pDeviceEx; REFIID WrapperID; - AddressLookupTableD3d9* ProxyAddressLookupTable; - public: - m_IDirect3DSwapChain9Ex(LPDIRECT3DSWAPCHAIN9EX pSwapChain9, m_IDirect3DDevice9Ex* pDevice, REFIID DeviceID) : - ProxyInterface(pSwapChain9), m_pDeviceEx(pDevice), WrapperID(DeviceID), ProxyAddressLookupTable(pDevice->ProxyAddressLookupTable) + m_IDirect3DSwapChain9Ex(LPDIRECT3DSWAPCHAIN9EX pSwapChain9, m_IDirect3DDevice9Ex* pDevice, REFIID DeviceID) : ProxyInterface(pSwapChain9), m_pDeviceEx(pDevice), WrapperID(DeviceID) { LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ") " << WrapperID); @@ -21,7 +18,7 @@ class m_IDirect3DSwapChain9Ex : public IDirect3DSwapChain9Ex, public AddressLook ProxyInterfaceEx = pSwapChain9; } - ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); + ProxyAddressLookupTable9.SaveAddress(this, ProxyInterface); } ~m_IDirect3DSwapChain9Ex() { diff --git a/d3d9/IDirect3DTexture9.cpp b/d3d9/IDirect3DTexture9.cpp index 6937ca2e..6698aae8 100644 --- a/d3d9/IDirect3DTexture9.cpp +++ b/d3d9/IDirect3DTexture9.cpp @@ -33,7 +33,7 @@ HRESULT m_IDirect3DTexture9::QueryInterface(THIS_ REFIID riid, void** ppvObj) if (SUCCEEDED(hr)) { - D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx, ProxyAddressLookupTable); + D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx); } return hr; @@ -175,7 +175,7 @@ HRESULT m_IDirect3DTexture9::GetSurfaceLevel(THIS_ UINT Level, IDirect3DSurface9 if (SUCCEEDED(hr) && ppSurfaceLevel) { - *ppSurfaceLevel = ProxyAddressLookupTable->FindAddress(*ppSurfaceLevel, m_pDeviceEx, IID_IDirect3DSurface9); + *ppSurfaceLevel = ProxyAddressLookupTable9.FindAddress(*ppSurfaceLevel, m_pDeviceEx, IID_IDirect3DSurface9); } return hr; diff --git a/d3d9/IDirect3DTexture9.h b/d3d9/IDirect3DTexture9.h index 84ad90e8..ff98df4e 100644 --- a/d3d9/IDirect3DTexture9.h +++ b/d3d9/IDirect3DTexture9.h @@ -6,15 +6,12 @@ class m_IDirect3DTexture9 : public IDirect3DTexture9, public AddressLookupTableD LPDIRECT3DTEXTURE9 ProxyInterface; m_IDirect3DDevice9Ex* m_pDeviceEx; - AddressLookupTableD3d9* ProxyAddressLookupTable; - public: - m_IDirect3DTexture9(LPDIRECT3DTEXTURE9 pTexture9, m_IDirect3DDevice9Ex* pDevice) : - ProxyInterface(pTexture9), m_pDeviceEx(pDevice), ProxyAddressLookupTable(pDevice->ProxyAddressLookupTable) + m_IDirect3DTexture9(LPDIRECT3DTEXTURE9 pTexture9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pTexture9), m_pDeviceEx(pDevice) { LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ")"); - ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); + ProxyAddressLookupTable9.SaveAddress(this, ProxyInterface); } ~m_IDirect3DTexture9() { diff --git a/d3d9/IDirect3DVertexBuffer9.cpp b/d3d9/IDirect3DVertexBuffer9.cpp index 8495b568..97d8d7e8 100644 --- a/d3d9/IDirect3DVertexBuffer9.cpp +++ b/d3d9/IDirect3DVertexBuffer9.cpp @@ -33,7 +33,7 @@ HRESULT m_IDirect3DVertexBuffer9::QueryInterface(THIS_ REFIID riid, void** ppvOb if (SUCCEEDED(hr)) { - D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx, ProxyAddressLookupTable); + D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx); } return hr; diff --git a/d3d9/IDirect3DVertexBuffer9.h b/d3d9/IDirect3DVertexBuffer9.h index e5270752..58d93702 100644 --- a/d3d9/IDirect3DVertexBuffer9.h +++ b/d3d9/IDirect3DVertexBuffer9.h @@ -6,15 +6,12 @@ class m_IDirect3DVertexBuffer9 : public IDirect3DVertexBuffer9, public AddressLo LPDIRECT3DVERTEXBUFFER9 ProxyInterface; m_IDirect3DDevice9Ex* m_pDeviceEx; - AddressLookupTableD3d9* ProxyAddressLookupTable; - public: - m_IDirect3DVertexBuffer9(LPDIRECT3DVERTEXBUFFER9 pBuffer8, m_IDirect3DDevice9Ex* pDevice) : - ProxyInterface(pBuffer8), m_pDeviceEx(pDevice), ProxyAddressLookupTable(pDevice->ProxyAddressLookupTable) + m_IDirect3DVertexBuffer9(LPDIRECT3DVERTEXBUFFER9 pBuffer8, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pBuffer8), m_pDeviceEx(pDevice) { LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ")"); - ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); + ProxyAddressLookupTable9.SaveAddress(this, ProxyInterface); } ~m_IDirect3DVertexBuffer9() { diff --git a/d3d9/IDirect3DVertexDeclaration9.cpp b/d3d9/IDirect3DVertexDeclaration9.cpp index 60c1ceda..a04dfe31 100644 --- a/d3d9/IDirect3DVertexDeclaration9.cpp +++ b/d3d9/IDirect3DVertexDeclaration9.cpp @@ -33,7 +33,7 @@ HRESULT m_IDirect3DVertexDeclaration9::QueryInterface(THIS_ REFIID riid, void** if (SUCCEEDED(hr)) { - D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx, ProxyAddressLookupTable); + D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx); } return hr; diff --git a/d3d9/IDirect3DVertexDeclaration9.h b/d3d9/IDirect3DVertexDeclaration9.h index e5d636cb..bbd4b8f3 100644 --- a/d3d9/IDirect3DVertexDeclaration9.h +++ b/d3d9/IDirect3DVertexDeclaration9.h @@ -6,15 +6,12 @@ class m_IDirect3DVertexDeclaration9 : public IDirect3DVertexDeclaration9, public LPDIRECT3DVERTEXDECLARATION9 ProxyInterface; m_IDirect3DDevice9Ex* m_pDeviceEx; - AddressLookupTableD3d9* ProxyAddressLookupTable; - public: - m_IDirect3DVertexDeclaration9(LPDIRECT3DVERTEXDECLARATION9 pDeclaration9, m_IDirect3DDevice9Ex* pDevice) : - ProxyInterface(pDeclaration9), m_pDeviceEx(pDevice), ProxyAddressLookupTable(pDevice->ProxyAddressLookupTable) + m_IDirect3DVertexDeclaration9(LPDIRECT3DVERTEXDECLARATION9 pDeclaration9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pDeclaration9), m_pDeviceEx(pDevice) { LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ")"); - ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); + ProxyAddressLookupTable9.SaveAddress(this, ProxyInterface); } ~m_IDirect3DVertexDeclaration9() { diff --git a/d3d9/IDirect3DVertexShader9.cpp b/d3d9/IDirect3DVertexShader9.cpp index 640ca819..f1637601 100644 --- a/d3d9/IDirect3DVertexShader9.cpp +++ b/d3d9/IDirect3DVertexShader9.cpp @@ -33,7 +33,7 @@ HRESULT m_IDirect3DVertexShader9::QueryInterface(THIS_ REFIID riid, void** ppvOb if (SUCCEEDED(hr)) { - D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx, ProxyAddressLookupTable); + D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx); } return hr; diff --git a/d3d9/IDirect3DVertexShader9.h b/d3d9/IDirect3DVertexShader9.h index 0eb52b71..0a9095e2 100644 --- a/d3d9/IDirect3DVertexShader9.h +++ b/d3d9/IDirect3DVertexShader9.h @@ -6,15 +6,12 @@ class m_IDirect3DVertexShader9 : public IDirect3DVertexShader9, public AddressLo LPDIRECT3DVERTEXSHADER9 ProxyInterface; m_IDirect3DDevice9Ex* m_pDeviceEx; - AddressLookupTableD3d9* ProxyAddressLookupTable; - public: - m_IDirect3DVertexShader9(LPDIRECT3DVERTEXSHADER9 pShader9, m_IDirect3DDevice9Ex* pDevice) : - ProxyInterface(pShader9), m_pDeviceEx(pDevice), ProxyAddressLookupTable(pDevice->ProxyAddressLookupTable) + m_IDirect3DVertexShader9(LPDIRECT3DVERTEXSHADER9 pShader9, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pShader9), m_pDeviceEx(pDevice) { LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ")"); - ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); + ProxyAddressLookupTable9.SaveAddress(this, ProxyInterface); } ~m_IDirect3DVertexShader9() { diff --git a/d3d9/IDirect3DVolume9.cpp b/d3d9/IDirect3DVolume9.cpp index a181ad67..63d2b53c 100644 --- a/d3d9/IDirect3DVolume9.cpp +++ b/d3d9/IDirect3DVolume9.cpp @@ -33,7 +33,7 @@ HRESULT m_IDirect3DVolume9::QueryInterface(THIS_ REFIID riid, void** ppvObj) if (SUCCEEDED(hr)) { - D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx, ProxyAddressLookupTable); + D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx); } return hr; @@ -98,7 +98,7 @@ HRESULT m_IDirect3DVolume9::GetContainer(THIS_ REFIID riid, void** ppContainer) if (SUCCEEDED(hr)) { - D3d9Wrapper::genericQueryInterface(riid, ppContainer, m_pDeviceEx, ProxyAddressLookupTable); + D3d9Wrapper::genericQueryInterface(riid, ppContainer, m_pDeviceEx); } return hr; diff --git a/d3d9/IDirect3DVolume9.h b/d3d9/IDirect3DVolume9.h index 2543d2d0..d9dac08d 100644 --- a/d3d9/IDirect3DVolume9.h +++ b/d3d9/IDirect3DVolume9.h @@ -6,15 +6,12 @@ class m_IDirect3DVolume9 : public IDirect3DVolume9, public AddressLookupTableD3d LPDIRECT3DVOLUME9 ProxyInterface; m_IDirect3DDevice9Ex* m_pDeviceEx; - AddressLookupTableD3d9* ProxyAddressLookupTable; - public: - m_IDirect3DVolume9(LPDIRECT3DVOLUME9 pVolume8, m_IDirect3DDevice9Ex* pDevice) : - ProxyInterface(pVolume8), m_pDeviceEx(pDevice), ProxyAddressLookupTable(pDevice->ProxyAddressLookupTable) + m_IDirect3DVolume9(LPDIRECT3DVOLUME9 pVolume8, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pVolume8), m_pDeviceEx(pDevice) { LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ")"); - ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); + ProxyAddressLookupTable9.SaveAddress(this, ProxyInterface); } ~m_IDirect3DVolume9() { diff --git a/d3d9/IDirect3DVolumeTexture9.cpp b/d3d9/IDirect3DVolumeTexture9.cpp index 8723aa99..5cddeaa3 100644 --- a/d3d9/IDirect3DVolumeTexture9.cpp +++ b/d3d9/IDirect3DVolumeTexture9.cpp @@ -33,7 +33,7 @@ HRESULT m_IDirect3DVolumeTexture9::QueryInterface(THIS_ REFIID riid, void** ppvO if (SUCCEEDED(hr)) { - D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx, ProxyAddressLookupTable); + D3d9Wrapper::genericQueryInterface(riid, ppvObj, m_pDeviceEx); } return hr; @@ -175,7 +175,7 @@ HRESULT m_IDirect3DVolumeTexture9::GetVolumeLevel(THIS_ UINT Level, IDirect3DVol if (SUCCEEDED(hr) && ppVolumeLevel) { - *ppVolumeLevel = ProxyAddressLookupTable->FindAddress(*ppVolumeLevel, m_pDeviceEx, IID_IDirect3DVolume9); + *ppVolumeLevel = ProxyAddressLookupTable9.FindAddress(*ppVolumeLevel, m_pDeviceEx, IID_IDirect3DVolume9); } return hr; diff --git a/d3d9/IDirect3DVolumeTexture9.h b/d3d9/IDirect3DVolumeTexture9.h index 80722520..69e039f7 100644 --- a/d3d9/IDirect3DVolumeTexture9.h +++ b/d3d9/IDirect3DVolumeTexture9.h @@ -6,15 +6,12 @@ class m_IDirect3DVolumeTexture9 : public IDirect3DVolumeTexture9, public Address LPDIRECT3DVOLUMETEXTURE9 ProxyInterface; m_IDirect3DDevice9Ex* m_pDeviceEx; - AddressLookupTableD3d9* ProxyAddressLookupTable; - public: - m_IDirect3DVolumeTexture9(LPDIRECT3DVOLUMETEXTURE9 pTexture8, m_IDirect3DDevice9Ex* pDevice) : - ProxyInterface(pTexture8), m_pDeviceEx(pDevice), ProxyAddressLookupTable(pDevice->ProxyAddressLookupTable) + m_IDirect3DVolumeTexture9(LPDIRECT3DVOLUMETEXTURE9 pTexture8, m_IDirect3DDevice9Ex* pDevice) : ProxyInterface(pTexture8), m_pDeviceEx(pDevice) { LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ")"); - ProxyAddressLookupTable->SaveAddress(this, ProxyInterface); + ProxyAddressLookupTable9.SaveAddress(this, ProxyInterface); } ~m_IDirect3DVolumeTexture9() { diff --git a/d3d9/InterfaceQuery.cpp b/d3d9/InterfaceQuery.cpp index 4761b96b..2294783e 100644 --- a/d3d9/InterfaceQuery.cpp +++ b/d3d9/InterfaceQuery.cpp @@ -16,9 +16,9 @@ #include "d3d9.h" -void WINAPI D3d9Wrapper::genericQueryInterface(REFIID riid, LPVOID *ppvObj, m_IDirect3DDevice9Ex* m_pDeviceEx, AddressLookupTableD3d9* ProxyAddressLookupTable) +void WINAPI D3d9Wrapper::genericQueryInterface(REFIID riid, LPVOID *ppvObj, m_IDirect3DDevice9Ex* m_pDeviceEx) { - if (!ppvObj || !*ppvObj || !m_pDeviceEx || !ProxyAddressLookupTable) + if (!ppvObj || !*ppvObj || !m_pDeviceEx) { LOG_LIMIT(100, __FUNCTION__ << " Warning: not wrapping interface because of nullptr: " << riid); return; @@ -58,14 +58,14 @@ void WINAPI D3d9Wrapper::genericQueryInterface(REFIID riid, LPVOID *ppvObj, m_ID if (riid == IID_IDirect3DSwapChain9 || riid == IID_IDirect3DSwapChain9Ex) { - *ppvObj = ProxyAddressLookupTable->FindAddress(*ppvObj, m_pDeviceEx, riid); + *ppvObj = ProxyAddressLookupTable9.FindAddress(*ppvObj, m_pDeviceEx, riid); return; } #define QUERYINTERFACE(x) \ if (riid == IID_ ## x) \ { \ - *ppvObj = ProxyAddressLookupTable->FindAddress(*ppvObj, m_pDeviceEx, riid); \ + *ppvObj = ProxyAddressLookupTable9.FindAddress(*ppvObj, m_pDeviceEx, riid); \ return; \ } diff --git a/d3d9/d3d9.cpp b/d3d9/d3d9.cpp index 95de6b90..821084f5 100644 --- a/d3d9/d3d9.cpp +++ b/d3d9/d3d9.cpp @@ -27,6 +27,8 @@ namespace D3d9Wrapper using namespace D3d9Wrapper; +AddressLookupTableD3d9 ProxyAddressLookupTable9(nullptr); + HMODULE GetSystemD3d9() { static HMODULE h_d3d9 = nullptr; diff --git a/d3d9/d3d9.h b/d3d9/d3d9.h index 2f0c484b..ed18235a 100644 --- a/d3d9/d3d9.h +++ b/d3d9/d3d9.h @@ -46,13 +46,15 @@ struct DEVICEDETAILS DWORD DeviceMultiSampleQuality = 0; }; +extern AddressLookupTableD3d9 ProxyAddressLookupTable9; + DWORD UpdateBehaviorFlags(DWORD BehaviorFlags); void UpdatePresentParameter(D3DPRESENT_PARAMETERS* pPresentationParameters, HWND hFocusWindow, DEVICEDETAILS& DeviceDetails, bool ForceExclusiveFullscreen, bool SetWindow); void UpdatePresentParameterForMultisample(D3DPRESENT_PARAMETERS* pPresentationParameters, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD MultiSampleQuality); namespace D3d9Wrapper { - void WINAPI genericQueryInterface(REFIID riid, LPVOID* ppvObj, m_IDirect3DDevice9Ex* m_pDeviceEx, AddressLookupTableD3d9* ProxyAddressLookupTable); + void WINAPI genericQueryInterface(REFIID riid, LPVOID* ppvObj, m_IDirect3DDevice9Ex* m_pDeviceEx); } #include "IDirect3D9Ex.h"