Use icons, music and background images of updates if available (#3494)

* Update game_info.h

* fix clang game_info.h

* SceUpdateChecker game_info.h

* fix clang game_info.h

* fix clang(darn you space) game_info.h

* there was another space... game_info.h

* Update game_info.h

* fix clang game_info.h
This commit is contained in:
UltraDaCat
2025-09-02 03:18:30 +02:00
committed by GitHub
parent c43ab1217d
commit d9b4618085

View File

@@ -19,6 +19,19 @@ public:
QVector<GameInfo> m_games;
QVector<GameInfo> m_games_backup;
static void SceUpdateChecker(const std::string sceItem, std::filesystem::path& gameItem,
std::filesystem::path& update_folder,
std::filesystem::path& patch_folder,
std::filesystem::path& game_folder) {
if (std::filesystem::exists(update_folder / "sce_sys" / sceItem)) {
gameItem = update_folder / "sce_sys" / sceItem;
} else if (std::filesystem::exists(patch_folder / "sce_sys" / sceItem)) {
gameItem = patch_folder / "sce_sys" / sceItem;
} else {
gameItem = game_folder / "sce_sys" / sceItem;
}
}
static bool CompareStrings(GameInfo& a, GameInfo& b) {
std::string name_a = a.name, name_b = b.name;
std::transform(name_a.begin(), name_a.end(), name_a.begin(), ::tolower);
@@ -29,27 +42,24 @@ public:
static GameInfo readGameInfo(const std::filesystem::path& filePath) {
GameInfo game;
game.path = filePath;
std::filesystem::path sce_folder_path = filePath / "sce_sys" / "param.sfo";
std::filesystem::path param_sfo_path;
std::filesystem::path game_update_path = filePath;
game_update_path += "-UPDATE";
if (std::filesystem::exists(game_update_path / "sce_sys" / "param.sfo")) {
sce_folder_path = game_update_path / "sce_sys" / "param.sfo";
} else {
game_update_path = filePath;
game_update_path += "-patch";
if (std::filesystem::exists(game_update_path / "sce_sys" / "param.sfo")) {
sce_folder_path = game_update_path / "sce_sys" / "param.sfo";
}
}
std::filesystem::path game_patch_path = filePath;
game_patch_path += "-patch";
SceUpdateChecker("param.sfo", param_sfo_path, game_update_path, game_patch_path, game.path);
PSF psf;
if (psf.Open(sce_folder_path)) {
game.icon_path = game.path / "sce_sys" / "icon0.png";
if (psf.Open(param_sfo_path)) {
SceUpdateChecker("icon0.png", game.icon_path, game_update_path, game_patch_path,
game.path);
QString iconpath;
Common::FS::PathToQString(iconpath, game.icon_path);
game.icon = QImage(iconpath);
game.pic_path = game.path / "sce_sys" / "pic1.png";
game.snd0_path = game.path / "sce_sys" / "snd0.at9";
SceUpdateChecker("pic1.png", game.pic_path, game_update_path, game_patch_path,
game.path);
SceUpdateChecker("snd0.at9", game.snd0_path, game_update_path, game_patch_path,
game.path);
if (const auto title = psf.GetString("TITLE"); title.has_value()) {
game.name = *title;