summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-12-04 19:34:46 +0100
committerZach Hilman <zachhilman@gmail.com>2018-12-04 19:34:50 +0100
commitf6f65035785479934ddd443a9236ec142b7a0ed6 (patch)
tree907ea82eefbe73ace97e2feb1d5dc88158885b01
parentqt: Add UI to display game properties and disable add-ons (diff)
downloadyuzu-f6f65035785479934ddd443a9236ec142b7a0ed6.tar
yuzu-f6f65035785479934ddd443a9236ec142b7a0ed6.tar.gz
yuzu-f6f65035785479934ddd443a9236ec142b7a0ed6.tar.bz2
yuzu-f6f65035785479934ddd443a9236ec142b7a0ed6.tar.lz
yuzu-f6f65035785479934ddd443a9236ec142b7a0ed6.tar.xz
yuzu-f6f65035785479934ddd443a9236ec142b7a0ed6.tar.zst
yuzu-f6f65035785479934ddd443a9236ec142b7a0ed6.zip
-rw-r--r--src/yuzu/configuration/config.cpp2
-rw-r--r--src/yuzu/configuration/configure_per_general.cpp18
-rw-r--r--src/yuzu/configuration/configure_per_general.h18
-rw-r--r--src/yuzu/game_list.cpp3
-rw-r--r--src/yuzu/game_list.h1
-rw-r--r--src/yuzu/game_list_worker.cpp2
-rw-r--r--src/yuzu/main.cpp29
-rw-r--r--src/yuzu/main.h1
-rw-r--r--src/yuzu_cmd/default_ini.h2
9 files changed, 54 insertions, 22 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 4d4bd2a46..97a1633b0 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -669,7 +669,7 @@ void Config::SaveValues() {
int i = 0;
for (const auto& elem : Settings::values.disabled_addons) {
qt_config->setArrayIndex(i);
- qt_config->setValue("title_id", elem.first);
+ qt_config->setValue("title_id", QVariant::fromValue<u64>(elem.first));
qt_config->beginWriteArray("disabled");
for (std::size_t j = 0; j < elem.second.size(); ++j) {
qt_config->setArrayIndex(j);
diff --git a/src/yuzu/configuration/configure_per_general.cpp b/src/yuzu/configuration/configure_per_general.cpp
index ed85f84a9..80109b434 100644
--- a/src/yuzu/configuration/configure_per_general.cpp
+++ b/src/yuzu/configuration/configure_per_general.cpp
@@ -5,24 +5,27 @@
#include <algorithm>
#include <memory>
#include <utility>
+
+#include <QHeaderView>
#include <QMenu>
#include <QMessageBox>
#include <QStandardItemModel>
#include <QString>
#include <QTimer>
#include <QTreeView>
-#include "common/param_package.h"
+
#include "core/file_sys/control_metadata.h"
#include "core/file_sys/patch_manager.h"
#include "core/file_sys/xts_archive.h"
#include "core/loader/loader.h"
-#include "input_common/main.h"
+#include "ui_configure_per_general.h"
#include "yuzu/configuration/config.h"
#include "yuzu/configuration/configure_input.h"
#include "yuzu/configuration/configure_per_general.h"
#include "yuzu/ui_settings.h"
+#include "yuzu/util/util.h"
-ConfigurePerGameGeneral::ConfigurePerGameGeneral(u64 title_id, QWidget* parent)
+ConfigurePerGameGeneral::ConfigurePerGameGeneral(QWidget* parent, u64 title_id)
: QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGameGeneral>()), title_id(title_id) {
ui->setupUi(this);
@@ -61,11 +64,13 @@ ConfigurePerGameGeneral::ConfigurePerGameGeneral(u64 title_id, QWidget* parent)
ui->icon_view->setScene(scene);
connect(item_model, &QStandardItemModel::itemChanged,
- [&]() { UISettings::values.is_game_list_reload_pending.exchange(true); });
+ [] { UISettings::values.is_game_list_reload_pending.exchange(true); });
this->loadConfiguration();
}
+ConfigurePerGameGeneral::~ConfigurePerGameGeneral() = default;
+
void ConfigurePerGameGeneral::applyConfiguration() {
std::vector<std::string> disabled_addons;
@@ -107,7 +112,7 @@ void ConfigurePerGameGeneral::loadConfiguration() {
if (loader->ReadDeveloper(developer) == Loader::ResultStatus::Success)
ui->display_developer->setText(QString::fromStdString(developer));
- ui->display_version->setText("1.0.0");
+ ui->display_version->setText(QStringLiteral("1.0.0"));
}
if (control.second != nullptr) {
@@ -160,7 +165,6 @@ void ConfigurePerGameGeneral::loadConfiguration() {
ui->display_format->setText(
QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())));
- QLocale locale = this->locale();
- QString valueText = locale.formattedDataSize(file->GetSize());
+ const auto valueText = ReadableByteSize(file->GetSize());
ui->display_size->setText(valueText);
}
diff --git a/src/yuzu/configuration/configure_per_general.h b/src/yuzu/configuration/configure_per_general.h
index 5f958bbba..a4494446c 100644
--- a/src/yuzu/configuration/configure_per_general.h
+++ b/src/yuzu/configuration/configure_per_general.h
@@ -4,21 +4,14 @@
#pragma once
-#include <array>
-#include <functional>
#include <memory>
-#include <string>
-#include <unordered_map>
+#include <vector>
+
#include <QKeyEvent>
#include <QList>
#include <QWidget>
-#include <boost/optional.hpp>
-#include "common/param_package.h"
-#include "core/file_sys/vfs.h"
-#include "core/settings.h"
-#include "input_common/main.h"
-#include "ui_configure_per_general.h"
-#include "yuzu/configuration/config.h"
+
+#include "core/file_sys/vfs_types.h"
class QTreeView;
class QGraphicsScene;
@@ -33,7 +26,8 @@ class ConfigurePerGameGeneral : public QDialog {
Q_OBJECT
public:
- explicit ConfigurePerGameGeneral(u64 title_id, QWidget* parent = nullptr);
+ explicit ConfigurePerGameGeneral(QWidget* parent, u64 title_id);
+ ~ConfigurePerGameGeneral() override;
/// Save all button configurations to settings file
void applyConfiguration();
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index b52a50915..8e9524fd6 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -333,6 +333,8 @@ void GameList::PopupContextMenu(const QPoint& menu_location) {
QAction* dump_romfs = context_menu.addAction(tr("Dump RomFS"));
QAction* copy_tid = context_menu.addAction(tr("Copy Title ID to Clipboard"));
QAction* navigate_to_gamedb_entry = context_menu.addAction(tr("Navigate to GameDB entry"));
+ context_menu.addSeparator();
+ QAction* properties = context_menu.addAction(tr("Properties"));
open_save_location->setEnabled(program_id != 0);
auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id);
@@ -346,6 +348,7 @@ void GameList::PopupContextMenu(const QPoint& menu_location) {
connect(copy_tid, &QAction::triggered, [&]() { emit CopyTIDRequested(program_id); });
connect(navigate_to_gamedb_entry, &QAction::triggered,
[&]() { emit NavigateToGamedbEntryRequested(program_id, compatibility_list); });
+ connect(properties, &QAction::triggered, [&]() { emit OpenPerGameGeneralRequested(path); });
context_menu.exec(tree_view->viewport()->mapToGlobal(menu_location));
}
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index 05e115e19..b317eb2fc 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -70,6 +70,7 @@ signals:
void CopyTIDRequested(u64 program_id);
void NavigateToGamedbEntryRequested(u64 program_id,
const CompatibilityList& compatibility_list);
+ void OpenPerGameGeneralRequested(const std::string& file);
private slots:
void onTextChanged(const QString& newText);
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp
index 1edc60df7..553269269 100644
--- a/src/yuzu/game_list_worker.cpp
+++ b/src/yuzu/game_list_worker.cpp
@@ -62,7 +62,7 @@ QString FormatPatchNameVersions(const FileSys::PatchManager& patch_manager,
FileSys::VirtualFile update_raw;
loader.ReadUpdateRaw(update_raw);
for (const auto& kv : patch_manager.GetPatchVersionNames(update_raw)) {
- const bool is_update = kv.first == "Update";
+ const bool is_update = kv.first == "Update" || kv.first == "[D] Update";
if (!updatable && is_update) {
continue;
}
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 22c207a3a..90b212ba5 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -9,6 +9,7 @@
// VFS includes must be before glad as they will conflict with Windows file api, which uses defines.
#include "applets/software_keyboard.h"
+#include "configuration/configure_per_general.h"
#include "core/file_sys/vfs.h"
#include "core/file_sys/vfs_real.h"
#include "core/hle/service/acc/profile_manager.h"
@@ -441,6 +442,8 @@ void GMainWindow::ConnectWidgetEvents() {
connect(game_list, &GameList::CopyTIDRequested, this, &GMainWindow::OnGameListCopyTID);
connect(game_list, &GameList::NavigateToGamedbEntryRequested, this,
&GMainWindow::OnGameListNavigateToGamedbEntry);
+ connect(game_list, &GameList::OpenPerGameGeneralRequested, this,
+ &GMainWindow::OnGameListOpenPerGameProperties);
connect(this, &GMainWindow::EmulationStarting, render_window,
&GRenderWindow::OnEmulationStarting);
@@ -988,6 +991,32 @@ void GMainWindow::OnGameListNavigateToGamedbEntry(u64 program_id,
QDesktopServices::openUrl(QUrl("https://yuzu-emu.org/game/" + directory));
}
+void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) {
+ u64 title_id{};
+ const auto v_file = Core::GetGameFileFromPath(vfs, file);
+ const auto loader = Loader::GetLoader(v_file);
+ if (loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) {
+ QMessageBox::information(this, tr("Properties"),
+ tr("The game properties could not be loaded."));
+ return;
+ }
+
+ ConfigurePerGameGeneral dialog(this, title_id);
+ dialog.loadFromFile(v_file);
+ auto result = dialog.exec();
+ if (result == QDialog::Accepted) {
+ dialog.applyConfiguration();
+
+ const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false);
+ if (reload) {
+ game_list->PopulateAsync(UISettings::values.gamedir,
+ UISettings::values.gamedir_deepscan);
+ }
+
+ config->Save();
+ }
+}
+
void GMainWindow::OnMenuLoadFile() {
const QString extensions =
QString("*.").append(GameList::supported_file_extensions.join(" *.")).append(" main");
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 674e73412..ca9c50367 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -168,6 +168,7 @@ private slots:
void OnGameListCopyTID(u64 program_id);
void OnGameListNavigateToGamedbEntry(u64 program_id,
const CompatibilityList& compatibility_list);
+ void OnGameListOpenPerGameProperties(const std::string& file);
void OnMenuLoadFile();
void OnMenuLoadFolder();
void OnMenuInstallToNAND();
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h
index 25236d05d..0f3f8da50 100644
--- a/src/yuzu_cmd/default_ini.h
+++ b/src/yuzu_cmd/default_ini.h
@@ -225,7 +225,7 @@ yuzu_token =
[AddOns]
# Used to disable add-ons
# List of title IDs of games that will have add-ons disabled (separated by '|'):
-title_ids =
+title_ids =
# For each title ID, have a key/value pair called `disabled_<title_id>` equal to the names of the add-ons to disable (sep. by '|')
# e.x. disabled_0100000000010000 = Update|DLC <- disables Updates and DLC on Super Mario Odyssey
)";