From f91292eff245dbe31a7cc391ecc45b36942f8538 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 21 Mar 2017 16:24:16 -0400 Subject: [PATCH] GeckoCodeConfig: Return vector by value for LoadCodes() Using an out-param is a leftover from C++03. Action Replay codes already return the vector of codes by value as well. --- Source/Core/Core/GeckoCodeConfig.cpp | 14 ++++++++------ Source/Core/Core/GeckoCodeConfig.h | 2 +- Source/Core/Core/PatchEngine.cpp | 5 +---- Source/Core/DolphinWX/Cheats/GeckoCodeDiag.cpp | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) 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); }