Windows: Make the instance counter go by 1, 2, 3.

This commit is contained in:
Unknown W. Brackets 2020-08-18 00:47:22 -07:00
parent 4d307be2b2
commit 495996e58b
3 changed files with 27 additions and 15 deletions

View file

@ -1117,12 +1117,13 @@ static void IterateSettings(IniFile &iniFile, std::function<void(Section *sectio
} }
} }
Config::Config() : bGameSpecific(false) { Config::Config() {
InitInstanceCounter();
} }
Config::~Config() { Config::~Config() {
ShutdownInstanceCounter(); if (bUpdatedInstanceCounter) {
ShutdownInstanceCounter();
}
} }
std::map<std::string, std::pair<std::string, int>> GetLangValuesMapping() { std::map<std::string, std::pair<std::string, int>> GetLangValuesMapping() {
@ -1173,6 +1174,11 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
const bool useIniFilename = iniFileName != nullptr && strlen(iniFileName) > 0; const bool useIniFilename = iniFileName != nullptr && strlen(iniFileName) > 0;
iniFilename_ = FindConfigFile(useIniFilename ? iniFileName : "ppsspp.ini"); iniFilename_ = FindConfigFile(useIniFilename ? iniFileName : "ppsspp.ini");
if (!bUpdatedInstanceCounter) {
InitInstanceCounter();
bUpdatedInstanceCounter = true;
}
const bool useControllerIniFilename = controllerIniFilename != nullptr && strlen(controllerIniFilename) > 0; const bool useControllerIniFilename = controllerIniFilename != nullptr && strlen(controllerIniFilename) > 0;
controllerIniFilename_ = FindConfigFile(useControllerIniFilename ? controllerIniFilename : "controls.ini"); controllerIniFilename_ = FindConfigFile(useControllerIniFilename ? controllerIniFilename : "controls.ini");

View file

@ -61,7 +61,8 @@ public:
// Whether to save the config on close. // Whether to save the config on close.
bool bSaveSettings; bool bSaveSettings;
bool bFirstRun; 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. int iRunCount; // To be used to for example check for updates every 10 runs and things like that.

View file

@ -516,6 +516,22 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
g_Config.internalDataDirectory = W32Util::UserDocumentsPath(); g_Config.internalDataDirectory = W32Util::UserDocumentsPath();
InitSysDirectories(); 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 // Load config up here, because those changes below would be overwritten
// if it's not loaded here first. // if it's not loaded here first.
g_Config.AddSearchPath(""); g_Config.AddSearchPath("");
@ -574,17 +590,6 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
g_Config.bSoftwareRendering = true; 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 #ifdef _DEBUG