trp data extracts to game_data/serial instead of folder name (#1194)

* trp data extracts to game_data/serial instead of folder name

* format
This commit is contained in:
CrazyBloo 2024-10-01 23:37:43 -04:00 committed by GitHub
parent e68774d449
commit 61f750bdd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 6 additions and 13 deletions

View File

@ -249,12 +249,6 @@ bool PKG::Extract(const std::filesystem::path& filepath, const std::filesystem::
file.Seek(currentPos);
}
// Extract trophy files
if (!trp.Extract(extract_path)) {
// Do nothing some pkg come with no trp file.
// return false;
}
// Read the seed
std::array<u8, 16> seed;
if (!file.Seek(pkgheader.pfs_image_offset + 0x370)) {

View File

@ -32,8 +32,7 @@ static void removePadding(std::vector<u8>& vec) {
}
}
bool TRP::Extract(const std::filesystem::path& trophyPath) {
std::filesystem::path title = trophyPath.filename();
bool TRP::Extract(const std::filesystem::path& trophyPath, const std::string titleId) {
std::filesystem::path gameSysDir = trophyPath / "sce_sys/trophy/";
if (!std::filesystem::exists(gameSysDir)) {
return false;
@ -54,8 +53,8 @@ bool TRP::Extract(const std::filesystem::path& trophyPath) {
s64 seekPos = sizeof(TrpHeader);
std::filesystem::path trpFilesPath(
Common::FS::GetUserPath(Common::FS::PathType::MetaDataDir) / title / "TrophyFiles" /
it.path().stem());
Common::FS::GetUserPath(Common::FS::PathType::MetaDataDir) / titleId /
"TrophyFiles" / it.path().stem());
std::filesystem::create_directories(trpFilesPath / "Icons");
std::filesystem::create_directory(trpFilesPath / "Xml");

View File

@ -33,7 +33,7 @@ class TRP {
public:
TRP();
~TRP();
bool Extract(const std::filesystem::path& trophyPath);
bool Extract(const std::filesystem::path& trophyPath, const std::string titleId);
void GetNPcommID(const std::filesystem::path& trophyPath, int index);
private:

View File

@ -115,7 +115,7 @@ void Emulator::Run(const std::filesystem::path& file) {
Common::FS::GetUserPath(Common::FS::PathType::MetaDataDir) / id / "TrophyFiles";
if (!std::filesystem::exists(trophyDir)) {
TRP trp;
if (!trp.Extract(file.parent_path())) {
if (!trp.Extract(file.parent_path(), id)) {
LOG_ERROR(Loader, "Couldn't extract trophies");
}
}

View File

@ -29,7 +29,7 @@ void TrophyViewer::PopulateTrophyWidget(QString title) {
QDir dir(trophyDirQt);
if (!dir.exists()) {
std::filesystem::path path = Common::FS::PathFromQString(gameTrpPath_);
if (!trp.Extract(path))
if (!trp.Extract(path, title.toStdString()))
return;
}
QFileInfoList dirList = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);