diff --git a/SonicTimeTwisted.gmx/SonicTimeTwisted.project.gmx b/SonicTimeTwisted.gmx/SonicTimeTwisted.project.gmx index f2d1d16af..5fad07f76 100644 --- a/SonicTimeTwisted.gmx/SonicTimeTwisted.project.gmx +++ b/SonicTimeTwisted.gmx/SonicTimeTwisted.project.gmx @@ -2158,88 +2158,6 @@ 057e_2006_057e_2007_joy_con__l__joy_con__r_.csv - - 057e_2006_joy_con__l_.csv - -1 - 652 - 2 - - 0 - -1 - 0 - 0 - - - 9223372036854775807 - - - 2097160 - - - 9223372036854775807 - - - 9223372036854775807 - - - 9223372036854775807 - - - 9223372036854775807 - - - 9223372036854775807 - - - 2097160 - - - 9223372036854775807 - - - 057e_2006_joy_con__l_.csv - - - 057e_2007_joy_con__r_.csv - -1 - 652 - 2 - - 0 - -1 - 0 - 0 - - - 9223372036854775807 - - - 2097160 - - - 9223372036854775807 - - - 9223372036854775807 - - - 9223372036854775807 - - - 9223372036854775807 - - - 9223372036854775807 - - - 2097160 - - - 9223372036854775807 - - - 057e_2007_joy_con__r_.csv - diff --git a/SonicTimeTwisted.gmx/datafiles/android/gamepad/057e_2006_057e_2007_joy_con__l__joy_con__r_.csv b/SonicTimeTwisted.gmx/datafiles/android/gamepad/057e_2006_057e_2007_joy_con__l__joy_con__r_.csv index e5707bc53..93a3799cf 100644 --- a/SonicTimeTwisted.gmx/datafiles/android/gamepad/057e_2006_057e_2007_joy_con__l__joy_con__r_.csv +++ b/SonicTimeTwisted.gmx/datafiles/android/gamepad/057e_2006_057e_2007_joy_con__l__joy_con__r_.csv @@ -1,25 +1,101 @@ min_api,max_api,vendor,product,other_vendor,other_product,event_device,event_type,event_code,event_value,mapped_type,mapped_code,mapped_value,comment -,,057e,2006,057e,2007,0,axis,15,-1,axis,1,-1,"Joy-Con (L)/Joy-Con (R), Left Stick UP" -,,,,,,,,15,1,,1,1,Left Stick DOWN -,,,,,,,,16,1,,0,-1,Left Stick LEFT -,,,,,,,,16,-1,,0,1,Left Stick RIGHT -,,,,,,,button,98,,,16,-1,D-Pad UP -,,,,,,,,97,,,16,1,D-Pad DOWN -,,,,,,,,96,,,15,-1,D-Pad LEFT -,,,,,,,,99,,,15,1,D-Pad RIGHT -,,,,,,1,axis,15,1,,14,-1,Right Stick UP -,,,,,,,,15,-1,,14,1,Right Stick DOWN -,,,,,,,,16,-1,,11,-1,Right Stick LEFT -,,,,,,,,16,1,,11,1,Right Stick RIGHT -,,,,,,,button,98,,button,96,,Cross/A/Bottom button -,,,,,,,,96,,,97,,Circle/B/Right button -,,,,,,,,99,,,99,,Square/X/Left button -,,,,,,,,97,,,100,,Triangle/Y/Top button -,,,,,,,,105,,,108,,Start button -,,,,,,0,,104,,,109,,Select button -,,,,,,,,107,,,102,,L1 button -,,,,,,1,,107,,,103,,R1 button -,,,,,,0,,0,,,104,,L2 button -,,,,,,1,,0,,,105,,R2 button -,,,,,,0,,109,,,106,,Left stick press -,,,,,,1,,108,,,107,,Right stick press +,29,057e,2006,,,,,,,,,,Left Joy-Con +,,,,,,,button,96,,button,96,,down key is A +,,,,,,,,97,,,97,,right key is B +,,,,,,,,98,,,99,,left key is X +,,,,,,,,99,,,100,,right key is Y +,,,,,,,,100,,,102,,SL is L1 +,,,,,,,,101,,,103,,SR is R1 +,,,,,,,,104,,,108,,Minus is START +,,,,,,,,106,,,109,,Screenshot is SELECT +,,,,,,,,107,,,104,,L is L2 +,,,,,,,,0,,,105,,ZL is R2 +,,,,,,,,109,,,110,,Thumbstick press is MODE +,,,,,,,axis,15,,axis,15,,Hat X axis works as intended out-of-the-box +,,,,,,,,16,,,16,,Hat Y axis works as intended out-of-the-box +,29,057e,2007,,,,,,,,,,Right Joy-Con +,,,,,,,button,96,,button,96,,down key is A +,,,,,,,,97,,,97,,right key is B +,,,,,,,,98,,,99,,left key is X +,,,,,,,,99,,,100,,right key is Y +,,,,,,,,100,,,102,,SL is L1 +,,,,,,,,101,,,103,,SR is R1 +,,,,,,,,105,,,108,,Minus is START +,,,,,,,,110,,,109,,Home is SELECT +,,,,,,,,107,,,104,,R is L2 +,,,,,,,,0,,,105,,ZR is R2 +,,,,,,,,108,,,110,,Thumbstick press is MODE +,,,,,,,axis,15,,axis,15,,Hat X axis works as intended out-of-the-box +,,,,,,,,16,,,16,,Hat Y axis works as intended out-of-the-box +,29,057e,2006,057e,2007,,,,,,,,Joy-Cons for Android 10- +,,,,,,0,button,98,,axis,16,-1,UP is Hat Y -1 +,,,,,,,,97,,,16,1,DOWN is Hat Y +1 +,,,,,,,,96,,,15,-1,LEFT is Hat X -1 +,,,,,,,,99,,,15,1,RIGHT is Hat X +1 +,,,,,,,,107,,button,102,,L is L1 +,,,,,,,,0,,,104,,ZL is L2 +,,,,,,,,109,,,106,,Left Thumbstick is L3 +,,,,,,,,104,,,109,,Minus is SELECT +,,,,,,,,106,,,110,,Screenshot is Mode +,,,,,,,,100,,,188,,SL is Generic 1 +,,,,,,,,101,,,189,,SR is Generic 2 +,,,,,,,axis,15,-1,axis,1,-1,Joy-Con's X axis is combined gamepad's Y axis +,,,,,,,,15,1,,1,1, +,,,,,,,,16,1,,0,-1,"Joy-Con's Y axis is combined gamepad's X axis, inverted" +,,,,,,,,16,-1,,0,1, +,,,,,,1,button,98,,button,96,,B is A +,,,,,,,,96,,,97,,A is B +,,,,,,,,99,,,99,,Y is X +,,,,,,,,97,,,100,,X is Y +,,,,,,,,105,,,108,,Plus is START +,,,,,,,,107,,,103,,R is R1 +,,,,,,,,0,,,105,,ZR is R2 +,,,,,,,,108,,,107,,Right Thumbstick is R3 +,,,,,,,,101,,,190,,SR is Generic 3 +,,,,,,,,100,,,191,,SL is Generic 4 +,,,,,,,axis,16,-1,axis,11,-1,Joy-Con's Y axis is combined gamepad's Z axis +,,,,,,,,16,1,,11,1, +,,,,,,,,15,1,,14,-1,"Joy-Con's X axis is combined gamepad's RZ axis, inverted" +,,,,,,,,15,-1,,14,1, +30,,057e,2006,057e,2007,,,,,,,,"Joy-Cons for Android 11+ are pre-mapped, but the D-Pad doesn't work" +,,,,,,0,,102,,button,102,, +,,,,,,,,104,,,104,, +,,,,,,,,106,,,106,, +,,,,,,,,109,,,109,, +,,,,,,,,110,,,110,, +,,,,,,,,101,,,101,, +,,,,,,,axis,1,-1,axis,1,-1, +,,,,,,,,1,1,,1,1, +,,,,,,,,0,-1,,0,-1, +,,,,,,,,0,1,,0,1, +,,,,,,1,button,96,,button,96,, +,,,,,,,,97,,,97,, +,,,,,,,,99,,,100,, +,,,,,,,,100,,,99,, +,,,,,,,,108,,,108,, +,,,,,,,,103,,,103,, +,,,,,,,,105,,,105,, +,,,,,,,,107,,,107,, +,,,,,,,,190,,,190,, +,,,,,,,,191,,,191,, +,,,,,,,axis,12,-1,axis,12,-1, +,,,,,,,,12,1,,12,1, +,,,,,,,,13,-1,,13,-1, +,,,,,,,,13,1,,13,1, +,,,,,,,,110,,,110,, +30,,057e,2007,,,,,,,,,,Right Joy-Con (just switching two buttons around for consistency's sake) +,,,,,,,button,96,,button,96,, +,,,,,,,,97,,,97,, +,,,,,,,,99,,,100,, +,,,,,,,,100,,,99,, +,,,,,,,,108,,,108,, +,,,,,,,,103,,,103,, +,,,,,,,,105,,,105,, +,,,,,,,,107,,,107,, +,,,,,,,,190,,,190,, +,,,,,,,,191,,,191,, +,,,,,,,axis,12,-1,axis,12,-1, +,,,,,,,,12,1,,12,1, +,,,,,,,,13,-1,,13,-1, +,,,,,,,,13,1,,13,1, +,,,,,,,,110,,,110,, diff --git a/SonicTimeTwisted.gmx/datafiles/android/gamepad/057e_2006_joy_con__l_.csv b/SonicTimeTwisted.gmx/datafiles/android/gamepad/057e_2006_joy_con__l_.csv deleted file mode 100644 index 25bd73118..000000000 --- a/SonicTimeTwisted.gmx/datafiles/android/gamepad/057e_2006_joy_con__l_.csv +++ /dev/null @@ -1,15 +0,0 @@ -min_api,max_api,vendor,product,other_vendor,other_product,event_device,event_type,event_code,event_value,mapped_type,mapped_code,mapped_value,comment -,,057e,2006,,,0,axis,16,-1,axis,16,-1,"Joy-Con (L), D-Pad UP" -,,,,,,,,16,1,,16,1,D-Pad DOWN -,,,,,,,,15,-1,,15,-1,D-Pad LEFT -,,,,,,,,15,1,,15,1,D-Pad RIGHT -,,,,,,,button,96,,button,96,,Cross/A/Bottom button -,,,,,,,,97,,,97,,Circle/B/Right button -,,,,,,,,98,,,99,,Square/X/Left button -,,,,,,,,99,,,100,,Triangle/Y/Top button -,,,,,,,,104,,,108,,Start button -,,,,,,,,106,,,109,,Select button -,,,,,,,,100,,,102,,L1 button -,,,,,,,,101,,,103,,R1 button -,,,,,,,,107,,,104,,L2 button -,,,,,,,,0,,,105,,R2 button diff --git a/SonicTimeTwisted.gmx/datafiles/android/gamepad/057e_2007_joy_con__r_.csv b/SonicTimeTwisted.gmx/datafiles/android/gamepad/057e_2007_joy_con__r_.csv deleted file mode 100644 index 2921e8b60..000000000 --- a/SonicTimeTwisted.gmx/datafiles/android/gamepad/057e_2007_joy_con__r_.csv +++ /dev/null @@ -1,15 +0,0 @@ -min_api,max_api,vendor,product,other_vendor,other_product,event_device,event_type,event_code,event_value,mapped_type,mapped_code,mapped_value,comment -,,057e,2007,,,0,axis,16,-1,axis,16,-1,"Joy-Con (R), D-Pad UP" -,,,,,,,,16,1,,16,1,D-Pad DOWN -,,,,,,,,15,-1,,15,-1,D-Pad LEFT -,,,,,,,,15,1,,15,1,D-Pad RIGHT -,,,,,,,button,96,,button,96,,Cross/A/Bottom button -,,,,,,,,97,,,97,,Circle/B/Right button -,,,,,,,,98,,,99,,Square/X/Left button -,,,,,,,,99,,,100,,Triangle/Y/Top button -,,,,,,,,105,,,108,,Start button -,,,,,,,,110,,,109,,Select button -,,,,,,,,100,,,102,,L1 button -,,,,,,,,101,,,103,,R1 button -,,,,,,,,107,,,104,,L2 button -,,,,,,,,0,,,105,,R2 button diff --git a/SonicTimeTwisted.gmx/extensions/SttAndroid/AndroidSource/Java/lib/InputDeviceManager.java b/SonicTimeTwisted.gmx/extensions/SttAndroid/AndroidSource/Java/lib/InputDeviceManager.java index 78426d3db..a152a5da1 100644 --- a/SonicTimeTwisted.gmx/extensions/SttAndroid/AndroidSource/Java/lib/InputDeviceManager.java +++ b/SonicTimeTwisted.gmx/extensions/SttAndroid/AndroidSource/Java/lib/InputDeviceManager.java @@ -1271,7 +1271,15 @@ protected boolean processKeyEventAnyKeyOn(KeyEvent event) { ); return true; } else { - return false; + if (!hardwareMappings.containsValue(eventInt)) { + this.setPressState( + eventInt, 0, + event.getAction() == KeyEvent.ACTION_DOWN + ); + return true; + } else { + return false; + } } } @@ -1432,14 +1440,23 @@ public void updateSoftwareMappings( * @param softwareMappings A map of software mapping entries */ protected void updateSoftwareMappingsFromMap(Map softwareMappings) { + boolean hwKeyFound; for (Entry entry : softwareMappings.entrySet()) { int inputCode = entry.getValue(); int keyCode = entry.getKey(); + hwKeyFound = false; for (Entry hwEntry : hardwareMappings.entrySet()) { if (hwEntry.getValue() == inputCode) { directMappings.put(hwEntry.getKey(), keyCode); + hwKeyFound = true; break; } + if (!hwKeyFound) { + hwKeyFound = inputCode == hwEntry.getKey() || inputCode == hwEntry.getValue(); + } + } + if(!hwKeyFound) { + directMappings.put(inputCode, keyCode); } } } diff --git a/SonicTimeTwisted.gmx/scripts/menu_part_android_btusb_device_step.gml b/SonicTimeTwisted.gmx/scripts/menu_part_android_btusb_device_step.gml index fa9f421c7..0ccfcc5b1 100644 --- a/SonicTimeTwisted.gmx/scripts/menu_part_android_btusb_device_step.gml +++ b/SonicTimeTwisted.gmx/scripts/menu_part_android_btusb_device_step.gml @@ -6,7 +6,7 @@ if(objProgram.inputManager.device_label == "") var dd_state = real(android_double_device_detecting_mode_get_state()); if(dd_state == 0) { - var currentDeviceLabel = string(android_get_device_label(0, -1)); + var currentDeviceLabel = string(android_get_device_label(0, 30)); if(currentDeviceLabel != "") { objProgram.inputManager.device_label = currentDeviceLabel; diff --git a/SonicTimeTwisted.gmx/scripts/menu_part_android_btusb_items.gml b/SonicTimeTwisted.gmx/scripts/menu_part_android_btusb_items.gml index f102c124b..e6cf0d674 100644 --- a/SonicTimeTwisted.gmx/scripts/menu_part_android_btusb_items.gml +++ b/SonicTimeTwisted.gmx/scripts/menu_part_android_btusb_items.gml @@ -7,15 +7,18 @@ if(android_get_input_mode()) //menu_fn_add_option(tr("_btusb_joymap_Rumble"), 0, 1, "< " + tr("_Off") + " >"); // codes below 31 are used for mapping menu_fn_add_option(tr("_btusb_joymap_Device"), 31); - menu_fn_add_option(tr("_options_menu_Remap_all"), 1); - menu_fn_add_option(tr("_buttonname_Up"), 2, 1, ""); - menu_fn_add_option(tr("_buttonname_Down"), 3, 1, ""); - menu_fn_add_option(tr("_buttonname_Left"), 4, 1, ""); - menu_fn_add_option(tr("_buttonname_Right"), 5, 1, ""); - menu_fn_add_option(tr("_buttonname_A"), 6, 1, ""); - menu_fn_add_option(tr("_buttonname_B"), 7, 1, ""); - menu_fn_add_option(tr("_buttonname_C"), 8, 1, ""); - menu_fn_add_option(tr("_buttonname_Start"), 9, 1, ""); + if (string_length(objProgram.inputManager.device_label) > 0) + { + menu_fn_add_option(tr("_options_menu_Remap_all"), 1); + menu_fn_add_option(tr("_buttonname_Up"), 2, 1, ""); + menu_fn_add_option(tr("_buttonname_Down"), 3, 1, ""); + menu_fn_add_option(tr("_buttonname_Left"), 4, 1, ""); + menu_fn_add_option(tr("_buttonname_Right"), 5, 1, ""); + menu_fn_add_option(tr("_buttonname_A"), 6, 1, ""); + menu_fn_add_option(tr("_buttonname_B"), 7, 1, ""); + menu_fn_add_option(tr("_buttonname_C"), 8, 1, ""); + menu_fn_add_option(tr("_buttonname_Start"), 9, 1, ""); + } } else { diff --git a/extras/android/android-studio-project/src/app/src/main/assets/mappings/switch.csv b/extras/android/android-studio-project/src/app/src/main/assets/mappings/switch.csv index 179940ee5..93a3799cf 100644 --- a/extras/android/android-studio-project/src/app/src/main/assets/mappings/switch.csv +++ b/extras/android/android-studio-project/src/app/src/main/assets/mappings/switch.csv @@ -27,7 +27,7 @@ min_api,max_api,vendor,product,other_vendor,other_product,event_device,event_typ ,,,,,,,,108,,,110,,Thumbstick press is MODE ,,,,,,,axis,15,,axis,15,,Hat X axis works as intended out-of-the-box ,,,,,,,,16,,,16,,Hat Y axis works as intended out-of-the-box -,29,057e,2006,057e,2007,,,,,,,,Joy-Cons +,29,057e,2006,057e,2007,,,,,,,,Joy-Cons for Android 10- ,,,,,,0,button,98,,axis,16,-1,UP is Hat Y -1 ,,,,,,,,97,,,16,1,DOWN is Hat Y +1 ,,,,,,,,96,,,15,-1,LEFT is Hat X -1 @@ -57,3 +57,45 @@ min_api,max_api,vendor,product,other_vendor,other_product,event_device,event_typ ,,,,,,,,16,1,,11,1, ,,,,,,,,15,1,,14,-1,"Joy-Con's X axis is combined gamepad's RZ axis, inverted" ,,,,,,,,15,-1,,14,1, +30,,057e,2006,057e,2007,,,,,,,,"Joy-Cons for Android 11+ are pre-mapped, but the D-Pad doesn't work" +,,,,,,0,,102,,button,102,, +,,,,,,,,104,,,104,, +,,,,,,,,106,,,106,, +,,,,,,,,109,,,109,, +,,,,,,,,110,,,110,, +,,,,,,,,101,,,101,, +,,,,,,,axis,1,-1,axis,1,-1, +,,,,,,,,1,1,,1,1, +,,,,,,,,0,-1,,0,-1, +,,,,,,,,0,1,,0,1, +,,,,,,1,button,96,,button,96,, +,,,,,,,,97,,,97,, +,,,,,,,,99,,,100,, +,,,,,,,,100,,,99,, +,,,,,,,,108,,,108,, +,,,,,,,,103,,,103,, +,,,,,,,,105,,,105,, +,,,,,,,,107,,,107,, +,,,,,,,,190,,,190,, +,,,,,,,,191,,,191,, +,,,,,,,axis,12,-1,axis,12,-1, +,,,,,,,,12,1,,12,1, +,,,,,,,,13,-1,,13,-1, +,,,,,,,,13,1,,13,1, +,,,,,,,,110,,,110,, +30,,057e,2007,,,,,,,,,,Right Joy-Con (just switching two buttons around for consistency's sake) +,,,,,,,button,96,,button,96,, +,,,,,,,,97,,,97,, +,,,,,,,,99,,,100,, +,,,,,,,,100,,,99,, +,,,,,,,,108,,,108,, +,,,,,,,,103,,,103,, +,,,,,,,,105,,,105,, +,,,,,,,,107,,,107,, +,,,,,,,,190,,,190,, +,,,,,,,,191,,,191,, +,,,,,,,axis,12,-1,axis,12,-1, +,,,,,,,,12,1,,12,1, +,,,,,,,,13,-1,,13,-1, +,,,,,,,,13,1,,13,1, +,,,,,,,,110,,,110,, diff --git a/extras/android/gms1-test-project/JoyInput.gmx/Configs/Default.config.gmx b/extras/android/gms1-test-project/JoyInput.gmx/Configs/Default.config.gmx index b5b93b3b1..4cb7faf07 100644 --- a/extras/android/gms1-test-project/JoyInput.gmx/Configs/Default.config.gmx +++ b/extras/android/gms1-test-project/JoyInput.gmx/Configs/Default.config.gmx @@ -19,7 +19,7 @@ 23.0.1 0 0 - 23 + 27 JoyInput @@ -43,7 +43,7 @@ 0 0 - -1 + 0 1 19 0 @@ -69,7 +69,7 @@ Configs\Default\android\splash.png 0 23.1.1 - 23 + 27 1024 false 0 diff --git a/extras/android/gms1-test-project/JoyInput.gmx/JoyInput.project.gmx b/extras/android/gms1-test-project/JoyInput.gmx/JoyInput.project.gmx index f8be8ba69..3d5a03d17 100644 --- a/extras/android/gms1-test-project/JoyInput.gmx/JoyInput.project.gmx +++ b/extras/android/gms1-test-project/JoyInput.gmx/JoyInput.project.gmx @@ -42,6 +42,7 @@ + objects\objTester diff --git a/extras/android/gms1-test-project/JoyInput.gmx/datafiles/android/gamepad/switch.csv b/extras/android/gms1-test-project/JoyInput.gmx/datafiles/android/gamepad/switch.csv index e0ea089c0..93a3799cf 100644 --- a/extras/android/gms1-test-project/JoyInput.gmx/datafiles/android/gamepad/switch.csv +++ b/extras/android/gms1-test-project/JoyInput.gmx/datafiles/android/gamepad/switch.csv @@ -1,5 +1,5 @@ min_api,max_api,vendor,product,other_vendor,other_product,event_device,event_type,event_code,event_value,mapped_type,mapped_code,mapped_value,comment -,,057e,2006,,,,,,,,,,Left Joy-Con +,29,057e,2006,,,,,,,,,,Left Joy-Con ,,,,,,,button,96,,button,96,,down key is A ,,,,,,,,97,,,97,,right key is B ,,,,,,,,98,,,99,,left key is X @@ -13,7 +13,7 @@ min_api,max_api,vendor,product,other_vendor,other_product,event_device,event_typ ,,,,,,,,109,,,110,,Thumbstick press is MODE ,,,,,,,axis,15,,axis,15,,Hat X axis works as intended out-of-the-box ,,,,,,,,16,,,16,,Hat Y axis works as intended out-of-the-box -,,057e,2007,,,,,,,,,,Right Joy-Con +,29,057e,2007,,,,,,,,,,Right Joy-Con ,,,,,,,button,96,,button,96,,down key is A ,,,,,,,,97,,,97,,right key is B ,,,,,,,,98,,,99,,left key is X @@ -27,27 +27,7 @@ min_api,max_api,vendor,product,other_vendor,other_product,event_device,event_typ ,,,,,,,,108,,,110,,Thumbstick press is MODE ,,,,,,,axis,15,,axis,15,,Hat X axis works as intended out-of-the-box ,,,,,,,,16,,,16,,Hat Y axis works as intended out-of-the-box -,,057e,2009,,,,,,,,,,"Pro Controller - everything is standard, can be used as reference" -,,,,,,,button,96,,button,96,,B is A -,,,,,,,,97,,,97,,A is B -,,,,,,,,99,,,99,,Y is X -,,,,,,,,100,,,100,,X is Y -,,,,,,,,102,,,102,,L1 is L1 -,,,,,,,,103,,,103,,R1 is R1 -,,,,,,,,104,,,104,,L2 is L2 -,,,,,,,,105,,,105,,R2 is R2 -,,,,,,,,108,,,108,,Plus is START -,,,,,,,,109,,,109,,Minus is SELECT -,,,,,,,,106,,,106,,L3 is L3 -,,,,,,,,107,,,107,,R3 is R3 -,,,,,,,,110,,,110,,Screenshot is Mode -,,,,,,,axis,15,,axis,15,,Hat X axis works as intended out-of-the-box -,,,,,,,,16,,,16,,Hat Y axis works as intended out-of-the-box -,,,,,,,,0,,,0,,X axis works as intended out-of-the-box -,,,,,,,,1,,,1,,Y axis works as intended out-of-the-box -,,,,,,,,11,,,11,,Right X is Z -,,,,,,,,14,,,14,,Right Y is RZ -,,057e,2006,057e,2007,,,,,,,,Joy-Cons +,29,057e,2006,057e,2007,,,,,,,,Joy-Cons for Android 10- ,,,,,,0,button,98,,axis,16,-1,UP is Hat Y -1 ,,,,,,,,97,,,16,1,DOWN is Hat Y +1 ,,,,,,,,96,,,15,-1,LEFT is Hat X -1 @@ -77,3 +57,45 @@ min_api,max_api,vendor,product,other_vendor,other_product,event_device,event_typ ,,,,,,,,16,1,,11,1, ,,,,,,,,15,1,,14,-1,"Joy-Con's X axis is combined gamepad's RZ axis, inverted" ,,,,,,,,15,-1,,14,1, +30,,057e,2006,057e,2007,,,,,,,,"Joy-Cons for Android 11+ are pre-mapped, but the D-Pad doesn't work" +,,,,,,0,,102,,button,102,, +,,,,,,,,104,,,104,, +,,,,,,,,106,,,106,, +,,,,,,,,109,,,109,, +,,,,,,,,110,,,110,, +,,,,,,,,101,,,101,, +,,,,,,,axis,1,-1,axis,1,-1, +,,,,,,,,1,1,,1,1, +,,,,,,,,0,-1,,0,-1, +,,,,,,,,0,1,,0,1, +,,,,,,1,button,96,,button,96,, +,,,,,,,,97,,,97,, +,,,,,,,,99,,,100,, +,,,,,,,,100,,,99,, +,,,,,,,,108,,,108,, +,,,,,,,,103,,,103,, +,,,,,,,,105,,,105,, +,,,,,,,,107,,,107,, +,,,,,,,,190,,,190,, +,,,,,,,,191,,,191,, +,,,,,,,axis,12,-1,axis,12,-1, +,,,,,,,,12,1,,12,1, +,,,,,,,,13,-1,,13,-1, +,,,,,,,,13,1,,13,1, +,,,,,,,,110,,,110,, +30,,057e,2007,,,,,,,,,,Right Joy-Con (just switching two buttons around for consistency's sake) +,,,,,,,button,96,,button,96,, +,,,,,,,,97,,,97,, +,,,,,,,,99,,,100,, +,,,,,,,,100,,,99,, +,,,,,,,,108,,,108,, +,,,,,,,,103,,,103,, +,,,,,,,,105,,,105,, +,,,,,,,,107,,,107,, +,,,,,,,,190,,,190,, +,,,,,,,,191,,,191,, +,,,,,,,axis,12,-1,axis,12,-1, +,,,,,,,,12,1,,12,1, +,,,,,,,,13,-1,,13,-1, +,,,,,,,,13,1,,13,1, +,,,,,,,,110,,,110,, diff --git a/extras/android/gms1-test-project/JoyInput.gmx/extensions/SttAndroid/AndroidSource/Java/lib/InputDeviceManager.java b/extras/android/gms1-test-project/JoyInput.gmx/extensions/SttAndroid/AndroidSource/Java/lib/InputDeviceManager.java index 78426d3db..a152a5da1 100644 --- a/extras/android/gms1-test-project/JoyInput.gmx/extensions/SttAndroid/AndroidSource/Java/lib/InputDeviceManager.java +++ b/extras/android/gms1-test-project/JoyInput.gmx/extensions/SttAndroid/AndroidSource/Java/lib/InputDeviceManager.java @@ -1271,7 +1271,15 @@ protected boolean processKeyEventAnyKeyOn(KeyEvent event) { ); return true; } else { - return false; + if (!hardwareMappings.containsValue(eventInt)) { + this.setPressState( + eventInt, 0, + event.getAction() == KeyEvent.ACTION_DOWN + ); + return true; + } else { + return false; + } } } @@ -1432,14 +1440,23 @@ public void updateSoftwareMappings( * @param softwareMappings A map of software mapping entries */ protected void updateSoftwareMappingsFromMap(Map softwareMappings) { + boolean hwKeyFound; for (Entry entry : softwareMappings.entrySet()) { int inputCode = entry.getValue(); int keyCode = entry.getKey(); + hwKeyFound = false; for (Entry hwEntry : hardwareMappings.entrySet()) { if (hwEntry.getValue() == inputCode) { directMappings.put(hwEntry.getKey(), keyCode); + hwKeyFound = true; break; } + if (!hwKeyFound) { + hwKeyFound = inputCode == hwEntry.getKey() || inputCode == hwEntry.getValue(); + } + } + if(!hwKeyFound) { + directMappings.put(inputCode, keyCode); } } } diff --git a/extras/android/gms1-test-project/JoyInput.gmx/objects/objTester.object.gmx b/extras/android/gms1-test-project/JoyInput.gmx/objects/objTester.object.gmx index 1f1fa050c..344a97fc5 100644 --- a/extras/android/gms1-test-project/JoyInput.gmx/objects/objTester.object.gmx +++ b/extras/android/gms1-test-project/JoyInput.gmx/objects/objTester.object.gmx @@ -160,7 +160,7 @@ if(inputState != prevInputState) if(readState >= 0) { - if(android_map_input(0, readState, mappedKey)) + if(android_map_input(0, mappedKey, readState)) { add_console_output(android_get_formatted_mapped_descriptor(0, mappedKey)); switch(mappedKey) @@ -196,6 +196,8 @@ if(inputState != prevInputState) case 128: add_console_output("Done"); android_set_any_key_mode(0, false); + mappedKey = 0; + state = 0; break; } } @@ -204,7 +206,7 @@ if(inputState != prevInputState) add_console_output("Can't map this"); } } - prevReadState = readState;; + prevReadState = readState; } } else