mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-02 13:01:27 +12:00
cellSaveData: Order equal elements using the opposing trait
Some checks failed
Generate Translation Template / Generate Translation Template (push) Failing after 47s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Intel (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
Build RPCS3 / RPCS3 Windows Clang (push) Has been cancelled
Some checks failed
Generate Translation Template / Generate Translation Template (push) Failing after 47s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Intel (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
Build RPCS3 / RPCS3 Windows Clang (push) Has been cancelled
This commit is contained in:
parent
aa50b0fbb9
commit
1660dc24b3
2 changed files with 52 additions and 17 deletions
|
@ -700,11 +700,32 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||||
u32 errDialog, PSetList setList, PSetBuf setBuf, PFuncList funcList, PFuncFixed funcFixed, PFuncStat funcStat,
|
u32 errDialog, PSetList setList, PSetBuf setBuf, PFuncList funcList, PFuncFixed funcFixed, PFuncStat funcStat,
|
||||||
PFuncFile funcFile, u32 container, u32 unk_op_flags /*TODO*/, vm::ptr<void> userdata, u32 userId, PFuncDone funcDone)
|
PFuncFile funcFile, u32 container, u32 unk_op_flags /*TODO*/, vm::ptr<void> userdata, u32 userId, PFuncDone funcDone)
|
||||||
{
|
{
|
||||||
if (const auto& [ok, list] = setList.try_read(); ok)
|
if (setList)
|
||||||
cellSaveData.notice("savedata_op(): setList = { .sortType=%d, .sortOrder=%d, .dirNamePrefix='%s' }", list.sortType, list.sortOrder, list.dirNamePrefix);
|
{
|
||||||
|
if (const auto& [ok, list] = setList.try_read(); ok)
|
||||||
|
{
|
||||||
|
cellSaveData.notice("savedata_op(): setList = { .sortType=%d, .sortOrder=%d, .dirNamePrefix='%s' }", list.sortType, list.sortOrder, list.dirNamePrefix);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cellSaveData.error("savedata_op(): Failed to read setList!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (const auto& [ok, buf] = setBuf.try_read(); ok)
|
if (setBuf)
|
||||||
cellSaveData.notice("savedata_op(): setBuf = { .dirListMax=%d, .fileListMax=%d, .bufSize=%d }", buf.dirListMax, buf.fileListMax, buf.bufSize);
|
{
|
||||||
|
if (const auto& [ok, buf] = setBuf.try_read(); ok)
|
||||||
|
{
|
||||||
|
cellSaveData.notice("savedata_op(): setBuf = { .dirListMax=%d, .fileListMax=%d, .bufSize=%d }", buf.dirListMax, buf.fileListMax, buf.bufSize);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cellSaveData.error("savedata_op(): Failed to read setBuf!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// There is a lot going on in this function, ensure function log and past log commands have completed for ease of debugging
|
||||||
|
logs::listener::sync_all();
|
||||||
|
|
||||||
if (const auto ecode = savedata_check_args(operation, version, dirName, errDialog, setList, setBuf, funcList, funcFixed, funcStat,
|
if (const auto ecode = savedata_check_args(operation, version, dirName, errDialog, setList, setBuf, funcList, funcFixed, funcStat,
|
||||||
funcFile, container, unk_op_flags, userdata, userId, funcDone))
|
funcFile, container, unk_op_flags, userdata, userId, funcDone))
|
||||||
|
@ -858,25 +879,34 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||||
const u32 order = setList->sortOrder;
|
const u32 order = setList->sortOrder;
|
||||||
const u32 type = setList->sortType;
|
const u32 type = setList->sortType;
|
||||||
|
|
||||||
std::sort(save_entries.begin(), save_entries.end(), [=](const SaveDataEntry& entry1, const SaveDataEntry& entry2)
|
std::sort(save_entries.begin(), save_entries.end(), [order, type](const SaveDataEntry& entry1, const SaveDataEntry& entry2) -> bool
|
||||||
{
|
{
|
||||||
if (order == CELL_SAVEDATA_SORTORDER_DESCENT && type == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME)
|
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)
|
||||||
{
|
{
|
||||||
return entry1.mtime > entry2.mtime;
|
if (mtime_equal)
|
||||||
|
{
|
||||||
|
return subtitle_lower != revert_order;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mtime_lower != revert_order;
|
||||||
}
|
}
|
||||||
if (order == CELL_SAVEDATA_SORTORDER_DESCENT && type == CELL_SAVEDATA_SORTTYPE_SUBTITLE)
|
else if (type == CELL_SAVEDATA_SORTTYPE_SUBTITLE)
|
||||||
{
|
{
|
||||||
return entry1.subtitle > entry2.subtitle;
|
if (subtitle_equal)
|
||||||
}
|
{
|
||||||
if (order == CELL_SAVEDATA_SORTORDER_ASCENT && type == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME)
|
return mtime_lower != revert_order;
|
||||||
{
|
}
|
||||||
return entry1.mtime < entry2.mtime;
|
|
||||||
}
|
return subtitle_lower != revert_order;
|
||||||
if (order == CELL_SAVEDATA_SORTORDER_ASCENT && type == CELL_SAVEDATA_SORTTYPE_SUBTITLE)
|
|
||||||
{
|
|
||||||
return entry1.subtitle < entry2.subtitle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ensure(false);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -701,6 +701,11 @@ void logs::file_writer::sync()
|
||||||
std::this_thread::yield();
|
std::this_thread::yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (thread_ctrl::get_current())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure written to disk
|
// Ensure written to disk
|
||||||
if (m_fout)
|
if (m_fout)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue