1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

Log PSF path on error

This commit is contained in:
Megamouse 2022-11-27 08:59:57 +01:00
parent 49a968219f
commit 5dbadccd7f
10 changed files with 35 additions and 31 deletions

View File

@ -553,7 +553,7 @@ bool package_reader::read_param_sfo()
tmp.seek(0);
m_psf = psf::load_object(tmp);
m_psf = psf::load_object(tmp, name);
if (m_psf.empty())
{
@ -610,7 +610,8 @@ package_error package_reader::check_target_app_version() const
return package_error::no_error;
}
const fs::file installed_sfo_file(rpcs3::utils::get_hdd0_dir() + "game/" + std::string(title_id) + "/PARAM.SFO");
const std::string sfo_path = rpcs3::utils::get_hdd0_dir() + "game/" + std::string(title_id) + "/PARAM.SFO";
const fs::file installed_sfo_file(sfo_path);
if (!installed_sfo_file)
{
if (!target_app_ver.empty())
@ -624,7 +625,7 @@ package_error package_reader::check_target_app_version() const
return package_error::no_error;
}
const auto installed_psf = psf::load_object(installed_sfo_file);
const auto installed_psf = psf::load_object(installed_sfo_file, sfo_path);
const auto installed_title_id = psf::get_string(installed_psf, "TITLE_ID", "");
const auto installed_app_ver = psf::get_string(installed_psf, "APP_VER", "");

View File

@ -39,7 +39,7 @@ audio_out_configuration::audio_out_configuration()
std::vector<CellAudioOutSoundMode>& primary_modes = primary_output.sound_modes;
std::vector<CellAudioOutSoundMode>& secondary_modes = secondary_output.sound_modes;
const psf::registry sfo = psf::load_object(fs::file(Emu.GetSfoDir(true) + "/PARAM.SFO"));
const psf::registry sfo = psf::load_object(Emu.GetSfoDir(true) + "/PARAM.SFO");
const s32 sound_format = psf::get_integer(sfo, "SOUND_FORMAT", psf::sound_format_flag::lpcm_2); // Default to Linear PCM 2 Ch.
const bool supports_lpcm_2 = (sound_format & psf::sound_format_flag::lpcm_2); // Linear PCM 2 Ch.

View File

