Fix issue where after a backend change restart, the new instance was considered secondary.

This commit is contained in:
Henrik Rydgård 2020-08-06 10:19:58 +02:00
parent ff248ff94f
commit f9a1a0eee5
2 changed files with 10 additions and 2 deletions

View file

@ -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

View file

@ -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());
}