shadPS4/src/qt_gui/game_info.h
Vinicius Rangel 0f4bcd8c83
Rewrite Save Data & Impl Save Data Dialog (#824)
* core: Rewrite PSF parser & add encoder

add .sfo hex pattern to /scripts

* core/fs: allow to mount path as read-only

* common: Add CString wrapper to handle native null-terminated strings

* SaveData: rewrite to implement full functionality

* mock value for SYSTEM_VER

* SavaData: backup features

* SavaData: SaveDataMemory features

* imgui Ref-counted textures

- has a background thread to decode textures

* imgui: rework gamepad navigation

* PSF: fixed psf not using enum class for PSFEntryFmt (was a standard old ugly enum)

- Add null check to CString when itself is used in a nullable field

* SaveDataDialog implementation

- Fix Mounting/Unmounting check of SaveInstance
2024-09-20 12:34:19 +03:00

48 lines
1.6 KiB
C++

// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QFutureWatcher>
#include <QtConcurrent>
#include "common/config.h"
#include "core/file_format/psf.h"
#include "game_list_utils.h"
class GameInfoClass : public QObject {
Q_OBJECT
public:
GameInfoClass();
~GameInfoClass();
void GetGameInfo(QWidget* parent = nullptr);
QVector<GameInfo> m_games;
static bool CompareStrings(GameInfo& a, GameInfo& b) {
return a.name < b.name;
}
static GameInfo readGameInfo(const std::string& filePath) {
GameInfo game;
game.path = filePath;
PSF psf;
if (psf.Open(std::filesystem::path(game.path) / "sce_sys" / "param.sfo")) {
game.icon_path = game.path + "/sce_sys/icon0.png";
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");
}
return game;
}
};