PostProcessing: Remove StageCount key for game settings

Potentially removes the ini file if it's otherwise empty.
This commit is contained in:
Stenzek 2025-01-09 18:00:33 +10:00
parent 2b4e60a5bf
commit 9b339d4bff
No known key found for this signature in database

View File

@ -317,8 +317,14 @@ void PostProcessing::Config::RemoveStage(SettingsInterface& si, const char* sect
for (u32 i = index; i < (stage_count - 1); i++)
CopyStageConfig(si, section, i + 1, i);
si.ClearSection(GetStageConfigSection(section, stage_count - 1));
si.SetUIntValue(section, "StageCount", stage_count - 1);
const u32 new_stage_count = stage_count - 1;
si.ClearSection(GetStageConfigSection(section, new_stage_count));
// if game settings, wipe the field out so we can potentially remove the file
if (&si != Host::Internal::GetBaseSettingsLayer())
si.DeleteValue(section, "StageCount");
else
si.SetUIntValue(section, "StageCount", new_stage_count);
}
void PostProcessing::Config::MoveStageUp(SettingsInterface& si, const char* section, u32 index)
@ -358,7 +364,12 @@ void PostProcessing::Config::ClearStages(SettingsInterface& si, const char* sect
const u32 count = GetStageCount(si, section);
for (s32 i = static_cast<s32>(count - 1); i >= 0; i--)
si.ClearSection(GetStageConfigSection(section, static_cast<u32>(i)));
// if game settings, wipe the field out so we can potentially remove the file
if (&si != Host::Internal::GetBaseSettingsLayer())
si.SetUIntValue(section, "StageCount", 0);
else
si.DeleteValue(section, "StageCount");
}
PostProcessing::Chain::Chain(const char* section) : m_section(section)