From bf0ba50dc494f21b91a353c3ab9a926a5699d0d8 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 23 Jan 2017 16:50:46 +1100 Subject: [PATCH] [Project64] have CSettingTypeApplication if string is default setting --- .../SettingType/SettingsType-Application.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Source/Project64-core/Settings/SettingType/SettingsType-Application.cpp b/Source/Project64-core/Settings/SettingType/SettingsType-Application.cpp index 51ac8aa9b..845ef903d 100644 --- a/Source/Project64-core/Settings/SettingType/SettingsType-Application.cpp +++ b/Source/Project64-core/Settings/SettingType/SettingsType-Application.cpp @@ -272,14 +272,23 @@ void CSettingTypeApplication::Save(int /*Index*/, uint32_t Value) } } -void CSettingTypeApplication::Save(int /*Index*/, const stdstr & Value) +void CSettingTypeApplication::Save(int Index, const stdstr & Value) { - m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), Value.c_str()); + Save(Index, Value.c_str()); } void CSettingTypeApplication::Save(int /*Index*/, const char * Value) { - m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), Value); + if (m_DefaultSetting != Default_None && + ((m_DefaultSetting == Default_Constant && strcmp(m_DefaultStr,Value) == 0) || + (m_DefaultSetting != Default_Constant && strcmp(g_Settings->LoadStringVal(m_DefaultSetting).c_str(),Value) == 0))) + { + m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), NULL); + } + else + { + m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), Value); + } } stdstr CSettingTypeApplication::FixSectionName(const char * Section)