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

This commit is contained in:
BearOso 2023-02-23 17:39:55 -06:00
parent 803125ffe9
commit 39e21410d8
2 changed files with 10 additions and 22 deletions

View File

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

View File

@ -7722,14 +7722,9 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
OutputMethod newOut = (OutputMethod)SendDlgItemMessage(hDlg, IDC_OUTPUTMETHOD, CB_GETITEMDATA, index, 0);
if(GUI.outputMethod==newOut)
break;
if(GUI.FullScreen)
ToggleFullScreen();
GUI.outputMethod=newOut;
WinDisplayReset();
UpdateModeComboBox(GetDlgItem(hDlg,IDC_RESOLUTION));
WinRefreshDisplay();
UpdateWindow(GUI.hWnd);
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);
}
break;
case IDC_SHADER_ENABLED: