diff --git a/input/android_input.c b/input/android_input.c index 8975d4567b..6344286799 100644 --- a/input/android_input.c +++ b/input/android_input.c @@ -548,7 +548,10 @@ static void handle_hotplug(void *data, unsigned *port, unsigned id, else if (strstr(name_buf, "Sony Navigation Controller")) device = DEVICE_PSMOVE_NAVI; else if (strstr(name_buf, "OUYA Game Controller")) + { device = DEVICE_OUYA; + strlcpy(name_buf, "OUYA", sizeof(name_buf)); + } else if (strstr(name_buf, "adc joystick")) device = DEVICE_JXD_S7300B; else if (strstr(name_buf, "idroid:con")) diff --git a/input/android_input.c.rem b/input/android_input.c.rem index ea9dd3eb71..2ae15f727b 100644 --- a/input/android_input.c.rem +++ b/input/android_input.c.rem @@ -772,27 +772,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_OUYA: - g_settings.input.device[port] = device; - strlcpy(g_settings.input.device_names[port], "OUYA", - 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_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+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_THUMBL] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - android->keycode_lut[AKEYCODE_BUTTON_THUMBR] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - android->keycode_lut[AKEYCODE_MENU] |= ((RARCH_MENU_TOGGLE+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 c0eb98f252..563a5daf63 100644 --- a/input/autoconf/builtin_android.c +++ b/input/autoconf/builtin_android.c @@ -70,6 +70,31 @@ DECL_BTN(right, h0right) \ DECL_BTN(l, 102) \ DECL_BTN(r, 103) +#define OUYA_DEFAULT_BINDS \ +DECL_BTN(a, 97) \ +DECL_BTN(b, 96) \ +DECL_BTN(x, 100) \ +DECL_BTN(y, 99) \ +DECL_BTN(start, 107) \ +DECL_BTN(select, 106) \ +DECL_BTN(up, 19) \ +DECL_BTN(down, 20) \ +DECL_BTN(left, 21) \ +DECL_BTN(right, 22) \ +DECL_BTN(l, 102) \ +DECL_BTN(r, 104) \ +DECL_BTN(l2, 104) \ +DECL_BTN(r2, 105) \ +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) \ +"input_menu_toggle_btn = 82\n" + #define SIXAXIS_DEFAULT_BINDS \ DECL_BTN(a, 97) \ DECL_BTN(b, 96) \ @@ -178,6 +203,10 @@ const char* const input_builtin_autoconfs[] = "input_driver = \"android\" \n" SAMSUNG_EIGP20_DEFAULT_BINDS, + "input_device = \"OUYA\" \n" + "input_driver = \"android\" \n" + OUYA_DEFAULT_BINDS, + "input_device = \"RumblePad 2\" \n" "input_driver = \"android\" \n" RUMBLEPAD2_DEFAULT_BINDS,