3
0
Fork 0
forked from suyu/suyu

misc: Commented out build id

This commit is contained in:
Akatsuki Levi 2024-03-15 16:36:36 -03:00 committed by Levi Akatsuki
parent 748bda79aa
commit 09c26cac1c
3 changed files with 25 additions and 19 deletions

View file

@ -47,10 +47,12 @@
ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::string& file_name, ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::string& file_name,
std::vector<VkDeviceInfo::Record>& vk_device_records, std::vector<VkDeviceInfo::Record>& vk_device_records,
Core::System& system_) Core::System& system_)
: QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()), title_id{title_id_}, : QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()),
system{system_}, pm{title_id_, system_.GetFileSystemController(), system_.GetContentProvider()},
title_id{title_id_}, system{system_},
builder{std::make_unique<ConfigurationShared::Builder>(this, !system_.IsPoweredOn())}, builder{std::make_unique<ConfigurationShared::Builder>(this, !system_.IsPoweredOn())},
tab_group{std::make_shared<std::vector<ConfigurationShared::Tab*>>()} { tab_group{std::make_shared<std::vector<ConfigurationShared::Tab*>>()} {
const auto file_path = std::filesystem::path(Common::FS::ToU8String(file_name)); 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()) const auto config_file_name = title_id == 0 ? Common::FS::PathToUTF8String(file_path.filename())
: fmt::format("{:016X}", title_id); : fmt::format("{:016X}", title_id);
@ -144,6 +146,14 @@ void ConfigurePerGame::LoadFromFile(FileSys::VirtualFile file_) {
LoadConfiguration(); 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() { void ConfigurePerGame::LoadConfiguration() {
if (file == nullptr) { if (file == nullptr) {
return; return;
@ -151,23 +161,14 @@ void ConfigurePerGame::LoadConfiguration() {
addons_tab->LoadFromFile(file); addons_tab->LoadFromFile(file);
const auto control = pm.GetControlMetadata();
const auto loader = Loader::GetLoader(system, file);
ui->display_title_id->setText( ui->display_title_id->setText(
QStringLiteral("%1").arg(title_id, 16, 16, QLatin1Char{'0'}).toUpper()); QStringLiteral("%1").arg(title_id, 16, 16, QLatin1Char{'0'}).toUpper());
Loader::NSOHeader nso_header{}; // TODO: Should get proper build id for UI
if (sizeof(Loader::NSOHeader) != file->ReadObject(&nso_header)) { // ui->display_build_id->setText(QString::fromStdString(GetBuildID()));
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);
if (control.first != nullptr) { if (control.first != nullptr) {
ui->display_version->setText(QString::fromStdString(control.first->GetVersionString())); ui->display_version->setText(QString::fromStdString(control.first->GetVersionString()));

View file

@ -11,6 +11,7 @@
#include <QList> #include <QList>
#include "configuration/shared_widget.h" #include "configuration/shared_widget.h"
#include "core/file_sys/patch_manager.h"
#include "core/file_sys/vfs/vfs_types.h" #include "core/file_sys/vfs/vfs_types.h"
#include "frontend_common/config.h" #include "frontend_common/config.h"
#include "suyu/configuration/configuration_shared.h" #include "suyu/configuration/configuration_shared.h"
@ -68,8 +69,11 @@ private:
void LoadConfiguration(); void LoadConfiguration();
std::string GetBuildID();
std::unique_ptr<Ui::ConfigurePerGame> ui; std::unique_ptr<Ui::ConfigurePerGame> ui;
FileSys::VirtualFile file; FileSys::VirtualFile file;
FileSys::PatchManager pm;
u64 title_id; u64 title_id;
QGraphicsScene* scene; QGraphicsScene* scene;

View file

@ -185,8 +185,9 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <!-- TODO: Gotta implement proper working build id -->
<!--item row="5" column="1">
<widget class="QLineEdit" name="display_build_id"> <widget class="QLineEdit" name="display_build_id">
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
@ -199,7 +200,7 @@
<string>Build ID</string> <string>Build ID</string>
</property> </property>
</widget> </widget>
</item> </item-->
</layout> </layout>
</item> </item>
<item> <item>