Revert "win32: Make changes to display driver not occur until restart."

This reverts commit 39e21410d8.
This commit is contained in:
BearOso 2023-03-15 15:47:35 -05:00
parent e81edf83a6
commit 5e02a77d59
2 changed files with 22 additions and 10 deletions

View File

@ -42,7 +42,7 @@ DWMFLUSHPROC DwmFlushProc = NULL;
DWMISCOMPOSITIONENABLEDPROC DwmIsCompositionEnabledProc = NULL; DWMISCOMPOSITIONENABLEDPROC DwmIsCompositionEnabledProc = NULL;
// Interface used to access the display output // Interface used to access the display output
IS9xDisplayOutput* S9xDisplayOutput = NULL; IS9xDisplayOutput *S9xDisplayOutput=&Direct3D;
#ifndef max #ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b)) #define max(a,b) (((a) > (b)) ? (a) : (b))
@ -95,8 +95,16 @@ void WinRefreshDisplay(void)
void WinChangeWindowSize(unsigned int newWidth, unsigned int newHeight) void WinChangeWindowSize(unsigned int newWidth, unsigned int newHeight)
{ {
if (S9xDisplayOutput) S9xDisplayOutput->ChangeRenderSize(newWidth,newHeight);
S9xDisplayOutput->ChangeRenderSize(newWidth,newHeight); }
static void FlushMessageQueue()
{
for (MSG msg; PeekMessage(&msg, GUI.hWnd, 0, 0, PM_NOREMOVE);)
{
GetMessage(&msg, GUI.hWnd, 0, 0);
DispatchMessage(&msg);
}
} }
/* WinDisplayReset /* WinDisplayReset
@ -107,9 +115,10 @@ returns true if successful, false otherwise
*/ */
bool WinDisplayReset(void) bool WinDisplayReset(void)
{ {
if (S9xDisplayOutput == NULL) S9xDisplayOutput->DeInitialize();
{ FlushMessageQueue();
switch (GUI.outputMethod) {
switch(GUI.outputMethod) {
default: default:
case DIRECT3D: case DIRECT3D:
S9xDisplayOutput = &Direct3D; S9xDisplayOutput = &Direct3D;
@ -125,10 +134,8 @@ bool WinDisplayReset(void)
case VULKAN: case VULKAN:
S9xDisplayOutput = &VulkanDriver; S9xDisplayOutput = &VulkanDriver;
break; break;
}
} }
S9xDisplayOutput->DeInitialize();
bool initialized = S9xDisplayOutput->Initialize(GUI.hWnd); bool initialized = S9xDisplayOutput->Initialize(GUI.hWnd);
if (!initialized) { if (!initialized) {

View File

@ -7783,9 +7783,14 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
OutputMethod newOut = (OutputMethod)SendDlgItemMessage(hDlg, IDC_OUTPUTMETHOD, CB_GETITEMDATA, index, 0); OutputMethod newOut = (OutputMethod)SendDlgItemMessage(hDlg, IDC_OUTPUTMETHOD, CB_GETITEMDATA, index, 0);
if(GUI.outputMethod==newOut) if(GUI.outputMethod==newOut)
break; break;
if(GUI.FullScreen)
ToggleFullScreen();
GUI.outputMethod=newOut; GUI.outputMethod=newOut;
MessageBox(hDlg, TEXT("Changes to graphics output method will take place when Snes9x is restarted."), TEXT("Snes9x Display"), MB_OK | MB_ICONINFORMATION);
WinDisplayReset();
UpdateModeComboBox(GetDlgItem(hDlg,IDC_RESOLUTION));
WinRefreshDisplay();
UpdateWindow(GUI.hWnd);
} }
break; break;
case IDC_SHADER_ENABLED: case IDC_SHADER_ENABLED: