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); 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 // Read the seed
std::array<u8, 16> seed; std::array<u8, 16> seed;
if (!file.Seek(pkgheader.pfs_image_offset + 0x370)) { 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) { bool TRP::Extract(const std::filesystem::path& trophyPath, const std::string titleId) {
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)) {
return false; return false;
@ -54,8 +53,8 @@ bool TRP::Extract(const std::filesystem::path& trophyPath) {
s64 seekPos = sizeof(TrpHeader); s64 seekPos = sizeof(TrpHeader);
std::filesystem::path trpFilesPath( std::filesystem::path trpFilesPath(
Common::FS::GetUserPath(Common::FS::PathType::MetaDataDir) / title / "TrophyFiles" / Common::FS::GetUserPath(Common::FS::PathType::MetaDataDir) / titleId /
it.path().stem()); "TrophyFiles" / it.path().stem());
std::filesystem::create_directories(trpFilesPath / "Icons"); std::filesystem::create_directories(trpFilesPath / "Icons");
std::filesystem::create_directory(trpFilesPath / "Xml"); std::filesystem::create_directory(trpFilesPath / "Xml");

View file

@ -33,7 +33,7 @@ class TRP {
public: public:
TRP(); TRP();
~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); void GetNPcommID(const std::filesystem::path& trophyPath, int index);
private: private:

View file

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

View file

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