[Project64] Fix up CSettingTypeApplication::Save for index based setting
This commit is contained in:
parent
05ae250a01
commit
ff8bb9d3fa
|
@ -195,13 +195,17 @@ bool CSettingTypeApplication::Load(uint32_t Index, std::string & Value) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeApplication::LoadDefault(uint32_t /*Index*/, bool & Value) const
|
void CSettingTypeApplication::LoadDefault(uint32_t Index, bool & Value) const
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting != Default_None)
|
if (m_DefaultSetting != Default_None)
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting == Default_Constant)
|
if (m_DefaultSetting == Default_Constant)
|
||||||
{
|
{
|
||||||
Value = m_DefaultValue != 0;
|
Value = m_DefaultValue != 0;
|
||||||
|
}
|
||||||
|
else if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||||
|
{
|
||||||
|
g_Settings->LoadBoolIndex(m_DefaultSetting, Index, Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -227,11 +231,13 @@ void CSettingTypeApplication::LoadDefault(uint32_t /*Index*/, std::string & Valu
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void CSettingTypeApplication::Save(uint32_t /*Index*/, bool Value)
|
void CSettingTypeApplication::Save(uint32_t Index, bool Value)
|
||||||
{
|
{
|
||||||
|
bool indexed = g_Settings->IndexBasedSetting(m_DefaultSetting);
|
||||||
|
|
||||||
if (m_DefaultSetting != Default_None &&
|
if (m_DefaultSetting != Default_None &&
|
||||||
((m_DefaultSetting == Default_Constant && (bool)m_DefaultValue == Value) ||
|
((m_DefaultSetting == Default_Constant && (bool)m_DefaultValue == Value) ||
|
||||||
(m_DefaultSetting != Default_Constant && g_Settings->LoadBool(m_DefaultSetting) == Value)))
|
(m_DefaultSetting != Default_Constant && (indexed ? g_Settings->LoadBoolIndex(m_DefaultSetting, Index) : g_Settings->LoadBool(m_DefaultSetting)) == Value)))
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), NULL);
|
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), NULL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue