diff --git a/Core/Instance.cpp b/Core/Instance.cpp index 70976427de..ed6222b185 100644 --- a/Core/Instance.cpp +++ b/Core/Instance.cpp @@ -136,9 +136,9 @@ void InitInstanceCounter() { void ShutdownInstanceCounter() { #if PPSSPP_PLATFORM(WINDOWS) - if (hIDMapFile != NULL) { + if (hIDMapFile) { CloseHandle(hIDMapFile); // If program exited(or crashed?) or the last handle reference closed the shared memory object will be deleted. - hIDMapFile = NULL; + hIDMapFile = nullptr; } #elif PPSSPP_PLATFORM(ANDROID) // Do nothing diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 5594e2e035..9945d98127 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -55,6 +55,7 @@ #include "Core/Config.h" #include "Core/ConfigValues.h" #include "Core/Host.h" +#include "Core/Instance.h" #include "Core/System.h" #include "Core/Reporting.h" #include "Core/TextureReplacer.h" @@ -229,6 +230,11 @@ void GameSettingsScreen::CreateViews() { renderingBackendChoice->HideChoice((int)GPUBackend::DIRECT3D11); if (!g_Config.IsBackendEnabled(GPUBackend::VULKAN)) renderingBackendChoice->HideChoice((int)GPUBackend::VULKAN); + + if (!IsFirstInstance()) { + // If we're not the first instance, can't save the setting, and it requires a restart, so... + renderingBackendChoice->SetEnabled(false); + } #endif Draw::DrawContext *draw = screenManager()->getDrawContext(); @@ -1273,6 +1279,8 @@ void GameSettingsScreen::TriggerRestart(const char *why) { } else if (!gamePath_.empty()) { param += " \"" + ReplaceAll(ReplaceAll(gamePath_, "\\", "\\\\"), "\"", "\\\"") + "\""; } + // Make sure the new instance is considered the first. + ShutdownInstanceCounter(); System_SendMessage("graphics_restart", param.c_str()); }