From 84fd55302564dd929e884116524dbd19815c7781 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 12 Jun 2014 04:23:32 +0200 Subject: [PATCH] (Android) Add JXD devices to autonconf --- input/android_input.c | 8 ++-- input/android_input.c.rem | 62 ------------------------ input/autoconf/builtin_android.c | 82 ++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 66 deletions(-) diff --git a/input/android_input.c b/input/android_input.c index bf75f97ac1..d6f401a4d3 100644 --- a/input/android_input.c +++ b/input/android_input.c @@ -466,7 +466,7 @@ static void handle_hotplug(void *data, unsigned *port, unsigned id, else if (strstr(device_name, "OUYA Game Controller")) strlcpy(name_buf, "OUYA", sizeof(name_buf)); else if (strstr(device_name, "adc joystick")) - device = DEVICE_JXD_S7300B; + strlcpy(name_buf, "JXD S7300B", sizeof(name_buf)); else if (strstr(device_name, "idroid:con")) device = DEVICE_IDROID_CON; else if (strstr(device_name, "NYKO PLAYPAD PRO")) @@ -494,9 +494,9 @@ static void handle_hotplug(void *data, unsigned *port, unsigned id, else if (strstr(device_name, "joy_key")) strlcpy(name_buf, "Archos Gamepad", sizeof(name_buf)); else if (strstr(device_name, "matrix_keyboard")) - device = DEVICE_JXD_S5110; + strlcpy(name_buf, "JXD S5110B", sizeof(name_buf)); else if (strstr(device_name, "tincore_adc_joystick")) - device = DEVICE_JXD_S5110_SKELROM; + strlcpy(name_buf, "JXD S5110B (Skelrom)", sizeof(name_buf)); else if (strstr(device_name, "keypad-zeus") || (strstr(device_name, "keypad-game-zeus"))) strlcpy(name_buf, "Xperia Play", sizeof(name_buf)); else if (strstr(device_name, "Broadcom Bluetooth HID")) @@ -504,7 +504,7 @@ static void handle_hotplug(void *data, unsigned *port, unsigned id, else if (strstr(device_name, "USB Gamepad")) device = DEVICE_THRUST_PREDATOR; else if (strstr(device_name, "ADC joystick")) - device = DEVICE_JXD_S7800B; + strlcpy(name_buf, "JXD S7800B", sizeof(name_buf)); else if (strstr(device_name, "DragonRise")) device = DEVICE_DRAGONRISE; else if (strstr(device_name, "Thrustmaster T Mini")) diff --git a/input/android_input.c.rem b/input/android_input.c.rem index b53a866711..d3f15813af 100644 --- a/input/android_input.c.rem +++ b/input/android_input.c.rem @@ -392,32 +392,6 @@ static void android_input_set_keybinds(void *data, unsigned device, android->keycode_lut[AKEYCODE_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); android->keycode_lut[AKEYCODE_SPACE] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - - //android->keycode_lut[AKEYCODE_VOLUME_UP] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - //android->keycode_lut[AKEYCODE_VOLUME_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - break; - case DEVICE_JXD_S7800B: - g_settings.input.device[port] = device; - strlcpy(g_settings.input.device_names[port], "JXD S7800B", - sizeof(g_settings.input.device_names[port])); - - android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - - android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_X] |= ((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); - android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - - android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); break; case DEVICE_IDROID_CON: g_settings.input.device[port] = device; @@ -618,42 +592,6 @@ static void android_input_set_keybinds(void *data, unsigned device, android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); break; - case DEVICE_JXD_S5110: - g_settings.input.device[port] = device; - strlcpy(g_settings.input.device_names[port], "JXD S5110", - sizeof(g_settings.input.device_names[port])); - - android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - android->keycode_lut[AKEYCODE_SPACE] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - android->keycode_lut[AKEYCODE_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_Y+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_JXD_S5110_SKELROM: - g_settings.input.device[port] = device; - strlcpy(g_settings.input.device_names[port], "JXD S5110 Skelrom", - sizeof(g_settings.input.device_names[port])); - - android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_Y+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_HOLTEK_JC_U912F: g_settings.input.device[port] = device; strlcpy(g_settings.input.device_names[port], "Elecom JC-U912F", diff --git a/input/autoconf/builtin_android.c b/input/autoconf/builtin_android.c index 174f51f843..eae4f75674 100644 --- a/input/autoconf/builtin_android.c +++ b/input/autoconf/builtin_android.c @@ -295,6 +295,72 @@ DECL_BTN(down, 20) \ DECL_BTN(left, 21) \ DECL_BTN(right, 22) +//TODO +// - Analog sticks (?) +#define JXD_S5110B_DEFAULT_BINDS \ +DECL_BTN(a, 96) \ +DECL_BTN(b, 97) \ +DECL_BTN(x, 99) \ +DECL_BTN(y, 100) \ +DECL_BTN(start, 62) \ +DECL_BTN(select, 66) \ +DECL_BTN(up, 19) \ +DECL_BTN(down, 20) \ +DECL_BTN(left, 21) \ +DECL_BTN(right, 22) \ +DECL_BTN(l, 102) \ +DECL_BTN(r, 103) + +//TODO +// - Analog sticks (?) +#define JXD_S5110B_SKELROM_DEFAULT_BINDS \ +DECL_BTN(a, 96) \ +DECL_BTN(b, 97) \ +DECL_BTN(x, 99) \ +DECL_BTN(y, 100) \ +DECL_BTN(start, 108) \ +DECL_BTN(select, 109) \ +DECL_BTN(up, 19) \ +DECL_BTN(down, 20) \ +DECL_BTN(left, 21) \ +DECL_BTN(right, 22) \ +DECL_BTN(l, 102) \ +DECL_BTN(r, 103) + +//TODO +// - Analog sticks (?) +#define JXD_S7300B_DEFAULT_BINDS \ +DECL_BTN(a, 96) \ +DECL_BTN(b, 97) \ +DECL_BTN(x, 99) \ +DECL_BTN(y, 100) \ +DECL_BTN(start, 66) \ +DECL_BTN(select, 62) \ +DECL_BTN(up, 19) \ +DECL_BTN(down, 20) \ +DECL_BTN(left, 21) \ +DECL_BTN(right, 22) \ +DECL_BTN(l, 102) \ +DECL_BTN(r, 103) + +//TODO +// - Analog sticks +#define JXD_S7800B_DEFAULT_BINDS \ +DECL_BTN(a, 96) \ +DECL_BTN(b, 97) \ +DECL_BTN(x, 99) \ +DECL_BTN(y, 100) \ +DECL_BTN(start, 108) \ +DECL_BTN(select, 109) \ +DECL_BTN(up, 19) \ +DECL_BTN(down, 20) \ +DECL_BTN(left, 21) \ +DECL_BTN(right, 22) \ +DECL_BTN(l, 102) \ +DECL_BTN(r, 103) \ +DECL_BTN(l2, 104) \ +DECL_BTN(r2, 105) + #define RUMBLEPAD2_DEFAULT_BINDS \ DECL_BTN(a, 190) \ DECL_BTN(b, 189) \ @@ -332,6 +398,22 @@ const char* const input_builtin_autoconfs[] = "input_driver = \"android\" \n" ZEUS_DEFAULT_BINDS, + "input_device = \"JXD S5110B\" \n" + "input_driver = \"android\" \n" + JXD_S5110B_DEFAULT_BINDS, + + "input_device = \"JXD S7300B\" \n" + "input_driver = \"android\" \n" + JXD_S7300B_DEFAULT_BINDS, + + "input_device = \"JXD S5110B (Skelrom)\" \n" + "input_driver = \"android\" \n" + JXD_S5110B_SKELROM_DEFAULT_BINDS, + + "input_device = \"JXD S7800B\" \n" + "input_driver = \"android\" \n" + JXD_S7800B_DEFAULT_BINDS, + "input_device = \"Archos Gamepad\" \n" "input_driver = \"android\" \n" ARCHOS_GAMEPAD_DEFAULT_BINDS,