diff options
author | David Marcec <dmarcecguzman@gmail.com> | 2019-07-08 06:51:40 +0200 |
---|---|---|
committer | David Marcec <dmarcecguzman@gmail.com> | 2019-07-08 06:51:40 +0200 |
commit | 5234e08a0d3d4630ee02acae3b85d2e2e65761b5 (patch) | |
tree | 2ddaf5770736f186acd3aa6aa05823de4bd95490 /src/core/hle/service | |
parent | hid:StartLrAssignmentMode, hid:StopLrAssignmentMode, hid:SwapNpadAssignment (diff) | |
download | yuzu-5234e08a0d3d4630ee02acae3b85d2e2e65761b5.tar yuzu-5234e08a0d3d4630ee02acae3b85d2e2e65761b5.tar.gz yuzu-5234e08a0d3d4630ee02acae3b85d2e2e65761b5.tar.bz2 yuzu-5234e08a0d3d4630ee02acae3b85d2e2e65761b5.tar.lz yuzu-5234e08a0d3d4630ee02acae3b85d2e2e65761b5.tar.xz yuzu-5234e08a0d3d4630ee02acae3b85d2e2e65761b5.tar.zst yuzu-5234e08a0d3d4630ee02acae3b85d2e2e65761b5.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 99af0469d..1e81f776f 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -563,17 +563,18 @@ bool Controller_NPad::SwapNpadAssignment(u32 npad_id_1, u32 npad_id_2) { npad_id_2 == NPAD_UNKNOWN) { return true; } + const auto npad_index_1 = NPadIdToIndex(npad_id_1); + const auto npad_index_2 = NPadIdToIndex(npad_id_2); - if (!IsControllerSupported(connected_controllers[NPadIdToIndex(npad_id_1)].type) || - !IsControllerSupported(connected_controllers[NPadIdToIndex(npad_id_2)].type)) { + if (!IsControllerSupported(connected_controllers[npad_index_1].type) || + !IsControllerSupported(connected_controllers[npad_index_2].type)) { return false; } - std::swap(connected_controllers[NPadIdToIndex(npad_id_1)].type, - connected_controllers[NPadIdToIndex(npad_id_2)].type); + std::swap(connected_controllers[npad_index_1].type, connected_controllers[npad_index_2].type); - InitNewlyAddedControler(NPadIdToIndex(npad_id_1)); - InitNewlyAddedControler(NPadIdToIndex(npad_id_2)); + InitNewlyAddedControler(npad_index_1); + InitNewlyAddedControler(npad_index_2); return true; } |