Skip to content

Commit

Permalink
Move variable SwitchingResolution
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Dec 24, 2024
1 parent 59b1832 commit ee67634
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 2 additions & 0 deletions GDI/WndProc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ namespace WndProc
LRESULT CallWndProc(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
bool IsExecutableAddress(void* address);

bool SwitchingResolution = false;

struct WNDPROCSTRUCT
{
private:
Expand Down
2 changes: 2 additions & 0 deletions GDI/WndProc.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ namespace WndProc
std::atomic<bool> IsExclusiveMode = false;
};

extern bool SwitchingResolution;

DATASTRUCT* AddWndProc(HWND hWnd);
void RemoveWndProc(HWND hWnd);
DATASTRUCT* GetWndProctStruct(HWND hWnd);
Expand Down
13 changes: 6 additions & 7 deletions ddraw/IDirectDrawX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ namespace {
}

// Default resolution
bool SwitchingResolution = false;
DWORD DefaultWidth;
DWORD DefaultHeight;
RECT LastWindowRect;
Expand Down Expand Up @@ -2301,7 +2300,7 @@ HRESULT m_IDirectDrawX::TestCooperativeLevel()
case DDERR_NOEXCLUSIVEMODE:
case D3D_OK:
default:
SwitchingResolution = false;
WndProc::SwitchingResolution = false;
return DD_OK;
}
}
Expand Down Expand Up @@ -2907,7 +2906,7 @@ bool m_IDirectDrawX::CheckD9Device(char* FunctionName)
}

// Check for delay while resolution switching
if (SwitchingResolution)
if (WndProc::SwitchingResolution)
{
for (int attempts = 0; attempts < 20; ++attempts)
{
Expand All @@ -2918,7 +2917,7 @@ bool m_IDirectDrawX::CheckD9Device(char* FunctionName)
Sleep(500);
}
}
SwitchingResolution = false;
WndProc::SwitchingResolution = false;

return true;
}
Expand Down Expand Up @@ -3089,7 +3088,7 @@ HRESULT m_IDirectDrawX::ResetD9Device()
HRESULT hr = TestD3D9CooperativeLevel();
if (SUCCEEDED(hr) || hr == DDERR_NOEXCLUSIVEMODE)
{
SwitchingResolution = false;
WndProc::SwitchingResolution = false;
return hr;
}
else if (hr == D3DERR_DEVICELOST)
Expand Down Expand Up @@ -3153,7 +3152,7 @@ HRESULT m_IDirectDrawX::ResetD9Device()

if (SUCCEEDED(hr))
{
SwitchingResolution = false;
WndProc::SwitchingResolution = false;
}

ReleasePTCriticalSection();
Expand Down Expand Up @@ -3408,7 +3407,7 @@ HRESULT m_IDirectDrawX::CreateD9Device(char* FunctionName)
}

// Reset flags after creating device
SwitchingResolution = false;
WndProc::SwitchingResolution = false;
LastUsedHWnd = hWnd;
EnableWaitVsync = false;
FourCCsList.clear();
Expand Down
2 changes: 0 additions & 2 deletions ddraw/ddrawExternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ DWORD GetDDrawHeight();
void InitDDraw();
void ExitDDraw();

extern bool SwitchingResolution;

#define DECLARE_IN_WRAPPED_PROC(procName, unused) \
const FARPROC procName ## _in = (FARPROC)*dd_ ## procName;

Expand Down

0 comments on commit ee67634

Please sign in to comment.