MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / _EnumEntry

Method _EnumEntry

common/SettingsWrapper.cpp:73–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73void SettingsLoadWrapper::_EnumEntry(const char* section, const char* var, int& value, const char* const* enumArray, int defvalue)
74{
75 const int cnt = _calcEnumLength(enumArray);
76 defvalue = std::clamp(defvalue, 0, cnt);
77
78 const std::string retval(m_si.GetStringValue(section, var, enumArray[defvalue]));
79
80 int i = 0;
81 while (enumArray[i] != nullptr && (retval != enumArray[i]))
82 i++;
83
84 if (enumArray[i] == nullptr)
85 {
86 Console.Warning("(LoadSettings) Warning: Unrecognized value '%s' on key '%s'\n\tUsing the default setting of '%s'.",
87 retval.c_str(), var, enumArray[defvalue]);
88 value = defvalue;
89 }
90 else
91 {
92 value = i;
93 }
94}
95
96bool SettingsLoadWrapper::EntryBitBool(const char* section, const char* var, bool value, const bool defvalue /*= false*/)
97{

Callers

nothing calls this directly

Calls 7

_calcEnumLengthFunction · 0.85
clampFunction · 0.70
GetStringValueMethod · 0.45
WarningMethod · 0.45
c_strMethod · 0.45
SetStringValueMethod · 0.45
DeleteValueMethod · 0.45

Tested by

no test coverage detected