summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2022-11-18 01:23:48 +0100
committerameerj <52414509+ameerj@users.noreply.github.com>2022-11-20 20:06:31 +0100
commit9efdad6a2733e701b24e9edcbad1851692ca8863 (patch)
treea0ba33591b59e59bcea565e3d5ec5b8b1846a687
parentMerge pull request #9250 from v1993/patch-10 (diff)
downloadyuzu-9efdad6a2733e701b24e9edcbad1851692ca8863.tar
yuzu-9efdad6a2733e701b24e9edcbad1851692ca8863.tar.gz
yuzu-9efdad6a2733e701b24e9edcbad1851692ca8863.tar.bz2
yuzu-9efdad6a2733e701b24e9edcbad1851692ca8863.tar.lz
yuzu-9efdad6a2733e701b24e9edcbad1851692ca8863.tar.xz
yuzu-9efdad6a2733e701b24e9edcbad1851692ca8863.tar.zst
yuzu-9efdad6a2733e701b24e9edcbad1851692ca8863.zip
-rw-r--r--src/common/settings_input.h1
-rw-r--r--src/core/hid/emulated_controller.cpp3
-rw-r--r--src/yuzu/CMakeLists.txt3
-rw-r--r--src/yuzu/configuration/config.cpp24
-rw-r--r--src/yuzu/configuration/configure_input_per_game.cpp76
-rw-r--r--src/yuzu/configuration/configure_input_per_game.h44
-rw-r--r--src/yuzu/configuration/configure_input_per_game.ui298
-rw-r--r--src/yuzu/configuration/configure_input_player.h2
-rw-r--r--src/yuzu/configuration/configure_per_game.cpp5
-rw-r--r--src/yuzu/configuration/configure_per_game.h6
-rw-r--r--src/yuzu/main.cpp17
11 files changed, 465 insertions, 14 deletions
diff --git a/src/common/settings_input.h b/src/common/settings_input.h
index 485e4ad22..46f38c703 100644
--- a/src/common/settings_input.h
+++ b/src/common/settings_input.h
@@ -391,6 +391,7 @@ struct PlayerInput {
u32 body_color_right;
u32 button_color_left;
u32 button_color_right;
+ std::string profile_name;
};
struct TouchscreenInput {
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index ec1364452..a2d106245 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -107,10 +107,9 @@ void EmulatedController::ReloadFromSettings() {
original_npad_type = npad_type;
}
+ Disconnect();
if (player.connected) {
Connect();
- } else {
- Disconnect();
}
ReloadInput();
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index 5cc1fbf32..8a252bd5d 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -85,6 +85,9 @@ add_executable(yuzu
configuration/configure_input_advanced.cpp
configuration/configure_input_advanced.h
configuration/configure_input_advanced.ui
+ configuration/configure_input_per_game.cpp
+ configuration/configure_input_per_game.h
+ configuration/configure_input_per_game.ui
configuration/configure_input_player.cpp
configuration/configure_input_player.h
configuration/configure_input_player.ui
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 343f3b8e5..4067ea607 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -186,7 +186,7 @@ void Config::WriteGlobalSetting(const Settings::SwitchableSetting<Type, ranged>&
void Config::ReadPlayerValue(std::size_t player_index) {
const QString player_prefix = [this, player_index] {
- if (type == ConfigType::InputProfile) {
+ if (type == ConfigType::InputProfile && global) {
return QString{};
} else {
return QStringLiteral("player_%1_").arg(player_index);
@@ -244,6 +244,14 @@ void Config::ReadPlayerValue(std::size_t player_index) {
->value(QStringLiteral("%1button_color_right").arg(player_prefix),
Settings::JOYCON_BUTTONS_NEON_RED)
.toUInt();
+
+ // This only applies to per-game configs
+ if (!global) {
+ player.profile_name =
+ qt_config->value(QStringLiteral("%1profile_name").arg(player_prefix), QString{})
+ .toString()
+ .toStdString();
+ }
}
for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
@@ -386,6 +394,7 @@ void Config::ReadAudioValues() {
}
void Config::ReadControlValues() {
+ Settings::values.players.SetGlobal(global);
qt_config->beginGroup(QStringLiteral("Controls"));
for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) {
@@ -904,7 +913,6 @@ void Config::ReadMultiplayerValues() {
void Config::ReadValues() {
if (global) {
- ReadControlValues();
ReadDataStorageValues();
ReadDebuggingValues();
ReadDisabledAddOnValues();
@@ -913,6 +921,7 @@ void Config::ReadValues() {
ReadWebServiceValues();
ReadMiscellaneousValues();
}
+ ReadControlValues();
ReadCoreValues();
ReadCpuValues();
ReadRendererValues();
@@ -923,7 +932,7 @@ void Config::ReadValues() {
void Config::SavePlayerValue(std::size_t player_index) {
const QString player_prefix = [this, player_index] {
- if (type == ConfigType::InputProfile) {
+ if (type == ConfigType::InputProfile && global) {
return QString{};
} else {
return QStringLiteral("player_%1_").arg(player_index);
@@ -951,6 +960,12 @@ void Config::SavePlayerValue(std::size_t player_index) {
player.button_color_left, Settings::JOYCON_BUTTONS_NEON_BLUE);
WriteSetting(QStringLiteral("%1button_color_right").arg(player_prefix),
player.button_color_right, Settings::JOYCON_BUTTONS_NEON_RED);
+
+ // This only applies to per-game configs
+ if (!global) {
+ WriteSetting(QStringLiteral("%1profile_name").arg(player_prefix),
+ QString::fromStdString(player.profile_name), QString{});
+ }
}
for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
@@ -1054,7 +1069,6 @@ void Config::SaveIrCameraValues() {
void Config::SaveValues() {
if (global) {
- SaveControlValues();
SaveDataStorageValues();
SaveDebuggingValues();
SaveDisabledAddOnValues();
@@ -1063,6 +1077,7 @@ void Config::SaveValues() {
SaveWebServiceValues();
SaveMiscellaneousValues();
}
+ SaveControlValues();
SaveCoreValues();
SaveCpuValues();
SaveRendererValues();
@@ -1085,6 +1100,7 @@ void Config::SaveAudioValues() {
}
void Config::SaveControlValues() {
+ Settings::values.players.SetGlobal(global);
qt_config->beginGroup(QStringLiteral("Controls"));
for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) {
diff --git a/src/yuzu/configuration/configure_input_per_game.cpp b/src/yuzu/configuration/configure_input_per_game.cpp
new file mode 100644
index 000000000..5773c268d
--- /dev/null
+++ b/src/yuzu/configuration/configure_input_per_game.cpp
@@ -0,0 +1,76 @@
+// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "common/settings.h"
+#include "core/core.h"
+#include "core/hid/emulated_controller.h"
+#include "core/hid/hid_core.h"
+#include "ui_configure_input_per_game.h"
+#include "yuzu/configuration/configure_input_per_game.h"
+#include "yuzu/configuration/input_profiles.h"
+
+ConfigureInputPerGame::ConfigureInputPerGame(Core::System& system_, QWidget* parent)
+ : QWidget(parent), ui(std::make_unique<Ui::ConfigureInputPerGame>()),
+ profiles(std::make_unique<InputProfiles>()), system{system_} {
+ ui->setupUi(this);
+
+ Settings::values.players.SetGlobal(false);
+ const auto previous_profile = Settings::values.players.GetValue()[0].profile_name;
+
+ const auto& profile_names = profiles->GetInputProfileNames();
+
+ ui->profile_player_1->addItem(QString::fromStdString("Use global configuration"));
+ for (size_t index = 0; index < profile_names.size(); ++index) {
+ const auto& profile_name = profile_names[index];
+ ui->profile_player_1->addItem(QString::fromStdString(profile_name));
+ if (profile_name == previous_profile) {
+ // offset by 1 since the first element is the global config
+ ui->profile_player_1->setCurrentIndex(static_cast<int>(index + 1));
+ }
+ }
+ LoadConfiguration();
+}
+
+void ConfigureInputPerGame::ApplyConfiguration() {
+ LoadConfiguration();
+
+ auto& hid_core = system.HIDCore();
+ auto* emulated_controller = hid_core.GetEmulatedControllerByIndex(0);
+
+ const auto selection_index = ui->profile_player_1->currentIndex();
+ if (selection_index == 0) {
+ Settings::values.players.SetGlobal(true);
+ emulated_controller->ReloadFromSettings();
+ return;
+ } else {
+ Settings::values.players.SetGlobal(false);
+ }
+ const QString profile_name = ui->profile_player_1->itemText(selection_index);
+ if (profile_name.isEmpty()) {
+ return;
+ }
+ profiles->SaveProfile(Settings::values.players.GetValue()[0].profile_name, 0);
+ emulated_controller->ReloadFromSettings();
+}
+
+void ConfigureInputPerGame::LoadConfiguration() {
+ auto& hid_core = system.HIDCore();
+ auto* emulated_controller = hid_core.GetEmulatedControllerByIndex(0);
+
+ Settings::values.players.SetGlobal(false);
+
+ const auto selection_index = ui->profile_player_1->currentIndex();
+ if (selection_index == 0) {
+ Settings::values.players.GetValue()[0].profile_name = "";
+ Settings::values.players.SetGlobal(true);
+ emulated_controller->ReloadFromSettings();
+ return;
+ }
+ const QString profile_name = ui->profile_player_1->itemText(selection_index);
+ if (profile_name.isEmpty()) {
+ return;
+ }
+ profiles->LoadProfile(profile_name.toStdString(), 0);
+ Settings::values.players.GetValue()[0].profile_name = profile_name.toStdString();
+ emulated_controller->ReloadFromSettings();
+}
diff --git a/src/yuzu/configuration/configure_input_per_game.h b/src/yuzu/configuration/configure_input_per_game.h
new file mode 100644
index 000000000..6feb608b7
--- /dev/null
+++ b/src/yuzu/configuration/configure_input_per_game.h
@@ -0,0 +1,44 @@
+// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <memory>
+
+#include <QWidget>
+
+namespace Core {
+class System;
+}
+
+namespace InputCommon {
+class InputSubsystem;
+}
+
+namespace Ui {
+class ConfigureInputPerGame;
+}
+
+class InputProfiles;
+
+class ConfigureInputPerGame : public QWidget {
+ Q_OBJECT
+
+public:
+ explicit ConfigureInputPerGame(Core::System& system_, QWidget* parent = nullptr);
+
+ /// Initializes the input dialog with the given input subsystem.
+ // void Initialize(InputCommon::InputSubsystem* input_subsystem_, std::size_t max_players = 8);
+
+ /// Save configurations to settings file.
+ void ApplyConfiguration();
+
+private:
+ /// Load configuration from settings file.
+ void LoadConfiguration();
+
+ std::unique_ptr<Ui::ConfigureInputPerGame> ui;
+ std::unique_ptr<InputProfiles> profiles;
+
+ Core::System& system;
+};
diff --git a/src/yuzu/configuration/configure_input_per_game.ui b/src/yuzu/configuration/configure_input_per_game.ui
new file mode 100644
index 000000000..8a384c0df
--- /dev/null
+++ b/src/yuzu/configuration/configure_input_per_game.ui
@@ -0,0 +1,298 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ConfigureInputPerGame</class>
+ <widget class="QWidget" name="PerGameInput">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>541</width>
+ <height>759</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <property name="accessibleName">
+ <string>Graphics</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_1">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Input Profiles</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QWidget" name="player_1" native="true">
+ <layout class="QHBoxLayout" name="input_profile_layout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_player_1">
+ <property name="text">
+ <string>Player 1 Profile</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="profile_player_1">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="player_3" native="true">
+ <layout class="QHBoxLayout" name="input_profile_layout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_player_3">
+ <property name="text">
+ <string>Player 3 Profile</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="profile_player_3">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="player_4" native="true">
+ <layout class="QHBoxLayout" name="input_profile_layout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_player_4">
+ <property name="text">
+ <string>Player 4 Profile</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="profile_player_4">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="player_5" native="true">
+ <layout class="QHBoxLayout" name="input_profile_layout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_player_5">
+ <property name="text">
+ <string>Player 5 Profile</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="profile_player_5">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="player_6" native="true">
+ <layout class="QHBoxLayout" name="input_profile_layout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_player_6">
+ <property name="text">
+ <string>Player 6 Profile</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="profile_player_6">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="player_7" native="true">
+ <layout class="QHBoxLayout" name="input_profile_layout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_player_7">
+ <property name="text">
+ <string>Player 7 Profile</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="profile_player_7">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="player_8" native="true">
+ <layout class="QHBoxLayout" name="input_profile_layout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_player_8">
+ <property name="text">
+ <string>Player 8 Profile</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="profile_player_8">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/yuzu/configuration/configure_input_player.h b/src/yuzu/configuration/configure_input_player.h
index 79434fdd8..26f60d121 100644
--- a/src/yuzu/configuration/configure_input_player.h
+++ b/src/yuzu/configuration/configure_input_player.h
@@ -38,7 +38,7 @@ enum class InputType;
namespace Ui {
class ConfigureInputPlayer;
-}
+} // namespace Ui
namespace Core::HID {
class HIDCore;
diff --git a/src/yuzu/configuration/configure_per_game.cpp b/src/yuzu/configuration/configure_per_game.cpp
index c3cb8f61d..cf0a6dc0e 100644
--- a/src/yuzu/configuration/configure_per_game.cpp
+++ b/src/yuzu/configuration/configure_per_game.cpp
@@ -28,7 +28,7 @@
#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_per_game.h"
#include "yuzu/configuration/configure_per_game.h"
#include "yuzu/configuration/configure_per_game_addons.h"
#include "yuzu/configuration/configure_system.h"
@@ -50,6 +50,7 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st
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);
+ input_tab = std::make_unique<ConfigureInputPerGame>(system_, this);
system_tab = std::make_unique<ConfigureSystem>(system_, this);
ui->setupUi(this);
@@ -61,6 +62,7 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st
ui->tabWidget->addTab(graphics_tab.get(), tr("Graphics"));
ui->tabWidget->addTab(graphics_advanced_tab.get(), tr("Adv. Graphics"));
ui->tabWidget->addTab(audio_tab.get(), tr("Audio"));
+ ui->tabWidget->addTab(input_tab.get(), tr("Input Profiles"));
setFocusPolicy(Qt::ClickFocus);
setWindowTitle(tr("Properties"));
@@ -91,6 +93,7 @@ void ConfigurePerGame::ApplyConfiguration() {
graphics_tab->ApplyConfiguration();
graphics_advanced_tab->ApplyConfiguration();
audio_tab->ApplyConfiguration();
+ input_tab->ApplyConfiguration();
system.ApplySettings();
Settings::LogSettings();
diff --git a/src/yuzu/configuration/configure_per_game.h b/src/yuzu/configuration/configure_per_game.h
index 17a98a0f3..4ecc43541 100644
--- a/src/yuzu/configuration/configure_per_game.h
+++ b/src/yuzu/configuration/configure_per_game.h
@@ -16,12 +16,17 @@ namespace Core {
class System;
}
+namespace InputCommon {
+class InputSubsystem;
+}
+
class ConfigurePerGameAddons;
class ConfigureAudio;
class ConfigureCpu;
class ConfigureGeneral;
class ConfigureGraphics;
class ConfigureGraphicsAdvanced;
+class ConfigureInputPerGame;
class ConfigureSystem;
class QGraphicsScene;
@@ -72,5 +77,6 @@ private:
std::unique_ptr<ConfigureGeneral> general_tab;
std::unique_ptr<ConfigureGraphics> graphics_tab;
std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab;
+ std::unique_ptr<ConfigureInputPerGame> input_tab;
std::unique_ptr<ConfigureSystem> system_tab;
};
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 72498f52a..e0c353788 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -124,6 +124,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include "yuzu/compatibility_list.h"
#include "yuzu/configuration/config.h"
#include "yuzu/configuration/configure_dialog.h"
+#include "yuzu/configuration/configure_input_per_game.h"
#include "yuzu/debugger/console.h"
#include "yuzu/debugger/controller.h"
#include "yuzu/debugger/profiler.h"
@@ -1647,6 +1648,11 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
LOG_INFO(Frontend, "yuzu starting...");
StoreRecentFile(filename); // Put the filename on top of the list
+ // Save configurations
+ UpdateUISettings();
+ game_list->SaveInterfaceLayout();
+ config->Save();
+
u64 title_id{0};
last_filename_booted = filename;
@@ -1666,11 +1672,6 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
system->ApplySettings();
}
- // Save configurations
- UpdateUISettings();
- game_list->SaveInterfaceLayout();
- config->Save();
-
Settings::LogSettings();
if (UISettings::values.select_user_on_boot) {
@@ -2790,6 +2791,7 @@ void GMainWindow::OnStopGame() {
ShutdownGame();
Settings::RestoreGlobalState(system->IsPoweredOn());
+ system->HIDCore().ReloadInputDevices();
UpdateStatusButtons();
}
@@ -3250,6 +3252,7 @@ void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file
// Do not cause the global config to write local settings into the config file
const bool is_powered_on = system->IsPoweredOn();
Settings::RestoreGlobalState(is_powered_on);
+ system->HIDCore().ReloadInputDevices();
UISettings::values.configuration_applied = false;
@@ -3709,6 +3712,7 @@ void GMainWindow::OnCoreError(Core::SystemResultStatus result, std::string detai
ShutdownGame();
Settings::RestoreGlobalState(system->IsPoweredOn());
+ system->HIDCore().ReloadInputDevices();
UpdateStatusButtons();
}
} else {
@@ -3860,18 +3864,19 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
// Unload controllers early
controller_dialog->UnloadController();
game_list->UnloadController();
- system->HIDCore().UnloadInputDevices();
// Shutdown session if the emu thread is active...
if (emu_thread != nullptr) {
ShutdownGame();
Settings::RestoreGlobalState(system->IsPoweredOn());
+ system->HIDCore().ReloadInputDevices();
UpdateStatusButtons();
}
render_window->close();
multiplayer_state->Close();
+ system->HIDCore().UnloadInputDevices();
system->GetRoomNetwork().Shutdown();
QWidget::closeEvent(event);