diff --git a/Source/Core/Core/GeckoCodeConfig.cpp b/Source/Core/Core/GeckoCodeConfig.cpp index 5d81352e88..f50b848d68 100644 --- a/Source/Core/Core/GeckoCodeConfig.cpp +++ b/Source/Core/Core/GeckoCodeConfig.cpp @@ -13,14 +13,14 @@ namespace Gecko { -void LoadCodes(const IniFile& globalIni, const IniFile& localIni, std::vector& gcodes) +std::vector LoadCodes(const IniFile& globalIni, const IniFile& localIni) { - const IniFile* inis[2] = {&globalIni, &localIni}; + std::vector gcodes; - for (const IniFile* ini : inis) + for (const IniFile& ini : {globalIni, localIni}) { std::vector lines; - ini->GetLines("Gecko", &lines, false); + ini.GetLines("Gecko", &lines, false); GeckoCode gcode; @@ -42,7 +42,7 @@ void LoadCodes(const IniFile& globalIni, const IniFile& localIni, std::vectorGetLines("Gecko_Enabled", &lines, false); + ini.GetLines("Gecko_Enabled", &lines, false); for (const std::string& line : lines) { @@ -93,6 +93,8 @@ void LoadCodes(const IniFile& globalIni, const IniFile& localIni, std::vector& gcodes); +std::vector LoadCodes(const IniFile& globalIni, const IniFile& localIni); void SaveCodes(IniFile& inifile, const std::vector& gcodes); } diff --git a/Source/Core/Core/PatchEngine.cpp b/Source/Core/Core/PatchEngine.cpp index 829d26c0c3..b2d9b17566 100644 --- a/Source/Core/Core/PatchEngine.cpp +++ b/Source/Core/Core/PatchEngine.cpp @@ -155,10 +155,7 @@ void LoadPatches() LoadPatchSection("OnFrame", onFrame, globalIni, localIni); ActionReplay::LoadAndApplyCodes(globalIni, localIni); - // lil silly - std::vector gcodes; - Gecko::LoadCodes(globalIni, localIni, gcodes); - Gecko::SetActiveCodes(gcodes); + Gecko::SetActiveCodes(Gecko::LoadCodes(globalIni, localIni)); LoadSpeedhacks("Speedhacks", merged); } diff --git a/Source/Core/DolphinWX/Cheats/GeckoCodeDiag.cpp b/Source/Core/DolphinWX/Cheats/GeckoCodeDiag.cpp index f2b275a9be..83733d601b 100644 --- a/Source/Core/DolphinWX/Cheats/GeckoCodeDiag.cpp +++ b/Source/Core/DolphinWX/Cheats/GeckoCodeDiag.cpp @@ -103,7 +103,7 @@ void CodeConfigPanel::LoadCodes(const IniFile& globalIni, const IniFile& localIn m_gcodes.clear(); if (!checkRunning || Core::IsRunning()) - Gecko::LoadCodes(globalIni, localIni, m_gcodes); + m_gcodes = Gecko::LoadCodes(globalIni, localIni); UpdateCodeList(checkRunning); }