summaryrefslogtreecommitdiff
path: root/src/yuzu/configuration/configure_input_player.cpp
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2021-10-14 14:12:22 -0400
committerGitHub <noreply@github.com>2021-10-14 14:12:22 -0400
commitb02d662980a401057d2ff7c1522d47f9f6538d81 (patch)
tree2717ff56b111eb1adfcb712e14ad69f25ab76b68 /src/yuzu/configuration/configure_input_player.cpp
parent894b483a0d619c3ceaa79fa0ff4cef6d37301f9c (diff)
parentb6894bfc5b86c2fae0b401f2cfc294a08994781d (diff)
Merge pull request #6774 from lat9nq/remove-global-yuzu
yuzu qt: Remove global system instances
Diffstat (limited to 'src/yuzu/configuration/configure_input_player.cpp')
-rw-r--r--src/yuzu/configuration/configure_input_player.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp
index 88f4bf388..3aab5d5f8 100644
--- a/src/yuzu/configuration/configure_input_player.cpp
+++ b/src/yuzu/configuration/configure_input_player.cpp
@@ -44,8 +44,7 @@ namespace {
constexpr std::size_t HANDHELD_INDEX = 8;
void UpdateController(Settings::ControllerType controller_type, std::size_t npad_index,
- bool connected) {
- Core::System& system{Core::System::GetInstance()};
+ bool connected, Core::System& system) {
if (!system.IsPoweredOn()) {
return;
}
@@ -232,11 +231,12 @@ QString AnalogToText(const Common::ParamPackage& param, const std::string& dir)
ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_index,
QWidget* bottom_row,
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),
debug(debug), input_subsystem{input_subsystem_}, profiles(profiles_),
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);
setFocusPolicy(Qt::ClickFocus);
@@ -683,7 +683,7 @@ void ConfigureInputPlayer::TryConnectSelectedController() {
controller_type == Settings::ControllerType::Handheld;
// Connect only if handheld is going from disconnected to connected
if (!handheld.connected && handheld_connected) {
- UpdateController(controller_type, HANDHELD_INDEX, true);
+ UpdateController(controller_type, HANDHELD_INDEX, true, system);
}
handheld.connected = handheld_connected;
}
@@ -703,7 +703,7 @@ void ConfigureInputPlayer::TryConnectSelectedController() {
return;
}
- UpdateController(controller_type, player_index, true);
+ UpdateController(controller_type, player_index, true, system);
}
void ConfigureInputPlayer::TryDisconnectSelectedController() {
@@ -721,7 +721,7 @@ void ConfigureInputPlayer::TryDisconnectSelectedController() {
controller_type == Settings::ControllerType::Handheld;
// Disconnect only if handheld is going from connected to disconnected
if (handheld.connected && !handheld_connected) {
- UpdateController(controller_type, HANDHELD_INDEX, false);
+ UpdateController(controller_type, HANDHELD_INDEX, false, system);
}
return;
}
@@ -737,7 +737,7 @@ void ConfigureInputPlayer::TryDisconnectSelectedController() {
}
// Disconnect the controller first.
- UpdateController(controller_type, player_index, false);
+ UpdateController(controller_type, player_index, false, system);
}
void ConfigureInputPlayer::showEvent(QShowEvent* event) {
@@ -1017,8 +1017,6 @@ void ConfigureInputPlayer::SetConnectableControllers() {
}
};
- Core::System& system{Core::System::GetInstance()};
-
if (!system.IsPoweredOn()) {
add_controllers(true);
return;