summaryrefslogtreecommitdiff
path: root/src/core/hid/emulated_controller.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2022-01-11 10:49:23 -0800
committerGravatar GitHub2022-01-11 10:49:23 -0800
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.gz
yuzu-c65c651b6fb174084a26039ce6ea78e9cd3aedf0.tar.xz
yuzu-c65c651b6fb174084a26039ce6ea78e9cd3aedf0.zip
Merge pull request #7633 from german77/hotkeys
yuzu: Add controller hotkeys
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() {
351 } 351 }
352} 352}
353 353
354void EmulatedController::EnableSystemButtons() {
355 system_buttons_enabled = true;
356}
357
358void EmulatedController::DisableSystemButtons() {
359 system_buttons_enabled = false;
360}
361
362void EmulatedController::ResetSystemButtons() {
363 controller.home_button_state.home.Assign(false);
364 controller.capture_button_state.capture.Assign(false);
365}
366
354bool EmulatedController::IsConfiguring() const { 367bool EmulatedController::IsConfiguring() const {
355 return is_configuring; 368 return is_configuring;
356} 369}
@@ -600,7 +613,16 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback
600 controller.npad_button_state.right_sr.Assign(current_status.value); 613 controller.npad_button_state.right_sr.Assign(current_status.value);
601 break; 614 break;
602 case Settings::NativeButton::Home: 615 case Settings::NativeButton::Home:
616 if (!system_buttons_enabled) {
617 break;
618 }
619 controller.home_button_state.home.Assign(current_status.value);
620 break;
603 case Settings::NativeButton::Screenshot: 621 case Settings::NativeButton::Screenshot:
622 if (!system_buttons_enabled) {
623 break;
624 }
625 controller.capture_button_state.capture.Assign(current_status.value);
604 break; 626 break;
605 } 627 }
606 } 628 }
@@ -1081,6 +1103,20 @@ BatteryValues EmulatedController::GetBatteryValues() const {
1081 return controller.battery_values; 1103 return controller.battery_values;
1082} 1104}
1083 1105
1106HomeButtonState EmulatedController::GetHomeButtons() const {
1107 if (is_configuring) {
1108 return {};
1109 }
1110 return controller.home_button_state;
1111}
1112
1113CaptureButtonState EmulatedController::GetCaptureButtons() const {
1114 if (is_configuring) {
1115 return {};
1116 }
1117 return controller.capture_button_state;
1118}
1119
1084NpadButtonState EmulatedController::GetNpadButtons() const { 1120NpadButtonState EmulatedController::GetNpadButtons() const {
1085 if (is_configuring) { 1121 if (is_configuring) {
1086 return {}; 1122 return {};