diff --git a/Core/Config.cpp b/Core/Config.cpp index f7fd8e9af..0a2355e5f 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -1117,12 +1117,13 @@ static void IterateSettings(IniFile &iniFile, std::function> GetLangValuesMapping() { @@ -1173,6 +1174,11 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) { const bool useIniFilename = iniFileName != nullptr && strlen(iniFileName) > 0; iniFilename_ = FindConfigFile(useIniFilename ? iniFileName : "ppsspp.ini"); + if (!bUpdatedInstanceCounter) { + InitInstanceCounter(); + bUpdatedInstanceCounter = true; + } + const bool useControllerIniFilename = controllerIniFilename != nullptr && strlen(controllerIniFilename) > 0; controllerIniFilename_ = FindConfigFile(useControllerIniFilename ? controllerIniFilename : "controls.ini"); diff --git a/Core/Config.h b/Core/Config.h index 71fa93e35..3072efdbc 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -61,7 +61,8 @@ public: // Whether to save the config on close. bool bSaveSettings; bool bFirstRun; - bool bGameSpecific; + bool bGameSpecific = false; + bool bUpdatedInstanceCounter = false; int iRunCount; // To be used to for example check for updates every 10 runs and things like that. diff --git a/Windows/main.cpp b/Windows/main.cpp index 50cd28534..7ee603d78 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -516,6 +516,22 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin g_Config.internalDataDirectory = W32Util::UserDocumentsPath(); InitSysDirectories(); + // Check for the Vulkan workaround before any serious init. + for (size_t i = 1; i < wideArgs.size(); ++i) { + if (wideArgs[i][0] == L'-') { + // This should only be called by DetectVulkanInExternalProcess(). + if (wideArgs[i] == L"--vulkan-available-check") { + // Just call it, this way it will crash here if it doesn't work. + // (this is an external process.) + bool result = VulkanMayBeAvailable(); + + LogManager::Shutdown(); + WinMainCleanup(); + return result ? EXIT_CODE_VULKAN_WORKS : EXIT_FAILURE; + } + } + } + // Load config up here, because those changes below would be overwritten // if it's not loaded here first. g_Config.AddSearchPath(""); @@ -574,17 +590,6 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin g_Config.bSoftwareRendering = true; } } - - // This should only be called by DetectVulkanInExternalProcess(). - if (wideArgs[i] == L"--vulkan-available-check") { - // Just call it, this way it will crash here if it doesn't work. - // (this is an external process.) - bool result = VulkanMayBeAvailable(); - - LogManager::Shutdown(); - WinMainCleanup(); - return result ? EXIT_CODE_VULKAN_WORKS : EXIT_FAILURE; - } } } #ifdef _DEBUG