From 3585881a6c6d8a5fad78ec1949be89a7a20b9be3 Mon Sep 17 00:00:00 2001 From: oltolm Date: Sun, 22 Feb 2026 01:59:55 +0100 Subject: [PATCH] cellSaveData: fix "Your comparator is not a valid strict-weak ordering" --- rpcs3/Emu/Cell/Modules/cellSaveData.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index a4d160fdcb..7878e86642 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -876,39 +876,42 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v // Sort the entries { - const u32 order = setList->sortOrder; const u32 type = setList->sortType; - std::sort(save_entries.begin(), save_entries.end(), [order, type](const SaveDataEntry& entry1, const SaveDataEntry& entry2) -> bool + auto comp = [type](const SaveDataEntry& entry1, const SaveDataEntry& entry2) -> bool { const bool mtime_lower = entry1.mtime < entry2.mtime; const bool mtime_equal = entry1.mtime == entry2.mtime; const bool subtitle_lower = entry1.subtitle < entry2.subtitle; const bool subtitle_equal = entry1.subtitle == entry2.subtitle; - const bool revert_order = order == CELL_SAVEDATA_SORTORDER_DESCENT; if (type == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME) { if (mtime_equal) { - return subtitle_lower != revert_order; + return subtitle_lower; } - return mtime_lower != revert_order; + return mtime_lower; } else if (type == CELL_SAVEDATA_SORTTYPE_SUBTITLE) { if (subtitle_equal) { - return mtime_lower != revert_order; + return mtime_lower; } - return subtitle_lower != revert_order; + return subtitle_lower; } ensure(false); return true; - }); + }; + + if (setList->sortOrder == CELL_SAVEDATA_SORTORDER_ASCENT) + std::sort(save_entries.begin(), save_entries.end(), comp); + else + std::sort(save_entries.rbegin(), save_entries.rend(), comp); } // Fill the listGet->dirList array