mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-05 08:52:36 +00:00
commit
544b86885d
@ -557,10 +557,10 @@ s32 PS4_SYSV_ABI sceNpTrophyGetTrophyUnlockState(OrbisNpTrophyContext context,
|
|||||||
|
|
||||||
const auto trophyDir =
|
const auto trophyDir =
|
||||||
Common::FS::GetUserPath(Common::FS::PathType::MetaDataDir) / game_serial / "TrophyFiles";
|
Common::FS::GetUserPath(Common::FS::PathType::MetaDataDir) / game_serial / "TrophyFiles";
|
||||||
|
auto trophy_file = trophyDir / "trophy00" / "Xml" / "TROP.XML";
|
||||||
|
|
||||||
pugi::xml_document doc;
|
pugi::xml_document doc;
|
||||||
pugi::xml_parse_result result =
|
pugi::xml_parse_result result = doc.load_file(trophy_file.native().c_str());
|
||||||
doc.load_file((trophyDir.string() + "/trophy00/Xml/TROP.XML").c_str());
|
|
||||||
|
|
||||||
int numTrophies = 0;
|
int numTrophies = 0;
|
||||||
|
|
||||||
|
@ -107,14 +107,16 @@ static void BackupThreadBody() {
|
|||||||
}
|
}
|
||||||
g_backup_status = WorkerStatus::Running;
|
g_backup_status = WorkerStatus::Running;
|
||||||
|
|
||||||
LOG_INFO(Lib_SaveData, "Backing up the following directory: {}", req.save_path.string());
|
LOG_INFO(Lib_SaveData, "Backing up the following directory: {}",
|
||||||
|
fmt::UTF(req.save_path.u8string()));
|
||||||
try {
|
try {
|
||||||
backup(req.save_path);
|
backup(req.save_path);
|
||||||
} catch (const std::filesystem::filesystem_error& err) {
|
} catch (const std::filesystem::filesystem_error& err) {
|
||||||
LOG_ERROR(Lib_SaveData, "Failed to backup {}: {}", req.save_path.string(), err.what());
|
LOG_ERROR(Lib_SaveData, "Failed to backup {}: {}", fmt::UTF(req.save_path.u8string()),
|
||||||
|
err.what());
|
||||||
}
|
}
|
||||||
LOG_DEBUG(Lib_SaveData, "Backing up the following directory: {} finished",
|
LOG_DEBUG(Lib_SaveData, "Backing up the following directory: {} finished",
|
||||||
req.save_path.string());
|
fmt::UTF(req.save_path.u8string()));
|
||||||
{
|
{
|
||||||
std::scoped_lock lk{g_backup_queue_mutex};
|
std::scoped_lock lk{g_backup_queue_mutex};
|
||||||
g_backup_queue.front().done = true;
|
g_backup_queue.front().done = true;
|
||||||
@ -160,7 +162,7 @@ bool NewRequest(OrbisUserServiceUserId user_id, std::string_view title_id,
|
|||||||
|
|
||||||
if (g_backup_status != WorkerStatus::Waiting && g_backup_status != WorkerStatus::Running) {
|
if (g_backup_status != WorkerStatus::Waiting && g_backup_status != WorkerStatus::Running) {
|
||||||
LOG_ERROR(Lib_SaveData, "Called backup while status is {}. Backup request to {} ignored",
|
LOG_ERROR(Lib_SaveData, "Called backup while status is {}. Backup request to {} ignored",
|
||||||
magic_enum::enum_name(g_backup_status.load()), save_path.string());
|
magic_enum::enum_name(g_backup_status.load()), fmt::UTF(save_path.u8string()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -184,7 +186,7 @@ bool NewRequest(OrbisUserServiceUserId user_id, std::string_view title_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Restore(const std::filesystem::path& save_path) {
|
bool Restore(const std::filesystem::path& save_path) {
|
||||||
LOG_INFO(Lib_SaveData, "Restoring backup for {}", save_path.string());
|
LOG_INFO(Lib_SaveData, "Restoring backup for {}", fmt::UTF(save_path.u8string()));
|
||||||
std::unique_lock lk{g_backup_running_mutex};
|
std::unique_lock lk{g_backup_running_mutex};
|
||||||
if (!fs::exists(save_path) || !fs::exists(save_path / backup_dir)) {
|
if (!fs::exists(save_path) || !fs::exists(save_path / backup_dir)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -77,7 +77,7 @@ static void SaveFileSafe(void* buf, size_t count, const std::filesystem::path& p
|
|||||||
g_saving_memory = true;
|
g_saving_memory = true;
|
||||||
std::scoped_lock lk{g_saving_memory_mutex};
|
std::scoped_lock lk{g_saving_memory_mutex};
|
||||||
try {
|
try {
|
||||||
LOG_DEBUG(Lib_SaveData, "Saving save data memory {}", g_save_path.string());
|
LOG_DEBUG(Lib_SaveData, "Saving save data memory {}", fmt::UTF(g_save_path.u8string()));
|
||||||
|
|
||||||
if (g_memory_dirty) {
|
if (g_memory_dirty) {
|
||||||
g_memory_dirty = false;
|
g_memory_dirty = false;
|
||||||
@ -163,7 +163,8 @@ size_t CreateSaveMemory(size_t memory_size) {
|
|||||||
|
|
||||||
bool ok = g_param_sfo.Open(g_param_sfo_path);
|
bool ok = g_param_sfo.Open(g_param_sfo_path);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
LOG_ERROR(Lib_SaveData, "Failed to open SFO at {}", g_param_sfo_path.string());
|
LOG_ERROR(Lib_SaveData, "Failed to open SFO at {}",
|
||||||
|
fmt::UTF(g_param_sfo_path.u8string()));
|
||||||
throw std::filesystem::filesystem_error(
|
throw std::filesystem::filesystem_error(
|
||||||
"failed to open SFO", g_param_sfo_path,
|
"failed to open SFO", g_param_sfo_path,
|
||||||
std::make_error_code(std::errc::illegal_byte_sequence));
|
std::make_error_code(std::errc::illegal_byte_sequence));
|
||||||
|
@ -607,7 +607,7 @@ Error PS4_SYSV_ABI sceSaveDataCheckBackupData(const OrbisSaveDataCheckBackupData
|
|||||||
if (check->param != nullptr) {
|
if (check->param != nullptr) {
|
||||||
PSF sfo;
|
PSF sfo;
|
||||||
if (!sfo.Open(backup_path / "sce_sys" / "param.sfo")) {
|
if (!sfo.Open(backup_path / "sce_sys" / "param.sfo")) {
|
||||||
LOG_ERROR(Lib_SaveData, "Failed to read SFO at {}", backup_path.string());
|
LOG_ERROR(Lib_SaveData, "Failed to read SFO at {}", fmt::UTF(backup_path.u8string()));
|
||||||
return Error::INTERNAL;
|
return Error::INTERNAL;
|
||||||
}
|
}
|
||||||
check->param->FromSFO(sfo);
|
check->param->FromSFO(sfo);
|
||||||
@ -818,7 +818,7 @@ Error PS4_SYSV_ABI sceSaveDataDirNameSearch(const OrbisSaveDataDirNameSearchCond
|
|||||||
const auto sfo_path = SaveInstance::GetParamSFOPath(dir_path);
|
const auto sfo_path = SaveInstance::GetParamSFOPath(dir_path);
|
||||||
PSF sfo;
|
PSF sfo;
|
||||||
if (!sfo.Open(sfo_path)) {
|
if (!sfo.Open(sfo_path)) {
|
||||||
LOG_ERROR(Lib_SaveData, "Failed to read SFO: {}", sfo_path.string());
|
LOG_ERROR(Lib_SaveData, "Failed to read SFO: {}", fmt::UTF(sfo_path.u8string()));
|
||||||
ASSERT_MSG(false, "Failed to read SFO");
|
ASSERT_MSG(false, "Failed to read SFO");
|
||||||
}
|
}
|
||||||
map_dir_sfo.emplace(dir_name, std::move(sfo));
|
map_dir_sfo.emplace(dir_name, std::move(sfo));
|
||||||
|
@ -189,7 +189,7 @@ void Emulator::Run(const std::filesystem::path& file) {
|
|||||||
if (!std::filesystem::exists(mount_captures_dir)) {
|
if (!std::filesystem::exists(mount_captures_dir)) {
|
||||||
std::filesystem::create_directory(mount_captures_dir);
|
std::filesystem::create_directory(mount_captures_dir);
|
||||||
}
|
}
|
||||||
VideoCore::SetOutputDir(mount_captures_dir.generic_string(), id);
|
VideoCore::SetOutputDir(mount_captures_dir, id);
|
||||||
|
|
||||||
// Initialize kernel and library facilities.
|
// Initialize kernel and library facilities.
|
||||||
Libraries::Kernel::init_pthreads();
|
Libraries::Kernel::init_pthreads();
|
||||||
@ -205,7 +205,7 @@ void Emulator::Run(const std::filesystem::path& file) {
|
|||||||
std::filesystem::path sce_module_folder = file.parent_path() / "sce_module";
|
std::filesystem::path sce_module_folder = file.parent_path() / "sce_module";
|
||||||
if (std::filesystem::is_directory(sce_module_folder)) {
|
if (std::filesystem::is_directory(sce_module_folder)) {
|
||||||
for (const auto& entry : std::filesystem::directory_iterator(sce_module_folder)) {
|
for (const auto& entry : std::filesystem::directory_iterator(sce_module_folder)) {
|
||||||
LOG_INFO(Loader, "Loading {}", entry.path().string().c_str());
|
LOG_INFO(Loader, "Loading {}", fmt::UTF(entry.path().u8string()));
|
||||||
linker->LoadModule(entry.path());
|
linker->LoadModule(entry.path());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ void GameInfoClass::GetGameInfo(QWidget* parent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_games = QtConcurrent::mapped(filePaths, [&](const QString& path) {
|
m_games = QtConcurrent::mapped(filePaths, [&](const QString& path) {
|
||||||
return readGameInfo(path.toStdString());
|
return readGameInfo(Common::FS::PathFromQString(path));
|
||||||
}).results();
|
}).results();
|
||||||
|
|
||||||
// Progress bar, please be patient :)
|
// Progress bar, please be patient :)
|
||||||
|
@ -22,12 +22,12 @@ public:
|
|||||||
return a.name < b.name;
|
return a.name < b.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GameInfo readGameInfo(const std::string& filePath) {
|
static GameInfo readGameInfo(const std::filesystem::path& filePath) {
|
||||||
GameInfo game;
|
GameInfo game;
|
||||||
game.path = filePath;
|
game.path = filePath;
|
||||||
|
|
||||||
PSF psf;
|
PSF psf;
|
||||||
if (psf.Open(std::filesystem::path(game.path) / "sce_sys" / "param.sfo")) {
|
if (psf.Open(game.path / "sce_sys" / "param.sfo")) {
|
||||||
game.icon_path = game.path / "sce_sys" / "icon0.png";
|
game.icon_path = game.path / "sce_sys" / "icon0.png";
|
||||||
QString iconpath;
|
QString iconpath;
|
||||||
Common::FS::PathToQString(iconpath, game.icon_path);
|
Common::FS::PathToQString(iconpath, game.icon_path);
|
||||||
|
@ -511,11 +511,12 @@ void MainWindow::StartGame() {
|
|||||||
if (gamePath != "") {
|
if (gamePath != "") {
|
||||||
AddRecentFiles(gamePath);
|
AddRecentFiles(gamePath);
|
||||||
Core::Emulator emulator;
|
Core::Emulator emulator;
|
||||||
if (!std::filesystem::exists(gamePath.toUtf8().constData())) {
|
const auto path = Common::FS::PathFromQString(gamePath);
|
||||||
|
if (!std::filesystem::exists(path)) {
|
||||||
QMessageBox::critical(nullptr, tr("Run Game"), QString(tr("Eboot.bin file not found")));
|
QMessageBox::critical(nullptr, tr("Run Game"), QString(tr("Eboot.bin file not found")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emulator.Run(gamePath.toUtf8().constData());
|
emulator.Run(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -948,14 +949,14 @@ void MainWindow::CreateRecentGameActions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
connect(m_recent_files_group, &QActionGroup::triggered, this, [this](QAction* action) {
|
connect(m_recent_files_group, &QActionGroup::triggered, this, [this](QAction* action) {
|
||||||
QString gamePath = action->text();
|
auto gamePath = Common::FS::PathFromQString(action->text());
|
||||||
AddRecentFiles(gamePath); // Update the list.
|
AddRecentFiles(action->text()); // Update the list.
|
||||||
Core::Emulator emulator;
|
Core::Emulator emulator;
|
||||||
if (!std::filesystem::exists(gamePath.toUtf8().constData())) {
|
if (!std::filesystem::exists(gamePath)) {
|
||||||
QMessageBox::critical(nullptr, tr("Run Game"), QString(tr("Eboot.bin file not found")));
|
QMessageBox::critical(nullptr, tr("Run Game"), QString(tr("Eboot.bin file not found")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emulator.Run(gamePath.toUtf8().constData());
|
emulator.Run(gamePath);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,11 +110,11 @@ void TriggerCapture() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetOutputDir(const std::string& path, const std::string& prefix) {
|
void SetOutputDir(const std::filesystem::path& path, const std::string& prefix) {
|
||||||
if (!rdoc_api) {
|
if (!rdoc_api) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rdoc_api->SetCaptureFilePathTemplate((path + '\\' + prefix).c_str());
|
rdoc_api->SetCaptureFilePathTemplate(fmt::UTF((path / prefix).u8string()).data.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace VideoCore
|
} // namespace VideoCore
|
||||||
|
@ -20,6 +20,6 @@ void EndCapture();
|
|||||||
void TriggerCapture();
|
void TriggerCapture();
|
||||||
|
|
||||||
/// Sets output directory for captures
|
/// Sets output directory for captures
|
||||||
void SetOutputDir(const std::string& path, const std::string& prefix);
|
void SetOutputDir(const std::filesystem::path& path, const std::string& prefix);
|
||||||
|
|
||||||
} // namespace VideoCore
|
} // namespace VideoCore
|
||||||
|
Loading…
Reference in New Issue
Block a user