Skip to content

Commit

Permalink
gui: Save sort mode if sorting is done successfully and sort based on…
Browse files Browse the repository at this point in the history
… sort mode on start up
  • Loading branch information
joel16 authored Jul 24, 2022
1 parent fd9e7d0 commit b26bb0f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion source/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -599,7 +601,11 @@ namespace GUI {
AppEntries entries;
std::vector<SceIoDirent> 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();
Expand Down

0 comments on commit b26bb0f

Please sign in to comment.