From d0bd978142e394a59a346800855f3b4db83e4bdb Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 28 Jun 2013 14:05:58 +0200 Subject: [PATCH] (Android) Add JC U912F gamepad to autodetection list --- android/native/jni/input_android.c | 26 ++++++++++++++++++++++---- android/native/jni/input_autodetect.c | 2 ++ driver.h | 1 + 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/android/native/jni/input_android.c b/android/native/jni/input_android.c index 7638d61bb2..88e9205d8b 100644 --- a/android/native/jni/input_android.c +++ b/android/native/jni/input_android.c @@ -820,12 +820,12 @@ static void android_input_set_keybinds(void *data, unsigned device, 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_BUTTON_1] |= ((RARCH_MENU_TOGGLE+1) << shift); - keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); @@ -1178,6 +1178,24 @@ static void android_input_set_keybinds(void *data, unsigned device, keycode_lut[AKEYCODE_BUTTON_THUMBR] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); keycode_lut[AKEYCODE_MENU] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); break; + case DEVICE_HOLTEK_JC_U912F: + g_settings.input.device[port] = device; + strlcpy(g_settings.input.device_names[port], "Elecom JC-U912F", + sizeof(g_settings.input.device_names[port])); + + keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + break; case DEVICE_XPERIA_PLAY: g_settings.input.device[port] = device; strlcpy(g_settings.input.device_names[port], "Xperia Play", diff --git a/android/native/jni/input_autodetect.c b/android/native/jni/input_autodetect.c index de46d92743..e886985a1f 100644 --- a/android/native/jni/input_autodetect.c +++ b/android/native/jni/input_autodetect.c @@ -219,6 +219,8 @@ void input_autodetect_setup (void *data, char *msg, size_t sizeof_msg, unsigned device = DEVICE_GAMEMID; else if (strstr(name_buf, "USB Gamepad")) device = DEVICE_DEFENDER_GAME_RACER_CLASSIC; + else if (strstr(name_buf, "HOLTEK JC - U912F vibration game")) + device = DEVICE_HOLTEK_JC_U912F; if (strstr(current_ime, "net.obsidianx.android.mogaime")) { diff --git a/driver.h b/driver.h index 59c87b0957..f97ec0fa85 100644 --- a/driver.h +++ b/driver.h @@ -268,6 +268,7 @@ enum input_devices DEVICE_THRUSTMASTER_T_MINI, DEVICE_GAMEMID, DEVICE_DEFENDER_GAME_RACER_CLASSIC, + DEVICE_HOLTEK_JC_U912F, #elif defined(GEKKO) DEVICE_GAMECUBE = 0, #ifdef HW_RVL