summaryrefslogtreecommitdiffstats
path: root/src/core/hid
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-12-26 02:00:11 +0100
committergerman77 <juangerman-13@hotmail.com>2022-01-07 04:11:27 +0100
commitb94e947793dcb53e9e00ef8bf587b2f689d38d41 (patch)
treef711fb7056365911b83dd859ddb5a2971af1924c /src/core/hid
parentMerge pull request #7673 from german77/no_return (diff)
downloadyuzu-b94e947793dcb53e9e00ef8bf587b2f689d38d41.tar
yuzu-b94e947793dcb53e9e00ef8bf587b2f689d38d41.tar.gz
yuzu-b94e947793dcb53e9e00ef8bf587b2f689d38d41.tar.bz2
yuzu-b94e947793dcb53e9e00ef8bf587b2f689d38d41.tar.lz
yuzu-b94e947793dcb53e9e00ef8bf587b2f689d38d41.tar.xz
yuzu-b94e947793dcb53e9e00ef8bf587b2f689d38d41.tar.zst
yuzu-b94e947793dcb53e9e00ef8bf587b2f689d38d41.zip
Diffstat (limited to 'src/core/hid')
-rw-r--r--src/core/hid/emulated_controller.cpp17
-rw-r--r--src/core/hid/emulated_controller.h10
-rw-r--r--src/core/hid/hid_types.h20
3 files changed, 46 insertions, 1 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 71fc05807..9f68a41cc 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -596,7 +596,10 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback
controller.npad_button_state.right_sr.Assign(current_status.value);
break;
case Settings::NativeButton::Home:
+ controller.home_button_state.home.Assign(current_status.value);
+ break;
case Settings::NativeButton::Screenshot:
+ controller.capture_button_state.capture.Assign(current_status.value);
break;
}
}
@@ -1077,6 +1080,20 @@ BatteryValues EmulatedController::GetBatteryValues() const {
return controller.battery_values;
}
+HomeButtonState EmulatedController::GetHomeButtons() const {
+ if (is_configuring) {
+ return {};
+ }
+ return controller.home_button_state;
+}
+
+CaptureButtonState EmulatedController::GetCaptureButtons() const {
+ if (is_configuring) {
+ return {};
+ }
+ return controller.capture_button_state;
+}
+
NpadButtonState EmulatedController::GetNpadButtons() const {
if (is_configuring) {
return {};
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h
index c0994ab4d..bee16a8ed 100644
--- a/src/core/hid/emulated_controller.h
+++ b/src/core/hid/emulated_controller.h
@@ -101,6 +101,8 @@ struct ControllerStatus {
VibrationValues vibration_values{};
// Data for HID serices
+ HomeButtonState home_button_state{};
+ CaptureButtonState capture_button_state{};
NpadButtonState npad_button_state{};
DebugPadButton debug_pad_button_state{};
AnalogSticks analog_stick_state{};
@@ -261,7 +263,13 @@ public:
/// Returns the latest battery status from the controller with parameters
BatteryValues GetBatteryValues() const;
- /// Returns the latest status of button input for the npad service
+ /// Returns the latest status of button input for the hid::HomeButton service
+ HomeButtonState GetHomeButtons() const;
+
+ /// Returns the latest status of button input for the hid::CaptureButton service
+ CaptureButtonState GetCaptureButtons() const;
+
+ /// Returns the latest status of button input for the hid::Npad service
NpadButtonState GetNpadButtons() const;
/// Returns the latest status of button input for the debug pad service
diff --git a/src/core/hid/hid_types.h b/src/core/hid/hid_types.h
index 4eca68533..778b328b9 100644
--- a/src/core/hid/hid_types.h
+++ b/src/core/hid/hid_types.h
@@ -378,6 +378,26 @@ struct LedPattern {
};
};
+struct HomeButtonState {
+ union {
+ u64 raw{};
+
+ // Buttons
+ BitField<0, 1, u64> home;
+ };
+};
+static_assert(sizeof(HomeButtonState) == 0x8, "HomeButtonState has incorrect size.");
+
+struct CaptureButtonState {
+ union {
+ u64 raw{};
+
+ // Buttons
+ BitField<0, 1, u64> capture;
+ };
+};
+static_assert(sizeof(CaptureButtonState) == 0x8, "CaptureButtonState has incorrect size.");
+
struct NpadButtonState {
union {
NpadButton raw{};