From 2c3b3eafbed68136c5157dc551b596bd1f567c8d Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Thu, 16 Apr 2015 12:55:55 +0300 Subject: [PATCH] first time wizard "overwrite": obey default console sources this is actually not a FTW issue but rather a console sources issue. the console log sources are not c++ classes and therefore don't get initialized other than when [attempting to] loading them from the ini file (where if the ini doesn't exist then they get their default values). however, during first time wizard, when choosing "overwrite", the console sources are saved without ever getting loaded and so end up without the default values applied (so all sources as disabled). this patch makes sure that if we're saving the conlog sources before ever attempting to load them, they'll get saved with the correct default values. --- pcsx2/gui/ConsoleLogger.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pcsx2/gui/ConsoleLogger.cpp b/pcsx2/gui/ConsoleLogger.cpp index dbd4070ff7..97de9f58c4 100644 --- a/pcsx2/gui/ConsoleLogger.cpp +++ b/pcsx2/gui/ConsoleLogger.cpp @@ -350,6 +350,13 @@ static const bool ConLogDefaults[] = false }; +// Typically on startup (or during first time wizard when choosing "import"), the +// settings are loaded from ini and if the ini doesn't exist then from ConLogDefaults, +// but during first time wizard when choosing "overwrite", the first action is "save", +// which ends up saving before applying ConLogDefaults, therefore all conlog sources +// are saved as disabled. ConLogInitialized is used to detect and avoid this issue. +static bool ConLogInitialized = false; + void ConLog_LoadSaveSettings( IniInterface& ini ) { ScopedIniGroup path(ini, L"ConsoleLogSources"); @@ -361,9 +368,14 @@ void ConLog_LoadSaveSettings( IniInterface& ini ) { if (ConsoleLogSource* log = ConLogSources[i]) { + // IsSaving() is for clarity only, since log->Enabled initial value is ignored when loading. + if (ini.IsSaving() && !ConLogInitialized) + log->Enabled = ConLogDefaults[i]; ini.Entry( log->GetCategory() + L"." + log->GetShortName(), log->Enabled, ConLogDefaults[i] ); } } + + ConLogInitialized = true; }