SaveLib PR related fixes (#1011)

* Safety checks in all SFO readings

* SaveData: log backup error and continue & fix possible concurrent file editing

* SaveData: Fix issue with old firmwares
This commit is contained in:
Vinicius Rangel 2024-09-22 02:16:06 -03:00 committed by GitHub
parent edde0a3e7e
commit 581ddfec4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 163 additions and 74 deletions

View file

@ -32,16 +32,31 @@ public:
QString iconpath = QString::fromStdString(game.icon_path);
game.icon = QImage(iconpath);
game.pic_path = game.path + "/sce_sys/pic1.png";
game.name = *psf.GetString("TITLE");
game.serial = *psf.GetString("TITLE_ID");
game.region =
GameListUtils::GetRegion(psf.GetString("CONTENT_ID")->at(0)).toStdString();
u32 fw_int = *psf.GetInteger("SYSTEM_VER");
QString fw = QString::number(fw_int, 16);
QString fw_ = fw.length() > 7 ? QString::number(fw_int, 16).left(3).insert(2, '.')
: fw.left(3).insert(1, '.');
game.fw = (fw_int == 0) ? "0.00" : fw_.toStdString();
game.version = *psf.GetString("APP_VER");
if (const auto title = psf.GetString("TITLE"); title.has_value()) {
game.name = *title;
}
if (const auto title_id = psf.GetString("TITLE_ID"); title_id.has_value()) {
game.serial = *title_id;
}
if (const auto content_id = psf.GetString("CONTENT_ID");
content_id.has_value() && !content_id->empty()) {
game.region = GameListUtils::GetRegion(content_id->at(0)).toStdString();
}
if (const auto fw_int_opt = psf.GetInteger("SYSTEM_VER"); fw_int_opt.has_value()) {
auto fw_int = *fw_int_opt;
if (fw_int == 0) {
game.fw = "0.00";
} else {
QString fw = QString::number(fw_int, 16);
QString fw_ = fw.length() > 7
? QString::number(fw_int, 16).left(3).insert(2, '.')
: fw.left(3).insert(1, '.');
game.fw = fw_.toStdString();
}
}
if (auto app_ver = psf.GetString("APP_VER"); app_ver.has_value()) {
game.version = *app_ver;
}
}
return game;
}