yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

Merge pull request #6774 from lat9nq/remove-global-yuzu

yuzu qt: Remove global system instances
This commit is contained in:
Morph 2021-10-14 14:12:22 -04:00 committed by GitHub
commit b02d662980
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
75 changed files with 716 additions and 654 deletions

View File

@ -37,17 +37,14 @@ constexpr std::array<std::array<bool, 4>, 8> led_patterns{{
}}; }};
void UpdateController(Settings::ControllerType controller_type, std::size_t npad_index, void UpdateController(Settings::ControllerType controller_type, std::size_t npad_index,
bool connected) { bool connected, Core::System& system) {
Core::System& system{Core::System::GetInstance()};
if (!system.IsPoweredOn()) { if (!system.IsPoweredOn()) {
return; return;
} }
Service::SM::ServiceManager& sm = system.ServiceManager();
auto& npad = auto& npad =
sm.GetService<Service::HID::Hid>("hid") system.ServiceManager()
.GetService<Service::HID::Hid>("hid")
->GetAppletResource() ->GetAppletResource()
->GetController<Service::HID::Controller_NPad>(Service::HID::HidController::NPad); ->GetController<Service::HID::Controller_NPad>(Service::HID::HidController::NPad);
@ -79,10 +76,10 @@ bool IsControllerCompatible(Settings::ControllerType controller_type,
QtControllerSelectorDialog::QtControllerSelectorDialog( QtControllerSelectorDialog::QtControllerSelectorDialog(
QWidget* parent, Core::Frontend::ControllerParameters parameters_, QWidget* parent, Core::Frontend::ControllerParameters parameters_,
InputCommon::InputSubsystem* input_subsystem_) InputCommon::InputSubsystem* input_subsystem_, Core::System& system_)
: QDialog(parent), ui(std::make_unique<Ui::QtControllerSelectorDialog>()), : QDialog(parent), ui(std::make_unique<Ui::QtControllerSelectorDialog>()),
parameters(std::move(parameters_)), input_subsystem{input_subsystem_}, parameters(std::move(parameters_)), input_subsystem{input_subsystem_},
input_profiles(std::make_unique<InputProfiles>()) { input_profiles(std::make_unique<InputProfiles>(system_)), system{system_} {
ui->setupUi(this); ui->setupUi(this);
player_widgets = { player_widgets = {
@ -245,7 +242,7 @@ int QtControllerSelectorDialog::exec() {
void QtControllerSelectorDialog::ApplyConfiguration() { void QtControllerSelectorDialog::ApplyConfiguration() {
const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue(); const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue();
Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked()); Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked());
OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue()); OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue(), system);
Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked());
Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked());
@ -293,7 +290,7 @@ void QtControllerSelectorDialog::CallConfigureMotionTouchDialog() {
} }
void QtControllerSelectorDialog::CallConfigureInputProfileDialog() { void QtControllerSelectorDialog::CallConfigureInputProfileDialog() {
ConfigureInputProfileDialog dialog(this, input_subsystem, input_profiles.get()); ConfigureInputProfileDialog dialog(this, input_subsystem, input_profiles.get(), system);
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
Qt::WindowSystemMenuHint); Qt::WindowSystemMenuHint);
@ -533,7 +530,7 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index)
} }
// Disconnect the controller first. // Disconnect the controller first.
UpdateController(controller_type, player_index, false); UpdateController(controller_type, player_index, false, system);
player.controller_type = controller_type; player.controller_type = controller_type;
player.connected = player_connected; player.connected = player_connected;
@ -548,7 +545,7 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index)
} }
handheld.connected = player_groupboxes[player_index]->isChecked() && handheld.connected = player_groupboxes[player_index]->isChecked() &&
controller_type == Settings::ControllerType::Handheld; controller_type == Settings::ControllerType::Handheld;
UpdateController(Settings::ControllerType::Handheld, 8, handheld.connected); UpdateController(Settings::ControllerType::Handheld, 8, handheld.connected, system);
} }
if (!player.connected) { if (!player.connected) {
@ -560,7 +557,7 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index)
using namespace std::chrono_literals; using namespace std::chrono_literals;
std::this_thread::sleep_for(60ms); std::this_thread::sleep_for(60ms);
UpdateController(controller_type, player_index, player_connected); UpdateController(controller_type, player_index, player_connected, system);
} }
void QtControllerSelectorDialog::UpdateLEDPattern(std::size_t player_index) { void QtControllerSelectorDialog::UpdateLEDPattern(std::size_t player_index) {
@ -659,7 +656,8 @@ void QtControllerSelectorDialog::DisableUnsupportedPlayers() {
for (std::size_t index = max_supported_players; index < NUM_PLAYERS; ++index) { for (std::size_t index = max_supported_players; index < NUM_PLAYERS; ++index) {
// Disconnect any unsupported players here and disable or hide them if applicable. // Disconnect any unsupported players here and disable or hide them if applicable.
Settings::values.players.GetValue()[index].connected = false; Settings::values.players.GetValue()[index].connected = false;
UpdateController(Settings::values.players.GetValue()[index].controller_type, index, false); UpdateController(Settings::values.players.GetValue()[index].controller_type, index, false,
system);
// Hide the player widgets when max_supported_controllers is less than or equal to 4. // Hide the player widgets when max_supported_controllers is less than or equal to 4.
if (max_supported_players <= 4) { if (max_supported_players <= 4) {
player_widgets[index]->hide(); player_widgets[index]->hide();

View File

@ -7,6 +7,7 @@
#include <array> #include <array>
#include <memory> #include <memory>
#include <QDialog> #include <QDialog>
#include "core/core.h"
#include "core/frontend/applets/controller.h" #include "core/frontend/applets/controller.h"
class GMainWindow; class GMainWindow;
@ -36,7 +37,8 @@ class QtControllerSelectorDialog final : public QDialog {
public: public:
explicit QtControllerSelectorDialog(QWidget* parent, explicit QtControllerSelectorDialog(QWidget* parent,
Core::Frontend::ControllerParameters parameters_, Core::Frontend::ControllerParameters parameters_,
InputCommon::InputSubsystem* input_subsystem_); InputCommon::InputSubsystem* input_subsystem_,
Core::System& system_);
~QtControllerSelectorDialog() override; ~QtControllerSelectorDialog() override;
int exec() override; int exec() override;
@ -103,6 +105,8 @@ private:
std::unique_ptr<InputProfiles> input_profiles; std::unique_ptr<InputProfiles> input_profiles;
Core::System& system;
// This is true if and only if all parameters are met. Otherwise, this is false. // This is true if and only if all parameters are met. Otherwise, this is false.
// This determines whether the "OK" button can be clicked to exit the applet. // This determines whether the "OK" button can be clicked to exit the applet.
bool parameters_met{false}; bool parameters_met{false};

View File

@ -42,7 +42,7 @@
#include "yuzu/bootmanager.h" #include "yuzu/bootmanager.h"
#include "yuzu/main.h" #include "yuzu/main.h"
EmuThread::EmuThread() = default; EmuThread::EmuThread(Core::System& system_) : system{system_} {}
EmuThread::~EmuThread() = default; EmuThread::~EmuThread() = default;
@ -51,7 +51,6 @@ void EmuThread::run() {
MicroProfileOnThreadCreate(name.c_str()); MicroProfileOnThreadCreate(name.c_str());
Common::SetCurrentThreadName(name.c_str()); Common::SetCurrentThreadName(name.c_str());
auto& system = Core::System::GetInstance();
auto& gpu = system.GPU(); auto& gpu = system.GPU();
auto stop_token = stop_source.get_token(); auto stop_token = stop_source.get_token();
@ -285,8 +284,10 @@ static Core::Frontend::EmuWindow::WindowSystemInfo GetWindowSystemInfo(QWindow*
} }
GRenderWindow::GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_, GRenderWindow::GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_,
std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_) std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_,
: QWidget(parent), emu_thread(emu_thread_), input_subsystem{std::move(input_subsystem_)} { Core::System& system_)
: QWidget(parent),
emu_thread(emu_thread_), input_subsystem{std::move(input_subsystem_)}, system{system_} {
setWindowTitle(QStringLiteral("yuzu %1 | %2-%3") setWindowTitle(QStringLiteral("yuzu %1 | %2-%3")
.arg(QString::fromUtf8(Common::g_build_name), .arg(QString::fromUtf8(Common::g_build_name),
QString::fromUtf8(Common::g_scm_branch), QString::fromUtf8(Common::g_scm_branch),
@ -629,8 +630,7 @@ void GRenderWindow::ReleaseRenderTarget() {
} }
void GRenderWindow::CaptureScreenshot(u32 res_scale, const QString& screenshot_path) { void GRenderWindow::CaptureScreenshot(u32 res_scale, const QString& screenshot_path) {
auto& renderer = Core::System::GetInstance().Renderer(); VideoCore::RendererBase& renderer = system.Renderer();
if (res_scale == 0) { if (res_scale == 0) {
res_scale = VideoCore::GetResolutionScaleFactor(renderer); res_scale = VideoCore::GetResolutionScaleFactor(renderer);
} }

View File

@ -34,13 +34,14 @@ enum class MouseButton;
namespace VideoCore { namespace VideoCore {
enum class LoadCallbackStage; enum class LoadCallbackStage;
} class RendererBase;
} // namespace VideoCore
class EmuThread final : public QThread { class EmuThread final : public QThread {
Q_OBJECT Q_OBJECT
public: public:
explicit EmuThread(); explicit EmuThread(Core::System& system_);
~EmuThread() override; ~EmuThread() override;
/** /**
@ -101,6 +102,7 @@ private:
std::condition_variable_any running_cv; std::condition_variable_any running_cv;
Common::Event running_wait{}; Common::Event running_wait{};
std::atomic_bool running_guard{false}; std::atomic_bool running_guard{false};
Core::System& system;
signals: signals:
/** /**
@ -131,7 +133,8 @@ class GRenderWindow : public QWidget, public Core::Frontend::EmuWindow {
public: public:
explicit GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_, explicit GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_,
std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_); std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_,
Core::System& system_);
~GRenderWindow() override; ~GRenderWindow() override;
// EmuWindow implementation. // EmuWindow implementation.
@ -232,6 +235,8 @@ private:
std::array<std::size_t, 16> touch_ids{}; std::array<std::size_t, 16> touch_ids{};
Core::System& system;
protected: protected:
void showEvent(QShowEvent* event) override; void showEvent(QShowEvent* event) override;
bool eventFilter(QObject* object, QEvent* event) override; bool eventFilter(QObject* object, QEvent* event) override;

View File

@ -8,14 +8,13 @@
#include <QtConcurrent/qtconcurrentrun.h> #include <QtConcurrent/qtconcurrentrun.h>
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/telemetry.h" #include "common/telemetry.h"
#include "core/core.h"
#include "core/telemetry_session.h" #include "core/telemetry_session.h"
#include "ui_compatdb.h" #include "ui_compatdb.h"
#include "yuzu/compatdb.h" #include "yuzu/compatdb.h"
CompatDB::CompatDB(QWidget* parent) CompatDB::CompatDB(Core::TelemetrySession& telemetry_session_, QWidget* parent)
: QWizard(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint), : QWizard(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint),
ui{std::make_unique<Ui::CompatDB>()} { ui{std::make_unique<Ui::CompatDB>()}, telemetry_session{telemetry_session_} {
ui->setupUi(this); ui->setupUi(this);
connect(ui->radioButton_Perfect, &QRadioButton::clicked, this, &CompatDB::EnableNext); connect(ui->radioButton_Perfect, &QRadioButton::clicked, this, &CompatDB::EnableNext);
connect(ui->radioButton_Great, &QRadioButton::clicked, this, &CompatDB::EnableNext); connect(ui->radioButton_Great, &QRadioButton::clicked, this, &CompatDB::EnableNext);
@ -53,16 +52,15 @@ void CompatDB::Submit() {
case CompatDBPage::Final: case CompatDBPage::Final:
back(); back();
LOG_DEBUG(Frontend, "Compatibility Rating: {}", compatibility->checkedId()); LOG_DEBUG(Frontend, "Compatibility Rating: {}", compatibility->checkedId());
Core::System::GetInstance().TelemetrySession().AddField( telemetry_session.AddField(Common::Telemetry::FieldType::UserFeedback, "Compatibility",
Common::Telemetry::FieldType::UserFeedback, "Compatibility",
compatibility->checkedId()); compatibility->checkedId());
button(NextButton)->setEnabled(false); button(NextButton)->setEnabled(false);
button(NextButton)->setText(tr("Submitting")); button(NextButton)->setText(tr("Submitting"));
button(CancelButton)->setVisible(false); button(CancelButton)->setVisible(false);
testcase_watcher.setFuture(QtConcurrent::run( testcase_watcher.setFuture(
[] { return Core::System::GetInstance().TelemetrySession().SubmitTestcase(); })); QtConcurrent::run([this] { return telemetry_session.SubmitTestcase(); }));
break; break;
default: default:
LOG_ERROR(Frontend, "Unexpected page: {}", currentId()); LOG_ERROR(Frontend, "Unexpected page: {}", currentId());

View File

@ -7,6 +7,7 @@
#include <memory> #include <memory>
#include <QFutureWatcher> #include <QFutureWatcher>
#include <QWizard> #include <QWizard>
#include "core/telemetry_session.h"
namespace Ui { namespace Ui {
class CompatDB; class CompatDB;
@ -16,7 +17,7 @@ class CompatDB : public QWizard {
Q_OBJECT Q_OBJECT
public: public:
explicit CompatDB(QWidget* parent = nullptr); explicit CompatDB(Core::TelemetrySession& telemetry_session_, QWidget* parent = nullptr);
~CompatDB(); ~CompatDB();
private: private:
@ -27,4 +28,6 @@ private:
void Submit(); void Submit();
void OnTestcaseSubmitted(); void OnTestcaseSubmitted();
void EnableNext(); void EnableNext();
Core::TelemetrySession& telemetry_session;
}; };

View File

@ -16,7 +16,8 @@
namespace FS = Common::FS; namespace FS = Common::FS;
Config::Config(const std::string& config_name, ConfigType config_type) : type(config_type) { Config::Config(Core::System& system_, const std::string& config_name, ConfigType config_type)
: type(config_type), system{system_} {
global = config_type == ConfigType::GlobalConfig; global = config_type == ConfigType::GlobalConfig;
Initialize(config_name); Initialize(config_name);
@ -1593,7 +1594,7 @@ void Config::Reload() {
ReadValues(); ReadValues();
// To apply default value changes // To apply default value changes
SaveValues(); SaveValues();
Core::System::GetInstance().ApplySettings(); system.ApplySettings();
} }
void Config::Save() { void Config::Save() {

View File

@ -14,6 +14,10 @@
class QSettings; class QSettings;
namespace Core {
class System;
}
class Config { class Config {
public: public:
enum class ConfigType { enum class ConfigType {
@ -22,7 +26,7 @@ public:
InputProfile, InputProfile,
}; };
explicit Config(const std::string& config_name = "qt-config", explicit Config(Core::System& system_, const std::string& config_name = "qt-config",
ConfigType config_type = ConfigType::GlobalConfig); ConfigType config_type = ConfigType::GlobalConfig);
~Config(); ~Config();
@ -176,6 +180,8 @@ private:
std::unique_ptr<QSettings> qt_config; std::unique_ptr<QSettings> qt_config;
std::string qt_config_loc; std::string qt_config_loc;
bool global; bool global;
Core::System& system;
}; };
// These metatype declarations cannot be in common/settings.h because core is devoid of QT // These metatype declarations cannot be in common/settings.h because core is devoid of QT

View File

@ -41,120 +41,8 @@
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>11</number> <number>-1</number>
</property> </property>
<widget class="ConfigureGeneral" name="generalTab">
<property name="accessibleName">
<string>General</string>
</property>
<attribute name="title">
<string>General</string>
</attribute>
</widget>
<widget class="ConfigureUi" name="uiTab">
<property name="accessibleName">
<string>UI</string>
</property>
<attribute name="title">
<string>Game List</string>
</attribute>
</widget>
<widget class="ConfigureSystem" name="systemTab">
<property name="accessibleName">
<string>System</string>
</property>
<attribute name="title">
<string>System</string>
</attribute>
</widget>
<widget class="ConfigureProfileManager" name="profileManagerTab">
<property name="accessibleName">
<string>Profiles</string>
</property>
<attribute name="title">
<string>Profiles</string>
</attribute>
</widget>
<widget class="ConfigureFilesystem" name="filesystemTab">
<property name="accessibleName">
<string>Filesystem</string>
</property>
<attribute name="title">
<string>Filesystem</string>
</attribute>
</widget>
<widget class="ConfigureInput" name="inputTab">
<property name="accessibleName">
<string>Controls</string>
</property>
<attribute name="title">
<string>Controls</string>
</attribute>
</widget>
<widget class="ConfigureHotkeys" name="hotkeysTab">
<property name="accessibleName">
<string>Hotkeys</string>
</property>
<attribute name="title">
<string>Hotkeys</string>
</attribute>
</widget>
<widget class="ConfigureCpu" name="cpuTab">
<property name="accessibleName">
<string>CPU</string>
</property>
<attribute name="title">
<string>CPU</string>
</attribute>
</widget>
<widget class="ConfigureGraphics" name="graphicsTab">
<property name="accessibleName">
<string>Graphics</string>
</property>
<attribute name="title">
<string>Graphics</string>
</attribute>
</widget>
<widget class="ConfigureGraphicsAdvanced" name="graphicsAdvancedTab">
<property name="accessibleName">
<string>Advanced</string>
</property>
<attribute name="title">
<string>GraphicsAdvanced</string>
</attribute>
</widget>
<widget class="ConfigureAudio" name="audioTab">
<property name="accessibleName">
<string>Audio</string>
</property>
<attribute name="title">
<string>Audio</string>
</attribute>
</widget>
<widget class="ConfigureDebugTab" name="debugTab">
<property name="accessibleName">
<string>Debug</string>
</property>
<attribute name="title">
<string>Debug</string>
</attribute>
</widget>
<widget class="ConfigureWeb" name="webTab">
<property name="accessibleName">
<string>Web</string>
</property>
<attribute name="title">
<string>Web</string>
</attribute>
</widget>
<widget class="ConfigureNetwork" name="networkTab">
<property name="accessibleName">
<string>Network</string>
</property>
<attribute name="title">
<string>Network</string>
</attribute>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -168,92 +56,6 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>ConfigureGeneral</class>
<extends>QWidget</extends>
<header>configuration/configure_general.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureSystem</class>
<extends>QWidget</extends>
<header>configuration/configure_system.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureProfileManager</class>
<extends>QWidget</extends>
<header>configuration/configure_profile_manager.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureFilesystem</class>
<extends>QWidget</extends>
<header>configuration/configure_filesystem.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureAudio</class>
<extends>QWidget</extends>
<header>configuration/configure_audio.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureCpu</class>
<extends>QWidget</extends>
<header>configuration/configure_cpu.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureGraphics</class>
<extends>QWidget</extends>
<header>configuration/configure_graphics.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureGraphicsAdvanced</class>
<extends>QWidget</extends>
<header>configuration/configure_graphics_advanced.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureWeb</class>
<extends>QWidget</extends>
<header>configuration/configure_web.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureUi</class>
<extends>QWidget</extends>
<header>configuration/configure_ui.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureInput</class>
<extends>QWidget</extends>
<header>configuration/configure_input.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureHotkeys</class>
<extends>QWidget</extends>
<header>configuration/configure_hotkeys.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureNetwork</class>
<extends>QWidget</extends>
<header>configuration/configure_network.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureDebugTab</class>
<extends>QWidget</extends>
<header>configuration/configure_debug_tab.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>

View File

@ -14,8 +14,8 @@
#include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_audio.h" #include "yuzu/configuration/configure_audio.h"
ConfigureAudio::ConfigureAudio(QWidget* parent) ConfigureAudio::ConfigureAudio(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureAudio>()) { : QWidget(parent), ui(std::make_unique<Ui::ConfigureAudio>()), system{system_} {
ui->setupUi(this); ui->setupUi(this);
InitializeAudioOutputSinkComboBox(); InitializeAudioOutputSinkComboBox();
@ -32,7 +32,7 @@ ConfigureAudio::ConfigureAudio(QWidget* parent)
SetConfiguration(); SetConfiguration();
const bool is_powered_on = Core::System::GetInstance().IsPoweredOn(); const bool is_powered_on = system_.IsPoweredOn();
ui->output_sink_combo_box->setEnabled(!is_powered_on); ui->output_sink_combo_box->setEnabled(!is_powered_on);
ui->audio_device_combo_box->setEnabled(!is_powered_on); ui->audio_device_combo_box->setEnabled(!is_powered_on);
} }

View File

@ -7,6 +7,10 @@
#include <memory> #include <memory>
#include <QWidget> #include <QWidget>
namespace Core {
class System;
}
namespace ConfigurationShared { namespace ConfigurationShared {
enum class CheckState; enum class CheckState;
} }
@ -19,10 +23,11 @@ class ConfigureAudio : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureAudio(QWidget* parent = nullptr); explicit ConfigureAudio(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureAudio() override; ~ConfigureAudio() override;
void ApplyConfiguration(); void ApplyConfiguration();
void SetConfiguration();
private: private:
void changeEvent(QEvent* event) override; void changeEvent(QEvent* event) override;
@ -33,7 +38,6 @@ private:
void UpdateAudioDevices(int sink_index); void UpdateAudioDevices(int sink_index);
void SetConfiguration();
void SetOutputSinkFromSinkID(); void SetOutputSinkFromSinkID();
void SetAudioDeviceFromDeviceID(); void SetAudioDeviceFromDeviceID();
void SetVolumeIndicatorText(int percentage); void SetVolumeIndicatorText(int percentage);
@ -41,4 +45,6 @@ private:
void SetupPerGameUI(); void SetupPerGameUI();
std::unique_ptr<Ui::ConfigureAudio> ui; std::unique_ptr<Ui::ConfigureAudio> ui;
const Core::System& system;
}; };

View File

@ -10,6 +10,9 @@
<height>368</height> <height>368</height>
</rect> </rect>
</property> </property>
<property name="accessibleName">
<string>Audio</string>
</property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">

View File

@ -13,7 +13,8 @@
#include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_cpu.h" #include "yuzu/configuration/configure_cpu.h"
ConfigureCpu::ConfigureCpu(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureCpu) { ConfigureCpu::ConfigureCpu(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureCpu), system{system_} {
ui->setupUi(this); ui->setupUi(this);
SetupPerGameUI(); SetupPerGameUI();
@ -27,7 +28,7 @@ ConfigureCpu::ConfigureCpu(QWidget* parent) : QWidget(parent), ui(new Ui::Config
ConfigureCpu::~ConfigureCpu() = default; ConfigureCpu::~ConfigureCpu() = default;
void ConfigureCpu::SetConfiguration() { void ConfigureCpu::SetConfiguration() {
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); const bool runtime_lock = !system.IsPoweredOn();
ui->accuracy->setEnabled(runtime_lock); ui->accuracy->setEnabled(runtime_lock);
ui->cpuopt_unsafe_unfuse_fma->setEnabled(runtime_lock); ui->cpuopt_unsafe_unfuse_fma->setEnabled(runtime_lock);

View File

@ -8,6 +8,10 @@
#include <QWidget> #include <QWidget>
#include "common/settings.h" #include "common/settings.h"
namespace Core {
class System;
}
namespace ConfigurationShared { namespace ConfigurationShared {
enum class CheckState; enum class CheckState;
} }
@ -20,10 +24,11 @@ class ConfigureCpu : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureCpu(QWidget* parent = nullptr); explicit ConfigureCpu(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureCpu() override; ~ConfigureCpu() override;
void ApplyConfiguration(); void ApplyConfiguration();
void SetConfiguration();
private: private:
void changeEvent(QEvent* event) override; void changeEvent(QEvent* event) override;
@ -31,8 +36,6 @@ private:
void UpdateGroup(int index); void UpdateGroup(int index);
void SetConfiguration();
void SetupPerGameUI(); void SetupPerGameUI();
std::unique_ptr<Ui::ConfigureCpu> ui; std::unique_ptr<Ui::ConfigureCpu> ui;
@ -42,4 +45,6 @@ private:
ConfigurationShared::CheckState cpuopt_unsafe_ignore_standard_fpcr; ConfigurationShared::CheckState cpuopt_unsafe_ignore_standard_fpcr;
ConfigurationShared::CheckState cpuopt_unsafe_inaccurate_nan; ConfigurationShared::CheckState cpuopt_unsafe_inaccurate_nan;
ConfigurationShared::CheckState cpuopt_unsafe_fastmem_check; ConfigurationShared::CheckState cpuopt_unsafe_fastmem_check;
const Core::System& system;
}; };

View File

@ -7,12 +7,15 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>448</width> <width>448</width>
<height>433</height> <height>439</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<property name="accessibleName">
<string>CPU</string>
</property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<item> <item>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">

View File

@ -11,8 +11,8 @@
#include "ui_configure_cpu_debug.h" #include "ui_configure_cpu_debug.h"
#include "yuzu/configuration/configure_cpu_debug.h" #include "yuzu/configuration/configure_cpu_debug.h"
ConfigureCpuDebug::ConfigureCpuDebug(QWidget* parent) ConfigureCpuDebug::ConfigureCpuDebug(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureCpuDebug) { : QWidget(parent), ui(new Ui::ConfigureCpuDebug), system{system_} {
ui->setupUi(this); ui->setupUi(this);
SetConfiguration(); SetConfiguration();
@ -21,7 +21,7 @@ ConfigureCpuDebug::ConfigureCpuDebug(QWidget* parent)
ConfigureCpuDebug::~ConfigureCpuDebug() = default; ConfigureCpuDebug::~ConfigureCpuDebug() = default;
void ConfigureCpuDebug::SetConfiguration() { void ConfigureCpuDebug::SetConfiguration() {
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); const bool runtime_lock = !system.IsPoweredOn();
ui->cpuopt_page_tables->setEnabled(runtime_lock); ui->cpuopt_page_tables->setEnabled(runtime_lock);
ui->cpuopt_page_tables->setChecked(Settings::values.cpuopt_page_tables.GetValue()); ui->cpuopt_page_tables->setChecked(Settings::values.cpuopt_page_tables.GetValue());

View File

@ -7,6 +7,10 @@
#include <memory> #include <memory>
#include <QWidget> #include <QWidget>
namespace Core {
class System;
}
namespace Ui { namespace Ui {
class ConfigureCpuDebug; class ConfigureCpuDebug;
} }
@ -15,7 +19,7 @@ class ConfigureCpuDebug : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureCpuDebug(QWidget* parent = nullptr); explicit ConfigureCpuDebug(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureCpuDebug() override; ~ConfigureCpuDebug() override;
void ApplyConfiguration(); void ApplyConfiguration();
@ -27,4 +31,6 @@ private:
void SetConfiguration(); void SetConfiguration();
std::unique_ptr<Ui::ConfigureCpuDebug> ui; std::unique_ptr<Ui::ConfigureCpuDebug> ui;
const Core::System& system;
}; };

View File

@ -13,6 +13,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<property name="accessibleName">
<string>CPU</string>
</property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<item> <item>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">

View File

@ -14,7 +14,8 @@
#include "yuzu/debugger/console.h" #include "yuzu/debugger/console.h"
#include "yuzu/uisettings.h" #include "yuzu/uisettings.h"
ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureDebug) { ConfigureDebug::ConfigureDebug(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureDebug), system{system_} {
ui->setupUi(this); ui->setupUi(this);
SetConfiguration(); SetConfiguration();
@ -28,7 +29,7 @@ ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::Co
ConfigureDebug::~ConfigureDebug() = default; ConfigureDebug::~ConfigureDebug() = default;
void ConfigureDebug::SetConfiguration() { void ConfigureDebug::SetConfiguration() {
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); const bool runtime_lock = !system.IsPoweredOn();
ui->toggle_console->setEnabled(runtime_lock); ui->toggle_console->setEnabled(runtime_lock);
ui->toggle_console->setChecked(UISettings::values.show_console.GetValue()); ui->toggle_console->setChecked(UISettings::values.show_console.GetValue());

View File

@ -7,6 +7,10 @@
#include <memory> #include <memory>
#include <QWidget> #include <QWidget>
namespace Core {
class System;
}
namespace Ui { namespace Ui {
class ConfigureDebug; class ConfigureDebug;
} }
@ -15,7 +19,7 @@ class ConfigureDebug : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureDebug(QWidget* parent = nullptr); explicit ConfigureDebug(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureDebug() override; ~ConfigureDebug() override;
void ApplyConfiguration(); void ApplyConfiguration();
@ -27,4 +31,6 @@ private:
void SetConfiguration(); void SetConfiguration();
std::unique_ptr<Ui::ConfigureDebug> ui; std::unique_ptr<Ui::ConfigureDebug> ui;
const Core::System& system;
}; };

View File

@ -2,16 +2,17 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "core/core.h"
#include "ui_configure_debug_controller.h" #include "ui_configure_debug_controller.h"
#include "yuzu/configuration/configure_debug_controller.h" #include "yuzu/configuration/configure_debug_controller.h"
#include "yuzu/configuration/configure_input_player.h" #include "yuzu/configuration/configure_input_player.h"
ConfigureDebugController::ConfigureDebugController(QWidget* parent, ConfigureDebugController::ConfigureDebugController(QWidget* parent,
InputCommon::InputSubsystem* input_subsystem, InputCommon::InputSubsystem* input_subsystem,
InputProfiles* profiles) InputProfiles* profiles, Core::System& system)
: QDialog(parent), ui(std::make_unique<Ui::ConfigureDebugController>()), : QDialog(parent), ui(std::make_unique<Ui::ConfigureDebugController>()),
debug_controller( debug_controller(
new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, true)) { new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, system, true)) {
ui->setupUi(this); ui->setupUi(this);
ui->controllerLayout->addWidget(debug_controller); ui->controllerLayout->addWidget(debug_controller);

View File

@ -13,6 +13,10 @@ class ConfigureInputPlayer;
class InputProfiles; class InputProfiles;
namespace Core {
class System;
}
namespace InputCommon { namespace InputCommon {
class InputSubsystem; class InputSubsystem;
} }
@ -26,7 +30,7 @@ class ConfigureDebugController : public QDialog {
public: public:
explicit ConfigureDebugController(QWidget* parent, InputCommon::InputSubsystem* input_subsystem, explicit ConfigureDebugController(QWidget* parent, InputCommon::InputSubsystem* input_subsystem,
InputProfiles* profiles); InputProfiles* profiles, Core::System& system);
~ConfigureDebugController() override; ~ConfigureDebugController() override;
void ApplyConfiguration(); void ApplyConfiguration();

View File

@ -2,21 +2,29 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <memory>
#include "ui_configure_debug_tab.h" #include "ui_configure_debug_tab.h"
#include "yuzu/configuration/configure_cpu_debug.h"
#include "yuzu/configuration/configure_debug.h"
#include "yuzu/configuration/configure_debug_tab.h" #include "yuzu/configuration/configure_debug_tab.h"
ConfigureDebugTab::ConfigureDebugTab(QWidget* parent) ConfigureDebugTab::ConfigureDebugTab(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureDebugTab) { : QWidget(parent),
ui(new Ui::ConfigureDebugTab), debug_tab{std::make_unique<ConfigureDebug>(system_, this)},
cpu_debug_tab{std::make_unique<ConfigureCpuDebug>(system_, this)} {
ui->setupUi(this); ui->setupUi(this);
ui->tabWidget->addTab(debug_tab.get(), tr("Debug"));
ui->tabWidget->addTab(cpu_debug_tab.get(), tr("CPU"));
SetConfiguration(); SetConfiguration();
} }
ConfigureDebugTab::~ConfigureDebugTab() = default; ConfigureDebugTab::~ConfigureDebugTab() = default;
void ConfigureDebugTab::ApplyConfiguration() { void ConfigureDebugTab::ApplyConfiguration() {
ui->debugTab->ApplyConfiguration(); debug_tab->ApplyConfiguration();
ui->cpuDebugTab->ApplyConfiguration(); cpu_debug_tab->ApplyConfiguration();
} }
void ConfigureDebugTab::SetCurrentIndex(int index) { void ConfigureDebugTab::SetCurrentIndex(int index) {

View File

@ -7,6 +7,13 @@
#include <memory> #include <memory>
#include <QWidget> #include <QWidget>
class ConfigureDebug;
class ConfigureCpuDebug;
namespace Core {
class System;
}
namespace Ui { namespace Ui {
class ConfigureDebugTab; class ConfigureDebugTab;
} }
@ -15,7 +22,7 @@ class ConfigureDebugTab : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureDebugTab(QWidget* parent = nullptr); explicit ConfigureDebugTab(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureDebugTab() override; ~ConfigureDebugTab() override;
void ApplyConfiguration(); void ApplyConfiguration();
@ -29,4 +36,7 @@ private:
void SetConfiguration(); void SetConfiguration();
std::unique_ptr<Ui::ConfigureDebugTab> ui; std::unique_ptr<Ui::ConfigureDebugTab> ui;
std::unique_ptr<ConfigureDebug> debug_tab;
std::unique_ptr<ConfigureCpuDebug> cpu_debug_tab;
}; };

View File

@ -13,40 +13,19 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<property name="accessibleName">
<string>Debug</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>-1</number>
</property> </property>
<widget class="ConfigureDebug" name="debugTab">
<attribute name="title">
<string>General</string>
</attribute>
</widget>
<widget class="ConfigureCpuDebug" name="cpuDebugTab">
<attribute name="title">
<string>CPU</string>
</attribute>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>ConfigureDebug</class>
<extends>QWidget</extends>
<header>configuration/configure_debug.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureCpuDebug</class>
<extends>QWidget</extends>
<header>configuration/configure_cpu_debug.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <memory>
#include <QAbstractButton> #include <QAbstractButton>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QHash> #include <QHash>
@ -9,37 +10,84 @@
#include <QPushButton> #include <QPushButton>
#include <QSignalBlocker> #include <QSignalBlocker>
#include <QTabWidget> #include <QTabWidget>
#include "common/logging/log.h"
#include "common/settings.h" #include "common/settings.h"
#include "core/core.h" #include "core/core.h"
#include "ui_configure.h" #include "ui_configure.h"
#include "yuzu/configuration/config.h" #include "yuzu/configuration/config.h"
#include "yuzu/configuration/configure_audio.h"
#include "yuzu/configuration/configure_cpu.h"
#include "yuzu/configuration/configure_debug_tab.h"
#include "yuzu/configuration/configure_dialog.h" #include "yuzu/configuration/configure_dialog.h"
#include "yuzu/configuration/configure_filesystem.h"
#include "yuzu/configuration/configure_general.h"
#include "yuzu/configuration/configure_graphics.h"
#include "yuzu/configuration/configure_graphics_advanced.h"
#include "yuzu/configuration/configure_hotkeys.h"
#include "yuzu/configuration/configure_input.h"
#include "yuzu/configuration/configure_input_player.h" #include "yuzu/configuration/configure_input_player.h"
#include "yuzu/configuration/configure_network.h"
#include "yuzu/configuration/configure_profile_manager.h"
#include "yuzu/configuration/configure_system.h"
#include "yuzu/configuration/configure_ui.h"
#include "yuzu/configuration/configure_web.h"
#include "yuzu/hotkeys.h" #include "yuzu/hotkeys.h"
ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry,
InputCommon::InputSubsystem* input_subsystem) InputCommon::InputSubsystem* input_subsystem,
: QDialog(parent), ui(new Ui::ConfigureDialog), registry(registry) { Core::System& system_)
: QDialog(parent), ui(new Ui::ConfigureDialog),
registry(registry), system{system_}, audio_tab{std::make_unique<ConfigureAudio>(system_,
this)},
cpu_tab{std::make_unique<ConfigureCpu>(system_, this)},
debug_tab_tab{std::make_unique<ConfigureDebugTab>(system_, this)},
filesystem_tab{std::make_unique<ConfigureFilesystem>(this)},
general_tab{std::make_unique<ConfigureGeneral>(system_, this)},
graphics_tab{std::make_unique<ConfigureGraphics>(system_, this)},
graphics_advanced_tab{std::make_unique<ConfigureGraphicsAdvanced>(system_, this)},
hotkeys_tab{std::make_unique<ConfigureHotkeys>(this)},
input_tab{std::make_unique<ConfigureInput>(system_, this)},
network_tab{std::make_unique<ConfigureNetwork>(system_, this)},
profile_tab{std::make_unique<ConfigureProfileManager>(system_, this)},
system_tab{std::make_unique<ConfigureSystem>(system_, this)},
ui_tab{std::make_unique<ConfigureUi>(system_, this)}, web_tab{std::make_unique<ConfigureWeb>(
this)} {
Settings::SetConfiguringGlobal(true); Settings::SetConfiguringGlobal(true);
ui->setupUi(this); ui->setupUi(this);
ui->hotkeysTab->Populate(registry);
ui->tabWidget->addTab(audio_tab.get(), tr("Audio"));
ui->tabWidget->addTab(cpu_tab.get(), tr("CPU"));
ui->tabWidget->addTab(debug_tab_tab.get(), tr("Debug"));
ui->tabWidget->addTab(filesystem_tab.get(), tr("Filesystem"));
ui->tabWidget->addTab(general_tab.get(), tr("General"));
ui->tabWidget->addTab(graphics_tab.get(), tr("Graphics"));
ui->tabWidget->addTab(graphics_advanced_tab.get(), tr("GraphicsAdvanced"));
ui->tabWidget->addTab(hotkeys_tab.get(), tr("Hotkeys"));
ui->tabWidget->addTab(input_tab.get(), tr("Controls"));
ui->tabWidget->addTab(profile_tab.get(), tr("Profiles"));
ui->tabWidget->addTab(network_tab.get(), tr("Network"));
ui->tabWidget->addTab(system_tab.get(), tr("System"));
ui->tabWidget->addTab(ui_tab.get(), tr("Game List"));
ui->tabWidget->addTab(web_tab.get(), tr("Web"));
hotkeys_tab->Populate(registry);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
ui->inputTab->Initialize(input_subsystem); input_tab->Initialize(input_subsystem);
ui->generalTab->SetResetCallback([&] { this->close(); }); general_tab->SetResetCallback([&] { this->close(); });
SetConfiguration(); SetConfiguration();
PopulateSelectionList(); PopulateSelectionList();
connect(ui->tabWidget, &QTabWidget::currentChanged, this, connect(ui->tabWidget, &QTabWidget::currentChanged, this,
[this]() { ui->debugTab->SetCurrentIndex(0); }); [this]() { debug_tab_tab->SetCurrentIndex(0); });
connect(ui->uiTab, &ConfigureUi::LanguageChanged, this, &ConfigureDialog::OnLanguageChanged); connect(ui_tab.get(), &ConfigureUi::LanguageChanged, this, &ConfigureDialog::OnLanguageChanged);
connect(ui->selectorList, &QListWidget::itemSelectionChanged, this, connect(ui->selectorList, &QListWidget::itemSelectionChanged, this,
&ConfigureDialog::UpdateVisibleTabs); &ConfigureDialog::UpdateVisibleTabs);
if (Core::System::GetInstance().IsPoweredOn()) { if (system.IsPoweredOn()) {
QPushButton* apply_button = ui->buttonBox->addButton(QDialogButtonBox::Apply); QPushButton* apply_button = ui->buttonBox->addButton(QDialogButtonBox::Apply);
connect(apply_button, &QAbstractButton::clicked, this, connect(apply_button, &QAbstractButton::clicked, this,
&ConfigureDialog::HandleApplyButtonClicked); &ConfigureDialog::HandleApplyButtonClicked);
@ -54,21 +102,21 @@ ConfigureDialog::~ConfigureDialog() = default;
void ConfigureDialog::SetConfiguration() {} void ConfigureDialog::SetConfiguration() {}
void ConfigureDialog::ApplyConfiguration() { void ConfigureDialog::ApplyConfiguration() {
ui->generalTab->ApplyConfiguration(); general_tab->ApplyConfiguration();
ui->uiTab->ApplyConfiguration(); ui_tab->ApplyConfiguration();
ui->systemTab->ApplyConfiguration(); system_tab->ApplyConfiguration();
ui->profileManagerTab->ApplyConfiguration(); profile_tab->ApplyConfiguration();
ui->filesystemTab->applyConfiguration(); filesystem_tab->applyConfiguration();
ui->inputTab->ApplyConfiguration(); input_tab->ApplyConfiguration();
ui->hotkeysTab->ApplyConfiguration(registry); hotkeys_tab->ApplyConfiguration(registry);
ui->cpuTab->ApplyConfiguration(); cpu_tab->ApplyConfiguration();
ui->graphicsTab->ApplyConfiguration(); graphics_tab->ApplyConfiguration();
ui->graphicsAdvancedTab->ApplyConfiguration(); graphics_advanced_tab->ApplyConfiguration();
ui->audioTab->ApplyConfiguration(); audio_tab->ApplyConfiguration();
ui->debugTab->ApplyConfiguration(); debug_tab_tab->ApplyConfiguration();
ui->webTab->ApplyConfiguration(); web_tab->ApplyConfiguration();
ui->networkTab->ApplyConfiguration(); network_tab->ApplyConfiguration();
Core::System::GetInstance().ApplySettings(); system.ApplySettings();
Settings::LogSettings(); Settings::LogSettings();
} }
@ -102,12 +150,14 @@ Q_DECLARE_METATYPE(QList<QWidget*>);
void ConfigureDialog::PopulateSelectionList() { void ConfigureDialog::PopulateSelectionList() {
const std::array<std::pair<QString, QList<QWidget*>>, 6> items{ const std::array<std::pair<QString, QList<QWidget*>>, 6> items{
{{tr("General"), {ui->generalTab, ui->hotkeysTab, ui->uiTab, ui->webTab, ui->debugTab}}, {{tr("General"),
{tr("System"), {ui->systemTab, ui->profileManagerTab, ui->networkTab, ui->filesystemTab}}, {general_tab.get(), hotkeys_tab.get(), ui_tab.get(), web_tab.get(), debug_tab_tab.get()}},
{tr("CPU"), {ui->cpuTab}}, {tr("System"),
{tr("Graphics"), {ui->graphicsTab, ui->graphicsAdvancedTab}}, {system_tab.get(), profile_tab.get(), network_tab.get(), filesystem_tab.get()}},
{tr("Audio"), {ui->audioTab}}, {tr("CPU"), {cpu_tab.get()}},
{tr("Controls"), ui->inputTab->GetSubTabs()}}, {tr("Graphics"), {graphics_tab.get(), graphics_advanced_tab.get()}},
{tr("Audio"), {audio_tab.get()}},
{tr("Controls"), input_tab->GetSubTabs()}},
}; };
[[maybe_unused]] const QSignalBlocker blocker(ui->selectorList); [[maybe_unused]] const QSignalBlocker blocker(ui->selectorList);
@ -142,6 +192,7 @@ void ConfigureDialog::UpdateVisibleTabs() {
const auto tabs = qvariant_cast<QList<QWidget*>>(items[0]->data(Qt::UserRole)); const auto tabs = qvariant_cast<QList<QWidget*>>(items[0]->data(Qt::UserRole));
for (auto* const tab : tabs) { for (auto* const tab : tabs) {
LOG_DEBUG(Frontend, "{}", tab->accessibleName().toStdString());
ui->tabWidget->addTab(tab, tab->accessibleName()); ui->tabWidget->addTab(tab, tab->accessibleName());
} }
} }

View File

@ -7,6 +7,25 @@
#include <memory> #include <memory>
#include <QDialog> #include <QDialog>
namespace Core {
class System;
}
class ConfigureAudio;
class ConfigureCpu;
class ConfigureDebugTab;
class ConfigureFilesystem;
class ConfigureGeneral;
class ConfigureGraphics;
class ConfigureGraphicsAdvanced;
class ConfigureHotkeys;
class ConfigureInput;
class ConfigureProfileManager;
class ConfigureSystem;
class ConfigureNetwork;
class ConfigureUi;
class ConfigureWeb;
class HotkeyRegistry; class HotkeyRegistry;
namespace InputCommon { namespace InputCommon {
@ -22,7 +41,7 @@ class ConfigureDialog : public QDialog {
public: public:
explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry,
InputCommon::InputSubsystem* input_subsystem); InputCommon::InputSubsystem* input_subsystem, Core::System& system_);
~ConfigureDialog() override; ~ConfigureDialog() override;
void ApplyConfiguration(); void ApplyConfiguration();
@ -45,4 +64,21 @@ private:
std::unique_ptr<Ui::ConfigureDialog> ui; std::unique_ptr<Ui::ConfigureDialog> ui;
HotkeyRegistry& registry; HotkeyRegistry& registry;
Core::System& system;
std::unique_ptr<ConfigureAudio> audio_tab;
std::unique_ptr<ConfigureCpu> cpu_tab;
std::unique_ptr<ConfigureDebugTab> debug_tab_tab;
std::unique_ptr<ConfigureFilesystem> filesystem_tab;
std::unique_ptr<ConfigureGeneral> general_tab;
std::unique_ptr<ConfigureGraphics> graphics_tab;
std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab;
std::unique_ptr<ConfigureHotkeys> hotkeys_tab;
std::unique_ptr<ConfigureInput> input_tab;
std::unique_ptr<ConfigureNetwork> network_tab;
std::unique_ptr<ConfigureProfileManager> profile_tab;
std::unique_ptr<ConfigureSystem> system_tab;
std::unique_ptr<ConfigureUi> ui_tab;
std::unique_ptr<ConfigureWeb> web_tab;
}; };

View File

@ -13,6 +13,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<property name="accessibleName">
<string>Filesystem</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">

View File

@ -15,8 +15,8 @@
#include "yuzu/configuration/configure_general.h" #include "yuzu/configuration/configure_general.h"
#include "yuzu/uisettings.h" #include "yuzu/uisettings.h"
ConfigureGeneral::ConfigureGeneral(QWidget* parent) ConfigureGeneral::ConfigureGeneral(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureGeneral) { : QWidget(parent), ui(new Ui::ConfigureGeneral), system{system_} {
ui->setupUi(this); ui->setupUi(this);
SetupPerGameUI(); SetupPerGameUI();
@ -35,7 +35,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
ConfigureGeneral::~ConfigureGeneral() = default; ConfigureGeneral::~ConfigureGeneral() = default;
void ConfigureGeneral::SetConfiguration() { void ConfigureGeneral::SetConfiguration() {
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); const bool runtime_lock = !system.IsPoweredOn();
ui->use_multi_core->setEnabled(runtime_lock); ui->use_multi_core->setEnabled(runtime_lock);
ui->use_multi_core->setChecked(Settings::values.use_multi_core.GetValue()); ui->use_multi_core->setChecked(Settings::values.use_multi_core.GetValue());

View File

@ -8,6 +8,10 @@
#include <memory> #include <memory>
#include <QWidget> #include <QWidget>
namespace Core {
class System;
}
class ConfigureDialog; class ConfigureDialog;
namespace ConfigurationShared { namespace ConfigurationShared {
@ -24,19 +28,18 @@ class ConfigureGeneral : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureGeneral(QWidget* parent = nullptr); explicit ConfigureGeneral(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureGeneral() override; ~ConfigureGeneral() override;
void SetResetCallback(std::function<void()> callback); void SetResetCallback(std::function<void()> callback);
void ResetDefaults(); void ResetDefaults();
void ApplyConfiguration(); void ApplyConfiguration();
void SetConfiguration();
private: private:
void changeEvent(QEvent* event) override; void changeEvent(QEvent* event) override;
void RetranslateUI(); void RetranslateUI();
void SetConfiguration();
void SetupPerGameUI(); void SetupPerGameUI();
std::function<void()> reset_callback; std::function<void()> reset_callback;
@ -45,4 +48,6 @@ private:
ConfigurationShared::CheckState use_speed_limit; ConfigurationShared::CheckState use_speed_limit;
ConfigurationShared::CheckState use_multi_core; ConfigurationShared::CheckState use_multi_core;
const Core::System& system;
}; };

View File

@ -13,6 +13,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<property name="accessibleName">
<string>General</string>
</property>
<layout class="QHBoxLayout" name="HorizontalLayout"> <layout class="QHBoxLayout" name="HorizontalLayout">
<item> <item>
<layout class="QVBoxLayout" name="VerticalLayout"> <layout class="QVBoxLayout" name="VerticalLayout">

View File

@ -19,8 +19,8 @@
#include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_graphics.h" #include "yuzu/configuration/configure_graphics.h"
ConfigureGraphics::ConfigureGraphics(QWidget* parent) ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureGraphics) { : QWidget(parent), ui(new Ui::ConfigureGraphics), system{system_} {
vulkan_device = Settings::values.vulkan_device.GetValue(); vulkan_device = Settings::values.vulkan_device.GetValue();
RetrieveVulkanDevices(); RetrieveVulkanDevices();
@ -83,7 +83,7 @@ void ConfigureGraphics::UpdateShaderBackendSelection(int backend) {
ConfigureGraphics::~ConfigureGraphics() = default; ConfigureGraphics::~ConfigureGraphics() = default;
void ConfigureGraphics::SetConfiguration() { void ConfigureGraphics::SetConfiguration() {
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); const bool runtime_lock = !system.IsPoweredOn();
ui->api_widget->setEnabled(runtime_lock); ui->api_widget->setEnabled(runtime_lock);
ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock); ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock);

View File

@ -10,6 +10,10 @@
#include <QWidget> #include <QWidget>
#include "common/settings.h" #include "common/settings.h"
namespace Core {
class System;
}
namespace ConfigurationShared { namespace ConfigurationShared {
enum class CheckState; enum class CheckState;
} }
@ -22,17 +26,16 @@ class ConfigureGraphics : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureGraphics(QWidget* parent = nullptr); explicit ConfigureGraphics(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureGraphics() override; ~ConfigureGraphics() override;
void ApplyConfiguration(); void ApplyConfiguration();
void SetConfiguration();
private: private:
void changeEvent(QEvent* event) override; void changeEvent(QEvent* event) override;
void RetranslateUI(); void RetranslateUI();
void SetConfiguration();
void UpdateBackgroundColorButton(QColor color); void UpdateBackgroundColorButton(QColor color);
void UpdateAPILayout(); void UpdateAPILayout();
void UpdateDeviceSelection(int device); void UpdateDeviceSelection(int device);
@ -56,4 +59,6 @@ private:
std::vector<QString> vulkan_devices; std::vector<QString> vulkan_devices;
u32 vulkan_device{}; u32 vulkan_device{};
Settings::ShaderBackend shader_backend{}; Settings::ShaderBackend shader_backend{};
const Core::System& system;
}; };

View File

@ -7,12 +7,15 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>437</width> <width>437</width>
<height>321</height> <height>482</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<property name="accessibleName">
<string>Graphics</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_1"> <layout class="QVBoxLayout" name="verticalLayout_1">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">

View File

@ -8,8 +8,8 @@
#include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_graphics_advanced.h" #include "yuzu/configuration/configure_graphics_advanced.h"
ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(QWidget* parent) ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureGraphicsAdvanced) { : QWidget(parent), ui(new Ui::ConfigureGraphicsAdvanced), system{system_} {
ui->setupUi(this); ui->setupUi(this);
@ -21,7 +21,7 @@ ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(QWidget* parent)
ConfigureGraphicsAdvanced::~ConfigureGraphicsAdvanced() = default; ConfigureGraphicsAdvanced::~ConfigureGraphicsAdvanced() = default;
void ConfigureGraphicsAdvanced::SetConfiguration() { void ConfigureGraphicsAdvanced::SetConfiguration() {
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); const bool runtime_lock = !system.IsPoweredOn();
ui->use_vsync->setEnabled(runtime_lock); ui->use_vsync->setEnabled(runtime_lock);
ui->use_asynchronous_shaders->setEnabled(runtime_lock); ui->use_asynchronous_shaders->setEnabled(runtime_lock);
ui->anisotropic_filtering_combobox->setEnabled(runtime_lock); ui->anisotropic_filtering_combobox->setEnabled(runtime_lock);

View File

@ -7,6 +7,10 @@
#include <memory> #include <memory>
#include <QWidget> #include <QWidget>
namespace Core {
class System;
}
namespace ConfigurationShared { namespace ConfigurationShared {
enum class CheckState; enum class CheckState;
} }
@ -19,17 +23,16 @@ class ConfigureGraphicsAdvanced : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureGraphicsAdvanced(QWidget* parent = nullptr); explicit ConfigureGraphicsAdvanced(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureGraphicsAdvanced() override; ~ConfigureGraphicsAdvanced() override;
void ApplyConfiguration(); void ApplyConfiguration();
void SetConfiguration();
private: private:
void changeEvent(QEvent* event) override; void changeEvent(QEvent* event) override;
void RetranslateUI(); void RetranslateUI();
void SetConfiguration();
void SetupPerGameUI(); void SetupPerGameUI();
std::unique_ptr<Ui::ConfigureGraphicsAdvanced> ui; std::unique_ptr<Ui::ConfigureGraphicsAdvanced> ui;
@ -37,4 +40,6 @@ private:
ConfigurationShared::CheckState use_vsync; ConfigurationShared::CheckState use_vsync;
ConfigurationShared::CheckState use_asynchronous_shaders; ConfigurationShared::CheckState use_asynchronous_shaders;
ConfigurationShared::CheckState use_fast_gpu_time; ConfigurationShared::CheckState use_fast_gpu_time;
const Core::System& system;
}; };

View File

@ -13,6 +13,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<property name="accessibleName">
<string>Advanced</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_1"> <layout class="QVBoxLayout" name="verticalLayout_1">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">

View File

@ -13,6 +13,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Hotkey Settings</string> <string>Hotkey Settings</string>
</property> </property>
<property name="accessibleName">
<string>Hotkeys</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">

View File

@ -39,12 +39,11 @@ void CallConfigureDialog(ConfigureInput& parent, Args&&... args) {
} }
} // Anonymous namespace } // Anonymous namespace
void OnDockedModeChanged(bool last_state, bool new_state) { void OnDockedModeChanged(bool last_state, bool new_state, Core::System& system) {
if (last_state == new_state) { if (last_state == new_state) {
return; return;
} }
Core::System& system{Core::System::GetInstance()};
if (!system.IsPoweredOn()) { if (!system.IsPoweredOn()) {
return; return;
} }
@ -66,9 +65,9 @@ void OnDockedModeChanged(bool last_state, bool new_state) {
} }
} }
ConfigureInput::ConfigureInput(QWidget* parent) ConfigureInput::ConfigureInput(Core::System& system_, QWidget* parent)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()), : QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()),
profiles(std::make_unique<InputProfiles>()) { profiles(std::make_unique<InputProfiles>(system_)), system{system_} {
ui->setupUi(this); ui->setupUi(this);
} }
@ -77,22 +76,22 @@ ConfigureInput::~ConfigureInput() = default;
void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem, void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem,
std::size_t max_players) { std::size_t max_players) {
player_controllers = { player_controllers = {
new ConfigureInputPlayer(this, 0, ui->consoleInputSettings, input_subsystem, new ConfigureInputPlayer(this, 0, ui->consoleInputSettings, input_subsystem, profiles.get(),
profiles.get()), system),
new ConfigureInputPlayer(this, 1, ui->consoleInputSettings, input_subsystem, new ConfigureInputPlayer(this, 1, ui->consoleInputSettings, input_subsystem, profiles.get(),
profiles.get()), system),
new ConfigureInputPlayer(this, 2, ui->consoleInputSettings, input_subsystem, new ConfigureInputPlayer(this, 2, ui->consoleInputSettings, input_subsystem, profiles.get(),
profiles.get()), system),
new ConfigureInputPlayer(this, 3, ui->consoleInputSettings, input_subsystem, new ConfigureInputPlayer(this, 3, ui->consoleInputSettings, input_subsystem, profiles.get(),
profiles.get()), system),
new ConfigureInputPlayer(this, 4, ui->consoleInputSettings, input_subsystem, new ConfigureInputPlayer(this, 4, ui->consoleInputSettings, input_subsystem, profiles.get(),
profiles.get()), system),
new ConfigureInputPlayer(this, 5, ui->consoleInputSettings, input_subsystem, new ConfigureInputPlayer(this, 5, ui->consoleInputSettings, input_subsystem, profiles.get(),
profiles.get()), system),
new ConfigureInputPlayer(this, 6, ui->consoleInputSettings, input_subsystem, new ConfigureInputPlayer(this, 6, ui->consoleInputSettings, input_subsystem, profiles.get(),
profiles.get()), system),
new ConfigureInputPlayer(this, 7, ui->consoleInputSettings, input_subsystem, new ConfigureInputPlayer(this, 7, ui->consoleInputSettings, input_subsystem, profiles.get(),
profiles.get()), system),
}; };
player_tabs = { player_tabs = {
@ -148,7 +147,8 @@ void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem,
ui->tabAdvanced->setLayout(new QHBoxLayout(ui->tabAdvanced)); ui->tabAdvanced->setLayout(new QHBoxLayout(ui->tabAdvanced));
ui->tabAdvanced->layout()->addWidget(advanced); ui->tabAdvanced->layout()->addWidget(advanced);
connect(advanced, &ConfigureInputAdvanced::CallDebugControllerDialog, [this, input_subsystem] { connect(advanced, &ConfigureInputAdvanced::CallDebugControllerDialog, [this, input_subsystem] {
CallConfigureDialog<ConfigureDebugController>(*this, input_subsystem, profiles.get()); CallConfigureDialog<ConfigureDebugController>(*this, input_subsystem, profiles.get(),
system);
}); });
connect(advanced, &ConfigureInputAdvanced::CallMouseConfigDialog, [this, input_subsystem] { connect(advanced, &ConfigureInputAdvanced::CallMouseConfigDialog, [this, input_subsystem] {
CallConfigureDialog<ConfigureMouseAdvanced>(*this, input_subsystem); CallConfigureDialog<ConfigureMouseAdvanced>(*this, input_subsystem);
@ -204,7 +204,7 @@ void ConfigureInput::ApplyConfiguration() {
const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue(); const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue();
Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked()); Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked());
OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue()); OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue(), system);
Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked());
Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked());

View File

@ -11,6 +11,10 @@
#include <QList> #include <QList>
#include <QWidget> #include <QWidget>
namespace Core {
class System;
}
class QCheckBox; class QCheckBox;
class QString; class QString;
class QTimer; class QTimer;
@ -28,13 +32,13 @@ namespace Ui {
class ConfigureInput; class ConfigureInput;
} }
void OnDockedModeChanged(bool last_state, bool new_state); void OnDockedModeChanged(bool last_state, bool new_state, Core::System& system);
class ConfigureInput : public QWidget { class ConfigureInput : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureInput(QWidget* parent = nullptr); explicit ConfigureInput(Core::System& system_, QWidget* parent = nullptr);
~ConfigureInput() override; ~ConfigureInput() override;
/// Initializes the input dialog with the given input subsystem. /// Initializes the input dialog with the given input subsystem.
@ -69,4 +73,6 @@ private:
std::array<QWidget*, 8> player_tabs; std::array<QWidget*, 8> player_tabs;
std::array<QCheckBox*, 8> player_connected; std::array<QCheckBox*, 8> player_connected;
ConfigureInputAdvanced* advanced; ConfigureInputAdvanced* advanced;
Core::System& system;
}; };

View File

@ -44,8 +44,7 @@ namespace {
constexpr std::size_t HANDHELD_INDEX = 8; constexpr std::size_t HANDHELD_INDEX = 8;
void UpdateController(Settings::ControllerType controller_type, std::size_t npad_index, void UpdateController(Settings::ControllerType controller_type, std::size_t npad_index,
bool connected) { bool connected, Core::System& system) {
Core::System& system{Core::System::GetInstance()};
if (!system.IsPoweredOn()) { if (!system.IsPoweredOn()) {
return; return;
} }
@ -232,11 +231,12 @@ QString AnalogToText(const Common::ParamPackage& param, const std::string& dir)
ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_index, ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_index,
QWidget* bottom_row, QWidget* bottom_row,
InputCommon::InputSubsystem* input_subsystem_, InputCommon::InputSubsystem* input_subsystem_,
InputProfiles* profiles_, bool debug) InputProfiles* profiles_, Core::System& system_,
bool debug)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureInputPlayer>()), player_index(player_index), : QWidget(parent), ui(std::make_unique<Ui::ConfigureInputPlayer>()), player_index(player_index),
debug(debug), input_subsystem{input_subsystem_}, profiles(profiles_), debug(debug), input_subsystem{input_subsystem_}, profiles(profiles_),
timeout_timer(std::make_unique<QTimer>()), poll_timer(std::make_unique<QTimer>()), timeout_timer(std::make_unique<QTimer>()), poll_timer(std::make_unique<QTimer>()),
bottom_row(bottom_row) { bottom_row(bottom_row), system{system_} {
ui->setupUi(this); ui->setupUi(this);
setFocusPolicy(Qt::ClickFocus); setFocusPolicy(Qt::ClickFocus);
@ -683,7 +683,7 @@ void ConfigureInputPlayer::TryConnectSelectedController() {
controller_type == Settings::ControllerType::Handheld; controller_type == Settings::ControllerType::Handheld;
// Connect only if handheld is going from disconnected to connected // Connect only if handheld is going from disconnected to connected
if (!handheld.connected && handheld_connected) { if (!handheld.connected && handheld_connected) {
UpdateController(controller_type, HANDHELD_INDEX, true); UpdateController(controller_type, HANDHELD_INDEX, true, system);
} }
handheld.connected = handheld_connected; handheld.connected = handheld_connected;
} }
@ -703,7 +703,7 @@ void ConfigureInputPlayer::TryConnectSelectedController() {
return; return;
} }
UpdateController(controller_type, player_index, true); UpdateController(controller_type, player_index, true, system);
} }
void ConfigureInputPlayer::TryDisconnectSelectedController() { void ConfigureInputPlayer::TryDisconnectSelectedController() {
@ -721,7 +721,7 @@ void ConfigureInputPlayer::TryDisconnectSelectedController() {
controller_type == Settings::ControllerType::Handheld; controller_type == Settings::ControllerType::Handheld;
// Disconnect only if handheld is going from connected to disconnected // Disconnect only if handheld is going from connected to disconnected
if (handheld.connected && !handheld_connected) { if (handheld.connected && !handheld_connected) {
UpdateController(controller_type, HANDHELD_INDEX, false); UpdateController(controller_type, HANDHELD_INDEX, false, system);
} }
return; return;
} }
@ -737,7 +737,7 @@ void ConfigureInputPlayer::TryDisconnectSelectedController() {
} }
// Disconnect the controller first. // Disconnect the controller first.
UpdateController(controller_type, player_index, false); UpdateController(controller_type, player_index, false, system);
} }
void ConfigureInputPlayer::showEvent(QShowEvent* event) { void ConfigureInputPlayer::showEvent(QShowEvent* event) {
@ -1017,8 +1017,6 @@ void ConfigureInputPlayer::SetConnectableControllers() {
} }
}; };
Core::System& system{Core::System::GetInstance()};
if (!system.IsPoweredOn()) { if (!system.IsPoweredOn()) {
add_controllers(true); add_controllers(true);
return; return;

View File

@ -29,6 +29,10 @@ class QWidget;
class InputProfiles; class InputProfiles;
namespace Core {
class System;
}
namespace InputCommon { namespace InputCommon {
class InputSubsystem; class InputSubsystem;
} }
@ -48,7 +52,8 @@ class ConfigureInputPlayer : public QWidget {
public: public:
explicit ConfigureInputPlayer(QWidget* parent, std::size_t player_index, QWidget* bottom_row, explicit ConfigureInputPlayer(QWidget* parent, std::size_t player_index, QWidget* bottom_row,
InputCommon::InputSubsystem* input_subsystem_, InputCommon::InputSubsystem* input_subsystem_,
InputProfiles* profiles_, bool debug = false); InputProfiles* profiles_, Core::System& system_,
bool debug = false);
~ConfigureInputPlayer() override; ~ConfigureInputPlayer() override;
/// Save all button configurations to settings file. /// Save all button configurations to settings file.
@ -233,4 +238,6 @@ private:
/// ConfigureInput widget. On show, add this widget to the main layout. This will change the /// ConfigureInput widget. On show, add this widget to the main layout. This will change the
/// parent of the widget to this widget (but thats fine). /// parent of the widget to this widget (but thats fine).
QWidget* bottom_row; QWidget* bottom_row;
Core::System& system;
}; };

View File

@ -2,14 +2,17 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "core/core.h"
#include "ui_configure_input_profile_dialog.h" #include "ui_configure_input_profile_dialog.h"
#include "yuzu/configuration/configure_input_player.h" #include "yuzu/configuration/configure_input_player.h"
#include "yuzu/configuration/configure_input_profile_dialog.h" #include "yuzu/configuration/configure_input_profile_dialog.h"
ConfigureInputProfileDialog::ConfigureInputProfileDialog( ConfigureInputProfileDialog::ConfigureInputProfileDialog(
QWidget* parent, InputCommon::InputSubsystem* input_subsystem, InputProfiles* profiles) QWidget* parent, InputCommon::InputSubsystem* input_subsystem, InputProfiles* profiles,
Core::System& system)
: QDialog(parent), ui(std::make_unique<Ui::ConfigureInputProfileDialog>()), : QDialog(parent), ui(std::make_unique<Ui::ConfigureInputProfileDialog>()),
profile_widget(new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, false)) { profile_widget(
new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, system, false)) {
ui->setupUi(this); ui->setupUi(this);
ui->controllerLayout->addWidget(profile_widget); ui->controllerLayout->addWidget(profile_widget);

View File

@ -13,6 +13,10 @@ class ConfigureInputPlayer;
class InputProfiles; class InputProfiles;
namespace Core {
class System;
}
namespace InputCommon { namespace InputCommon {
class InputSubsystem; class InputSubsystem;
} }
@ -27,7 +31,7 @@ class ConfigureInputProfileDialog : public QDialog {
public: public:
explicit ConfigureInputProfileDialog(QWidget* parent, explicit ConfigureInputProfileDialog(QWidget* parent,
InputCommon::InputSubsystem* input_subsystem, InputCommon::InputSubsystem* input_subsystem,
InputProfiles* profiles); InputProfiles* profiles, Core::System& system);
~ConfigureInputProfileDialog() override; ~ConfigureInputProfileDialog() override;
private: private:

View File

@ -10,8 +10,8 @@
#include "ui_configure_network.h" #include "ui_configure_network.h"
#include "yuzu/configuration/configure_network.h" #include "yuzu/configuration/configure_network.h"
ConfigureNetwork::ConfigureNetwork(QWidget* parent) ConfigureNetwork::ConfigureNetwork(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureNetwork>()) { : QWidget(parent), ui(std::make_unique<Ui::ConfigureNetwork>()), system{system_} {
ui->setupUi(this); ui->setupUi(this);
ui->network_interface->addItem(tr("None")); ui->network_interface->addItem(tr("None"));
@ -33,7 +33,7 @@ void ConfigureNetwork::RetranslateUi() {
} }
void ConfigureNetwork::SetConfiguration() { void ConfigureNetwork::SetConfiguration() {
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); const bool runtime_lock = !system.IsPoweredOn();
const std::string& network_interface = Settings::values.network_interface.GetValue(); const std::string& network_interface = Settings::values.network_interface.GetValue();

View File

@ -16,7 +16,7 @@ class ConfigureNetwork : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureNetwork(QWidget* parent = nullptr); explicit ConfigureNetwork(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureNetwork() override; ~ConfigureNetwork() override;
void ApplyConfiguration(); void ApplyConfiguration();
@ -26,4 +26,6 @@ private:
void SetConfiguration(); void SetConfiguration();
std::unique_ptr<Ui::ConfigureNetwork> ui; std::unique_ptr<Ui::ConfigureNetwork> ui;
const Core::System& system;
}; };

View File

@ -13,6 +13,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<property name="accessibleName">
<string>Network</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">

View File

@ -30,32 +30,56 @@
#include "core/loader/loader.h" #include "core/loader/loader.h"
#include "ui_configure_per_game.h" #include "ui_configure_per_game.h"
#include "yuzu/configuration/config.h" #include "yuzu/configuration/config.h"
#include "yuzu/configuration/configure_audio.h"
#include "yuzu/configuration/configure_cpu.h"
#include "yuzu/configuration/configure_general.h"
#include "yuzu/configuration/configure_graphics.h"
#include "yuzu/configuration/configure_graphics_advanced.h"
#include "yuzu/configuration/configure_input.h" #include "yuzu/configuration/configure_input.h"
#include "yuzu/configuration/configure_per_game.h" #include "yuzu/configuration/configure_per_game.h"
#include "yuzu/configuration/configure_per_game_addons.h"
#include "yuzu/configuration/configure_system.h"
#include "yuzu/uisettings.h" #include "yuzu/uisettings.h"
#include "yuzu/util/util.h" #include "yuzu/util/util.h"
ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name) ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name,
: QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()), title_id(title_id) { Core::System& system_)
: QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()),
title_id(title_id), system{system_}, addons_tab{std::make_unique<ConfigurePerGameAddons>(
system_, this)},
audio_tab{std::make_unique<ConfigureAudio>(system_, this)},
cpu_tab{std::make_unique<ConfigureCpu>(system_, this)},
general_tab{std::make_unique<ConfigureGeneral>(system_, this)},
graphics_tab{std::make_unique<ConfigureGraphics>(system_, this)},
graphics_advanced_tab{std::make_unique<ConfigureGraphicsAdvanced>(system_, this)},
system_tab{std::make_unique<ConfigureSystem>(system_, this)} {
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);
game_config = std::make_unique<Config>(config_file_name, Config::ConfigType::PerGameConfig); game_config =
std::make_unique<Config>(system, config_file_name, Config::ConfigType::PerGameConfig);
Settings::SetConfiguringGlobal(false);
ui->setupUi(this); ui->setupUi(this);
ui->tabWidget->addTab(addons_tab.get(), tr("Add-Ons"));
ui->tabWidget->addTab(general_tab.get(), tr("General"));
ui->tabWidget->addTab(system_tab.get(), tr("System"));
ui->tabWidget->addTab(cpu_tab.get(), tr("CPU"));
ui->tabWidget->addTab(graphics_tab.get(), tr("Graphics"));
ui->tabWidget->addTab(graphics_advanced_tab.get(), tr("GraphicsAdvanced"));
ui->tabWidget->addTab(audio_tab.get(), tr("Audio"));
setFocusPolicy(Qt::ClickFocus); setFocusPolicy(Qt::ClickFocus);
setWindowTitle(tr("Properties")); setWindowTitle(tr("Properties"));
// remove Help question mark button from the title bar // remove Help question mark button from the title bar
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
ui->addonsTab->SetTitleId(title_id); addons_tab->SetTitleId(title_id);
scene = new QGraphicsScene; scene = new QGraphicsScene;
ui->icon_view->setScene(scene); ui->icon_view->setScene(scene);
if (Core::System::GetInstance().IsPoweredOn()) { if (system.IsPoweredOn()) {
QPushButton* apply_button = ui->buttonBox->addButton(QDialogButtonBox::Apply); QPushButton* apply_button = ui->buttonBox->addButton(QDialogButtonBox::Apply);
connect(apply_button, &QAbstractButton::clicked, this, connect(apply_button, &QAbstractButton::clicked, this,
&ConfigurePerGame::HandleApplyButtonClicked); &ConfigurePerGame::HandleApplyButtonClicked);
@ -67,15 +91,15 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, const std::str
ConfigurePerGame::~ConfigurePerGame() = default; ConfigurePerGame::~ConfigurePerGame() = default;
void ConfigurePerGame::ApplyConfiguration() { void ConfigurePerGame::ApplyConfiguration() {
ui->addonsTab->ApplyConfiguration(); addons_tab->ApplyConfiguration();
ui->generalTab->ApplyConfiguration(); general_tab->ApplyConfiguration();
ui->cpuTab->ApplyConfiguration(); cpu_tab->ApplyConfiguration();
ui->systemTab->ApplyConfiguration(); system_tab->ApplyConfiguration();
ui->graphicsTab->ApplyConfiguration(); graphics_tab->ApplyConfiguration();
ui->graphicsAdvancedTab->ApplyConfiguration(); graphics_advanced_tab->ApplyConfiguration();
ui->audioTab->ApplyConfiguration(); audio_tab->ApplyConfiguration();
Core::System::GetInstance().ApplySettings(); system.ApplySettings();
Settings::LogSettings(); Settings::LogSettings();
game_config->Save(); game_config->Save();
@ -108,12 +132,11 @@ void ConfigurePerGame::LoadConfiguration() {
return; return;
} }
ui->addonsTab->LoadFromFile(file); addons_tab->LoadFromFile(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());
auto& system = Core::System::GetInstance();
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
system.GetContentProvider()}; system.GetContentProvider()};
const auto control = pm.GetControlMetadata(); const auto control = pm.GetControlMetadata();
@ -164,4 +187,11 @@ void ConfigurePerGame::LoadConfiguration() {
const auto valueText = ReadableByteSize(file->GetSize()); const auto valueText = ReadableByteSize(file->GetSize());
ui->display_size->setText(valueText); ui->display_size->setText(valueText);
general_tab->SetConfiguration();
cpu_tab->SetConfiguration();
system_tab->SetConfiguration();
graphics_tab->SetConfiguration();
graphics_advanced_tab->SetConfiguration();
audio_tab->SetConfiguration();
} }

View File

@ -14,6 +14,18 @@
#include "core/file_sys/vfs_types.h" #include "core/file_sys/vfs_types.h"
#include "yuzu/configuration/config.h" #include "yuzu/configuration/config.h"
namespace Core {
class System;
}
class ConfigurePerGameAddons;
class ConfigureAudio;
class ConfigureCpu;
class ConfigureGeneral;
class ConfigureGraphics;
class ConfigureGraphicsAdvanced;
class ConfigureSystem;
class QGraphicsScene; class QGraphicsScene;
class QStandardItem; class QStandardItem;
class QStandardItemModel; class QStandardItemModel;
@ -29,7 +41,8 @@ class ConfigurePerGame : public QDialog {
public: public:
// Cannot use std::filesystem::path due to https://bugreports.qt.io/browse/QTBUG-73263 // Cannot use std::filesystem::path due to https://bugreports.qt.io/browse/QTBUG-73263
explicit ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name); explicit ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name,
Core::System& system_);
~ConfigurePerGame() override; ~ConfigurePerGame() override;
/// Save all button configurations to settings file /// Save all button configurations to settings file
@ -52,4 +65,14 @@ private:
QGraphicsScene* scene; QGraphicsScene* scene;
std::unique_ptr<Config> game_config; std::unique_ptr<Config> game_config;
Core::System& system;
std::unique_ptr<ConfigurePerGameAddons> addons_tab;
std::unique_ptr<ConfigureAudio> audio_tab;
std::unique_ptr<ConfigureCpu> cpu_tab;
std::unique_ptr<ConfigureGeneral> general_tab;
std::unique_ptr<ConfigureGraphics> graphics_tab;
std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab;
std::unique_ptr<ConfigureSystem> system_tab;
}; };

View File

@ -7,12 +7,13 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>900</width> <width>900</width>
<height>600</height> <height>630</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>900</width> <width>900</width>
<height>0</height>
</size> </size>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -214,7 +215,7 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>-1</number>
</property> </property>
<property name="usesScrollButtons"> <property name="usesScrollButtons">
<bool>true</bool> <bool>true</bool>
@ -225,41 +226,6 @@
<property name="tabsClosable"> <property name="tabsClosable">
<bool>false</bool> <bool>false</bool>
</property> </property>
<widget class="ConfigurePerGameAddons" name="addonsTab">
<attribute name="title">
<string>Add-Ons</string>
</attribute>
</widget>
<widget class="ConfigureGeneral" name="generalTab">
<attribute name="title">
<string>General</string>
</attribute>
</widget>
<widget class="ConfigureSystem" name="systemTab">
<attribute name="title">
<string>System</string>
</attribute>
</widget>
<widget class="ConfigureCpu" name="cpuTab">
<attribute name="title">
<string>CPU</string>
</attribute>
</widget>
<widget class="ConfigureGraphics" name="graphicsTab">
<attribute name="title">
<string>Graphics</string>
</attribute>
</widget>
<widget class="ConfigureGraphicsAdvanced" name="graphicsAdvancedTab">
<attribute name="title">
<string>Adv. Graphics</string>
</attribute>
</widget>
<widget class="ConfigureAudio" name="audioTab">
<attribute name="title">
<string>Audio</string>
</attribute>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -284,50 +250,6 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>ConfigureGeneral</class>
<extends>QWidget</extends>
<header>configuration/configure_general.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureSystem</class>
<extends>QWidget</extends>
<header>configuration/configure_system.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureAudio</class>
<extends>QWidget</extends>
<header>configuration/configure_audio.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureGraphics</class>
<extends>QWidget</extends>
<header>configuration/configure_graphics.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureGraphicsAdvanced</class>
<extends>QWidget</extends>
<header>configuration/configure_graphics_advanced.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigurePerGameAddons</class>
<extends>QWidget</extends>
<header>configuration/configure_per_game_addons.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureCpu</class>
<extends>QWidget</extends>
<header>configuration/configure_cpu.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>
@ -335,12 +257,32 @@
<signal>accepted()</signal> <signal>accepted()</signal>
<receiver>ConfigurePerGame</receiver> <receiver>ConfigurePerGame</receiver>
<slot>accept()</slot> <slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection> </connection>
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
<receiver>ConfigurePerGame</receiver> <receiver>ConfigurePerGame</receiver>
<slot>reject()</slot> <slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection> </connection>
</connections> </connections>
</ui> </ui>

View File

@ -26,8 +26,8 @@
#include "yuzu/uisettings.h" #include "yuzu/uisettings.h"
#include "yuzu/util/util.h" #include "yuzu/util/util.h"
ConfigurePerGameAddons::ConfigurePerGameAddons(QWidget* parent) ConfigurePerGameAddons::ConfigurePerGameAddons(Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigurePerGameAddons) { : QWidget(parent), ui(new Ui::ConfigurePerGameAddons), system{system_} {
ui->setupUi(this); ui->setupUi(this);
layout = new QVBoxLayout; layout = new QVBoxLayout;
@ -58,7 +58,7 @@ ConfigurePerGameAddons::ConfigurePerGameAddons(QWidget* parent)
ui->scrollArea->setLayout(layout); ui->scrollArea->setLayout(layout);
ui->scrollArea->setEnabled(!Core::System::GetInstance().IsPoweredOn()); ui->scrollArea->setEnabled(!system.IsPoweredOn());
connect(item_model, &QStandardItemModel::itemChanged, connect(item_model, &QStandardItemModel::itemChanged,
[] { UISettings::values.is_game_list_reload_pending.exchange(true); }); [] { UISettings::values.is_game_list_reload_pending.exchange(true); });
@ -112,7 +112,6 @@ void ConfigurePerGameAddons::LoadConfiguration() {
return; return;
} }
auto& system = Core::System::GetInstance();
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
system.GetContentProvider()}; system.GetContentProvider()};
const auto loader = Loader::GetLoader(system, file); const auto loader = Loader::GetLoader(system, file);

View File

@ -11,6 +11,10 @@
#include "core/file_sys/vfs_types.h" #include "core/file_sys/vfs_types.h"
namespace Core {
class System;
}
class QGraphicsScene; class QGraphicsScene;
class QStandardItem; class QStandardItem;
class QStandardItemModel; class QStandardItemModel;
@ -25,7 +29,7 @@ class ConfigurePerGameAddons : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigurePerGameAddons(QWidget* parent = nullptr); explicit ConfigurePerGameAddons(Core::System& system_, QWidget* parent = nullptr);
~ConfigurePerGameAddons() override; ~ConfigurePerGameAddons() override;
/// Save all button configurations to settings file /// Save all button configurations to settings file
@ -50,4 +54,6 @@ private:
QStandardItemModel* item_model; QStandardItemModel* item_model;
std::vector<QList<QStandardItem*>> list_items; std::vector<QList<QStandardItem*>> list_items;
Core::System& system;
}; };

View File

@ -13,6 +13,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<property name="accessibleDescription">
<string>Add-Ons</string>
</property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QScrollArea" name="scrollArea"> <widget class="QScrollArea" name="scrollArea">

View File

@ -76,9 +76,9 @@ QString GetProfileUsernameFromUser(QWidget* parent, const QString& description_t
} }
} // Anonymous namespace } // Anonymous namespace
ConfigureProfileManager::ConfigureProfileManager(QWidget* parent) ConfigureProfileManager::ConfigureProfileManager(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureProfileManager), : QWidget(parent), ui(new Ui::ConfigureProfileManager),
profile_manager(std::make_unique<Service::Account::ProfileManager>()) { profile_manager(std::make_unique<Service::Account::ProfileManager>()), system{system_} {
ui->setupUi(this); ui->setupUi(this);
tree_view = new QTreeView; tree_view = new QTreeView;
@ -137,7 +137,7 @@ void ConfigureProfileManager::RetranslateUI() {
} }
void ConfigureProfileManager::SetConfiguration() { void ConfigureProfileManager::SetConfiguration() {
enabled = !Core::System::GetInstance().IsPoweredOn(); enabled = !system.IsPoweredOn();
item_model->removeRows(0, item_model->rowCount()); item_model->removeRows(0, item_model->rowCount());
list_items.clear(); list_items.clear();
@ -180,8 +180,6 @@ void ConfigureProfileManager::ApplyConfiguration() {
if (!enabled) { if (!enabled) {
return; return;
} }
Core::System::GetInstance().ApplySettings();
} }
void ConfigureProfileManager::SelectUser(const QModelIndex& index) { void ConfigureProfileManager::SelectUser(const QModelIndex& index) {

View File

@ -9,6 +9,10 @@
#include <QList> #include <QList>
#include <QWidget> #include <QWidget>
namespace Core {
class System;
}
class QGraphicsScene; class QGraphicsScene;
class QStandardItem; class QStandardItem;
class QStandardItemModel; class QStandardItemModel;
@ -27,7 +31,7 @@ class ConfigureProfileManager : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureProfileManager(QWidget* parent = nullptr); explicit ConfigureProfileManager(const Core::System& system_, QWidget* parent = nullptr);
~ConfigureProfileManager() override; ~ConfigureProfileManager() override;
void ApplyConfiguration(); void ApplyConfiguration();
@ -58,4 +62,6 @@ private:
bool enabled = false; bool enabled = false;
std::unique_ptr<Service::Account::ProfileManager> profile_manager; std::unique_ptr<Service::Account::ProfileManager> profile_manager;
const Core::System& system;
}; };

View File

@ -6,13 +6,16 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>366</width> <width>390</width>
<height>483</height> <height>483</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<property name="accessibleName">
<string>Profiles</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">

View File

@ -17,7 +17,8 @@
#include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_system.h" #include "yuzu/configuration/configure_system.h"
ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureSystem) { ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureSystem), system{system_} {
ui->setupUi(this); ui->setupUi(this);
connect(ui->button_regenerate_console_id, &QPushButton::clicked, this, connect(ui->button_regenerate_console_id, &QPushButton::clicked, this,
&ConfigureSystem::RefreshConsoleID); &ConfigureSystem::RefreshConsoleID);
@ -59,7 +60,7 @@ void ConfigureSystem::RetranslateUI() {
} }
void ConfigureSystem::SetConfiguration() { void ConfigureSystem::SetConfiguration() {
enabled = !Core::System::GetInstance().IsPoweredOn(); enabled = !system.IsPoweredOn();
const auto rng_seed = const auto rng_seed =
QStringLiteral("%1") QStringLiteral("%1")
.arg(Settings::values.rng_seed.GetValue().value_or(0), 8, 16, QLatin1Char{'0'}) .arg(Settings::values.rng_seed.GetValue().value_or(0), 8, 16, QLatin1Char{'0'})
@ -103,8 +104,6 @@ void ConfigureSystem::SetConfiguration() {
void ConfigureSystem::ReadSystemSettings() {} void ConfigureSystem::ReadSystemSettings() {}
void ConfigureSystem::ApplyConfiguration() { void ConfigureSystem::ApplyConfiguration() {
auto& system = Core::System::GetInstance();
// Allow setting custom RTC even if system is powered on, // Allow setting custom RTC even if system is powered on,
// to allow in-game time to be fast forwarded // to allow in-game time to be fast forwarded
if (Settings::IsConfiguringGlobal()) { if (Settings::IsConfiguringGlobal()) {
@ -162,8 +161,6 @@ void ConfigureSystem::ApplyConfiguration() {
break; break;
} }
} }
system.ApplySettings();
} }
void ConfigureSystem::RefreshConsoleID() { void ConfigureSystem::RefreshConsoleID() {

View File

@ -9,6 +9,10 @@
#include <QList> #include <QList>
#include <QWidget> #include <QWidget>
namespace Core {
class System;
}
namespace ConfigurationShared { namespace ConfigurationShared {
enum class CheckState; enum class CheckState;
} }
@ -21,17 +25,16 @@ class ConfigureSystem : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureSystem(QWidget* parent = nullptr); explicit ConfigureSystem(Core::System& system_, QWidget* parent = nullptr);
~ConfigureSystem() override; ~ConfigureSystem() override;
void ApplyConfiguration(); void ApplyConfiguration();
void SetConfiguration();
private: private:
void changeEvent(QEvent* event) override; void changeEvent(QEvent* event) override;
void RetranslateUI(); void RetranslateUI();
void SetConfiguration();
void ReadSystemSettings(); void ReadSystemSettings();
void RefreshConsoleID(); void RefreshConsoleID();
@ -48,4 +51,6 @@ private:
ConfigurationShared::CheckState use_rng_seed; ConfigurationShared::CheckState use_rng_seed;
ConfigurationShared::CheckState use_custom_rtc; ConfigurationShared::CheckState use_custom_rtc;
Core::System& system;
}; };

View File

@ -13,6 +13,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<property name="accessibleName">
<string>System</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">

View File

@ -54,7 +54,8 @@ QString GetTranslatedRowTextName(size_t index) {
} }
} // Anonymous namespace } // Anonymous namespace
ConfigureUi::ConfigureUi(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureUi) { ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureUi), system{system_} {
ui->setupUi(this); ui->setupUi(this);
InitializeLanguageComboBox(); InitializeLanguageComboBox();
@ -116,7 +117,7 @@ void ConfigureUi::ApplyConfiguration() {
UISettings::values.enable_screenshot_save_as = ui->enable_screenshot_save_as->isChecked(); UISettings::values.enable_screenshot_save_as = ui->enable_screenshot_save_as->isChecked();
Common::FS::SetYuzuPath(Common::FS::YuzuPath::ScreenshotsDir, Common::FS::SetYuzuPath(Common::FS::YuzuPath::ScreenshotsDir,
ui->screenshot_path_edit->text().toStdString()); ui->screenshot_path_edit->text().toStdString());
Core::System::GetInstance().ApplySettings(); system.ApplySettings();
} }
void ConfigureUi::RequestGameListUpdate() { void ConfigureUi::RequestGameListUpdate() {

View File

@ -7,6 +7,10 @@
#include <memory> #include <memory>
#include <QWidget> #include <QWidget>
namespace Core {
class System;
}
namespace Ui { namespace Ui {
class ConfigureUi; class ConfigureUi;
} }
@ -15,7 +19,7 @@ class ConfigureUi : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureUi(QWidget* parent = nullptr); explicit ConfigureUi(Core::System& system_, QWidget* parent = nullptr);
~ConfigureUi() override; ~ConfigureUi() override;
void ApplyConfiguration(); void ApplyConfiguration();
@ -42,4 +46,6 @@ private:
void UpdateSecondRowComboBox(bool init = false); void UpdateSecondRowComboBox(bool init = false);
std::unique_ptr<Ui::ConfigureUi> ui; std::unique_ptr<Ui::ConfigureUi> ui;
Core::System& system;
}; };

View File

@ -7,12 +7,15 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>363</width> <width>363</width>
<height>391</height> <height>507</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<property name="accessibleName">
<string>UI</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QGroupBox" name="general_groupBox"> <widget class="QGroupBox" name="general_groupBox">

View File

@ -13,6 +13,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<property name="accessibleName">
<string>Web</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
@ -55,7 +58,7 @@
</widget> </widget>
</item> </item>
<item row="0" column="1" colspan="3"> <item row="0" column="1" colspan="3">
<widget class="QLabel" name="username" /> <widget class="QLabel" name="username"/>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_token"> <widget class="QLabel" name="label_token">
@ -65,8 +68,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="4"> <item row="1" column="4">
<widget class="QLabel" name="label_token_verified"> <widget class="QLabel" name="label_token_verified"/>
</widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_username"> <widget class="QLabel" name="label_username">

View File

@ -28,7 +28,7 @@ std::filesystem::path GetNameWithoutExtension(std::filesystem::path filename) {
} // namespace } // namespace
InputProfiles::InputProfiles() { InputProfiles::InputProfiles(Core::System& system_) : system{system_} {
const auto input_profile_loc = FS::GetYuzuPath(FS::YuzuPath::ConfigDir) / "input"; const auto input_profile_loc = FS::GetYuzuPath(FS::YuzuPath::ConfigDir) / "input";
if (!FS::IsDir(input_profile_loc)) { if (!FS::IsDir(input_profile_loc)) {
@ -44,8 +44,8 @@ InputProfiles::InputProfiles() {
if (IsINI(filename) && IsProfileNameValid(name_without_ext)) { if (IsINI(filename) && IsProfileNameValid(name_without_ext)) {
map_profiles.insert_or_assign( map_profiles.insert_or_assign(
name_without_ext, name_without_ext, std::make_unique<Config>(system, name_without_ext,
std::make_unique<Config>(name_without_ext, Config::ConfigType::InputProfile)); Config::ConfigType::InputProfile));
} }
return true; return true;
@ -81,7 +81,8 @@ bool InputProfiles::CreateProfile(const std::string& profile_name, std::size_t p
} }
map_profiles.insert_or_assign( map_profiles.insert_or_assign(
profile_name, std::make_unique<Config>(profile_name, Config::ConfigType::InputProfile)); profile_name,
std::make_unique<Config>(system, profile_name, Config::ConfigType::InputProfile));
return SaveProfile(profile_name, player_index); return SaveProfile(profile_name, player_index);
} }

View File

@ -8,12 +8,16 @@
#include <string_view> #include <string_view>
#include <unordered_map> #include <unordered_map>
namespace Core {
class System;
}
class Config; class Config;
class InputProfiles { class InputProfiles {
public: public:
explicit InputProfiles(); explicit InputProfiles(Core::System& system_);
virtual ~InputProfiles(); virtual ~InputProfiles();
std::vector<std::string> GetInputProfileNames(); std::vector<std::string> GetInputProfileNames();
@ -29,4 +33,6 @@ private:
bool ProfileExistsInMap(const std::string& profile_name) const; bool ProfileExistsInMap(const std::string& profile_name) const;
std::unordered_map<std::string, std::unique_ptr<Config>> map_profiles; std::unordered_map<std::string, std::unique_ptr<Config>> map_profiles;
Core::System& system;
}; };

View File

@ -89,20 +89,20 @@ std::size_t WaitTreeItem::Row() const {
return row; return row;
} }
std::vector<std::unique_ptr<WaitTreeThread>> WaitTreeItem::MakeThreadItemList() { std::vector<std::unique_ptr<WaitTreeThread>> WaitTreeItem::MakeThreadItemList(
Core::System& system) {
std::vector<std::unique_ptr<WaitTreeThread>> item_list; std::vector<std::unique_ptr<WaitTreeThread>> item_list;
std::size_t row = 0; std::size_t row = 0;
auto add_threads = [&](const std::vector<Kernel::KThread*>& threads) { auto add_threads = [&](const std::vector<Kernel::KThread*>& threads) {
for (std::size_t i = 0; i < threads.size(); ++i) { for (std::size_t i = 0; i < threads.size(); ++i) {
if (threads[i]->GetThreadTypeForDebugging() == Kernel::ThreadType::User) { if (threads[i]->GetThreadTypeForDebugging() == Kernel::ThreadType::User) {
item_list.push_back(std::make_unique<WaitTreeThread>(*threads[i])); item_list.push_back(std::make_unique<WaitTreeThread>(*threads[i], system));
item_list.back()->row = row; item_list.back()->row = row;
} }
++row; ++row;
} }
}; };
const auto& system = Core::System::GetInstance();
add_threads(system.GlobalSchedulerContext().GetThreadList()); add_threads(system.GlobalSchedulerContext().GetThreadList());
return item_list; return item_list;
@ -115,9 +115,10 @@ QString WaitTreeText::GetText() const {
return text; return text;
} }
WaitTreeMutexInfo::WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table) WaitTreeMutexInfo::WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table,
: mutex_address(mutex_address) { Core::System& system_)
mutex_value = Core::System::GetInstance().Memory().Read32(mutex_address); : mutex_address(mutex_address), system{system_} {
mutex_value = system.Memory().Read32(mutex_address);
owner_handle = static_cast<Kernel::Handle>(mutex_value & Kernel::Svc::HandleWaitMask); owner_handle = static_cast<Kernel::Handle>(mutex_value & Kernel::Svc::HandleWaitMask);
owner = handle_table.GetObject<Kernel::KThread>(owner_handle).GetPointerUnsafe(); owner = handle_table.GetObject<Kernel::KThread>(owner_handle).GetPointerUnsafe();
} }
@ -136,12 +137,13 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeMutexInfo::GetChildren() cons
list.push_back(std::make_unique<WaitTreeText>( list.push_back(std::make_unique<WaitTreeText>(
tr("owner handle: 0x%1").arg(owner_handle, 8, 16, QLatin1Char{'0'}))); tr("owner handle: 0x%1").arg(owner_handle, 8, 16, QLatin1Char{'0'})));
if (owner != nullptr) { if (owner != nullptr) {
list.push_back(std::make_unique<WaitTreeThread>(*owner)); list.push_back(std::make_unique<WaitTreeThread>(*owner, system));
} }
return list; return list;
} }
WaitTreeCallstack::WaitTreeCallstack(const Kernel::KThread& thread) : thread(thread) {} WaitTreeCallstack::WaitTreeCallstack(const Kernel::KThread& thread, Core::System& system_)
: thread(thread), system{system_} {}
WaitTreeCallstack::~WaitTreeCallstack() = default; WaitTreeCallstack::~WaitTreeCallstack() = default;
QString WaitTreeCallstack::GetText() const { QString WaitTreeCallstack::GetText() const {
@ -159,8 +161,7 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeCallstack::GetChildren() cons
return list; return list;
} }
auto backtrace = Core::ARM_Interface::GetBacktraceFromContext(Core::System::GetInstance(), auto backtrace = Core::ARM_Interface::GetBacktraceFromContext(system, thread.GetContext64());
thread.GetContext64());
for (auto& entry : backtrace) { for (auto& entry : backtrace) {
std::string s = fmt::format("{:20}{:016X} {:016X} {:016X} {}", entry.module, entry.address, std::string s = fmt::format("{:20}{:016X} {:016X} {:016X} {}", entry.module, entry.address,
@ -172,8 +173,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeCallstack::GetChildren() cons
} }
WaitTreeSynchronizationObject::WaitTreeSynchronizationObject( WaitTreeSynchronizationObject::WaitTreeSynchronizationObject(
const Kernel::KSynchronizationObject& o) const Kernel::KSynchronizationObject& o, Core::System& system_)
: object(o) {} : object(o), system{system_} {}
WaitTreeSynchronizationObject::~WaitTreeSynchronizationObject() = default; WaitTreeSynchronizationObject::~WaitTreeSynchronizationObject() = default;
WaitTreeExpandableItem::WaitTreeExpandableItem() = default; WaitTreeExpandableItem::WaitTreeExpandableItem() = default;
@ -191,16 +192,18 @@ QString WaitTreeSynchronizationObject::GetText() const {
} }
std::unique_ptr<WaitTreeSynchronizationObject> WaitTreeSynchronizationObject::make( std::unique_ptr<WaitTreeSynchronizationObject> WaitTreeSynchronizationObject::make(
const Kernel::KSynchronizationObject& object) { const Kernel::KSynchronizationObject& object, Core::System& system) {
const auto type = const auto type =
static_cast<Kernel::KClassTokenGenerator::ObjectType>(object.GetTypeObj().GetClassToken()); static_cast<Kernel::KClassTokenGenerator::ObjectType>(object.GetTypeObj().GetClassToken());
switch (type) { switch (type) {
case Kernel::KClassTokenGenerator::ObjectType::KReadableEvent: case Kernel::KClassTokenGenerator::ObjectType::KReadableEvent:
return std::make_unique<WaitTreeEvent>(static_cast<const Kernel::KReadableEvent&>(object)); return std::make_unique<WaitTreeEvent>(static_cast<const Kernel::KReadableEvent&>(object),
system);
case Kernel::KClassTokenGenerator::ObjectType::KThread: case Kernel::KClassTokenGenerator::ObjectType::KThread:
return std::make_unique<WaitTreeThread>(static_cast<const Kernel::KThread&>(object)); return std::make_unique<WaitTreeThread>(static_cast<const Kernel::KThread&>(object),
system);
default: default:
return std::make_unique<WaitTreeSynchronizationObject>(object); return std::make_unique<WaitTreeSynchronizationObject>(object, system);
} }
} }
@ -211,15 +214,15 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeSynchronizationObject::GetChi
if (threads.empty()) { if (threads.empty()) {
list.push_back(std::make_unique<WaitTreeText>(tr("waited by no thread"))); list.push_back(std::make_unique<WaitTreeText>(tr("waited by no thread")));
} else { } else {
list.push_back(std::make_unique<WaitTreeThreadList>(std::move(threads))); list.push_back(std::make_unique<WaitTreeThreadList>(std::move(threads), system));
} }
return list; return list;
} }
WaitTreeObjectList::WaitTreeObjectList(const std::vector<Kernel::KSynchronizationObject*>& list, WaitTreeObjectList::WaitTreeObjectList(const std::vector<Kernel::KSynchronizationObject*>& list,
bool w_all) bool w_all, Core::System& system_)
: object_list(list), wait_all(w_all) {} : object_list(list), wait_all(w_all), system{system_} {}
WaitTreeObjectList::~WaitTreeObjectList() = default; WaitTreeObjectList::~WaitTreeObjectList() = default;
@ -231,13 +234,14 @@ QString WaitTreeObjectList::GetText() const {
std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeObjectList::GetChildren() const { std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeObjectList::GetChildren() const {
std::vector<std::unique_ptr<WaitTreeItem>> list(object_list.size()); std::vector<std::unique_ptr<WaitTreeItem>> list(object_list.size());
std::transform(object_list.begin(), object_list.end(), list.begin(), std::transform(object_list.begin(), object_list.end(), list.begin(), [this](const auto& t) {
[](const auto& t) { return WaitTreeSynchronizationObject::make(*t); }); return WaitTreeSynchronizationObject::make(*t, system);
});
return list; return list;
} }
WaitTreeThread::WaitTreeThread(const Kernel::KThread& thread) WaitTreeThread::WaitTreeThread(const Kernel::KThread& thread, Core::System& system_)
: WaitTreeSynchronizationObject(thread) {} : WaitTreeSynchronizationObject(thread, system_), system{system_} {}
WaitTreeThread::~WaitTreeThread() = default; WaitTreeThread::~WaitTreeThread() = default;
QString WaitTreeThread::GetText() const { QString WaitTreeThread::GetText() const {
@ -360,7 +364,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const {
const VAddr mutex_wait_address = thread.GetMutexWaitAddressForDebugging(); const VAddr mutex_wait_address = thread.GetMutexWaitAddressForDebugging();
if (mutex_wait_address != 0) { if (mutex_wait_address != 0) {
const auto& handle_table = thread.GetOwnerProcess()->GetHandleTable(); const auto& handle_table = thread.GetOwnerProcess()->GetHandleTable();
list.push_back(std::make_unique<WaitTreeMutexInfo>(mutex_wait_address, handle_table)); list.push_back(
std::make_unique<WaitTreeMutexInfo>(mutex_wait_address, handle_table, system));
} else { } else {
list.push_back(std::make_unique<WaitTreeText>(tr("not waiting for mutex"))); list.push_back(std::make_unique<WaitTreeText>(tr("not waiting for mutex")));
} }
@ -369,20 +374,20 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const {
thread.GetWaitReasonForDebugging() == thread.GetWaitReasonForDebugging() ==
Kernel::ThreadWaitReasonForDebugging::Synchronization) { Kernel::ThreadWaitReasonForDebugging::Synchronization) {
list.push_back(std::make_unique<WaitTreeObjectList>(thread.GetWaitObjectsForDebugging(), list.push_back(std::make_unique<WaitTreeObjectList>(thread.GetWaitObjectsForDebugging(),
thread.IsCancellable())); thread.IsCancellable(), system));
} }
list.push_back(std::make_unique<WaitTreeCallstack>(thread)); list.push_back(std::make_unique<WaitTreeCallstack>(thread, system));
return list; return list;
} }
WaitTreeEvent::WaitTreeEvent(const Kernel::KReadableEvent& object) WaitTreeEvent::WaitTreeEvent(const Kernel::KReadableEvent& object, Core::System& system_)
: WaitTreeSynchronizationObject(object) {} : WaitTreeSynchronizationObject(object, system_) {}
WaitTreeEvent::~WaitTreeEvent() = default; WaitTreeEvent::~WaitTreeEvent() = default;
WaitTreeThreadList::WaitTreeThreadList(std::vector<Kernel::KThread*>&& list) WaitTreeThreadList::WaitTreeThreadList(std::vector<Kernel::KThread*>&& list, Core::System& system_)
: thread_list(std::move(list)) {} : thread_list(std::move(list)), system{system_} {}
WaitTreeThreadList::~WaitTreeThreadList() = default; WaitTreeThreadList::~WaitTreeThreadList() = default;
QString WaitTreeThreadList::GetText() const { QString WaitTreeThreadList::GetText() const {
@ -392,11 +397,12 @@ QString WaitTreeThreadList::GetText() const {
std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThreadList::GetChildren() const { std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThreadList::GetChildren() const {
std::vector<std::unique_ptr<WaitTreeItem>> list(thread_list.size()); std::vector<std::unique_ptr<WaitTreeItem>> list(thread_list.size());
std::transform(thread_list.begin(), thread_list.end(), list.begin(), std::transform(thread_list.begin(), thread_list.end(), list.begin(),
[](const auto& t) { return std::make_unique<WaitTreeThread>(*t); }); [this](const auto& t) { return std::make_unique<WaitTreeThread>(*t, system); });
return list; return list;
} }
WaitTreeModel::WaitTreeModel(QObject* parent) : QAbstractItemModel(parent) {} WaitTreeModel::WaitTreeModel(Core::System& system_, QObject* parent)
: QAbstractItemModel(parent), system{system_} {}
WaitTreeModel::~WaitTreeModel() = default; WaitTreeModel::~WaitTreeModel() = default;
QModelIndex WaitTreeModel::index(int row, int column, const QModelIndex& parent) const { QModelIndex WaitTreeModel::index(int row, int column, const QModelIndex& parent) const {
@ -455,10 +461,11 @@ void WaitTreeModel::ClearItems() {
} }
void WaitTreeModel::InitItems() { void WaitTreeModel::InitItems() {
thread_items = WaitTreeItem::MakeThreadItemList(); thread_items = WaitTreeItem::MakeThreadItemList(system);
} }
WaitTreeWidget::WaitTreeWidget(QWidget* parent) : QDockWidget(tr("&Wait Tree"), parent) { WaitTreeWidget::WaitTreeWidget(Core::System& system_, QWidget* parent)
: QDockWidget(tr("&Wait Tree"), parent), system{system_} {
setObjectName(QStringLiteral("WaitTreeWidget")); setObjectName(QStringLiteral("WaitTreeWidget"));
view = new QTreeView(this); view = new QTreeView(this);
view->setHeaderHidden(true); view->setHeaderHidden(true);
@ -469,7 +476,7 @@ WaitTreeWidget::WaitTreeWidget(QWidget* parent) : QDockWidget(tr("&Wait Tree"),
WaitTreeWidget::~WaitTreeWidget() = default; WaitTreeWidget::~WaitTreeWidget() = default;
void WaitTreeWidget::OnDebugModeEntered() { void WaitTreeWidget::OnDebugModeEntered() {
if (!Core::System::GetInstance().IsPoweredOn()) if (!system.IsPoweredOn())
return; return;
model->InitItems(); model->InitItems();
view->setModel(model); view->setModel(model);
@ -483,7 +490,7 @@ void WaitTreeWidget::OnDebugModeLeft() {
} }
void WaitTreeWidget::OnEmulationStarting(EmuThread* emu_thread) { void WaitTreeWidget::OnEmulationStarting(EmuThread* emu_thread) {
model = new WaitTreeModel(this); model = new WaitTreeModel(system, this);
view->setModel(model); view->setModel(model);
setEnabled(false); setEnabled(false);
} }

View File

@ -18,6 +18,10 @@
class EmuThread; class EmuThread;
namespace Core {
class System;
}
namespace Kernel { namespace Kernel {
class KHandleTable; class KHandleTable;
class KReadableEvent; class KReadableEvent;
@ -42,7 +46,7 @@ public:
WaitTreeItem* Parent() const; WaitTreeItem* Parent() const;
const std::vector<std::unique_ptr<WaitTreeItem>>& Children() const; const std::vector<std::unique_ptr<WaitTreeItem>>& Children() const;
std::size_t Row() const; std::size_t Row() const;
static std::vector<std::unique_ptr<WaitTreeThread>> MakeThreadItemList(); static std::vector<std::unique_ptr<WaitTreeThread>> MakeThreadItemList(Core::System& system);
private: private:
std::size_t row; std::size_t row;
@ -75,7 +79,8 @@ public:
class WaitTreeMutexInfo : public WaitTreeExpandableItem { class WaitTreeMutexInfo : public WaitTreeExpandableItem {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table); explicit WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table,
Core::System& system_);
~WaitTreeMutexInfo() override; ~WaitTreeMutexInfo() override;
QString GetText() const override; QString GetText() const override;
@ -86,12 +91,14 @@ private:
u32 mutex_value{}; u32 mutex_value{};
Kernel::Handle owner_handle{}; Kernel::Handle owner_handle{};
Kernel::KThread* owner{}; Kernel::KThread* owner{};
Core::System& system;
}; };
class WaitTreeCallstack : public WaitTreeExpandableItem { class WaitTreeCallstack : public WaitTreeExpandableItem {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeCallstack(const Kernel::KThread& thread); explicit WaitTreeCallstack(const Kernel::KThread& thread, Core::System& system_);
~WaitTreeCallstack() override; ~WaitTreeCallstack() override;
QString GetText() const override; QString GetText() const override;
@ -99,27 +106,34 @@ public:
private: private:
const Kernel::KThread& thread; const Kernel::KThread& thread;
Core::System& system;
}; };
class WaitTreeSynchronizationObject : public WaitTreeExpandableItem { class WaitTreeSynchronizationObject : public WaitTreeExpandableItem {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeSynchronizationObject(const Kernel::KSynchronizationObject& object); explicit WaitTreeSynchronizationObject(const Kernel::KSynchronizationObject& object,
Core::System& system_);
~WaitTreeSynchronizationObject() override; ~WaitTreeSynchronizationObject() override;
static std::unique_ptr<WaitTreeSynchronizationObject> make( static std::unique_ptr<WaitTreeSynchronizationObject> make(
const Kernel::KSynchronizationObject& object); const Kernel::KSynchronizationObject& object, Core::System& system);
QString GetText() const override; QString GetText() const override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
protected: protected:
const Kernel::KSynchronizationObject& object; const Kernel::KSynchronizationObject& object;
private:
Core::System& system;
}; };
class WaitTreeObjectList : public WaitTreeExpandableItem { class WaitTreeObjectList : public WaitTreeExpandableItem {
Q_OBJECT Q_OBJECT
public: public:
WaitTreeObjectList(const std::vector<Kernel::KSynchronizationObject*>& list, bool wait_all); WaitTreeObjectList(const std::vector<Kernel::KSynchronizationObject*>& list, bool wait_all,
Core::System& system_);
~WaitTreeObjectList() override; ~WaitTreeObjectList() override;
QString GetText() const override; QString GetText() const override;
@ -128,30 +142,35 @@ public:
private: private:
const std::vector<Kernel::KSynchronizationObject*>& object_list; const std::vector<Kernel::KSynchronizationObject*>& object_list;
bool wait_all; bool wait_all;
Core::System& system;
}; };
class WaitTreeThread : public WaitTreeSynchronizationObject { class WaitTreeThread : public WaitTreeSynchronizationObject {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeThread(const Kernel::KThread& thread); explicit WaitTreeThread(const Kernel::KThread& thread, Core::System& system_);
~WaitTreeThread() override; ~WaitTreeThread() override;
QString GetText() const override; QString GetText() const override;
QColor GetColor() const override; QColor GetColor() const override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
private:
Core::System& system;
}; };
class WaitTreeEvent : public WaitTreeSynchronizationObject { class WaitTreeEvent : public WaitTreeSynchronizationObject {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeEvent(const Kernel::KReadableEvent& object); explicit WaitTreeEvent(const Kernel::KReadableEvent& object, Core::System& system_);
~WaitTreeEvent() override; ~WaitTreeEvent() override;
}; };
class WaitTreeThreadList : public WaitTreeExpandableItem { class WaitTreeThreadList : public WaitTreeExpandableItem {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeThreadList(std::vector<Kernel::KThread*>&& list); explicit WaitTreeThreadList(std::vector<Kernel::KThread*>&& list, Core::System& system_);
~WaitTreeThreadList() override; ~WaitTreeThreadList() override;
QString GetText() const override; QString GetText() const override;
@ -159,13 +178,15 @@ public:
private: private:
std::vector<Kernel::KThread*> thread_list; std::vector<Kernel::KThread*> thread_list;
Core::System& system;
}; };
class WaitTreeModel : public QAbstractItemModel { class WaitTreeModel : public QAbstractItemModel {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeModel(QObject* parent = nullptr); explicit WaitTreeModel(Core::System& system_, QObject* parent = nullptr);
~WaitTreeModel() override; ~WaitTreeModel() override;
QVariant data(const QModelIndex& index, int role) const override; QVariant data(const QModelIndex& index, int role) const override;
@ -179,13 +200,15 @@ public:
private: private:
std::vector<std::unique_ptr<WaitTreeThread>> thread_items; std::vector<std::unique_ptr<WaitTreeThread>> thread_items;
Core::System& system;
}; };
class WaitTreeWidget : public QDockWidget { class WaitTreeWidget : public QDockWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeWidget(QWidget* parent = nullptr); explicit WaitTreeWidget(Core::System& system_, QWidget* parent = nullptr);
~WaitTreeWidget() override; ~WaitTreeWidget() override;
public slots: public slots:
@ -198,4 +221,6 @@ public slots:
private: private:
QTreeView* view; QTreeView* view;
WaitTreeModel* model; WaitTreeModel* model;
Core::System& system;
}; };

View File

@ -13,7 +13,7 @@
namespace DiscordRPC { namespace DiscordRPC {
DiscordImpl::DiscordImpl() { DiscordImpl::DiscordImpl(Core::System& system_) : system{system_} {
DiscordEventHandlers handlers{}; DiscordEventHandlers handlers{};
// The number is the client ID for yuzu, it's used for images and the // The number is the client ID for yuzu, it's used for images and the
@ -35,12 +35,13 @@ void DiscordImpl::Update() {
std::chrono::system_clock::now().time_since_epoch()) std::chrono::system_clock::now().time_since_epoch())
.count(); .count();
std::string title; std::string title;
if (Core::System::GetInstance().IsPoweredOn()) if (system.IsPoweredOn()) {
Core::System::GetInstance().GetAppLoader().ReadTitle(title); system.GetAppLoader().ReadTitle(title);
}
DiscordRichPresence presence{}; DiscordRichPresence presence{};
presence.largeImageKey = "yuzu_logo"; presence.largeImageKey = "yuzu_logo";
presence.largeImageText = "yuzu is an emulator for the Nintendo Switch"; presence.largeImageText = "yuzu is an emulator for the Nintendo Switch";
if (Core::System::GetInstance().IsPoweredOn()) { if (system.IsPoweredOn()) {
presence.state = title.c_str(); presence.state = title.c_str();
presence.details = "Currently in game"; presence.details = "Currently in game";
} else { } else {

View File

@ -6,15 +6,21 @@
#include "yuzu/discord.h" #include "yuzu/discord.h"
namespace Core {
class System;
}
namespace DiscordRPC { namespace DiscordRPC {
class DiscordImpl : public DiscordInterface { class DiscordImpl : public DiscordInterface {
public: public:
DiscordImpl(); DiscordImpl(Core::System& system_);
~DiscordImpl() override; ~DiscordImpl() override;
void Pause() override; void Pause() override;
void Update() override; void Update() override;
Core::System& system;
}; };
} // namespace DiscordRPC } // namespace DiscordRPC

View File

@ -304,8 +304,8 @@ void GameList::OnFilterCloseClicked() {
} }
GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvider* provider, GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvider* provider,
GMainWindow* parent) Core::System& system_, GMainWindow* parent)
: QWidget{parent}, vfs(std::move(vfs)), provider(provider) { : QWidget{parent}, vfs(std::move(vfs)), provider(provider), system{system_} {
watcher = new QFileSystemWatcher(this); watcher = new QFileSystemWatcher(this);
connect(watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory); connect(watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory);
@ -737,7 +737,8 @@ void GameList::PopulateAsync(QVector<UISettings::GameDir>& game_dirs) {
emit ShouldCancelWorker(); emit ShouldCancelWorker();
GameListWorker* worker = new GameListWorker(vfs, provider, game_dirs, compatibility_list); GameListWorker* worker =
new GameListWorker(vfs, provider, game_dirs, compatibility_list, system);
connect(worker, &GameListWorker::EntryReady, this, &GameList::AddEntry, Qt::QueuedConnection); connect(worker, &GameListWorker::EntryReady, this, &GameList::AddEntry, Qt::QueuedConnection);
connect(worker, &GameListWorker::DirEntryReady, this, &GameList::AddDirEntry, connect(worker, &GameListWorker::DirEntryReady, this, &GameList::AddDirEntry,

View File

@ -72,7 +72,8 @@ public:
}; };
explicit GameList(std::shared_ptr<FileSys::VfsFilesystem> vfs, explicit GameList(std::shared_ptr<FileSys::VfsFilesystem> vfs,
FileSys::ManualContentProvider* provider, GMainWindow* parent = nullptr); FileSys::ManualContentProvider* provider, Core::System& system_,
GMainWindow* parent = nullptr);
~GameList() override; ~GameList() override;
QString GetLastFilterResultItem() const; QString GetLastFilterResultItem() const;
@ -145,6 +146,8 @@ private:
CompatibilityList compatibility_list; CompatibilityList compatibility_list;
friend class GameListSearchField; friend class GameListSearchField;
Core::System& system;
}; };
class GameListPlaceholder : public QWidget { class GameListPlaceholder : public QWidget {

View File

@ -228,16 +228,15 @@ QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::stri
GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs, GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs,
FileSys::ManualContentProvider* provider, FileSys::ManualContentProvider* provider,
QVector<UISettings::GameDir>& game_dirs, QVector<UISettings::GameDir>& game_dirs,
const CompatibilityList& compatibility_list) const CompatibilityList& compatibility_list, Core::System& system_)
: vfs(std::move(vfs)), provider(provider), game_dirs(game_dirs), : vfs(std::move(vfs)), provider(provider), game_dirs(game_dirs),
compatibility_list(compatibility_list) {} compatibility_list(compatibility_list), system{system_} {}
GameListWorker::~GameListWorker() = default; GameListWorker::~GameListWorker() = default;
void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) { void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
using namespace FileSys; using namespace FileSys;
auto& system = Core::System::GetInstance();
const auto& cache = dynamic_cast<ContentProviderUnion&>(system.GetContentProvider()); const auto& cache = dynamic_cast<ContentProviderUnion&>(system.GetContentProvider());
auto installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application, auto installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application,
@ -285,10 +284,7 @@ void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_path, bool deep_scan, void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_path, bool deep_scan,
GameListDir* parent_dir) { GameListDir* parent_dir) {
auto& system = Core::System::GetInstance(); const auto callback = [this, target, parent_dir](const std::filesystem::path& path) -> bool {
const auto callback = [this, target, parent_dir,
&system](const std::filesystem::path& path) -> bool {
if (stop_processing) { if (stop_processing) {
// Breaks the callback loop. // Breaks the callback loop.
return false; return false;

View File

@ -19,6 +19,10 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "yuzu/compatibility_list.h" #include "yuzu/compatibility_list.h"
namespace Core {
class System;
}
class QStandardItem; class QStandardItem;
namespace FileSys { namespace FileSys {
@ -37,7 +41,7 @@ public:
explicit GameListWorker(std::shared_ptr<FileSys::VfsFilesystem> vfs, explicit GameListWorker(std::shared_ptr<FileSys::VfsFilesystem> vfs,
FileSys::ManualContentProvider* provider, FileSys::ManualContentProvider* provider,
QVector<UISettings::GameDir>& game_dirs, QVector<UISettings::GameDir>& game_dirs,
const CompatibilityList& compatibility_list); const CompatibilityList& compatibility_list, Core::System& system_);
~GameListWorker() override; ~GameListWorker() override;
/// Starts the processing of directory tree information. /// Starts the processing of directory tree information.
@ -80,4 +84,6 @@ private:
QStringList watch_list; QStringList watch_list;
std::atomic_bool stop_processing; std::atomic_bool stop_processing;
Core::System& system;
}; };

View File

@ -171,7 +171,7 @@ void GMainWindow::ShowTelemetryCallout() {
"<br/><br/>Would you like to share your usage data with us?"); "<br/><br/>Would you like to share your usage data with us?");
if (QMessageBox::question(this, tr("Telemetry"), telemetry_message) != QMessageBox::Yes) { if (QMessageBox::question(this, tr("Telemetry"), telemetry_message) != QMessageBox::Yes) {
Settings::values.enable_telemetry = false; Settings::values.enable_telemetry = false;
Core::System::GetInstance().ApplySettings(); system.ApplySettings();
} }
} }
@ -190,9 +190,10 @@ static void RemoveCachedContents() {
Common::FS::RemoveDirRecursively(offline_system_data); Common::FS::RemoveDirRecursively(offline_system_data);
} }
GMainWindow::GMainWindow() GMainWindow::GMainWindow(Core::System& system_)
: input_subsystem{std::make_shared<InputCommon::InputSubsystem>()}, : input_subsystem{std::make_shared<InputCommon::InputSubsystem>()}, system{system_},
config{std::make_unique<Config>()}, vfs{std::make_shared<FileSys::RealVfsFilesystem>()}, config{std::make_unique<Config>(system_)},
vfs{std::make_shared<FileSys::RealVfsFilesystem>()},
provider{std::make_unique<FileSys::ManualContentProvider>()} { provider{std::make_unique<FileSys::ManualContentProvider>()} {
Common::Log::Initialize(); Common::Log::Initialize();
LoadTranslation(); LoadTranslation();
@ -255,11 +256,10 @@ GMainWindow::GMainWindow()
show(); show();
Core::System::GetInstance().SetContentProvider( system.SetContentProvider(std::make_unique<FileSys::ContentProviderUnion>());
std::make_unique<FileSys::ContentProviderUnion>()); system.RegisterContentProvider(FileSys::ContentProviderUnionSlot::FrontendManual,
Core::System::GetInstance().RegisterContentProvider( provider.get());
FileSys::ContentProviderUnionSlot::FrontendManual, provider.get()); system.GetFileSystemController().CreateFactories(*vfs);
Core::System::GetInstance().GetFileSystemController().CreateFactories(*vfs);
// Remove cached contents generated during the previous session // Remove cached contents generated during the previous session
RemoveCachedContents(); RemoveCachedContents();
@ -410,7 +410,7 @@ void GMainWindow::RegisterMetaTypes() {
void GMainWindow::ControllerSelectorReconfigureControllers( void GMainWindow::ControllerSelectorReconfigureControllers(
const Core::Frontend::ControllerParameters& parameters) { const Core::Frontend::ControllerParameters& parameters) {
QtControllerSelectorDialog dialog(this, parameters, input_subsystem.get()); QtControllerSelectorDialog dialog(this, parameters, input_subsystem.get(), system);
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint |
Qt::WindowTitleHint | Qt::WindowSystemMenuHint); Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
@ -420,7 +420,7 @@ void GMainWindow::ControllerSelectorReconfigureControllers(
emit ControllerSelectorReconfigureFinished(); emit ControllerSelectorReconfigureFinished();
// Don't forget to apply settings. // Don't forget to apply settings.
Core::System::GetInstance().ApplySettings(); system.ApplySettings();
config->Save(); config->Save();
UpdateStatusButtons(); UpdateStatusButtons();
@ -454,8 +454,8 @@ void GMainWindow::SoftwareKeyboardInitialize(
return; return;
} }
software_keyboard = new QtSoftwareKeyboardDialog(render_window, Core::System::GetInstance(), software_keyboard = new QtSoftwareKeyboardDialog(render_window, system, is_inline,
is_inline, std::move(initialize_parameters)); std::move(initialize_parameters));
if (is_inline) { if (is_inline) {
connect( connect(
@ -566,7 +566,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
return; return;
} }
QtNXWebEngineView web_browser_view(this, Core::System::GetInstance(), input_subsystem.get()); QtNXWebEngineView web_browser_view(this, system, input_subsystem.get());
ui.action_Pause->setEnabled(false); ui.action_Pause->setEnabled(false);
ui.action_Restart->setEnabled(false); ui.action_Restart->setEnabled(false);
@ -698,10 +698,10 @@ void GMainWindow::InitializeWidgets() {
#ifdef YUZU_ENABLE_COMPATIBILITY_REPORTING #ifdef YUZU_ENABLE_COMPATIBILITY_REPORTING
ui.action_Report_Compatibility->setVisible(true); ui.action_Report_Compatibility->setVisible(true);
#endif #endif
render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem); render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem, system);
render_window->hide(); render_window->hide();
game_list = new GameList(vfs, provider.get(), this); game_list = new GameList(vfs, provider.get(), system, this);
ui.horizontalLayout->addWidget(game_list); ui.horizontalLayout->addWidget(game_list);
game_list_placeholder = new GameListPlaceholder(this); game_list_placeholder = new GameListPlaceholder(this);
@ -767,14 +767,14 @@ void GMainWindow::InitializeWidgets() {
tr("Handheld controller can't be used on docked mode. Pro " tr("Handheld controller can't be used on docked mode. Pro "
"controller will be selected.")); "controller will be selected."));
controller_type = Settings::ControllerType::ProController; controller_type = Settings::ControllerType::ProController;
ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get()); ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), system);
configure_dialog.ApplyConfiguration(); configure_dialog.ApplyConfiguration();
controller_dialog->refreshConfiguration(); controller_dialog->refreshConfiguration();
} }
Settings::values.use_docked_mode.SetValue(!is_docked); Settings::values.use_docked_mode.SetValue(!is_docked);
dock_status_button->setChecked(!is_docked); dock_status_button->setChecked(!is_docked);
OnDockedModeChanged(is_docked, !is_docked); OnDockedModeChanged(is_docked, !is_docked, system);
}); });
dock_status_button->setText(tr("DOCK")); dock_status_button->setText(tr("DOCK"));
dock_status_button->setCheckable(true); dock_status_button->setCheckable(true);
@ -798,7 +798,7 @@ void GMainWindow::InitializeWidgets() {
} }
} }
Core::System::GetInstance().ApplySettings(); system.ApplySettings();
UpdateGPUAccuracyButton(); UpdateGPUAccuracyButton();
}); });
UpdateGPUAccuracyButton(); UpdateGPUAccuracyButton();
@ -826,7 +826,7 @@ void GMainWindow::InitializeWidgets() {
Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL); Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL);
} }
Core::System::GetInstance().ApplySettings(); system.ApplySettings();
}); });
statusBar()->insertPermanentWidget(0, renderer_status_button); statusBar()->insertPermanentWidget(0, renderer_status_button);
@ -843,7 +843,7 @@ void GMainWindow::InitializeDebugWidgets() {
debug_menu->addAction(microProfileDialog->toggleViewAction()); debug_menu->addAction(microProfileDialog->toggleViewAction());
#endif #endif
waitTreeWidget = new WaitTreeWidget(this); waitTreeWidget = new WaitTreeWidget(system, this);
addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget); addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget);
waitTreeWidget->hide(); waitTreeWidget->hide();
debug_menu->addAction(waitTreeWidget->toggleViewAction()); debug_menu->addAction(waitTreeWidget->toggleViewAction());
@ -946,7 +946,7 @@ void GMainWindow::InitializeHotkeys() {
}); });
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Restart Emulation"), this), connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Restart Emulation"), this),
&QShortcut::activated, this, [this] { &QShortcut::activated, this, [this] {
if (!Core::System::GetInstance().IsPoweredOn()) { if (!system.IsPoweredOn()) {
return; return;
} }
BootGame(game_path); BootGame(game_path);
@ -1002,7 +1002,7 @@ void GMainWindow::InitializeHotkeys() {
Settings::values.use_docked_mode.SetValue( Settings::values.use_docked_mode.SetValue(
!Settings::values.use_docked_mode.GetValue()); !Settings::values.use_docked_mode.GetValue());
OnDockedModeChanged(!Settings::values.use_docked_mode.GetValue(), OnDockedModeChanged(!Settings::values.use_docked_mode.GetValue(),
Settings::values.use_docked_mode.GetValue()); Settings::values.use_docked_mode.GetValue(), system);
dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue());
}); });
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Mute Audio"), this), connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Mute Audio"), this),
@ -1238,7 +1238,6 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
return false; return false;
} }
Core::System& system{Core::System::GetInstance()};
system.SetFilesystem(vfs); system.SetFilesystem(vfs);
system.SetAppletFrontendSet({ system.SetAppletFrontendSet({
@ -1348,7 +1347,6 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
last_filename_booted = filename; last_filename_booted = filename;
auto& system = Core::System::GetInstance();
const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData()); const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData());
const auto loader = Loader::GetLoader(system, v_file, program_id, program_index); const auto loader = Loader::GetLoader(system, v_file, program_id, program_index);
@ -1359,7 +1357,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
const auto config_file_name = title_id == 0 const auto config_file_name = title_id == 0
? Common::FS::PathToUTF8String(file_path.filename()) ? Common::FS::PathToUTF8String(file_path.filename())
: fmt::format("{:016X}", title_id); : fmt::format("{:016X}", title_id);
Config per_game_config(config_file_name, Config::ConfigType::PerGameConfig); Config per_game_config(system, config_file_name, Config::ConfigType::PerGameConfig);
} }
ConfigureVibration::SetAllVibrationDevices(); ConfigureVibration::SetAllVibrationDevices();
@ -1382,7 +1380,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
return; return;
// Create and start the emulation thread // Create and start the emulation thread
emu_thread = std::make_unique<EmuThread>(); emu_thread = std::make_unique<EmuThread>(system);
emit EmulationStarting(emu_thread.get()); emit EmulationStarting(emu_thread.get());
emu_thread->start(); emu_thread->start();
@ -1427,7 +1425,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
std::string title_version; std::string title_version;
const auto res = system.GetGameName(title_name); const auto res = system.GetGameName(title_name);
const auto metadata = [&system, title_id] { const auto metadata = [this, title_id] {
const FileSys::PatchManager pm(title_id, system.GetFileSystemController(), const FileSys::PatchManager pm(title_id, system.GetFileSystemController(),
system.GetContentProvider()); system.GetContentProvider());
return pm.GetControlMetadata(); return pm.GetControlMetadata();
@ -1566,9 +1564,8 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
const std::string& game_path) { const std::string& game_path) {
std::filesystem::path path; std::filesystem::path path;
QString open_target; QString open_target;
auto& system = Core::System::GetInstance();
const auto [user_save_size, device_save_size] = [this, &game_path, &program_id, &system] { const auto [user_save_size, device_save_size] = [this, &game_path, &program_id] {
const FileSys::PatchManager pm{program_id, system.GetFileSystemController(), const FileSys::PatchManager pm{program_id, system.GetFileSystemController(),
system.GetContentProvider()}; system.GetContentProvider()};
const auto control = pm.GetControlMetadata().first; const auto control = pm.GetControlMetadata().first;
@ -1754,7 +1751,7 @@ void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryT
} }
void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) { void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) {
const auto& fs_controller = Core::System::GetInstance().GetFileSystemController(); const auto& fs_controller = system.GetFileSystemController();
const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) || const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) ||
fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id); fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id);
@ -1770,7 +1767,7 @@ void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) {
void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) { void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) {
const auto update_id = program_id | 0x800; const auto update_id = program_id | 0x800;
const auto& fs_controller = Core::System::GetInstance().GetFileSystemController(); const auto& fs_controller = system.GetFileSystemController();
const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) || const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) ||
fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id); fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id);
@ -1785,8 +1782,8 @@ void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type)
void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) { void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) {
u32 count{}; u32 count{};
const auto& fs_controller = Core::System::GetInstance().GetFileSystemController(); const auto& fs_controller = system.GetFileSystemController();
const auto dlc_entries = Core::System::GetInstance().GetContentProvider().ListEntriesFilter( const auto dlc_entries = system.GetContentProvider().ListEntriesFilter(
FileSys::TitleType::AOC, FileSys::ContentRecordType::Data); FileSys::TitleType::AOC, FileSys::ContentRecordType::Data);
for (const auto& entry : dlc_entries) { for (const auto& entry : dlc_entries) {
@ -1924,7 +1921,6 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
"cancelled the operation.")); "cancelled the operation."));
}; };
auto& system = Core::System::GetInstance();
const auto loader = Loader::GetLoader(system, vfs->OpenFile(game_path, FileSys::Mode::Read)); const auto loader = Loader::GetLoader(system, vfs->OpenFile(game_path, FileSys::Mode::Read));
if (loader == nullptr) { if (loader == nullptr) {
failed(); failed();
@ -2092,7 +2088,7 @@ void GMainWindow::OnGameListShowList(bool show) {
void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) { void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) {
u64 title_id{}; u64 title_id{};
const auto v_file = Core::GetGameFileFromPath(vfs, file); const auto v_file = Core::GetGameFileFromPath(vfs, file);
const auto loader = Loader::GetLoader(Core::System::GetInstance(), v_file); const auto loader = Loader::GetLoader(system, v_file);
if (loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) { if (loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) {
QMessageBox::information(this, tr("Properties"), QMessageBox::information(this, tr("Properties"),
@ -2306,8 +2302,7 @@ InstallResult GMainWindow::InstallNSPXCI(const QString& filename) {
if (nsp->GetStatus() != Loader::ResultStatus::Success) { if (nsp->GetStatus() != Loader::ResultStatus::Success) {
return InstallResult::Failure; return InstallResult::Failure;
} }
const auto res = const auto res = system.GetFileSystemController().GetUserNANDContents()->InstallEntry(
Core::System::GetInstance().GetFileSystemController().GetUserNANDContents()->InstallEntry(
*nsp, true, qt_raw_copy); *nsp, true, qt_raw_copy);
switch (res) { switch (res) {
case FileSys::InstallResult::Success: case FileSys::InstallResult::Success:
@ -2388,15 +2383,11 @@ InstallResult GMainWindow::InstallNCA(const QString& filename) {
FileSys::InstallResult res; FileSys::InstallResult res;
if (index >= static_cast<s32>(FileSys::TitleType::Application)) { if (index >= static_cast<s32>(FileSys::TitleType::Application)) {
res = Core::System::GetInstance() res = system.GetFileSystemController().GetUserNANDContents()->InstallEntry(
.GetFileSystemController() *nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy);
.GetUserNANDContents()
->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy);
} else { } else {
res = Core::System::GetInstance() res = system.GetFileSystemController().GetSystemNANDContents()->InstallEntry(
.GetFileSystemController() *nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy);
.GetSystemNANDContents()
->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy);
} }
if (res == FileSys::InstallResult::Success) { if (res == FileSys::InstallResult::Success) {
@ -2458,7 +2449,6 @@ void GMainWindow::OnPauseGame() {
} }
void GMainWindow::OnStopGame() { void GMainWindow::OnStopGame() {
auto& system{Core::System::GetInstance()};
if (system.GetExitLock() && !ConfirmForceLockedExit()) { if (system.GetExitLock() && !ConfirmForceLockedExit()) {
return; return;
} }
@ -2483,8 +2473,8 @@ void GMainWindow::OnExit() {
} }
void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) { void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) {
OverlayDialog dialog(render_window, Core::System::GetInstance(), error_code, error_text, OverlayDialog dialog(render_window, system, error_code, error_text, QString{}, tr("OK"),
QString{}, tr("OK"), Qt::AlignLeft | Qt::AlignVCenter); Qt::AlignLeft | Qt::AlignVCenter);
dialog.exec(); dialog.exec();
emit ErrorDisplayFinished(); emit ErrorDisplayFinished();
@ -2493,7 +2483,7 @@ void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_tex
void GMainWindow::OnMenuReportCompatibility() { void GMainWindow::OnMenuReportCompatibility() {
if (!Settings::values.yuzu_token.GetValue().empty() && if (!Settings::values.yuzu_token.GetValue().empty() &&
!Settings::values.yuzu_username.GetValue().empty()) { !Settings::values.yuzu_username.GetValue().empty()) {
CompatDB compatdb{this}; CompatDB compatdb{system.TelemetrySession(), this};
compatdb.exec(); compatdb.exec();
} else { } else {
QMessageBox::critical( QMessageBox::critical(
@ -2656,7 +2646,8 @@ void GMainWindow::OnConfigure() {
const auto old_theme = UISettings::values.theme; const auto old_theme = UISettings::values.theme;
const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue();
ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get()); Settings::SetConfiguringGlobal(true);
ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), system);
connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this, connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this,
&GMainWindow::OnLanguageChanged); &GMainWindow::OnLanguageChanged);
@ -2692,7 +2683,7 @@ void GMainWindow::OnConfigure() {
Settings::values.disabled_addons.clear(); Settings::values.disabled_addons.clear();
config = std::make_unique<Config>(); config = std::make_unique<Config>(system);
UISettings::values.reset_to_defaults = false; UISettings::values.reset_to_defaults = false;
UISettings::values.game_dirs = std::move(old_game_dirs); UISettings::values.game_dirs = std::move(old_game_dirs);
@ -2754,15 +2745,15 @@ void GMainWindow::OnConfigureTas() {
} }
void GMainWindow::OnConfigurePerGame() { void GMainWindow::OnConfigurePerGame() {
const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); const u64 title_id = system.CurrentProcess()->GetTitleID();
OpenPerGameConfiguration(title_id, game_path.toStdString()); OpenPerGameConfiguration(title_id, game_path.toStdString());
} }
void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file_name) { void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file_name) {
const auto v_file = Core::GetGameFileFromPath(vfs, file_name); const auto v_file = Core::GetGameFileFromPath(vfs, file_name);
const auto& system = Core::System::GetInstance();
ConfigurePerGame dialog(this, title_id, file_name); Settings::SetConfiguringGlobal(false);
ConfigurePerGame dialog(this, title_id, file_name, system);
dialog.LoadFromFile(v_file); dialog.LoadFromFile(v_file);
const auto result = dialog.exec(); const auto result = dialog.exec();
@ -2802,7 +2793,6 @@ void GMainWindow::OnLoadAmiibo() {
} }
void GMainWindow::LoadAmiibo(const QString& filename) { void GMainWindow::LoadAmiibo(const QString& filename) {
Core::System& system{Core::System::GetInstance()};
Service::SM::ServiceManager& sm = system.ServiceManager(); Service::SM::ServiceManager& sm = system.ServiceManager();
auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user"); auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user");
if (nfc == nullptr) { if (nfc == nullptr) {
@ -2854,7 +2844,7 @@ void GMainWindow::OnToggleFilterBar() {
} }
void GMainWindow::OnCaptureScreenshot() { void GMainWindow::OnCaptureScreenshot() {
const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); const u64 title_id = system.CurrentProcess()->GetTitleID();
const auto screenshot_path = const auto screenshot_path =
QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)); QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir));
const auto date = const auto date =
@ -2960,7 +2950,6 @@ void GMainWindow::UpdateStatusBar() {
tas_label->clear(); tas_label->clear();
} }
auto& system = Core::System::GetInstance();
auto results = system.GetAndResetPerfStats(); auto results = system.GetAndResetPerfStats();
auto& shader_notify = system.GPU().ShaderNotify(); auto& shader_notify = system.GPU().ShaderNotify();
const int shaders_building = shader_notify.ShadersBuilding(); const int shaders_building = shader_notify.ShadersBuilding();
@ -3123,7 +3112,7 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
if (emu_thread) { if (emu_thread) {
ShutdownGame(); ShutdownGame();
Settings::RestoreGlobalState(Core::System::GetInstance().IsPoweredOn()); Settings::RestoreGlobalState(system.IsPoweredOn());
UpdateStatusButtons(); UpdateStatusButtons();
} }
} else { } else {
@ -3165,7 +3154,6 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
const auto function = [this, &keys, &pdm] { const auto function = [this, &keys, &pdm] {
keys.PopulateFromPartitionData(pdm); keys.PopulateFromPartitionData(pdm);
auto& system = Core::System::GetInstance();
system.GetFileSystemController().CreateFactories(*vfs); system.GetFileSystemController().CreateFactories(*vfs);
keys.DeriveETicket(pdm, system.GetContentProvider()); keys.DeriveETicket(pdm, system.GetContentProvider());
}; };
@ -3209,7 +3197,7 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
prog.close(); prog.close();
} }
Core::System::GetInstance().GetFileSystemController().CreateFactories(*vfs); system.GetFileSystemController().CreateFactories(*vfs);
if (behavior == ReinitializeKeyBehavior::Warning) { if (behavior == ReinitializeKeyBehavior::Warning) {
game_list->PopulateAsync(UISettings::values.game_dirs); game_list->PopulateAsync(UISettings::values.game_dirs);
@ -3277,7 +3265,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
if (emu_thread != nullptr) { if (emu_thread != nullptr) {
ShutdownGame(); ShutdownGame();
Settings::RestoreGlobalState(Core::System::GetInstance().IsPoweredOn()); Settings::RestoreGlobalState(system.IsPoweredOn());
UpdateStatusButtons(); UpdateStatusButtons();
} }
@ -3352,7 +3340,7 @@ bool GMainWindow::ConfirmForceLockedExit() {
} }
void GMainWindow::RequestGameExit() { void GMainWindow::RequestGameExit() {
auto& sm{Core::System::GetInstance().ServiceManager()}; auto& sm{system.ServiceManager()};
auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE"); auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE");
auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE");
bool has_signalled = false; bool has_signalled = false;
@ -3446,7 +3434,7 @@ void GMainWindow::OnLanguageChanged(const QString& locale) {
void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) { void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) {
#ifdef USE_DISCORD_PRESENCE #ifdef USE_DISCORD_PRESENCE
if (state) { if (state) {
discord_rpc = std::make_unique<DiscordRPC::DiscordImpl>(); discord_rpc = std::make_unique<DiscordRPC::DiscordImpl>(system);
} else { } else {
discord_rpc = std::make_unique<DiscordRPC::NullImpl>(); discord_rpc = std::make_unique<DiscordRPC::NullImpl>();
} }
@ -3501,7 +3489,7 @@ int main(int argc, char* argv[]) {
setlocale(LC_ALL, "C"); setlocale(LC_ALL, "C");
Core::System::InitializeGlobalInstance(); Core::System::InitializeGlobalInstance();
GMainWindow main_window; GMainWindow main_window{Core::System::GetInstance()};
// After settings have been loaded by GMainWindow, apply the filter // After settings have been loaded by GMainWindow, apply the filter
main_window.show(); main_window.show();

View File

@ -107,7 +107,7 @@ class GMainWindow : public QMainWindow {
public: public:
void filterBarSetChecked(bool state); void filterBarSetChecked(bool state);
void UpdateUITheme(); void UpdateUITheme();
GMainWindow(); GMainWindow(Core::System& system_);
~GMainWindow() override; ~GMainWindow() override;
bool DropAction(QDropEvent* event); bool DropAction(QDropEvent* event);
@ -311,6 +311,8 @@ private:
std::unique_ptr<DiscordRPC::DiscordInterface> discord_rpc; std::unique_ptr<DiscordRPC::DiscordInterface> discord_rpc;
std::shared_ptr<InputCommon::InputSubsystem> input_subsystem; std::shared_ptr<InputCommon::InputSubsystem> input_subsystem;
Core::System& system;
GRenderWindow* render_window; GRenderWindow* render_window;
GameList* game_list; GameList* game_list;
LoadingScreen* loading_screen; LoadingScreen* loading_screen;