From 41a83fdbf22df9db586b45202281eef3dab1a7e3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 11 Jun 2014 10:16:27 +0200 Subject: [PATCH] (Android) Add default binds for 360 pad --- input/android_input.c | 7 ++++++- input/autoconf/builtin_android.c | 31 ++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/input/android_input.c b/input/android_input.c index f27143badf..381f7c0185 100644 --- a/input/android_input.c +++ b/input/android_input.c @@ -501,8 +501,13 @@ static void handle_hotplug(void *data, unsigned port, unsigned id, device = DEVICE_MS_SIDEWINDER_DUAL_STRIKE; else if (strstr(name_buf, "SideWinder")) device = DEVICE_MS_SIDEWINDER; - else if (strstr(name_buf, "X-Box 360") || strstr(name_buf, "X-Box") + else if (strstr(name_buf, "X-Box 360") || strstr(name_buf, "Xbox 360 Wireless Receiver")) + { + device = DEVICE_MS_XBOX; + strlcpy(name_buf, "XBox 360", sizeof(name_buf)); + } + else if (strstr(name_buf, "X-Box")) device = DEVICE_MS_XBOX; } else if (strstr(name_buf, "WiseGroup")) diff --git a/input/autoconf/builtin_android.c b/input/autoconf/builtin_android.c index 995178cbd8..5b4a01a579 100644 --- a/input/autoconf/builtin_android.c +++ b/input/autoconf/builtin_android.c @@ -67,6 +67,32 @@ DECL_AXIS(r_x_minus, -2) \ DECL_AXIS(r_y_plus, +3) \ DECL_AXIS(r_y_minus, -3) +#define XBOX360_DEFAULT_BINDS \ +DECL_BTN(a, 97) \ +DECL_BTN(b, 96) \ +DECL_BTN(x, 100) \ +DECL_BTN(y, 99) \ +DECL_BTN(start, 108) \ +DECL_BTN(select, 4) \ +DECL_AXIS(up, -5) \ +DECL_AXIS(down, +5) \ +DECL_AXIS(left, -4) \ +DECL_AXIS(right, +4) \ +DECL_BTN(l, 102) \ +DECL_BTN(r, 103) \ +DECL_AXIS(l2, +6) \ +DECL_AXIS(r2, +7) \ +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) + #define RUMBLEPAD2_DEFAULT_BINDS \ DECL_BTN(a, 190) \ DECL_BTN(b, 189) \ @@ -104,10 +130,13 @@ const char* const input_builtin_autoconfs[] = "input_driver = \"android\" \n" RUMBLEPAD2_DEFAULT_BINDS, + "input_device = \"XBox 360\" \n" + "input_driver = \"android\" \n" + XBOX360_DEFAULT_BINDS, + "input_device = \"PlayStation3\" \n" "input_driver = \"android\" \n" SIXAXIS_DEFAULT_BINDS, NULL }; -