mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-03 06:38:46 +00:00
Add some more logging
This commit is contained in:
parent
62077b654f
commit
b58b9a251f
2 changed files with 15 additions and 4 deletions
|
@ -205,9 +205,9 @@ public:
|
||||||
return WriteSpan(string);
|
return WriteSpan(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteBytes(const std::filesystem::path path, std::span<const u8> data) {
|
static size_t WriteBytes(const std::filesystem::path path, std::span<const u8> data) {
|
||||||
IOFile out(path, FileAccessMode::Write);
|
IOFile out(path, FileAccessMode::Write);
|
||||||
out.Write(data);
|
return out.Write(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -12,6 +12,7 @@ void TRP::GetNPcommID(const std::filesystem::path& trophyPath, int index) {
|
||||||
std::filesystem::path trpPath = trophyPath / "sce_sys/npbind.dat";
|
std::filesystem::path trpPath = trophyPath / "sce_sys/npbind.dat";
|
||||||
Common::FS::IOFile npbindFile(trpPath, Common::FS::FileAccessMode::Read);
|
Common::FS::IOFile npbindFile(trpPath, Common::FS::FileAccessMode::Read);
|
||||||
if (!npbindFile.IsOpen()) {
|
if (!npbindFile.IsOpen()) {
|
||||||
|
LOG_CRITICAL(Common_Filesystem, "Failed to open npbind.dat file");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!npbindFile.Seek(0x84 + (index * 0x180))) {
|
if (!npbindFile.Seek(0x84 + (index * 0x180))) {
|
||||||
|
@ -36,6 +37,7 @@ bool TRP::Extract(const std::filesystem::path& trophyPath) {
|
||||||
std::filesystem::path title = trophyPath.filename();
|
std::filesystem::path title = trophyPath.filename();
|
||||||
std::filesystem::path gameSysDir = trophyPath / "sce_sys/trophy/";
|
std::filesystem::path gameSysDir = trophyPath / "sce_sys/trophy/";
|
||||||
if (!std::filesystem::exists(gameSysDir)) {
|
if (!std::filesystem::exists(gameSysDir)) {
|
||||||
|
LOG_CRITICAL(Common_Filesystem, "Game sce_sys directory doesn't exist");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int index = 0; const auto& it : std::filesystem::directory_iterator(gameSysDir)) {
|
for (int index = 0; const auto& it : std::filesystem::directory_iterator(gameSysDir)) {
|
||||||
|
@ -44,13 +46,16 @@ bool TRP::Extract(const std::filesystem::path& trophyPath) {
|
||||||
|
|
||||||
Common::FS::IOFile file(it.path(), Common::FS::FileAccessMode::Read);
|
Common::FS::IOFile file(it.path(), Common::FS::FileAccessMode::Read);
|
||||||
if (!file.IsOpen()) {
|
if (!file.IsOpen()) {
|
||||||
|
LOG_CRITICAL(Common_Filesystem, "Unable to open trophy file for read");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TrpHeader header;
|
TrpHeader header;
|
||||||
file.Read(header);
|
file.Read(header);
|
||||||
if (header.magic != 0xDCA24D00)
|
if (header.magic != 0xDCA24D00) {
|
||||||
|
LOG_CRITICAL(Common_Filesystem, "Wrong trophy magic number");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
s64 seekPos = sizeof(TrpHeader);
|
s64 seekPos = sizeof(TrpHeader);
|
||||||
std::filesystem::path trpFilesPath(
|
std::filesystem::path trpFilesPath(
|
||||||
|
@ -99,7 +104,13 @@ bool TRP::Extract(const std::filesystem::path& trophyPath) {
|
||||||
size_t pos = xml_name.find("ESFM");
|
size_t pos = xml_name.find("ESFM");
|
||||||
if (pos != std::string::npos)
|
if (pos != std::string::npos)
|
||||||
xml_name.replace(pos, xml_name.length(), "XML");
|
xml_name.replace(pos, xml_name.length(), "XML");
|
||||||
Common::FS::IOFile::WriteBytes(trpFilesPath / "Xml" / xml_name, XML);
|
size_t written =
|
||||||
|
Common::FS::IOFile::WriteBytes(trpFilesPath / "Xml" / xml_name, XML);
|
||||||
|
if (written != XML.size()) {
|
||||||
|
LOG_CRITICAL(Common_Filesystem,
|
||||||
|
"Trophy XML write failed, wanted to write {} bytes, wrote {}",
|
||||||
|
XML.size(), written);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue