diff --git a/Source/Core/Core/ActionReplay.cpp b/Source/Core/Core/ActionReplay.cpp index f3641f72bc..11542534b1 100644 --- a/Source/Core/Core/ActionReplay.cpp +++ b/Source/Core/Core/ActionReplay.cpp @@ -285,10 +285,8 @@ void SaveCodes(IniFile* local_ini, const std::vector& codes) for (const ActionReplay::ARCode& code : codes) { - if (code.enabled) - enabled_lines.emplace_back('$' + code.name); - else if (code.default_enabled) - disabled_lines.emplace_back('$' + code.name); + if (code.enabled != code.default_enabled) + (code.enabled ? enabled_lines : disabled_lines).emplace_back('$' + code.name); if (code.user_defined) { diff --git a/Source/Core/Core/GeckoCodeConfig.cpp b/Source/Core/Core/GeckoCodeConfig.cpp index 605fb82533..ab791bbe76 100644 --- a/Source/Core/Core/GeckoCodeConfig.cpp +++ b/Source/Core/Core/GeckoCodeConfig.cpp @@ -242,10 +242,8 @@ void SaveCodes(IniFile& inifile, const std::vector& gcodes) for (const GeckoCode& geckoCode : gcodes) { - if (geckoCode.enabled) - enabled_lines.emplace_back('$' + geckoCode.name); - else if (geckoCode.default_enabled) - disabled_lines.emplace_back('$' + geckoCode.name); + if (geckoCode.enabled != geckoCode.default_enabled) + (geckoCode.enabled ? enabled_lines : disabled_lines).emplace_back('$' + geckoCode.name); SaveGeckoCode(lines, geckoCode); } diff --git a/Source/Core/DolphinQt/Config/PatchesWidget.cpp b/Source/Core/DolphinQt/Config/PatchesWidget.cpp index 1ac7f55154..43dd4a415e 100644 --- a/Source/Core/DolphinQt/Config/PatchesWidget.cpp +++ b/Source/Core/DolphinQt/Config/PatchesWidget.cpp @@ -133,10 +133,8 @@ void PatchesWidget::SavePatches() for (const auto& patch : m_patches) { - if (patch.enabled) - lines_enabled.emplace_back('$' + patch.name); - else if (patch.default_enabled) - lines_disabled.emplace_back('$' + patch.name); + if (patch.enabled != patch.default_enabled) + (patch.enabled ? lines_enabled : lines_disabled).emplace_back('$' + patch.name); if (!patch.user_defined) continue;