mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-22 04:24:44 +00:00
Save backup: fix search not handling empty pattern
*backup time improv
This commit is contained in:
parent
05bfadc9eb
commit
25c38d143e
3 changed files with 15 additions and 5 deletions
|
@ -115,6 +115,10 @@ static void BackupThreadBody() {
|
|||
}
|
||||
LOG_DEBUG(Lib_SaveData, "Backing up the following directory: {} finished",
|
||||
req.save_path.string());
|
||||
{
|
||||
std::scoped_lock lk{g_backup_queue_mutex};
|
||||
g_backup_queue.front().done = true;
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::seconds(10)); // Don't backup too often
|
||||
{
|
||||
std::scoped_lock lk{g_backup_queue_mutex};
|
||||
|
@ -206,8 +210,9 @@ WorkerStatus GetWorkerStatus() {
|
|||
|
||||
bool IsBackupExecutingFor(const std::filesystem::path& save_path) {
|
||||
std::scoped_lock lk{g_backup_queue_mutex};
|
||||
return std::ranges::find(g_backup_queue, save_path,
|
||||
[](const auto& v) { return v.save_path; }) != g_backup_queue.end();
|
||||
const auto& it =
|
||||
std::ranges::find(g_backup_queue, save_path, [](const auto& v) { return v.save_path; });
|
||||
return it != g_backup_queue.end() && !it->done;
|
||||
}
|
||||
|
||||
std::filesystem::path MakeBackupPath(const std::filesystem::path& save_path) {
|
||||
|
|
|
@ -28,6 +28,8 @@ enum class OrbisSaveDataEventType : u32 {
|
|||
};
|
||||
|
||||
struct BackupRequest {
|
||||
bool done{};
|
||||
|
||||
OrbisUserServiceUserId user_id{};
|
||||
std::string title_id{};
|
||||
std::string dir_name{};
|
||||
|
|
|
@ -581,6 +581,7 @@ Error PS4_SYSV_ABI sceSaveDataCheckBackupData(const OrbisSaveDataCheckBackupData
|
|||
LOG_INFO(Lib_SaveData, "called with invalid parameter");
|
||||
return Error::PARAMETER;
|
||||
}
|
||||
LOG_DEBUG(Lib_SaveData, "called with titleId={}", check->titleId->data.to_view());
|
||||
|
||||
const std::string_view title{check->titleId != nullptr ? std::string_view{check->titleId->data}
|
||||
: std::string_view{g_game_serial}};
|
||||
|
@ -801,9 +802,11 @@ Error PS4_SYSV_ABI sceSaveDataDirNameSearch(const OrbisSaveDataDirNameSearchCond
|
|||
if (cond->dirName != nullptr) {
|
||||
// Filter names
|
||||
const auto pat = Common::ToLower(std::string_view{cond->dirName->data});
|
||||
std::erase_if(dir_list, [&](const std::string& dir_name) {
|
||||
return !match(Common::ToLower(dir_name), pat);
|
||||
});
|
||||
if (!pat.empty()) {
|
||||
std::erase_if(dir_list, [&](const std::string& dir_name) {
|
||||
return !match(Common::ToLower(dir_name), pat);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, PSF> map_dir_sfo;
|
||||
|
|
Loading…
Add table
Reference in a new issue