diff --git a/input/android_input.c b/input/android_input.c index 0dd82172fb..15a446441e 100644 --- a/input/android_input.c +++ b/input/android_input.c @@ -399,9 +399,9 @@ static void handle_hotplug(void *data, unsigned *port, unsigned id, if (strstr(device_name,"Logitech") && strstr(device_name, "RumblePad 2")) strlcpy(name_buf, "RumblePad 2", sizeof(name_buf)); else if (strstr(device_name, "Logitech") && strstr(device_name, "Dual Action")) - device = DEVICE_LOGITECH_DUAL_ACTION; + strlcpy(name_buf, "Logitech Dual Action", sizeof(name_buf)); else if (strstr(device_name, "Logitech") && strstr(device_name, "Precision")) - device = DEVICE_LOGITECH_PRECISION_GAMEPAD; + strlcpy(name_buf, "Logitech Precision", sizeof(name_buf)); else if (strstr(device_name, "iControlPad-")) // followed by a 4 (hex) char HW id device = DEVICE_ICONTROLPAD_HID_JOYSTICK; else if (strstr(device_name, "SEGA VIRTUA STICK High Grade")) @@ -415,9 +415,9 @@ static void handle_hotplug(void *data, unsigned *port, unsigned id, else if (strstr(device_name, "MadCatz") && strstr(device_name, "PC USB Wired Stick")) device = DEVICE_MADCATZ_PC_USB_STICK; else if (strstr(device_name, "Logicool") && strstr(device_name, "RumblePad 2")) - device = DEVICE_LOGICOOL_RUMBLEPAD2; + strlcpy(name_buf, "Logicool RumblePad 2", sizeof(name_buf)); else if (strstr(device_name, "Sun4i-keypad")) - device = DEVICE_IDROID_X360; + strlcpy(name_buf, "iDroid x360", sizeof(name_buf)); else if (strstr(device_name, "Zeemote") && strstr(device_name, "Steelseries free")) device = DEVICE_ZEEMOTE_STEELSERIES; else if (strstr(device_name, "HuiJia USB GamePad")) @@ -449,9 +449,9 @@ static void handle_hotplug(void *data, unsigned *port, unsigned id, if (strstr(device_name, "WiseGroup")) strlcpy(name_buf, "PlayStation2 WiseGroup", sizeof(name_buf)); else if (strstr(device_name, "JC-PS102U")) - device = DEVICE_JCPS102_PLAYSTATION2; + strlcpy(name_buf, "PlayStation2 JCPS102", sizeof(name_buf)); else - device = DEVICE_GENERIC_PLAYSTATION2_CONVERTER; + strlcpy(name_buf, "PlayStation2 Generic", sizeof(name_buf)); } } else if (strstr(device_name, "PLAYSTATION(R)3") || strstr(device_name, "Dualshock3") diff --git a/input/android_input.c.rem b/input/android_input.c.rem index efa415160f..5d663bb1fe 100644 --- a/input/android_input.c.rem +++ b/input/android_input.c.rem @@ -18,43 +18,6 @@ static void android_input_set_keybinds(void *data, unsigned device, switch (device) { - case DEVICE_LOGITECH_DUAL_ACTION: - g_settings.input.device[port] = device; - strlcpy(g_settings.input.device_names[port], "Logitech Dual Action", - sizeof(g_settings.input.device_names[port])); - - android->keycode_lut[96] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - android->keycode_lut[99] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - android->keycode_lut[100] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - android->keycode_lut[97] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - android->keycode_lut[102] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - android->keycode_lut[103] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - android->keycode_lut[104] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - android->keycode_lut[105] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - android->keycode_lut[106] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); - android->keycode_lut[107] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); - android->keycode_lut[109] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - android->keycode_lut[4] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - android->keycode_lut[108] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - break; - case DEVICE_LOGITECH_PRECISION_GAMEPAD: - g_settings.input.device[port] = device; - strlcpy(g_settings.input.device_names[port], "Logitech Precision", - sizeof(g_settings.input.device_names[port])); - - android->keycode_lut[188] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - android->keycode_lut[190] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - android->keycode_lut[189] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - android->keycode_lut[191] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - - android->keycode_lut[192] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - android->keycode_lut[193] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - android->keycode_lut[194] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - android->keycode_lut[195] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - - android->keycode_lut[196] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - android->keycode_lut[197] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - break; case DEVICE_ICONTROLPAD_HID_JOYSTICK: g_settings.input.device[port] = device; strlcpy(g_settings.input.device_names[port], "iControlPad HID Joystick profile", @@ -157,58 +120,6 @@ static void android_input_set_keybinds(void *data, unsigned device, android->keycode_lut[105] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); android->keycode_lut[110] |= ((RARCH_QUIT_KEY+1) << shift); break; - case DEVICE_LOGICOOL_RUMBLEPAD2: - g_settings.input.device[port] = device; - strlcpy(g_settings.input.device_names[port], "Logicool Rumblepad 2", - sizeof(g_settings.input.device_names[port])); - - // Rumblepad 2 DInput */ - /* TODO: Add L3/R3 */ - android->keycode_lut[97] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - android->keycode_lut[98] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - - android->keycode_lut[99] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - android->keycode_lut[96] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - - android->keycode_lut[104] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - android->keycode_lut[105] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - - android->keycode_lut[100] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - android->keycode_lut[101] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - android->keycode_lut[102] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - android->keycode_lut[103] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - break; - case DEVICE_IDROID_X360: - g_settings.input.device[port] = device; - strlcpy(g_settings.input.device_names[port], "iDroid x360", - sizeof(g_settings.input.device_names[port])); - - android->keycode_lut[19] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - android->keycode_lut[20] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - android->keycode_lut[21] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - android->keycode_lut[22] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - android->keycode_lut[124] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - android->keycode_lut[69] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - android->keycode_lut[76] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - android->keycode_lut[123] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - android->keycode_lut[71] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - android->keycode_lut[112] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - android->keycode_lut[126] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - android->keycode_lut[70] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - android->keycode_lut[82] |= ((RARCH_MENU_TOGGLE+1) << shift); - // Left Analog Up: 152 - // Left Analog Down: 146 - // Left Analog Right: 150 - // Left Analog Left: 148 - // Right Analog Up: 92 (92) - // Right Analog Down: 93 (93) - // Right Analog Right: 113 (113) - // Right Analog Left: 72 (72) - android->keycode_lut[152] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - android->keycode_lut[146] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - android->keycode_lut[150] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - android->keycode_lut[148] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - break; case DEVICE_ZEEMOTE_STEELSERIES: g_settings.input.device[port] = device; strlcpy(g_settings.input.device_names[port], "Zeemote Steelseries", @@ -241,50 +152,6 @@ static void android_input_set_keybinds(void *data, unsigned device, android->keycode_lut[198] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); android->keycode_lut[199] |= ((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", - sizeof(g_settings.input.device_names[port])); - - android->keycode_lut[200] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - android->keycode_lut[202] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - android->keycode_lut[203] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - android->keycode_lut[201] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - android->keycode_lut[191] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - android->keycode_lut[188] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - android->keycode_lut[192] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - android->keycode_lut[194] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - android->keycode_lut[190] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - android->keycode_lut[189] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - android->keycode_lut[193] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - android->keycode_lut[195] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - android->keycode_lut[197] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - android->keycode_lut[196] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - android->keycode_lut[198] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); - android->keycode_lut[199] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); - break; - case DEVICE_GENERIC_PLAYSTATION2_CONVERTER: - g_settings.input.device[port] = device; - strlcpy(g_settings.input.device_names[port], "Generic PlayStation2", - sizeof(g_settings.input.device_names[port])); - - android->keycode_lut[200] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - android->keycode_lut[202] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - android->keycode_lut[203] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - android->keycode_lut[201] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - android->keycode_lut[191] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - android->keycode_lut[188] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - android->keycode_lut[192] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - android->keycode_lut[194] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - android->keycode_lut[190] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - android->keycode_lut[189] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - android->keycode_lut[193] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - android->keycode_lut[195] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - android->keycode_lut[197] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - android->keycode_lut[196] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - android->keycode_lut[198] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); - android->keycode_lut[199] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); - break; case DEVICE_KEYBOARD_RETROPAD: g_settings.input.device[port] = device; strlcpy(g_settings.input.device_names[port], "Generic Keyboard", diff --git a/input/autoconf/builtin_android.c b/input/autoconf/builtin_android.c index 28b5cf333f..80e89b2b59 100644 --- a/input/autoconf/builtin_android.c +++ b/input/autoconf/builtin_android.c @@ -41,6 +41,49 @@ DECL_AXIS(r_y_plus, -3) \ DECL_AXIS(r_y_minus, +3) \ "input_menu_toggle_btn = 108\n" +// TODO +// Verify buttons +#define IDROID_X360_DEFAULT_BINDS \ +DECL_BTN(a, 69) \ +DECL_BTN(b, 124) \ +DECL_BTN(x, 76) \ +DECL_BTN(y, 123) \ +DECL_BTN(start, 126) \ +DECL_BTN(select, 70) \ +DECL_BTN(up, 19) \ +DECL_BTN(down, 20) \ +DECL_BTN(left, 21) \ +DECL_BTN(right, 22) \ +DECL_BTN(l, 71) \ +DECL_BTN(r, 112) \ +DECL_AXIS(l2, +6) \ +DECL_AXIS(r2, +7) \ +DECL_BTN(l_x_plus, 150) \ +DECL_BTN(l_x_minus, 148) \ +DECL_BTN(l_y_plus, 152) \ +DECL_BTN(l_y_minus, 146) \ +DECL_BTN(r_x_plus, 113) \ +DECL_BTN(r_x_minus, 72) \ +DECL_BTN(r_y_plus, 92) \ +DECL_BTN(r_y_minus, 93) \ +"input_menu_toggle_btn = 82\n" + +#define LOGITECH_PRECISION_DEFAULT_BINDS \ +DECL_BTN(a, 190) \ +DECL_BTN(b, 189) \ +DECL_BTN(x, 191) \ +DECL_BTN(y, 188) \ +DECL_BTN(start, 197) \ +DECL_BTN(select, 196) \ +DECL_BTN(up, h0up) \ +DECL_BTN(down, h0down) \ +DECL_BTN(left, h0left) \ +DECL_BTN(right, h0right) \ +DECL_BTN(l, 192) \ +DECL_BTN(r, 193) \ +DECL_BTN(l2, 194) \ +DECL_BTN(r2, 195) + // TODO // Verify if stick works #define SEGA_VIRTUA_STICK_DEFAULT_BINDS \ @@ -264,6 +307,58 @@ DECL_BTN(r, 103) \ DECL_BTN(l2, 101) \ DECL_BTN(r2, 98) +#define PS2_JCPS102_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, 200) \ +DECL_BTN(down, 202) \ +DECL_BTN(left, 203) \ +DECL_BTN(right, 201) \ +DECL_BTN(l, 194) \ +DECL_BTN(r, 195) \ +DECL_BTN(l2, 195) \ +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 PS2_GENERIC_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, 200) \ +DECL_BTN(down, 202) \ +DECL_BTN(left, 203) \ +DECL_BTN(right, 201) \ +DECL_BTN(l, 194) \ +DECL_BTN(r, 192) \ +DECL_BTN(l2, 195) \ +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 PS2_WISEGROUP_DEFAULT_BINDS \ DECL_BTN(a, 189) \ DECL_BTN(b, 190) \ @@ -477,6 +572,36 @@ DECL_AXIS(r_x_minus, -2) \ DECL_AXIS(r_y_plus, +3) \ DECL_AXIS(r_y_minus, -3) +// TODO +// Verify if Dpad works +// Verify if sticks work +#define LOGICOOL_RUMBLEPAD2_DEFAULT_BINDS \ +DECL_BTN(a, 98) \ +DECL_BTN(b, 97) \ +DECL_BTN(x, 99) \ +DECL_BTN(y, 96) \ +DECL_BTN(start, 105) \ +DECL_BTN(select, 104) \ +DECL_BTN(up, h0up) \ +DECL_BTN(down, h0down) \ +DECL_BTN(left, h0left) \ +DECL_BTN(right, h0right) \ +DECL_BTN(l, 100) \ +DECL_BTN(r, 101) \ +DECL_BTN(l2, 102) \ +DECL_BTN(r2, 103) \ +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) + +// TODO +// Verify if Dpad works +// Verify if sticks work #define RUMBLEPAD2_DEFAULT_BINDS \ DECL_BTN(a, 190) \ DECL_BTN(b, 189) \ @@ -503,6 +628,35 @@ DECL_AXIS(r_x_minus, -2) \ DECL_AXIS(r_y_plus, -3) \ DECL_AXIS(r_y_minus, +3) +// TODO +// Verify if Dpad works +// Verify if sticks work +#define LOGITECH_DUAL_ACTION_DEFAULT_BINDS \ +DECL_BTN(a, 100) \ +DECL_BTN(b, 99) \ +DECL_BTN(x, 97) \ +DECL_BTN(y, 96) \ +DECL_BTN(start, 108) \ +DECL_BTN(select, 109) \ +DECL_BTN(up, h0up) \ +DECL_BTN(down, h0down) \ +DECL_BTN(left, h0left) \ +DECL_BTN(right, h0right) \ +DECL_BTN(l, 102) \ +DECL_BTN(r, 103) \ +DECL_BTN(l2, 104) \ +DECL_BTN(r2, 105) \ +DECL_BTN(l3, 106) \ +DECL_BTN(r3, 107) \ +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) + // Some hardcoded autoconfig information. Will be used for pads with no autoconfig cfg files. const char* const input_builtin_autoconfs[] = { @@ -542,6 +696,18 @@ const char* const input_builtin_autoconfs[] = "input_driver = \"android\" \n" TOMMO_NEOGEOX_DEFAULT_BINDS, + "input_device = \"Logitech Precision\" \n" + "input_driver = \"android\" \n" + LOGITECH_PRECISION_DEFAULT_BINDS, + + "input_device = \"Logitech Dual Action\" \n" + "input_driver = \"android\" \n" + LOGITECH_DUAL_ACTION_DEFAULT_BINDS, + + "input_device = \"iDroid x360\" \n" + "input_driver = \"android\" \n" + IDROID_X360_DEFAULT_BINDS, + "input_device = \"Samsung Gamepad EI-GP20\" \n" "input_driver = \"android\" \n" SAMSUNG_EIGP20_DEFAULT_BINDS, @@ -554,6 +720,10 @@ const char* const input_builtin_autoconfs[] = "input_driver = \"android\" \n" OUYA_DEFAULT_BINDS, + "input_device = \"Logicool RumblePad 2\" \n" + "input_driver = \"android\" \n" + LOGICOOL_RUMBLEPAD2_DEFAULT_BINDS, + "input_device = \"RumblePad 2\" \n" "input_driver = \"android\" \n" RUMBLEPAD2_DEFAULT_BINDS, @@ -578,6 +748,14 @@ const char* const input_builtin_autoconfs[] = "input_driver = \"android\" \n" SEGA_VIRTUA_STICK_DEFAULT_BINDS, + "input_device = \"PlayStation2 JCPS102\" \n" + "input_driver = \"android\" \n" + PS2_JCPS102_DEFAULT_BINDS, + + "input_device = \"PlayStation2 Generic\" \n" + "input_driver = \"android\" \n" + PS2_GENERIC_DEFAULT_BINDS, + "input_device = \"PlayStation2 WiseGroup\" \n" "input_driver = \"android\" \n" PS2_WISEGROUP_DEFAULT_BINDS,