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