aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/configuration/configure_input_player.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu/configuration/configure_input_player.h')
-rw-r--r--src/yuzu/configuration/configure_input_player.h57
1 files changed, 20 insertions, 37 deletions
diff --git a/src/yuzu/configuration/configure_input_player.h b/src/yuzu/configuration/configure_input_player.h
index 39b44b8a56..47df6b3d33 100644
--- a/src/yuzu/configuration/configure_input_player.h
+++ b/src/yuzu/configuration/configure_input_player.h
@@ -29,48 +29,37 @@ class QWidget;
class InputProfiles;
-namespace Core {
-class System;
-}
-
namespace InputCommon {
class InputSubsystem;
}
namespace InputCommon::Polling {
-class DevicePoller;
-enum class DeviceType;
+enum class InputType;
} // namespace InputCommon::Polling
namespace Ui {
class ConfigureInputPlayer;
}
+namespace Core::HID {
+class HIDCore;
+class EmulatedController;
+enum class NpadStyleIndex : u8;
+} // namespace Core::HID
+
class ConfigureInputPlayer : public QWidget {
Q_OBJECT
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.
void ApplyConfiguration();
- /**
- * Attempts to connect the currently selected controller in the HID backend.
- * This function will not do anything if it is not connected in the frontend.
- */
- void TryConnectSelectedController();
-
- /**
- * Attempts to disconnect the currently selected controller in the HID backend.
- * This function will not do anything if the configuration has not changed.
- */
- void TryDisconnectSelectedController();
-
/// Set the connection state checkbox (used to sync state).
void ConnectPlayer(bool connected);
@@ -104,6 +93,10 @@ protected:
void showEvent(QShowEvent* event) override;
private:
+ QString ButtonToText(const Common::ParamPackage& param);
+
+ QString AnalogToText(const Common::ParamPackage& param, const std::string& dir);
+
void changeEvent(QEvent* event) override;
void RetranslateUI();
@@ -113,7 +106,7 @@ private:
/// Called when the button was pressed.
void HandleClick(QPushButton* button, std::size_t button_id,
std::function<void(const Common::ParamPackage&)> new_input_setter,
- InputCommon::Polling::DeviceType type);
+ InputCommon::Polling::InputType type);
/// Finish polling and configure input using the input_setter.
void SetPollingResult(const Common::ParamPackage& params, bool abort);
@@ -134,17 +127,14 @@ private:
void SetConnectableControllers();
/// Gets the Controller Type for a given controller combobox index.
- Settings::ControllerType GetControllerTypeFromIndex(int index) const;
+ Core::HID::NpadStyleIndex GetControllerTypeFromIndex(int index) const;
/// Gets the controller combobox index for a given Controller Type.
- int GetIndexFromControllerType(Settings::ControllerType type) const;
+ int GetIndexFromControllerType(Core::HID::NpadStyleIndex type) const;
/// Update the available input devices.
void UpdateInputDevices();
- /// Update the current controller icon.
- void UpdateControllerIcon();
-
/// Hides and disables controller settings based on the current controller type.
void UpdateControllerAvailableButtons();
@@ -176,6 +166,7 @@ private:
std::size_t player_index;
bool debug;
+ bool is_powered_on;
InputCommon::InputSubsystem* input_subsystem;
@@ -185,7 +176,7 @@ private:
std::unique_ptr<QTimer> poll_timer;
/// Stores a pair of "Connected Controllers" combobox index and Controller Type enum.
- std::vector<std::pair<int, Settings::ControllerType>> index_controller_type_pairs;
+ std::vector<std::pair<int, Core::HID::NpadStyleIndex>> index_controller_type_pairs;
static constexpr int PLAYER_COUNT = 8;
std::array<QCheckBox*, PLAYER_COUNT> player_connected_checkbox;
@@ -193,9 +184,7 @@ private:
/// This will be the the setting function when an input is awaiting configuration.
std::optional<std::function<void(const Common::ParamPackage&)>> input_setter;
- std::array<Common::ParamPackage, Settings::NativeButton::NumButtons> buttons_param;
- std::array<Common::ParamPackage, Settings::NativeAnalog::NumAnalogs> analogs_param;
- std::array<Common::ParamPackage, Settings::NativeMotion::NumMotions> motions_param;
+ Core::HID::EmulatedController* emulated_controller;
static constexpr int ANALOG_SUB_BUTTONS_NUM = 4;
@@ -221,15 +210,9 @@ private:
static const std::array<std::string, ANALOG_SUB_BUTTONS_NUM> analog_sub_buttons;
- std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> device_pollers;
-
/// A flag to indicate that the "Map Analog Stick" pop-up has been shown and accepted once.
bool map_analog_stick_accepted{};
- /// A flag to indicate if keyboard keys are okay when configuring an input. If this is false,
- /// keyboard events are ignored.
- bool want_keyboard_mouse{};
-
/// List of physical devices users can map with. If a SDL backed device is selected, then you
/// can use this device to get a default mapping.
std::vector<Common::ParamPackage> input_devices;
@@ -239,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;
};