From c33ccfaa71d9283f71a820e20ba4dfc99d9e0c6f Mon Sep 17 00:00:00 2001 From: Akatsuki Levi Date: Fri, 15 Mar 2024 16:36:36 -0300 Subject: [PATCH] misc: Commented out build id --- src/suyu/configuration/configure_per_game.cpp | 33 ++++++++++--------- src/suyu/configuration/configure_per_game.h | 4 +++ src/suyu/configuration/configure_per_game.ui | 7 ++-- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/suyu/configuration/configure_per_game.cpp b/src/suyu/configuration/configure_per_game.cpp index 98d881fea6..7caff1035b 100644 --- a/src/suyu/configuration/configure_per_game.cpp +++ b/src/suyu/configuration/configure_per_game.cpp @@ -47,10 +47,12 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::string& file_name, std::vector& vk_device_records, Core::System& system_) - : QDialog(parent), ui(std::make_unique()), title_id{title_id_}, - system{system_}, + : QDialog(parent), ui(std::make_unique()), + pm{title_id_, system_.GetFileSystemController(), system_.GetContentProvider()}, + title_id{title_id_}, system{system_}, builder{std::make_unique(this, !system_.IsPoweredOn())}, tab_group{std::make_shared>()} { + const auto file_path = std::filesystem::path(Common::FS::ToU8String(file_name)); const auto config_file_name = title_id == 0 ? Common::FS::PathToUTF8String(file_path.filename()) : fmt::format("{:016X}", title_id); @@ -144,6 +146,14 @@ void ConfigurePerGame::LoadFromFile(FileSys::VirtualFile file_) { LoadConfiguration(); } +std::string ConfigurePerGame::GetBuildID() { + LOG_INFO(Core, "{}", file->GetExtension()); + + // https://github.com/Ryujinx/Ryujinx/blob/master/src/Ryujinx.UI.Common/App/ApplicationData.cs#L71 + + return "Invalid File"; +} + void ConfigurePerGame::LoadConfiguration() { if (file == nullptr) { return; @@ -151,23 +161,14 @@ void ConfigurePerGame::LoadConfiguration() { addons_tab->LoadFromFile(file); + const auto control = pm.GetControlMetadata(); + const auto loader = Loader::GetLoader(system, file); + ui->display_title_id->setText( QStringLiteral("%1").arg(title_id, 16, 16, QLatin1Char{'0'}).toUpper()); - Loader::NSOHeader nso_header{}; - if (sizeof(Loader::NSOHeader) != file->ReadObject(&nso_header)) { - LOG_ERROR(Core, "Could not read header for file {}", file->GetFullPath()); - return; - } - - const auto build_id_raw = Common::HexToString(nso_header.build_id); - const auto build_id = build_id_raw.substr(0, build_id_raw.find_last_not_of('0') + 1); - ui->display_build_id->setText(QString::fromStdString(build_id)); - - const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), - system.GetContentProvider()}; - const auto control = pm.GetControlMetadata(); - const auto loader = Loader::GetLoader(system, file); + // TODO: Should get proper build id for UI + // ui->display_build_id->setText(QString::fromStdString(GetBuildID())); if (control.first != nullptr) { ui->display_version->setText(QString::fromStdString(control.first->GetVersionString())); diff --git a/src/suyu/configuration/configure_per_game.h b/src/suyu/configuration/configure_per_game.h index 3fa03b1d88..7e1aff28db 100644 --- a/src/suyu/configuration/configure_per_game.h +++ b/src/suyu/configuration/configure_per_game.h @@ -11,6 +11,7 @@ #include #include "configuration/shared_widget.h" +#include "core/file_sys/patch_manager.h" #include "core/file_sys/vfs/vfs_types.h" #include "frontend_common/config.h" #include "suyu/configuration/configuration_shared.h" @@ -68,8 +69,11 @@ private: void LoadConfiguration(); + std::string GetBuildID(); + std::unique_ptr ui; FileSys::VirtualFile file; + FileSys::PatchManager pm; u64 title_id; QGraphicsScene* scene; diff --git a/src/suyu/configuration/configure_per_game.ui b/src/suyu/configuration/configure_per_game.ui index a57e9a3527..712705e082 100644 --- a/src/suyu/configuration/configure_per_game.ui +++ b/src/suyu/configuration/configure_per_game.ui @@ -185,8 +185,9 @@ true - - + + +