diff --git a/Core/Config.cpp b/Core/Config.cpp index 817630e46..7c7cf6dac 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -495,6 +495,9 @@ static ConfigSetting graphicsSettings[] = { ReportedConfigSetting("AutoFrameSkip", &g_Config.bAutoFrameSkip, false, true, true), ConfigSetting("FrameRate", &g_Config.iFpsLimit, 0, true, true), ConfigSetting("FrameSkipUnthrottle", &g_Config.bFrameSkipUnthrottle, &DefaultFrameskipUnthrottle, true, false), +#if defined(USING_WIN_UI) + ConfigSetting("RestartRequired", &g_Config.bRestartRequired, false, false), +#endif ReportedConfigSetting("ForceMaxEmulatedFPS", &g_Config.iForceMaxEmulatedFPS, 60, true, true), // TODO: Hm, on fast mobile GPUs we should definitely default to at least 4 (setting = 2)... diff --git a/Core/Config.h b/Core/Config.h index dcad956a7..d598989cf 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -113,6 +113,7 @@ public: bool bTopMost; std::string sFont; bool bIgnoreWindowsKey; + bool bRestartRequired; #endif bool bPauseWhenMinimized; diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index a90975cfa..868aa500a 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -360,6 +360,12 @@ void SystemInfoScreen::CreateViews() { deviceSpecs->Add(new InfoItem("Name", System_GetProperty(SYSPROP_NAME))); deviceSpecs->Add(new InfoItem("Lang/Region", System_GetProperty(SYSPROP_LANGREGION))); deviceSpecs->Add(new InfoItem("ABI", GetCompilerABI())); +#ifdef _WIN32 + if (IsDebuggerPresent()) { + deviceSpecs->Add(new InfoItem("Debugger Present", "Yes")); + } +#endif + deviceSpecs->Add(new ItemHeader("CPU Information")); deviceSpecs->Add(new InfoItem("Name", cpu_info.brand_string)); #if defined(ARM) || defined(ARM64) || defined(MIPS) diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index 811b8e0ca..476431796 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -566,6 +566,15 @@ namespace MainWindow { NativeMessageReceived("gpu_resized", ""); } + static void RestartApp() { + if (IsDebuggerPresent()) { + PostMessage(MainWindow::GetHWND(), WM_USER_RESTART_EMUTHREAD, 0, 0); + } else { + g_Config.bRestartRequired = true; + PostMessage(MainWindow::GetHWND(), WM_CLOSE, 0, 0); + } + } + void MainWindowMenu_Process(HWND hWnd, WPARAM wParam) { std::string fn; @@ -752,11 +761,11 @@ namespace MainWindow { break; case ID_TEXTURESCALING_AUTO: setTexScalingMultiplier(TEXSCALING_AUTO); break; - case ID_TEXTURESCALING_OFF: setTexScalingMultiplier(TEXSCALING_OFF); break; - case ID_TEXTURESCALING_2X: setTexScalingMultiplier(TEXSCALING_2X); break; - case ID_TEXTURESCALING_3X: setTexScalingMultiplier(TEXSCALING_3X); break; - case ID_TEXTURESCALING_4X: setTexScalingMultiplier(TEXSCALING_4X); break; - case ID_TEXTURESCALING_5X: setTexScalingMultiplier(TEXSCALING_MAX); break; + case ID_TEXTURESCALING_OFF: setTexScalingMultiplier(TEXSCALING_OFF); break; + case ID_TEXTURESCALING_2X: setTexScalingMultiplier(TEXSCALING_2X); break; + case ID_TEXTURESCALING_3X: setTexScalingMultiplier(TEXSCALING_3X); break; + case ID_TEXTURESCALING_4X: setTexScalingMultiplier(TEXSCALING_4X); break; + case ID_TEXTURESCALING_5X: setTexScalingMultiplier(TEXSCALING_MAX); break; case ID_TEXTURESCALING_XBRZ: setTexScalingType(TextureScalerCommon::XBRZ); break; case ID_TEXTURESCALING_HYBRID: setTexScalingType(TextureScalerCommon::HYBRID); break; @@ -770,22 +779,22 @@ namespace MainWindow { case ID_OPTIONS_DIRECT3D9: g_Config.iGPUBackend = GPU_BACKEND_DIRECT3D9; - PostMessage(MainWindow::GetHWND(), WM_USER_RESTART_EMUTHREAD, 0, 0); + RestartApp(); break; case ID_OPTIONS_DIRECT3D11: g_Config.iGPUBackend = GPU_BACKEND_DIRECT3D11; - PostMessage(MainWindow::GetHWND(), WM_USER_RESTART_EMUTHREAD, 0, 0); + RestartApp(); break; case ID_OPTIONS_OPENGL: g_Config.iGPUBackend = GPU_BACKEND_OPENGL; - PostMessage(MainWindow::GetHWND(), WM_USER_RESTART_EMUTHREAD, 0, 0); + RestartApp(); break; case ID_OPTIONS_VULKAN: g_Config.iGPUBackend = GPU_BACKEND_VULKAN; - PostMessage(MainWindow::GetHWND(), WM_USER_RESTART_EMUTHREAD, 0, 0); + RestartApp(); break; case ID_OPTIONS_NONBUFFEREDRENDERING: setRenderingMode(FB_NON_BUFFERED_MODE); break; diff --git a/Windows/main.cpp b/Windows/main.cpp index 0b46bdeb9..37482f073 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -242,7 +242,12 @@ void System_SendMessage(const char *command, const char *parameter) { PostMessage(MainWindow::GetHWND(), WM_CLOSE, 0, 0); } } else if (!strcmp(command, "graphics_restart")) { - PostMessage(MainWindow::GetHWND(), MainWindow::WM_USER_RESTART_EMUTHREAD, 0, 0); + if (IsDebuggerPresent()) { + PostMessage(MainWindow::GetHWND(), MainWindow::WM_USER_RESTART_EMUTHREAD, 0, 0); + } else { + g_Config.bRestartRequired = true; + PostMessage(MainWindow::GetHWND(), WM_CLOSE, 0, 0); + } } else if (!strcmp(command, "setclipboardtext")) { if (OpenClipboard(MainWindow::GetDisplayHWND())) { std::wstring data = ConvertUTF8ToWString(parameter); @@ -575,6 +580,10 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin LogManager::Shutdown(); + if (g_Config.bRestartRequired) { + W32Util::ExitAndRestart(); + } + net::Shutdown(); CoUninitialize(); diff --git a/ext/native/thin3d/thin3d_vulkan.cpp b/ext/native/thin3d/thin3d_vulkan.cpp index 9807dc993..5ee9895fc 100644 --- a/ext/native/thin3d/thin3d_vulkan.cpp +++ b/ext/native/thin3d/thin3d_vulkan.cpp @@ -922,13 +922,15 @@ void VKContext::SetScissorRect(int left, int top, int width, int height) { } void VKContext::SetViewports(int count, Viewport *viewports) { - viewport_.x = viewports[0].TopLeftX; - viewport_.y = viewports[0].TopLeftY; - viewport_.width = viewports[0].Width; - viewport_.height = viewports[0].Height; - viewport_.minDepth = viewports[0].MinDepth; - viewport_.maxDepth = viewports[0].MaxDepth; - viewportDirty_ = true; + if (count > 0) { + viewport_.x = viewports[0].TopLeftX; + viewport_.y = viewports[0].TopLeftY; + viewport_.width = viewports[0].Width; + viewport_.height = viewports[0].Height; + viewport_.minDepth = viewports[0].MinDepth; + viewport_.maxDepth = viewports[0].MaxDepth; + viewportDirty_ = true; + } } void VKContext::SetBlendFactor(float color[4]) {