mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-03-12 14:46:49 +01:00
GeckoCodeConfig: Move gecko code title building to its own function
Keeps it separate from the rest of the saving code and also allows for easy rvalue-reference moving into the lines vector as a side-benefit.
This commit is contained in:
parent
3be5373768
commit
f0fa692457
@ -97,6 +97,18 @@ std::vector<GeckoCode> LoadCodes(const IniFile& globalIni, const IniFile& localI
|
|||||||
return gcodes;
|
return gcodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string MakeGeckoCodeTitle(const GeckoCode& code)
|
||||||
|
{
|
||||||
|
std::string title = '$' + code.name;
|
||||||
|
|
||||||
|
if (!code.creator.empty())
|
||||||
|
{
|
||||||
|
title += " [" + code.creator + ']';
|
||||||
|
}
|
||||||
|
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
// used by the SaveGeckoCodes function
|
// used by the SaveGeckoCodes function
|
||||||
static void SaveGeckoCode(std::vector<std::string>& lines, std::vector<std::string>& enabledLines,
|
static void SaveGeckoCode(std::vector<std::string>& lines, std::vector<std::string>& enabledLines,
|
||||||
const GeckoCode& gcode)
|
const GeckoCode& gcode)
|
||||||
@ -107,21 +119,7 @@ static void SaveGeckoCode(std::vector<std::string>& lines, std::vector<std::stri
|
|||||||
if (!gcode.user_defined)
|
if (!gcode.user_defined)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string name;
|
lines.push_back(MakeGeckoCodeTitle(gcode));
|
||||||
|
|
||||||
// save the name
|
|
||||||
name += '$';
|
|
||||||
name += gcode.name;
|
|
||||||
|
|
||||||
// save the creator name
|
|
||||||
if (gcode.creator.size())
|
|
||||||
{
|
|
||||||
name += " [";
|
|
||||||
name += gcode.creator;
|
|
||||||
name += ']';
|
|
||||||
}
|
|
||||||
|
|
||||||
lines.push_back(name);
|
|
||||||
|
|
||||||
// save all the code lines
|
// save all the code lines
|
||||||
for (const GeckoCode::Code& code : gcode.codes)
|
for (const GeckoCode::Code& code : gcode.codes)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user