From cda7e145efc10ef31a346ea21db84a7e8403139e Mon Sep 17 00:00:00 2001 From: gaowanqiu Date: Sun, 2 Apr 2023 21:58:52 +0800 Subject: [PATCH 1/2] fix: wrong key mapping for NS Pro controller --- src/input/emulated/ClassicController.cpp | 35 +++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/input/emulated/ClassicController.cpp b/src/input/emulated/ClassicController.cpp index 5a3bdb43e..e584a6cac 100644 --- a/src/input/emulated/ClassicController.cpp +++ b/src/input/emulated/ClassicController.cpp @@ -174,6 +174,39 @@ bool ClassicController::set_default_mapping(const std::shared_ptrget_guid() == SDLController::kSwitchProController) + { + mapping = + { + {kButtonId_A, kButton0}, + {kButtonId_B, kButton1}, + {kButtonId_X, kButton2}, + {kButtonId_Y, kButton3}, + + {kButtonId_L, kButton9}, + {kButtonId_R, kButton10}, + {kButtonId_ZL, kTriggerXP}, + {kButtonId_ZR, kTriggerYP}, + + {kButtonId_Plus, kButton6}, + {kButtonId_Minus, kButton4}, + + {kButtonId_Up, kButton11}, + {kButtonId_Down, kButton12}, + {kButtonId_Left, kButton13}, + {kButtonId_Right, kButton14}, + + {kButtonId_StickL_Up, kAxisYN}, + {kButtonId_StickL_Down, kAxisYP}, + {kButtonId_StickL_Left, kAxisXN}, + {kButtonId_StickL_Right, kAxisXP}, + + {kButtonId_StickR_Up, kRotationYN}, + {kButtonId_StickR_Down, kRotationYP}, + {kButtonId_StickR_Left, kRotationXN}, + {kButtonId_StickR_Right, kRotationXP}, + }; + } else { mapping = @@ -256,4 +289,4 @@ bool ClassicController::set_default_mapping(const std::shared_ptr Date: Sun, 2 Apr 2023 22:26:07 +0800 Subject: [PATCH 2/2] fix: add NS Pro Controller mapping --- src/input/emulated/ProController.cpp | 38 +++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/input/emulated/ProController.cpp b/src/input/emulated/ProController.cpp index a546cde88..f0744d092 100644 --- a/src/input/emulated/ProController.cpp +++ b/src/input/emulated/ProController.cpp @@ -183,6 +183,42 @@ bool ProController::set_default_mapping(const std::shared_ptr& c {kButtonId_StickR_Right, kRotationXP}, }; } + else if (sdl_controller->get_guid() == SDLController::kSwitchProController) + { + mapping = + { + {kButtonId_A, kButton0}, + {kButtonId_B, kButton1}, + {kButtonId_X, kButton2}, + {kButtonId_Y, kButton3}, + + {kButtonId_L, kButton9}, + {kButtonId_R, kButton10}, + {kButtonId_ZL, kTriggerXP}, + {kButtonId_ZR, kTriggerYP}, + + {kButtonId_Plus, kButton6}, + {kButtonId_Minus, kButton4}, + + {kButtonId_Up, kButton11}, + {kButtonId_Down, kButton12}, + {kButtonId_Left, kButton13}, + {kButtonId_Right, kButton14}, + + {kButtonId_StickL, kButton7}, + {kButtonId_StickR, kButton8}, + + {kButtonId_StickL_Up, kAxisYN}, + {kButtonId_StickL_Down, kAxisYP}, + {kButtonId_StickL_Left, kAxisXN}, + {kButtonId_StickL_Right, kAxisXP}, + + {kButtonId_StickR_Up, kRotationYN}, + {kButtonId_StickR_Down, kRotationYP}, + {kButtonId_StickR_Left, kRotationXN}, + {kButtonId_StickR_Right, kRotationXP}, + }; + } else { mapping = @@ -271,4 +307,4 @@ bool ProController::set_default_mapping(const std::shared_ptr& c }); return mapping_updated; -} \ No newline at end of file +}