@ -415,7 +415,7 @@ error_code cellHddGameCheck(ppu_thread& ppu, u32 version, vm::cptr<char> dirName
else
{
// TODO: Is cellHddGameCheck really responsible for writing the information in get->getParam ? (If not, delete this else)
const psf::registry psf = psf::load_object(fs::file(local_dir +"/PARAM.SFO"));
const psf::registry psf = psf::load_object(local_dir + "/PARAM.SFO");
// Some following fields may be zero in old FW 1.00 version PARAM.SFO
if (psf.contains("PARENTAL_LEVEL")) get->getParam.parentalLevel = ::at32(psf, "PARENTAL_LEVEL").as_integer();
@ -670,7 +670,7 @@ error_code cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr
*attributes = 0; // TODO
// TODO: dirName might be a read only string when BootCheck is called on a disc game. (e.g. Ben 10 Ultimate Alien: Cosmic Destruction)
sfo = psf::load_object(fs::file(vfs::get("/dev_bdvd/PS3_GAME/PARAM.SFO")));
sfo = psf::load_object(vfs::get("/dev_bdvd/PS3_GAME/PARAM.SFO"));
}
else if (cat == "GD")
{
@ -679,7 +679,7 @@ error_code cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr
*type = CELL_GAME_GAMETYPE_DISC;
*attributes = CELL_GAME_ATTRIBUTE_PATCH; // TODO
sfo = psf::load_object(fs::file(vfs::get(Emu.GetDir() + "PARAM.SFO")));
sfo = psf::load_object(vfs::get(Emu.GetDir() + "PARAM.SFO"));
}
else
{
@ -688,7 +688,7 @@ error_code cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr
*type = CELL_GAME_GAMETYPE_HDD;
*attributes = 0; // TODO
sfo = psf::load_object(fs::file(vfs::get(Emu.GetDir() + "PARAM.SFO")));
sfo = psf::load_object(vfs::get(Emu.GetDir() + "PARAM.SFO"));
dir = Emu.GetTitleID();
}
@ -723,7 +723,7 @@ error_code cellGamePatchCheck(vm::ptr<CellGameContentSize> size, vm::ptr<void> r
return CELL_GAME_ERROR_NOTPATCH;
}
psf::registry sfo = psf::load_object(fs::file(vfs::get(Emu.GetDir() + "PARAM.SFO")));
psf::registry sfo = psf::load_object(vfs::get(Emu.GetDir() + "PARAM.SFO"));
auto& perm = g_fxo->get<content_permission>();
@ -1708,7 +1708,7 @@ error_code cellDiscGameGetBootDiscInfo(vm::ptr<CellDiscGameSystemFileParam> getP
return CELL_DISCGAME_ERROR_NOT_DISCBOOT;
}
const psf::registry psf = psf::load_object(fs::file(vfs::get(dir + "/PARAM.SFO")));
const psf::registry psf = psf::load_object(vfs::get(dir + "/PARAM.SFO"));
if (psf.contains("PARENTAL_LEVEL")) getParam->parentalLevel = ::at32(psf, "PARENTAL_LEVEL").as_integer();
if (psf.contains("TITLE_ID")) strcpy_trunc(getParam->titleId, ::at32(psf, "TITLE_ID").as_string());

View File

@ -228,7 +228,7 @@ static std::vector<SaveDataEntry> get_save_entries(const std::string& base_dir,
}
// PSF parameters
const psf::registry psf = psf::load_object(fs::file(base_dir + entry.name + "/PARAM.SFO"));
const psf::registry psf = psf::load_object(base_dir + entry.name + "/PARAM.SFO");
if (psf.empty())
{
@ -755,7 +755,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
listGet->dirListNum++; // number of directories in list
// PSF parameters
const psf::registry psf = psf::load_object(fs::file(base_dir + entry.name + "/PARAM.SFO"));
const psf::registry psf = psf::load_object(base_dir + entry.name + "/PARAM.SFO");
if (psf.empty())
{
@ -1372,7 +1372,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
const std::string old_path = base_dir + ".backup_" + save_entry.escaped + "/";
const std::string new_path = base_dir + ".working_" + save_entry.escaped + "/";
psf::registry psf = psf::load_object(fs::file(dir_path + "PARAM.SFO"));
psf::registry psf = psf::load_object(dir_path + "PARAM.SFO");
bool has_modified = false;
bool recreated = false;
@ -2070,7 +2070,7 @@ static NEVER_INLINE error_code savedata_get_list_item(vm::cptr<char> dirName, vm
return CELL_SAVEDATA_ERROR_NODATA;
}
const psf::registry psf = psf::load_object(fs::file(sfo));
const psf::registry psf = psf::load_object(sfo);
if (sysFileParam)
{

View File

@ -1000,10 +1000,11 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
// Load PARAM.SFO (TODO)
psf::registry _psf;
if (fs::file sfov{elf_dir + "/sce_sys/param.sfo"})
const std::string sfo_path = elf_dir + "/sce_sys/param.sfo";
if (fs::file sfov{sfo_path})
{
m_sfo_dir = elf_dir;
_psf = psf::load_object(sfov);
_psf = psf::load_object(sfov, sfo_path);
}
else
{
@ -1033,7 +1034,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
m_sfo_dir = rpcs3::utils::get_sfo_dir_from_game_path(elf_dir + "/../", m_title_id);
}
_psf = psf::load_object(fs::file(m_sfo_dir + "/PARAM.SFO"));
_psf = psf::load_object(m_sfo_dir + "/PARAM.SFO");
}
m_title = std::string(psf::get_string(_psf, "TITLE", std::string_view(m_path).substr(m_path.find_last_of(fs::delim) + 1)));
@ -1412,7 +1413,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
return game_boot_result::invalid_file_or_folder;
}
const auto game_psf = psf::load_object(fs::file{vfs::get("/dev_bdvd/PS3_GAME/PARAM.SFO")});
const auto game_psf = psf::load_object(vfs::get("/dev_bdvd/PS3_GAME/PARAM.SFO"));
const auto bdvd_title_id = psf::get_string(game_psf, "TITLE_ID");
if (m_title_id.empty())
@ -1528,7 +1529,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
// Set title to actual disc title if necessary
const std::string disc_sfo_dir = vfs::get("/dev_bdvd/PS3_GAME/PARAM.SFO");
const auto disc_psf_obj = psf::load_object(fs::file{ disc_sfo_dir });
const auto disc_psf_obj = psf::load_object(disc_sfo_dir);
// Install PKGDIR, INSDIR, PS3_EXTRA
if (!bdvd_dir.empty())
@ -2877,13 +2878,14 @@ std::set<std::string> Emulator::GetGameDirs() const
if (entry.is_directory && entry.name.starts_with(GetTitleID()))
{
const std::string sfo_dir = game_dir + entry.name + '/';
const fs::file sfo_file(sfo_dir + "PARAM.SFO");
const std::string sfo_path = sfo_dir + "PARAM.SFO";
const fs::file sfo_file(sfo_path);
if (!sfo_file)
{
continue;
}
const psf::registry psf = psf::load_object(sfo_file);
const psf::registry psf = psf::load_object(sfo_file, sfo_path);
const std::string title_id = std::string(psf::get_string(psf, "TITLE_ID", ""));
if (title_id == GetTitleID())
@ -3038,7 +3040,7 @@ game_boot_result Emulator::InsertDisc(const std::string& path)
// Double check PARAM.SFO
const std::string sfo_dir = rpcs3::utils::get_sfo_dir_from_game_path(disc_root);
const psf::registry _psf = psf::load_object(fs::file(sfo_dir + "/PARAM.SFO"));
const psf::registry _psf = psf::load_object(sfo_dir + "/PARAM.SFO");
if (_psf.empty())
{

View File

@ -308,7 +308,7 @@ namespace rpcs3::utils
if (entry.is_directory && fs::is_file(sfo_path))
{
const auto psf = psf::load_object(fs::file(sfo_path));
const auto psf = psf::load_object(sfo_path);
const auto serial = psf::get_string(psf, "TITLE_ID");
if (serial == title_id)
{
@ -321,7 +321,7 @@ namespace rpcs3::utils
return game_path + "/PS3_GAME";
}
const auto psf = psf::load_object(fs::file(game_path + "/PARAM.SFO"));
const auto psf = psf::load_object(game_path + "/PARAM.SFO");
const auto category = psf::get_string(psf, "CATEGORY");
const auto content_id = psf::get_string(psf, "CONTENT_ID");

View File

@ -157,9 +157,9 @@ namespace psf
fmt::throw_exception("Invalid format (0x%x)", m_type);
}
load_result_t load(const fs::file& stream)
load_result_t load(const fs::file& stream, std::string_view filename)
{
#define PSF_CHECK(cond, err) if (!static_cast<bool>(cond)) { if (error::err != error::stream) psf_log.error("Error loading PSF: %s%s", error::err, \
#define PSF_CHECK(cond, err) if (!static_cast<bool>(cond)) { if (error::err != error::stream) psf_log.error("Error loading PSF '%s': %s%s", filename, error::err, \
src_loc{__builtin_LINE(), __builtin_COLUMN(), __builtin_FILE(), __builtin_FUNCTION()}); \
result.clear(); \
errc = error::err; \
@ -257,7 +257,7 @@ namespace psf
load_result_t load(const std::string& filename)
{
return load(fs::file(filename));
return load(fs::file(filename), filename);
}
std::vector<u8> save_object(const psf::registry& psf, std::vector<u8>&& init)

View File

@ -88,9 +88,10 @@ namespace psf
};
// Load PSF registry from SFO binary format
load_result_t load(const fs::file&);
load_result_t load(const fs::file&, std::string_view filename);
load_result_t load(const std::string& filename);
inline registry load_object(const fs::file& f) { return load(f).sfo; }
inline registry load_object(const fs::file& f, std::string_view filename) { return load(f, filename).sfo; }
inline registry load_object(const std::string& filename) { return load(filename).sfo; }
// Convert PSF registry to SFO binary format
std::vector<u8> save_object(const registry&, std::vector<u8>&& init = std::vector<u8>{});

View File

@ -49,7 +49,7 @@ namespace disc
// Load PARAM.SFO
const std::string sfo_dir = rpcs3::utils::get_sfo_dir_from_game_path(elf_dir + "/../", "");
const psf::registry _psf = psf::load_object(fs::file(sfo_dir + "/PARAM.SFO"));
const psf::registry _psf = psf::load_object(sfo_dir + "/PARAM.SFO");
if (_psf.empty())
{

View File

@ -571,7 +571,7 @@ void game_list_frame::Refresh(const bool from_drive, const bool scroll_after)
const Localized thread_localized;
const std::string sfo_dir = rpcs3::utils::get_sfo_dir_from_game_path(dir);
const psf::registry psf = psf::load_object(fs::file(sfo_dir + "/PARAM.SFO"));
const psf::registry psf = psf::load_object(sfo_dir + "/PARAM.SFO");
const std::string_view title_id = psf::get_string(psf, "TITLE_ID", "");
if (title_id.empty())