diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-04-01 15:49:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-01 15:49:08 +0200 |
commit | b2772bcb0d994a9646282e98aca5d97b70f843f4 (patch) | |
tree | d2a1f4b3990c946d63652c23361174a33cd3e782 /src/core/hle/service/am/applets | |
parent | Merge pull request #9999 from german77/new_hid_hurra (diff) | |
parent | applet: controller: Implement cancel button (diff) | |
download | yuzu-b2772bcb0d994a9646282e98aca5d97b70f843f4.tar yuzu-b2772bcb0d994a9646282e98aca5d97b70f843f4.tar.gz yuzu-b2772bcb0d994a9646282e98aca5d97b70f843f4.tar.bz2 yuzu-b2772bcb0d994a9646282e98aca5d97b70f843f4.tar.lz yuzu-b2772bcb0d994a9646282e98aca5d97b70f843f4.tar.xz yuzu-b2772bcb0d994a9646282e98aca5d97b70f843f4.tar.zst yuzu-b2772bcb0d994a9646282e98aca5d97b70f843f4.zip |
Diffstat (limited to 'src/core/hle/service/am/applets')
-rw-r--r-- | src/core/hle/service/am/applets/applet_controller.cpp | 12 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/applet_controller.h | 9 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/core/hle/service/am/applets/applet_controller.cpp b/src/core/hle/service/am/applets/applet_controller.cpp index 2d1d115d7..9840d2547 100644 --- a/src/core/hle/service/am/applets/applet_controller.cpp +++ b/src/core/hle/service/am/applets/applet_controller.cpp @@ -224,7 +224,8 @@ void Controller::Execute() { parameters.allow_dual_joycons, parameters.allow_left_joycon, parameters.allow_right_joycon); - frontend.ReconfigureControllers([this] { ConfigurationComplete(); }, parameters); + frontend.ReconfigureControllers( + [this](bool is_success) { ConfigurationComplete(is_success); }, parameters); break; } case ControllerSupportMode::ShowControllerStrapGuide: @@ -232,16 +233,16 @@ void Controller::Execute() { case ControllerSupportMode::ShowControllerKeyRemappingForSystem: UNIMPLEMENTED_MSG("ControllerSupportMode={} is not implemented", controller_private_arg.mode); - ConfigurationComplete(); + ConfigurationComplete(true); break; default: { - ConfigurationComplete(); + ConfigurationComplete(true); break; } } } -void Controller::ConfigurationComplete() { +void Controller::ConfigurationComplete(bool is_success) { ControllerSupportResultInfo result_info{}; // If enable_single_mode is enabled, player_count is 1 regardless of any other parameters. @@ -250,7 +251,8 @@ void Controller::ConfigurationComplete() { result_info.selected_id = static_cast<u32>(system.HIDCore().GetFirstNpadId()); - result_info.result = 0; + result_info.result = + is_success ? ControllerSupportResult::Success : ControllerSupportResult::Cancel; LOG_DEBUG(Service_HID, "Result Info: player_count={}, selected_id={}, result={}", result_info.player_count, result_info.selected_id, result_info.result); diff --git a/src/core/hle/service/am/applets/applet_controller.h b/src/core/hle/service/am/applets/applet_controller.h index 1fbabee11..f6c64f633 100644 --- a/src/core/hle/service/am/applets/applet_controller.h +++ b/src/core/hle/service/am/applets/applet_controller.h @@ -48,6 +48,11 @@ enum class ControllerSupportCaller : u8 { MaxControllerSupportCaller, }; +enum class ControllerSupportResult : u32 { + Success = 0, + Cancel = 2, +}; + struct ControllerSupportArgPrivate { u32 arg_private_size{}; u32 arg_size{}; @@ -112,7 +117,7 @@ struct ControllerSupportResultInfo { s8 player_count{}; INSERT_PADDING_BYTES(3); u32 selected_id{}; - u32 result{}; + ControllerSupportResult result{}; }; static_assert(sizeof(ControllerSupportResultInfo) == 0xC, "ControllerSupportResultInfo has incorrect size."); @@ -131,7 +136,7 @@ public: void Execute() override; Result RequestExit() override; - void ConfigurationComplete(); + void ConfigurationComplete(bool is_success); private: const Core::Frontend::ControllerApplet& frontend; |