From 648b3070e07612d0cbf88ffbcbb220b4f03de5cf Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 11 Jun 2014 21:44:44 +0200 Subject: [PATCH] (Android) Add Sidewinder, PS2 WiseGroup, SideWinder Dual Strike binds --- input/android_input.c | 9 ++++ input/android_input.c.rem | 56 ----------------------- input/autoconf/builtin_android.c | 77 +++++++++++++++++++++++++++++++- 3 files changed, 84 insertions(+), 58 deletions(-) diff --git a/input/android_input.c b/input/android_input.c index 6344286799..901153dafc 100644 --- a/input/android_input.c +++ b/input/android_input.c @@ -506,9 +506,15 @@ static void handle_hotplug(void *data, unsigned *port, unsigned id, else if (strstr(name_buf, "Microsoft")) { if (strstr(name_buf, "Dual Strike")) + { device = DEVICE_MS_SIDEWINDER_DUAL_STRIKE; + strlcpy(name_buf, "SideWinder Dual Strike", sizeof(name_buf)); + } else if (strstr(name_buf, "SideWinder")) + { device = DEVICE_MS_SIDEWINDER; + strlcpy(name_buf, "SideWinder Classic", sizeof(name_buf)); + } else if (strstr(name_buf, "X-Box 360") || strstr(name_buf, "Xbox 360 Wireless Receiver")) { @@ -524,7 +530,10 @@ static void handle_hotplug(void *data, unsigned *port, unsigned id, || strstr(name_buf, "JC-PS102U") || strstr(name_buf, "Dual USB Joypad")) { if (strstr(name_buf, "WiseGroup")) + { device = DEVICE_WISEGROUP_PLAYSTATION2; + strlcpy(name_buf, "PlayStation2 WiseGroup", sizeof(name_buf)); + } else if (strstr(name_buf, "JC-PS102U")) device = DEVICE_JCPS102_PLAYSTATION2; else diff --git a/input/android_input.c.rem b/input/android_input.c.rem index 2ae15f727b..e2eb7b828c 100644 --- a/input/android_input.c.rem +++ b/input/android_input.c.rem @@ -297,62 +297,6 @@ static void android_input_set_keybinds(void *data, unsigned device, android->keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); android->keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); break; - case DEVICE_MS_SIDEWINDER_DUAL_STRIKE: - /* TODO - unfinished */ - g_settings.input.device[port] = device; - strlcpy(g_settings.input.device_names[port], "MS Sidewinder Dual Strike", - sizeof(g_settings.input.device_names[port])); - - android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X) << shift); - android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L) << shift); - android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R) << shift); - android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_L2) << shift); - break; - case DEVICE_MS_SIDEWINDER: - g_settings.input.device[port] = device; - strlcpy(g_settings.input.device_names[port], "MS Sidewinder", - sizeof(g_settings.input.device_names[port])); - - android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - break; - case DEVICE_WISEGROUP_PLAYSTATION2: - g_settings.input.device[port] = device; - strlcpy(g_settings.input.device_names[port], "WiseGroup PlayStation2", - sizeof(g_settings.input.device_names[port])); - - android->keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_16] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); - break; case DEVICE_JCPS102_PLAYSTATION2: g_settings.input.device[port] = device; strlcpy(g_settings.input.device_names[port], "JCPS102 PlayStation2", diff --git a/input/autoconf/builtin_android.c b/input/autoconf/builtin_android.c index 563a5daf63..815b21c2e2 100644 --- a/input/autoconf/builtin_android.c +++ b/input/autoconf/builtin_android.c @@ -95,7 +95,68 @@ DECL_AXIS(r_y_plus, +3) \ DECL_AXIS(r_y_minus, -3) \ "input_menu_toggle_btn = 82\n" -#define SIXAXIS_DEFAULT_BINDS \ +#define SIDEWINDER_DUAL_STRIKE_DEFAULT_BINDS \ +DECL_BTN(a, 190) \ +DECL_BTN(b, 191) \ +DECL_BTN(x, 188) \ +DECL_BTN(y, 189) \ +DECL_BTN(start, 192) \ +DECL_BTN(select, 193) \ +DECL_BTN(up, h0up) \ +DECL_BTN(down, h0down) \ +DECL_BTN(left, h0left) \ +DECL_BTN(right, h0right) \ +DECL_BTN(l, 194) \ +DECL_BTN(r, 195) \ +DECL_AXIS(r_x_plus, +0) \ +DECL_AXIS(r_x_minus, -0) \ +DECL_AXIS(r_y_plus, -1) \ +DECL_AXIS(r_y_minus, +1) \ +"input_menu_toggle_btn = 196\n" + +#define SIDEWINDER_CLASSIC_DEFAULT_BINDS \ +DECL_BTN(a, 97) \ +DECL_BTN(b, 96) \ +DECL_BTN(x, 99) \ +DECL_BTN(y, 100) \ +DECL_BTN(start, 104) \ +DECL_BTN(select, 105) \ +DECL_AXIS(up, -1) \ +DECL_AXIS(down, +1) \ +DECL_AXIS(left, -0) \ +DECL_AXIS(right, +0) \ +DECL_BTN(l, 102) \ +DECL_BTN(r, 103) \ +DECL_BTN(l2, 101) \ +DECL_BTN(r2, 98) + +#define PS2_WISEGROUP_DEFAULT_BINDS \ +DECL_BTN(a, 189) \ +DECL_BTN(b, 190) \ +DECL_BTN(x, 188) \ +DECL_BTN(y, 191) \ +DECL_BTN(start, 196) \ +DECL_BTN(select, 197) \ +DECL_BTN(up, h0up) \ +DECL_BTN(down, h0down) \ +DECL_BTN(left, h0left) \ +DECL_BTN(right, h0right) \ +DECL_BTN(l, 194) \ +DECL_BTN(r, 195) \ +DECL_BTN(l2, 192) \ +DECL_BTN(r2, 193) \ +DECL_BTN(l3, 198) \ +DECL_BTN(r3, 199) \ +DECL_AXIS(l_x_plus, +0) \ +DECL_AXIS(l_x_minus, -0) \ +DECL_AXIS(l_y_plus, +1) \ +DECL_AXIS(l_y_minus, -1) \ +DECL_AXIS(r_x_plus, +2) \ +DECL_AXIS(r_x_minus, -2) \ +DECL_AXIS(r_y_plus, +3) \ +DECL_AXIS(r_y_minus, -3) + +#define PS3_DEFAULT_BINDS \ DECL_BTN(a, 97) \ DECL_BTN(b, 96) \ DECL_BTN(x, 100) \ @@ -211,13 +272,25 @@ const char* const input_builtin_autoconfs[] = "input_driver = \"android\" \n" RUMBLEPAD2_DEFAULT_BINDS, + "input_device = \"SideWinder Dual Strike\" \n" + "input_driver = \"android\" \n" + SIDEWINDER_DUAL_STRIKE_DEFAULT_BINDS, + + "input_device = \"SideWinder Classic\" \n" + "input_driver = \"android\" \n" + SIDEWINDER_CLASSIC_DEFAULT_BINDS, + "input_device = \"XBox 360\" \n" "input_driver = \"android\" \n" XBOX360_DEFAULT_BINDS, + "input_device = \"PlayStation2 WiseGroup\" \n" + "input_driver = \"android\" \n" + PS2_WISEGROUP_DEFAULT_BINDS, + "input_device = \"PlayStation3\" \n" "input_driver = \"android\" \n" - SIXAXIS_DEFAULT_BINDS, + PS3_DEFAULT_BINDS, "input_device = \"HuiJia\" \n" "input_driver = \"android\" \n"