summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-11-05 04:54:22 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2021-11-25 03:30:27 +0100
commita17550be9855a32a62a1358b23babab929a39cbb (patch)
tree905192e50fd4510e436e2983aec6d9b42bcfd846 /src
parentservice/hid: Remove includes of core.h and settings.h (diff)
downloadyuzu-a17550be9855a32a62a1358b23babab929a39cbb.tar
yuzu-a17550be9855a32a62a1358b23babab929a39cbb.tar.gz
yuzu-a17550be9855a32a62a1358b23babab929a39cbb.tar.bz2
yuzu-a17550be9855a32a62a1358b23babab929a39cbb.tar.lz
yuzu-a17550be9855a32a62a1358b23babab929a39cbb.tar.xz
yuzu-a17550be9855a32a62a1358b23babab929a39cbb.tar.zst
yuzu-a17550be9855a32a62a1358b23babab929a39cbb.zip
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/configuration/configure_debug_controller.cpp9
-rw-r--r--src/yuzu/configuration/configure_debug_controller.h7
-rw-r--r--src/yuzu/configuration/configure_dialog.cpp2
-rw-r--r--src/yuzu/configuration/configure_input.cpp29
-rw-r--r--src/yuzu/configuration/configure_input.h3
-rw-r--r--src/yuzu/configuration/configure_input_player.cpp35
-rw-r--r--src/yuzu/configuration/configure_input_player.h16
-rw-r--r--src/yuzu/configuration/configure_input_player_widget.cpp3
-rw-r--r--src/yuzu/configuration/configure_input_player_widget.h4
-rw-r--r--src/yuzu/configuration/configure_input_profile_dialog.cpp4
10 files changed, 55 insertions, 57 deletions
diff --git a/src/yuzu/configuration/configure_debug_controller.cpp b/src/yuzu/configuration/configure_debug_controller.cpp
index 31ec48384..9a8de92a1 100644
--- a/src/yuzu/configuration/configure_debug_controller.cpp
+++ b/src/yuzu/configuration/configure_debug_controller.cpp
@@ -2,17 +2,18 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include "core/core.h"
+#include "core/hid/hid_core.h"
#include "ui_configure_debug_controller.h"
#include "yuzu/configuration/configure_debug_controller.h"
#include "yuzu/configuration/configure_input_player.h"
ConfigureDebugController::ConfigureDebugController(QWidget* parent,
InputCommon::InputSubsystem* input_subsystem,
- InputProfiles* profiles, Core::System& system)
+ InputProfiles* profiles,
+ Core::HID::HIDCore& hid_core, bool is_powered_on)
: QDialog(parent), ui(std::make_unique<Ui::ConfigureDebugController>()),
- debug_controller(
- new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, system, true)) {
+ debug_controller(new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles,
+ hid_core, is_powered_on, true)) {
ui->setupUi(this);
ui->controllerLayout->addWidget(debug_controller);
diff --git a/src/yuzu/configuration/configure_debug_controller.h b/src/yuzu/configuration/configure_debug_controller.h
index 6e17c5aa0..d716edbc2 100644
--- a/src/yuzu/configuration/configure_debug_controller.h
+++ b/src/yuzu/configuration/configure_debug_controller.h
@@ -13,8 +13,8 @@ class ConfigureInputPlayer;
class InputProfiles;
-namespace Core {
-class System;
+namespace Core::HID {
+class HIDCore;
}
namespace InputCommon {
@@ -30,7 +30,8 @@ class ConfigureDebugController : public QDialog {
public:
explicit ConfigureDebugController(QWidget* parent, InputCommon::InputSubsystem* input_subsystem,
- InputProfiles* profiles, Core::System& system);
+ InputProfiles* profiles, Core::HID::HIDCore& hid_core,
+ bool is_powered_on);
~ConfigureDebugController() override;
void ApplyConfiguration();
diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp
index 1eb9d70e5..642a5f966 100644
--- a/src/yuzu/configuration/configure_dialog.cpp
+++ b/src/yuzu/configuration/configure_dialog.cpp
@@ -74,7 +74,7 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry,
hotkeys_tab->Populate(registry);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
- input_tab->Initialize(input_subsystem, system_);
+ input_tab->Initialize(input_subsystem);
general_tab->SetResetCallback([&] { this->close(); });
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp
index dece27fde..99450bc7d 100644
--- a/src/yuzu/configuration/configure_input.cpp
+++ b/src/yuzu/configuration/configure_input.cpp
@@ -10,6 +10,8 @@
#include <QTimer>
#include "core/core.h"
+#include "core/hid/emulated_controller.h"
+#include "core/hid/hid_core.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/am/applet_ae.h"
#include "core/hle/service/am/applet_oe.h"
@@ -73,25 +75,27 @@ ConfigureInput::ConfigureInput(Core::System& system_, QWidget* parent)
ConfigureInput::~ConfigureInput() = default;
-void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem, Core::System& system,
+void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem,
std::size_t max_players) {
+ const bool is_powered_on = system.IsPoweredOn();
+ auto& hid_core = system.HIDCore();
player_controllers = {
new ConfigureInputPlayer(this, 0, ui->consoleInputSettings, input_subsystem, profiles.get(),
- system),
+ hid_core, is_powered_on),
new ConfigureInputPlayer(this, 1, ui->consoleInputSettings, input_subsystem, profiles.get(),
- system),
+ hid_core, is_powered_on),
new ConfigureInputPlayer(this, 2, ui->consoleInputSettings, input_subsystem, profiles.get(),
- system),
+ hid_core, is_powered_on),
new ConfigureInputPlayer(this, 3, ui->consoleInputSettings, input_subsystem, profiles.get(),
- system),
+ hid_core, is_powered_on),
new ConfigureInputPlayer(this, 4, ui->consoleInputSettings, input_subsystem, profiles.get(),
- system),
+ hid_core, is_powered_on),
new ConfigureInputPlayer(this, 5, ui->consoleInputSettings, input_subsystem, profiles.get(),
- system),
+ hid_core, is_powered_on),
new ConfigureInputPlayer(this, 6, ui->consoleInputSettings, input_subsystem, profiles.get(),
- system),
+ hid_core, is_powered_on),
new ConfigureInputPlayer(this, 7, ui->consoleInputSettings, input_subsystem, profiles.get(),
- system),
+ hid_core, is_powered_on),
};
player_tabs = {
@@ -147,10 +151,11 @@ void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem, Co
advanced = new ConfigureInputAdvanced(this);
ui->tabAdvanced->setLayout(new QHBoxLayout(ui->tabAdvanced));
ui->tabAdvanced->layout()->addWidget(advanced);
+
connect(advanced, &ConfigureInputAdvanced::CallDebugControllerDialog,
- [this, input_subsystem, &system] {
- CallConfigureDialog<ConfigureDebugController>(*this, input_subsystem,
- profiles.get(), system);
+ [this, input_subsystem, &hid_core, is_powered_on] {
+ CallConfigureDialog<ConfigureDebugController>(
+ *this, input_subsystem, profiles.get(), hid_core, is_powered_on);
});
connect(advanced, &ConfigureInputAdvanced::CallMouseConfigDialog, [this, input_subsystem] {
CallConfigureDialog<ConfigureMouseAdvanced>(*this, input_subsystem);
diff --git a/src/yuzu/configuration/configure_input.h b/src/yuzu/configuration/configure_input.h
index 6e5edad58..4cafa3dab 100644
--- a/src/yuzu/configuration/configure_input.h
+++ b/src/yuzu/configuration/configure_input.h
@@ -42,8 +42,7 @@ public:
~ConfigureInput() override;
/// Initializes the input dialog with the given input subsystem.
- void Initialize(InputCommon::InputSubsystem* input_subsystem_, Core::System& system,
- std::size_t max_players = 8);
+ void Initialize(InputCommon::InputSubsystem* input_subsystem_, std::size_t max_players = 8);
/// Save all button configurations to settings file.
void ApplyConfiguration();
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp
index 95a9b8614..76f55eb54 100644
--- a/src/yuzu/configuration/configure_input_player.cpp
+++ b/src/yuzu/configuration/configure_input_player.cpp
@@ -12,7 +12,6 @@
#include <QMessageBox>
#include <QTimer>
#include "common/param_package.h"
-#include "core/core.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h"
@@ -134,18 +133,17 @@ QString ConfigureInputPlayer::AnalogToText(const Common::ParamPackage& param,
ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_index,
QWidget* bottom_row,
InputCommon::InputSubsystem* input_subsystem_,
- InputProfiles* profiles_, Core::System& system_,
- bool debug)
+ InputProfiles* profiles_, Core::HID::HIDCore& hid_core_,
+ bool is_powered_on_, 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), system{system_} {
-
+ debug(debug), is_powered_on{is_powered_on_}, input_subsystem{input_subsystem_},
+ profiles(profiles_), timeout_timer(std::make_unique<QTimer>()),
+ poll_timer(std::make_unique<QTimer>()), bottom_row(bottom_row), hid_core{hid_core_} {
if (player_index == 0) {
auto* emulated_controller_p1 =
- system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
+ hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
auto* emulated_controller_hanheld =
- system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
+ hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
emulated_controller_p1->SaveCurrentConfig();
emulated_controller_p1->EnableConfiguration();
emulated_controller_hanheld->SaveCurrentConfig();
@@ -157,7 +155,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
emulated_controller = emulated_controller_p1;
}
} else {
- emulated_controller = system_.HIDCore().GetEmulatedControllerByIndex(player_index);
+ emulated_controller = hid_core.GetEmulatedControllerByIndex(player_index);
emulated_controller->SaveCurrentConfig();
emulated_controller->EnableConfiguration();
}
@@ -487,9 +485,9 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
if (player_index == 0) {
auto* emulated_controller_p1 =
- system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
+ hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
auto* emulated_controller_hanheld =
- system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
+ hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
bool is_connected = emulated_controller->IsConnected(true);
emulated_controller_p1->SetNpadStyleIndex(type);
@@ -547,9 +545,9 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
ConfigureInputPlayer::~ConfigureInputPlayer() {
if (player_index == 0) {
auto* emulated_controller_p1 =
- system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
+ hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
auto* emulated_controller_hanheld =
- system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
+ hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
emulated_controller_p1->DisableConfiguration();
emulated_controller_hanheld->DisableConfiguration();
} else {
@@ -560,9 +558,9 @@ ConfigureInputPlayer::~ConfigureInputPlayer() {
void ConfigureInputPlayer::ApplyConfiguration() {
if (player_index == 0) {
auto* emulated_controller_p1 =
- system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
+ hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
auto* emulated_controller_hanheld =
- system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
+ hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
emulated_controller_p1->DisableConfiguration();
emulated_controller_p1->SaveCurrentConfig();
emulated_controller_p1->EnableConfiguration();
@@ -846,12 +844,11 @@ void ConfigureInputPlayer::SetConnectableControllers() {
}
};
- if (!system.IsPoweredOn()) {
+ if (!is_powered_on) {
add_controllers(true);
- return;
}
- add_controllers(false, system.HIDCore().GetSupportedStyleTag());
+ add_controllers(false, hid_core.GetSupportedStyleTag());
}
Core::HID::NpadStyleIndex ConfigureInputPlayer::GetControllerTypeFromIndex(int index) const {
diff --git a/src/yuzu/configuration/configure_input_player.h b/src/yuzu/configuration/configure_input_player.h
index 7bff4b196..47df6b3d3 100644
--- a/src/yuzu/configuration/configure_input_player.h
+++ b/src/yuzu/configuration/configure_input_player.h
@@ -29,10 +29,6 @@ class QWidget;
class InputProfiles;
-namespace Core {
-class System;
-}
-
namespace InputCommon {
class InputSubsystem;
}
@@ -45,11 +41,8 @@ namespace Ui {
class ConfigureInputPlayer;
}
-namespace Core {
-class System;
-}
-
namespace Core::HID {
+class HIDCore;
class EmulatedController;
enum class NpadStyleIndex : u8;
} // namespace Core::HID
@@ -60,8 +53,8 @@ class ConfigureInputPlayer : public QWidget {
public:
explicit ConfigureInputPlayer(QWidget* parent, std::size_t player_index, QWidget* bottom_row,
InputCommon::InputSubsystem* input_subsystem_,
- InputProfiles* profiles_, Core::System& system_,
- bool debug = false);
+ InputProfiles* profiles_, Core::HID::HIDCore& hid_core_,
+ bool is_powered_on_, bool debug = false);
~ConfigureInputPlayer() override;
/// Save all button configurations to settings file.
@@ -173,6 +166,7 @@ private:
std::size_t player_index;
bool debug;
+ bool is_powered_on;
InputCommon::InputSubsystem* input_subsystem;
@@ -228,5 +222,5 @@ private:
/// parent of the widget to this widget (but thats fine).
QWidget* bottom_row;
- Core::System& system;
+ Core::HID::HIDCore& hid_core;
};
diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp
index af65cf64c..ff40f57f5 100644
--- a/src/yuzu/configuration/configure_input_player_widget.cpp
+++ b/src/yuzu/configuration/configure_input_player_widget.cpp
@@ -6,7 +6,8 @@
#include <QMenu>
#include <QPainter>
#include <QTimer>
-#include "core/core.h"
+
+#include "core/hid/emulated_controller.h"
#include "yuzu/configuration/configure_input_player_widget.h"
PlayerControlPreview::PlayerControlPreview(QWidget* parent) : QFrame(parent) {
diff --git a/src/yuzu/configuration/configure_input_player_widget.h b/src/yuzu/configuration/configure_input_player_widget.h
index ee217f3c9..4cd5c3be0 100644
--- a/src/yuzu/configuration/configure_input_player_widget.h
+++ b/src/yuzu/configuration/configure_input_player_widget.h
@@ -7,10 +7,10 @@
#include <array>
#include <QFrame>
#include <QPointer>
+
#include "common/input.h"
-#include "common/settings.h"
+#include "common/settings_input.h"
#include "core/hid/emulated_controller.h"
-#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h"
class QLabel;
diff --git a/src/yuzu/configuration/configure_input_profile_dialog.cpp b/src/yuzu/configuration/configure_input_profile_dialog.cpp
index cd5a88cea..17bbe6b61 100644
--- a/src/yuzu/configuration/configure_input_profile_dialog.cpp
+++ b/src/yuzu/configuration/configure_input_profile_dialog.cpp
@@ -11,8 +11,8 @@ ConfigureInputProfileDialog::ConfigureInputProfileDialog(
QWidget* parent, InputCommon::InputSubsystem* input_subsystem, InputProfiles* profiles,
Core::System& system)
: QDialog(parent), ui(std::make_unique<Ui::ConfigureInputProfileDialog>()),
- profile_widget(
- new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, system, false)) {
+ profile_widget(new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles,
+ system.HIDCore(), system.IsPoweredOn(), false)) {
ui->setupUi(this);
ui->controllerLayout->addWidget(profile_widget);