Skip to content

Commit

Permalink
Fix debug build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Aug 23, 2024
1 parent 27a97a4 commit 801b10c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Dllmain/BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 7107
#define BUILD_NUMBER 7108
2 changes: 1 addition & 1 deletion d3d9/IDirect3D9Ex.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class m_IDirect3D9Ex : public IDirect3D9Ex, public AddressLookupTableD3d9Object
public:
m_IDirect3D9Ex(LPDIRECT3D9EX pDirect3D, REFIID DeviceID) : ProxyInterface(pDirect3D), WrapperID(DeviceID)
{
LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ")");
LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ") " << WrapperID);

if (WrapperID == IID_IDirect3D9Ex)
{
Expand Down
16 changes: 6 additions & 10 deletions d3d9/IDirect3DDevice9Ex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,13 @@ struct TABLEMAP {

std::vector<TABLEMAP> AddressDeviceMap;

// Add device to map
void AddToAddressDeviceMap(m_IDirect3DDevice9Ex* Device, AddressLookupTableD3d9<m_IDirect3DDevice9Ex>* ProxyAddressLookupTable)
{
// Check if device already exists in the map
for (auto &entry : AddressDeviceMap)
{
if (entry.Device == Device)
{
return;
}
}
// Add device to map if not already in the map
AddressDeviceMap.push_back({ Device, ProxyAddressLookupTable });
}

// Remove device from the map
void RemoveFromAddressDeviceMap(m_IDirect3DDevice9Ex* Device, AddressLookupTableD3d9<m_IDirect3DDevice9Ex>* ProxyAddressLookupTable)
{
// Remove device from the map
Expand Down Expand Up @@ -2455,7 +2448,10 @@ HRESULT m_IDirect3DDevice9Ex::GetDisplayModeEx(THIS_ UINT iSwapChain, D3DDISPLAY
void m_IDirect3DDevice9Ex::ReInitDevice()
{
#ifdef ENABLE_DEBUGOVERLAY
DOverlay.Setup(DeviceDetails.DeviceWindow, ProxyInterface);
if (IsWindow(DeviceDetails.DeviceWindow))
{
DOverlay.Setup(DeviceDetails.DeviceWindow, ProxyInterface);
}
#endif

// Get screen size
Expand Down
18 changes: 14 additions & 4 deletions d3d9/IDirect3DDevice9Ex.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class m_IDirect3DDevice9Ex : public IDirect3DDevice9Ex, public AddressLookupTabl
public:
m_IDirect3DDevice9Ex(LPDIRECT3DDEVICE9EX pDevice, m_IDirect3D9Ex* pD3D, REFIID DeviceID) : ProxyInterface(pDevice), m_pD3DEx(pD3D), WrapperID(DeviceID)
{
LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ")");
LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ") " << WrapperID);

if (WrapperID == IID_IDirect3DDevice9Ex)
{
Expand All @@ -74,14 +74,19 @@ class m_IDirect3DDevice9Ex : public IDirect3DDevice9Ex, public AddressLookupTabl
}
void SetProxyLookupTable(AddressLookupTableD3d9<m_IDirect3DDevice9Ex>* LookupTable)
{
ProxyAddressLookupTable = LookupTable;
if (!ProxyAddressLookupTable)
{
ProxyAddressLookupTable = LookupTable;

ProxyAddressLookupTable->SaveAddress(this, ProxyInterface);
ProxyAddressLookupTable->SaveAddress(this, ProxyInterface);

AddToAddressDeviceMap(this, ProxyAddressLookupTable);
AddToAddressDeviceMap(this, ProxyAddressLookupTable);
}
}
void SetDeviceDetails(DEVICEDETAILS& NewDeviceDetails)
{
HWND LastDeviceWindow = DeviceDetails.DeviceWindow;

DeviceDetails = NewDeviceDetails;

// Check for SSAA
Expand All @@ -90,6 +95,11 @@ class m_IDirect3DDevice9Ex : public IDirect3DDevice9Ex, public AddressLookupTabl
{
SetSSAA = true;
}

if (DeviceDetails.DeviceWindow != LastDeviceWindow)
{
ReInitDevice();
}
}

AddressLookupTableD3d9<m_IDirect3DDevice9Ex>* ProxyAddressLookupTable = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion d3d9/IDirect3DSwapChain9Ex.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class m_IDirect3DSwapChain9Ex : public IDirect3DSwapChain9Ex, public AddressLook
m_IDirect3DSwapChain9Ex(LPDIRECT3DSWAPCHAIN9EX pSwapChain9, m_IDirect3DDevice9Ex* pDevice, REFIID DeviceID) :
ProxyInterface(pSwapChain9), m_pDeviceEx(pDevice), WrapperID(DeviceID), ProxyAddressLookupTable(pDevice->ProxyAddressLookupTable)
{
LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ")");
LOG_LIMIT(3, "Creating interface " << __FUNCTION__ << " (" << this << ") " << WrapperID);

if (WrapperID == IID_IDirect3DSwapChain9Ex)
{
Expand Down

0 comments on commit 801b10c

Please sign in to comment.