From b26bb0f4391c046e6836f74118a4335d150f64bf Mon Sep 17 00:00:00 2001 From: Joel Date: Sun, 24 Jul 2022 15:29:12 -0400 Subject: [PATCH] gui: Save sort mode if sorting is done successfully and sort based on sort mode on start up --- source/gui.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/gui.cpp b/source/gui.cpp index f27a58b..c7a7080 100644 --- a/source/gui.cpp +++ b/source/gui.cpp @@ -171,8 +171,10 @@ namespace GUI { case StateConfirmSort: AppList::Backup(); backupExists = true; - if ((AppList::Save(entries.icons)) == 0) + if ((AppList::Save(entries.icons)) == 0) { + Config::Save(cfg); state = StateDone; + } else state = StateError; break; @@ -599,7 +601,11 @@ namespace GUI { AppEntries entries; std::vector loadouts; + // Initial sort based on cfg.sort_mode AppList::Get(entries); + std::sort(entries.icons.begin(), entries.icons.end(), cfg.sort_mode == SortAsc? AppList::SortAppDesc : AppList::SortAppDesc); + std::sort(entries.child_apps.begin(), entries.child_apps.end(), cfg.sort_mode == SortAsc? AppList::SortChildAppDesc : AppList::SortChildAppDesc); + FS::GetDirList("ux0:data/VITAHomebrewSorter/loadouts", loadouts); int date_format = Utils::GetDateFormat();