From 498190d9f485359f2063364a815db0b0019b2c38 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 4 Nov 2023 19:18:09 +0100 Subject: [PATCH] Added secondary sorting by fullname when sorting systems --- es-app/src/SystemData.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/es-app/src/SystemData.cpp b/es-app/src/SystemData.cpp index ce5ac1093..b54e0b487 100644 --- a/es-app/src/SystemData.cpp +++ b/es-app/src/SystemData.cpp @@ -813,9 +813,19 @@ bool SystemData::loadConfig() << " (collections not included)"; LOG(LogInfo) << "Total game count: " << gameCount; - // Sort systems by sortName, which will normally be the same as the full name. + // Sort systems by sortName, and always perform secondary sorting by the full name. std::sort(std::begin(sSystemVector), std::end(sSystemVector), [](SystemData* a, SystemData* b) { - return Utils::String::toUpper(a->getSortName()) < Utils::String::toUpper(b->getSortName()); + if (Utils::String::toUpper(a->getSortName()) < Utils::String::toUpper(b->getSortName())) + return true; + if (Utils::String::toUpper(a->getSortName()) > Utils::String::toUpper(b->getSortName())) + return false; + + if (Utils::String::toUpper(a->getFullName()) < Utils::String::toUpper(b->getFullName())) + return true; + if (Utils::String::toUpper(a->getFullName()) > Utils::String::toUpper(b->getFullName())) + return false; + + return false; }); // Don't load any collections if there are no systems available.