From a639d85affa13f3bfcc222a334e7ffa87e3e10fc Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 13 Jun 2014 07:36:45 +0200 Subject: [PATCH] (Android) Add Supersmart joy 2 default binds --- input/android_input.c | 2 +- input/android_input.c.rem | 37 -------------------------------- input/autoconf/builtin_android.c | 20 +++++++++++++++++ 3 files changed, 21 insertions(+), 38 deletions(-) diff --git a/input/android_input.c b/input/android_input.c index d6f401a4d3..fc1e5f2ad3 100644 --- a/input/android_input.c +++ b/input/android_input.c @@ -423,7 +423,7 @@ static void handle_hotplug(void *data, unsigned *port, unsigned id, else if (strstr(device_name, "HuiJia USB GamePad")) strlcpy(name_buf, "HuiJia", sizeof(name_buf)); else if (strstr(device_name, "Smartjoy Family Super Smartjoy 2")) - device = DEVICE_SUPER_SMARTJOY; + strlcpy(name_buf, "Super Smartjoy 2", sizeof(name_buf)); else if (strstr(device_name, "Jess Tech Dual Analog Rumble Pad")) device = DEVICE_SAITEK_RUMBLE_P480; else if (strstr(device_name, "mtk-kpd")) diff --git a/input/android_input.c.rem b/input/android_input.c.rem index d3f15813af..d5ad9efe7e 100644 --- a/input/android_input.c.rem +++ b/input/android_input.c.rem @@ -223,20 +223,6 @@ static void android_input_set_keybinds(void *data, unsigned device, 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_SUPER_SMARTJOY: - g_settings.input.device[port] = device; - strlcpy(g_settings.input.device_names[port], "Super Smartjoy", - sizeof(g_settings.input.device_names[port])); - - android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - break; case DEVICE_SAITEK_RUMBLE_P480: g_settings.input.device[port] = device; strlcpy(g_settings.input.device_names[port], "Saitek Rumble P480", @@ -370,29 +356,6 @@ static void android_input_set_keybinds(void *data, unsigned device, android->keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); android->keycode_lut[AKEYCODE_UNKNOWN] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); break; - case DEVICE_JXD_S7300B: - g_settings.input.device[port] = device; - strlcpy(g_settings.input.device_names[port], "JXD S7300B", - 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_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - android->keycode_lut[AKEYCODE_SPACE] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - break; case DEVICE_IDROID_CON: g_settings.input.device[port] = device; strlcpy(g_settings.input.device_names[port], "i.droid", diff --git a/input/autoconf/builtin_android.c b/input/autoconf/builtin_android.c index ff89952971..6eac0609d8 100644 --- a/input/autoconf/builtin_android.c +++ b/input/autoconf/builtin_android.c @@ -41,6 +41,22 @@ DECL_AXIS(r_y_plus, -3) \ DECL_AXIS(r_y_minus, +3) \ "input_menu_toggle_btn = 108\n" +// TODO +// - D-pad - verify if it works +#define SUPER_SMARTJOY2_DEFAULT_BINDS \ +DECL_BTN(a, 189) \ +DECL_BTN(b, 190) \ +DECL_BTN(x, 188) \ +DECL_BTN(y, 191) \ +DECL_BTN(select, 192) \ +DECL_BTN(start, 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) + #define ZEUS_DEFAULT_BINDS \ DECL_BTN(a, 4) \ DECL_BTN(b, 23) \ @@ -510,5 +526,9 @@ const char* const input_builtin_autoconfs[] = "input_driver = \"android\" \n" HUIJIA_DEFAULT_BINDS, + "input_device = \"Super Smartjoy 2\" \n" + "input_driver = \"android\" \n" + SUPER_SMARTJOY2_DEFAULT_BINDS, + NULL };