summaryrefslogtreecommitdiffstats
path: root/src/core/hid/emulated_controller.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-01-11 19:49:23 +0100
committerGitHub <noreply@github.com>2022-01-11 19:49:23 +0100
commitc65c651b6fb174084a26039ce6ea78e9cd3aedf0 (patch)
tree9790b6abe3e9d05649629fe851031438ed6ad139 /src/core/hid/emulated_controller.cpp
parentMerge pull request #7683 from liushuyu/fmt-8.1 (diff)
parentyuzu: Add controller hotkeys (diff)
downloadyuzu-c65c651b6fb174084a26039ce6ea78e9cd3aedf0.tar
yuzu-c65c651b6fb174084a26039ce6ea78e9cd3aedf0.tar.gz
yuzu-c65c651b6fb174084a26039ce6ea78e9cd3aedf0.tar.bz2
yuzu-c65c651b6fb174084a26039ce6ea78e9cd3aedf0.tar.lz
yuzu-c65c651b6fb174084a26039ce6ea78e9cd3aedf0.tar.xz
yuzu-c65c651b6fb174084a26039ce6ea78e9cd3aedf0.tar.zst
yuzu-c65c651b6fb174084a26039ce6ea78e9cd3aedf0.zip
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
-rw-r--r--src/core/hid/emulated_controller.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 52a56ef1a..13edb7332 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -351,6 +351,19 @@ void EmulatedController::DisableConfiguration() {
}
}
+void EmulatedController::EnableSystemButtons() {
+ system_buttons_enabled = true;
+}
+
+void EmulatedController::DisableSystemButtons() {
+ system_buttons_enabled = false;
+}
+
+void EmulatedController::ResetSystemButtons() {
+ controller.home_button_state.home.Assign(false);
+ controller.capture_button_state.capture.Assign(false);
+}
+
bool EmulatedController::IsConfiguring() const {
return is_configuring;
}
@@ -600,7 +613,16 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback
controller.npad_button_state.right_sr.Assign(current_status.value);
break;
case Settings::NativeButton::Home:
+ if (!system_buttons_enabled) {
+ break;
+ }
+ controller.home_button_state.home.Assign(current_status.value);
+ break;
case Settings::NativeButton::Screenshot:
+ if (!system_buttons_enabled) {
+ break;
+ }
+ controller.capture_button_state.capture.Assign(current_status.value);
break;
}
}
@@ -1081,6 +1103,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 {};