diff options
author | David Marcec <dmarcecguzman@gmail.com> | 2019-07-01 07:12:57 +0200 |
---|---|---|
committer | David Marcec <dmarcecguzman@gmail.com> | 2019-07-01 07:12:57 +0200 |
commit | 472210bf72e1509f7266e49bf50be7a681078552 (patch) | |
tree | 16647a42c9f71f764a5bf501422c16b4c09e4cdc /src/core/hle/service/hid/controllers/npad.cpp | |
parent | Merge pull request #2583 from FernandoS27/core-timing-safe (diff) | |
download | yuzu-472210bf72e1509f7266e49bf50be7a681078552.tar yuzu-472210bf72e1509f7266e49bf50be7a681078552.tar.gz yuzu-472210bf72e1509f7266e49bf50be7a681078552.tar.bz2 yuzu-472210bf72e1509f7266e49bf50be7a681078552.tar.lz yuzu-472210bf72e1509f7266e49bf50be7a681078552.tar.xz yuzu-472210bf72e1509f7266e49bf50be7a681078552.tar.zst yuzu-472210bf72e1509f7266e49bf50be7a681078552.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index fdd6d79a2..99af0469d 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -548,6 +548,36 @@ void Controller_NPad::DisconnectNPad(u32 npad_id) { connected_controllers[NPadIdToIndex(npad_id)].is_connected = false; } +void Controller_NPad::StartLRAssignmentMode() { + // Nothing internally is used for lr assignment mode. Since we have the ability to set the + // controller types from boot, it doesn't really matter about showing a selection screen + is_in_lr_assignment_mode = true; +} + +void Controller_NPad::StopLRAssignmentMode() { + is_in_lr_assignment_mode = false; +} + +bool Controller_NPad::SwapNpadAssignment(u32 npad_id_1, u32 npad_id_2) { + if (npad_id_1 == NPAD_HANDHELD || npad_id_2 == NPAD_HANDHELD || npad_id_1 == NPAD_UNKNOWN || + npad_id_2 == NPAD_UNKNOWN) { + return true; + } + + if (!IsControllerSupported(connected_controllers[NPadIdToIndex(npad_id_1)].type) || + !IsControllerSupported(connected_controllers[NPadIdToIndex(npad_id_2)].type)) { + return false; + } + + std::swap(connected_controllers[NPadIdToIndex(npad_id_1)].type, + connected_controllers[NPadIdToIndex(npad_id_2)].type); + + InitNewlyAddedControler(NPadIdToIndex(npad_id_1)); + InitNewlyAddedControler(NPadIdToIndex(npad_id_2)); + + return true; +} + bool Controller_NPad::IsControllerSupported(NPadControllerType controller) { if (controller == NPadControllerType::Handheld) { // Handheld is not even a supported type, lets stop here |