From cb8445154295556de821d2a605bb231e42ba1245 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 26 May 2013 01:13:24 +0200 Subject: [PATCH] (Android) Add Gamestop Wireless, Tomee NES USB, and Thrustmaster T Mini Wireless to autodetection list --- android/native/jni/input_android.c | 48 +++++++++++++++++++++++++++ android/native/jni/input_autodetect.c | 4 +++ android/native/jni/input_autodetect.h | 1 + android/phoenix/res/values/array.xml | 1 + driver.h | 2 ++ 5 files changed, 56 insertions(+) diff --git a/android/native/jni/input_android.c b/android/native/jni/input_android.c index 1fa2f8d5fa..c08992a4f2 100644 --- a/android/native/jni/input_android.c +++ b/android/native/jni/input_android.c @@ -1197,6 +1197,28 @@ static void android_input_set_keybinds(void *data, unsigned device, keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); break; + case ICADE_PROFILE_GAMESTOP_WIRELESS: + keycode_lut[AKEYCODE_W] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); + keycode_lut[AKEYCODE_S] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); + keycode_lut[AKEYCODE_A] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); + keycode_lut[AKEYCODE_D] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); + keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); + keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); + keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); + keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); + keycode_lut[AKEYCODE_3] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_1] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_7] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_ESCAPE] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_6] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_9] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); + keycode_lut[AKEYCODE_0] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); + break; } } break; @@ -1232,6 +1254,32 @@ static void android_input_set_keybinds(void *data, unsigned device, keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); break; + case DEVICE_TOMEE_NES_USB: + g_settings.input.device[port] = device; + strlcpy(g_settings.input.device_names[port], "Tomee NES USB", + sizeof(g_settings.input.device_names[port])); + + keycode_lut[AKEYCODE_BUTTON_R2]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_L2]|= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_A]|= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_B]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + break; + case DEVICE_THRUSTMASTER_T_MINI: + g_settings.input.device[port] = device; + strlcpy(g_settings.input.device_names[port], "Thrustmaster T Mini", + sizeof(g_settings.input.device_names[port])); + + keycode_lut[AKEYCODE_BUTTON_R2]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_L2]|= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_A]|= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_X]|= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_B]|= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_C]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y]|= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Z]|= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_L2]|= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_R1]|= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + break; case DEVICE_MOGA_IME: g_settings.input.device[port] = device; strlcpy(g_settings.input.device_names[port], "Moga IME", diff --git a/android/native/jni/input_autodetect.c b/android/native/jni/input_autodetect.c index 723a3df5fd..e18c76c264 100644 --- a/android/native/jni/input_autodetect.c +++ b/android/native/jni/input_autodetect.c @@ -191,6 +191,10 @@ void input_autodetect_setup (void *data, char *msg, size_t sizeof_msg, unsigned device = DEVICE_THRUST_PREDATOR; else if (strstr(name_buf, "DragonRise")) device = DEVICE_DRAGONRISE; + else if (strstr(name_buf, "Thrustmaster T Mini")) + device = DEVICE_THRUSTMASTER_T_MINI; + else if (strstr(name_buf, "2Axes 11Keys Game Pad")) + device = DEVICE_TOMEE_NES_USB; if (strstr(current_ime, "net.obsidianx.android.mogaime")) { diff --git a/android/native/jni/input_autodetect.h b/android/native/jni/input_autodetect.h index 2706e54b80..2bde935fdd 100644 --- a/android/native/jni/input_autodetect.h +++ b/android/native/jni/input_autodetect.h @@ -24,6 +24,7 @@ enum { ICADE_PROFILE_RED_SAMURAI = 0, ICADE_PROFILE_IPEGA_PG9017, + ICADE_PROFILE_GAMESTOP_WIRELESS, } icade_profile_enums; enum { diff --git a/android/phoenix/res/values/array.xml b/android/phoenix/res/values/array.xml index c6fcc02043..9b49514eaa 100644 --- a/android/phoenix/res/values/array.xml +++ b/android/phoenix/res/values/array.xml @@ -33,6 +33,7 @@ Red Samurai iPega PG-9017 + Gamestop Wireless diff --git a/driver.h b/driver.h index fdd8dfef88..82266311f7 100644 --- a/driver.h +++ b/driver.h @@ -262,6 +262,8 @@ enum input_devices DEVICE_CCPCREATIONS_WIIUSE_IME, DEVICE_KEYBOARD_RETROPAD, DEVICE_OUYA, + DEVICE_TOMEE_NES_USB, + DEVICE_THRUSTMASTER_T_MINI, #elif defined(GEKKO) DEVICE_GAMECUBE = 0, #ifdef HW_RVL