diff --git a/android/native/jni/input_android.c b/android/native/jni/input_android.c index d78a250c54..2fd9014ba3 100644 --- a/android/native/jni/input_android.c +++ b/android/native/jni/input_android.c @@ -27,6 +27,12 @@ #define MAX_TOUCH 16 +typedef struct +{ + float dzone_min; + float dzone_max; +} dpad_values_t; + #define PRESSED_UP(x, y) ((y <= dzone_min)) #define PRESSED_DOWN(x, y) ((y >= dzone_max)) #define PRESSED_LEFT(x, y) ((x <= dzone_min)) @@ -35,9 +41,10 @@ static unsigned pads_connected; static int state_device_ids[MAX_PADS]; static uint64_t state[MAX_PADS]; -uint64_t keycode_lut[LAST_KEYCODE]; +static uint64_t keycode_lut[LAST_KEYCODE]; dpad_values_t dpad_state[MAX_PADS]; + struct input_pointer { int16_t x, y; @@ -222,10 +229,27 @@ static void engine_handle_dpad_getaxisvalue(AInputEvent *event, static void *android_input_init(void) { - unsigned i, j; + unsigned i, j, k; pads_connected = 0; - input_autodetect_init(); + for(j = 0; j < LAST_KEYCODE; j++) + keycode_lut[j] = 0; + + if (!g_settings.input.autodetect_enable) + { + for (j = 0; j < MAX_PADS; j++) + { + uint8_t shift = 8 + (j * 8); + for (k = 0; k < RARCH_FIRST_CUSTOM_BIND; k++) + { + if (g_settings.input.binds[j][k].valid && g_settings.input.binds[j][k].joykey && g_settings.input.binds[j][k].joykey < LAST_KEYCODE) + { + RARCH_LOG("binding %llu to %d (p%d)\n", g_settings.input.binds[j][k].joykey, k, j); + keycode_lut[g_settings.input.binds[j][k].joykey] |= ((k + 1) << shift); + } + } + } + } for(i = 0; i < MAX_PADS; i++) { @@ -281,6 +305,862 @@ static void *android_input_init(void) return (void*)-1; } +int zeus_id = -1; +int zeus_second_id = -1; +static unsigned zeus_port; + +static void android_set_default_keybinds(unsigned device, unsigned port, unsigned id) +{ + /* eight 8-bit values are packed into one uint64_t + * one for each of the 8 pads */ + unsigned shift = 8 + (port * 8); + + g_settings.input.dpad_emulation[port] = DPAD_EMULATION_LSTICK; + + // NOTE - we have to add '1' to the bit mask because + // RETRO_DEVICE_ID_JOYPAD_B is 0 + + switch (device) + { + case DEVICE_LOGITECH_RUMBLEPAD2: + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); + break; + case DEVICE_LOGITECH_DUAL_ACTION: + 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_Y] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_X+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); + keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_THUMBL] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_THUMBR] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + break; + case DEVICE_ICONTROLPAD_BLUEZ_IME: + g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; + 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_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+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_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + + /* left analog stick */ + 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); + + /* right analog stick - TODO */ + // Left - 11 + // Right - 13 + // Down - 12 + // Up - 15 + break; + case DEVICE_TTT_THT_ARCADE: + dpad_state[id].dzone_min = -2.00f; + dpad_state[id].dzone_max = 1.00f; + + /* same as Rumblepad 2 - merge? */ + //keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + + /* TODO - unsure about pad 2 still */ +#if 0 + keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); + keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); + + keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_16] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); +#endif + break; + case DEVICE_TOMMO_NEOGEOX_ARCADE: + g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; + 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_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + break; + case DEVICE_MADCATZ_PC_USB_STICK: + keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+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_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+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); /* request hack */ + keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); /* request hack */ + keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_MODE] |= ((RARCH_QUIT_KEY+1) << shift); + break; + case DEVICE_LOGICOOL_RUMBLEPAD2: + // Rumblepad 2 DInput */ + /* TODO: Add L3/R3 */ + 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_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + + keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + break; + case DEVICE_IDROID_X360: + g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; + 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_INSERT] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_MINUS] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_SLASH] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_MOVE_END] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_LEFT_BRACKET] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_FORWARD_DEL] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_MEDIA_PLAY] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_EQUALS] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_MENU] |= ((RARCH_MENU_TOGGLE+1) << shift); + // Left Analog Up: 152 + // Left Analog Down: 146 + // Left Analog Right: 150 + // Left Analog Left: 148 + // Right Analog Up: 92 (AKEYCODE_PAGE_UP) + // Right Analog Down: 93 (AKEYCODE_PAGE_DOWN) + // Right Analog Right: 113 (AKEYCODE_CTRL_LEFT) + // Right Analog Left: 72 (AKEYCODE_RIGHT_BRACKET) + keycode_lut[AKEYCODE_NUMPAD_8] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); + keycode_lut[AKEYCODE_NUMPAD_2] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); + keycode_lut[AKEYCODE_NUMPAD_6] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); + keycode_lut[AKEYCODE_NUMPAD_4] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); + break; + case DEVICE_ZEEMOTE_STEELSERIES: + keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_MODE] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+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); + break; + case DEVICE_HUIJIA_USB_SNES: + dpad_state[id].dzone_min = -1.00f; + dpad_state[id].dzone_max = 1.00f; + + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + break; + case DEVICE_SUPER_SMARTJOY: + dpad_state[id].dzone_min = -1.00f; + dpad_state[id].dzone_max = 1.00f; + + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + break; + case DEVICE_SAITEK_RUMBLE_P480: + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); + break; + case DEVICE_MS_SIDEWINDER_DUAL_STRIKE: + /* TODO - unfinished */ + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X) << shift); + keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L) << shift); + keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R) << shift); + keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_L2) << shift); + break; + case DEVICE_MS_SIDEWINDER: + keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_R2+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_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+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); + break; + case DEVICE_MS_XBOX: + /* TODO: left and right triggers for Xbox 1*/ + 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_THUMBL] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_THUMBR] |= ((RETRO_DEVICE_ID_JOYPAD_R3+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_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+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); + break; + case DEVICE_WISEGROUP_PLAYSTATION2: + keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); + keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); + keycode_lut[AKEYCODE_BUTTON_16] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); + break; + case DEVICE_JCPS102_PLAYSTATION2: + keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); + keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); + keycode_lut[AKEYCODE_BUTTON_16] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); + break; + case DEVICE_GENERIC_PLAYSTATION2_CONVERTER: + keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); + keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); + keycode_lut[AKEYCODE_BUTTON_16] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); + break; + case DEVICE_KEYBOARD_RETROPAD: + // Keyboard + // TODO: Map L2/R2/L3/R3 + keycode_lut[AKEYCODE_Z] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_SHIFT_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+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_X] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_S] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_Q] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_W] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + + /* Misc control scheme */ + keycode_lut[AKEYCODE_F2] |= ((RARCH_SAVE_STATE_KEY+1) << shift); + keycode_lut[AKEYCODE_F4] |= ((RARCH_LOAD_STATE_KEY+1) << shift); + keycode_lut[AKEYCODE_F7] |= ((RARCH_STATE_SLOT_PLUS+1) << shift); + keycode_lut[AKEYCODE_F6] |= ((RARCH_STATE_SLOT_MINUS+1) << shift); + keycode_lut[AKEYCODE_SPACE] |= ((RARCH_FAST_FORWARD_KEY+1) << shift); + keycode_lut[AKEYCODE_L] |= ((RARCH_FAST_FORWARD_HOLD_KEY+1) << shift); + keycode_lut[AKEYCODE_BREAK] |= ((RARCH_PAUSE_TOGGLE+1) << shift); + keycode_lut[AKEYCODE_K] |= ((RARCH_FRAMEADVANCE+1) << shift); + keycode_lut[AKEYCODE_H] |= ((RARCH_RESET+1) << shift); + keycode_lut[AKEYCODE_R] |= ((RARCH_REWIND+1) << shift); + keycode_lut[AKEYCODE_F9] |= ((RARCH_MUTE+1) << shift); + + keycode_lut[AKEYCODE_ESCAPE] |= ((RARCH_QUIT_KEY+1) << shift); + break; + case DEVICE_PLAYSTATION3_VERSION1: + g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; + 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_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_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); + keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_THUMBL] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_THUMBR] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_1] |= ((RARCH_MENU_TOGGLE+1) << shift); + break; + case DEVICE_PLAYSTATION3_VERSION2: + g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; + 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_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_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_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); + keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_THUMBL] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_THUMBR] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); + break; + case DEVICE_MOGA: + g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; + 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_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_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+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); + break; + case DEVICE_PSMOVE_NAVI: + /* TODO - unfinished */ + keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + + keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_UNKNOWN] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + break; + case DEVICE_JXD_S7300B: + g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; + 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_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+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); + keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + + keycode_lut[AKEYCODE_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_SPACE] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + + //keycode_lut[AKEYCODE_VOLUME_UP] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + //keycode_lut[AKEYCODE_VOLUME_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + break; + case DEVICE_IDROID_CON: + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); + break; + case DEVICE_NYKO_PLAYPAD_PRO: + 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_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+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); + 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_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_THUMBL] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); + keycode_lut[AKEYCODE_BUTTON_THUMBR] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); + break; + case DEVICE_GENIUS_MAXFIRE_G08XU: + keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + break; + case DEVICE_USB_2_AXIS_8_BUTTON_GAMEPAD: + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + 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_BUFFALO_BGC_FC801: + dpad_state[id].dzone_min = -1.00f; + dpad_state[id].dzone_max = 1.00f; + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + 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_RETROUSB_RETROPAD: + keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + break; + case DEVICE_RETROUSB_SNES_RETROPORT: + keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+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_C] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + break; + case DEVICE_CYPRESS_USB: + keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_L2+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_START+1) << shift); + break; + case DEVICE_MAYFLASH_WII_CLASSIC: + g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; + + keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); + keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); + keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); + + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + 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 DEVICE_SZMY_POWER_DUAL_BOX_WII: + g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; + + keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); + keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); + keycode_lut[AKEYCODE_BUTTON_16] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); + + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + 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 DEVICE_TOODLES_2008_CHIMP: + keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + break; + case DEVICE_ARCHOS_GAMEPAD: + 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_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+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); + keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+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); + break; + case DEVICE_JXD_S5110: + 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_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_SPACE] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_Y+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); + break; + case DEVICE_XPERIA_PLAY: + if (zeus_id < 0) + { + RARCH_LOG("zeus_pad 1 detected: %d\n", id); + zeus_id = id; + zeus_port = port; + } + else + { + RARCH_LOG("zeus_pad 2 detected: %d\n", id); + zeus_second_id = id; + port = zeus_port; + shift = 8 + (port * 8); + } + + g_extern.lifecycle_mode_state |= (1ULL << MODE_INPUT_XPERIA_PLAY_HACK); + + keycode_lut[AKEYCODE_DPAD_CENTER] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+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_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_MENU] |= ((RARCH_MENU_TOGGLE+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); + break; + case DEVICE_BROADCOM_BLUETOOTH_HID: + if ((g_settings.input.icade_count +1) < 4) + { + g_settings.input.icade_count++; + + switch(g_settings.input.icade_profile[g_settings.input.icade_count]) + { + case ICADE_PROFILE_RED_SAMURAI: + /* TODO: unsure about Select button here */ + /* TODO: hookup right stick + * RStick Up: 37 + * RStick Down: 39 + * RStick Left:38 + * RStick Right: 40 */ + + /* Red Samurai */ + 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_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_9] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); + keycode_lut[AKEYCODE_0] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); + keycode_lut[AKEYCODE_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_6] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_7] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + + /* unsure if the person meant the SNES-mapping here or whether it's the pad */ + 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_3] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + break; + case ICADE_PROFILE_IPEGA_PG9017: + /* Todo: diagonals - patchy? */ + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + 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; + } + } + break; + case DEVICE_THRUST_PREDATOR: + /* TODO: L3/R3 */ + + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + 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 DEVICE_DRAGONRISE: + /* TODO: L3/R3 */ + + keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + 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_MOGA_IME: + /* TODO: + * right stick up: 188 + * right stick down: 189 + * right stick left: 190 + * right stick right: 191 + */ + 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_BUTTON_START]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_SELECT]|= ((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); + keycode_lut[AKEYCODE_BUTTON_X]|= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y]|= ((RETRO_DEVICE_ID_JOYPAD_X+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); + break; + case DEVICE_CCPCREATIONS_WIIUSE_IME: + g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; + + /* Player 1 */ + 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_1] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_3] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); + keycode_lut[AKEYCODE_4] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); + keycode_lut[AKEYCODE_5] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); + keycode_lut[AKEYCODE_6] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); + keycode_lut[AKEYCODE_M] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_P] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_E] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_B] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_F] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_G] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_C] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_LEFT_BRACKET] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_RIGHT_BRACKET] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + keycode_lut[AKEYCODE_Z] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_H] |= ((RARCH_RESET+1) << shift); + 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_C] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_Z] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + + /* Player 2 */ + shift += 8; + keycode_lut[AKEYCODE_I] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); + keycode_lut[AKEYCODE_K] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); + keycode_lut[AKEYCODE_J] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); + keycode_lut[AKEYCODE_O]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); + keycode_lut[AKEYCODE_COMMA] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_PERIOD] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_VOLUME_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); + keycode_lut[AKEYCODE_VOLUME_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); + keycode_lut[AKEYCODE_MEDIA_PREVIOUS] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); + keycode_lut[AKEYCODE_MEDIA_NEXT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); + keycode_lut[AKEYCODE_MEDIA_PLAY] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_MEDIA_STOP] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_ENDCALL] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_CALL] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_PLUS] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_MINUS] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_BACKSLASH] |= ((RARCH_RESET+1) << shift); + keycode_lut[AKEYCODE_L] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_R] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_SEARCH] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_TAB] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + + /* Player 3 */ + shift += 8; + keycode_lut[AKEYCODE_PAGE_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); + keycode_lut[AKEYCODE_PAGE_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); + keycode_lut[AKEYCODE_MEDIA_REWIND] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); + keycode_lut[AKEYCODE_MEDIA_FAST_FORWARD]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); + keycode_lut[AKEYCODE_SOFT_LEFT]|= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_SOFT_RIGHT]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_THUMBR]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_THUMBL]|= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_SPACE]|= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); + keycode_lut[AKEYCODE_SYM]|= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); + keycode_lut[AKEYCODE_EXPLORER]|= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); + keycode_lut[AKEYCODE_ENVELOPE]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); + keycode_lut[AKEYCODE_BUTTON_X]|= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Y]|= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BUTTON_A]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_B]|= ((RETRO_DEVICE_ID_JOYPAD_B+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); + keycode_lut[AKEYCODE_BUTTON_R2]|= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + + /* Player 4 */ + shift += 8; + keycode_lut[AKEYCODE_N] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); + keycode_lut[AKEYCODE_Q] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); + keycode_lut[AKEYCODE_T] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); + keycode_lut[AKEYCODE_APOSTROPHE]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); + keycode_lut[AKEYCODE_NOTIFICATION]|= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_MUTE]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_BUTTON_START]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); + keycode_lut[AKEYCODE_BUTTON_SELECT]|= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); + keycode_lut[AKEYCODE_CLEAR]|= ((RARCH_RESET+1) << shift); + keycode_lut[AKEYCODE_CAPS_LOCK] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); + keycode_lut[AKEYCODE_SCROLL_LOCK] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); + //keycode_lut[AKEYCODE_T] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); -- Left meta + //keycode_lut[AKEYCODE_APOSTROPHE]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); -- right meta + keycode_lut[AKEYCODE_META_FUNCTION_ON] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); + keycode_lut[AKEYCODE_SYSRQ] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); + keycode_lut[AKEYCODE_BREAK] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); + keycode_lut[AKEYCODE_MOVE_HOME] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); + keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); + keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + keycode_lut[AKEYCODE_GRAVE] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + keycode_lut[AKEYCODE_MEDIA_PAUSE] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); + break; + case DEVICE_NONE: + default: + break; + } + + keycode_lut[AKEYCODE_MENU] |= ((RARCH_MENU_TOGGLE + 1) << shift); +} + // Handle all events. If our activity is in pause state, block until we're unpaused. static void android_input_poll(void *data) @@ -364,7 +1244,7 @@ static void android_input_poll(void *data) } else if (g_settings.input.back_behavior == BACK_BUTTON_MENU_TOGGLE) { - int action = AKeyEvent_getAction(event); + int action = AKeyEvent_getAction(event); if (action == AKEY_EVENT_ACTION_DOWN) *lifecycle_state |= (1ULL << RARCH_MENU_TOGGLE); else if (action == AKEY_EVENT_ACTION_UP) @@ -520,6 +1400,6 @@ const input_driver_t input_android = { android_input_state, android_input_key_pressed, android_input_free_input, - NULL, + android_set_default_keybinds, "android_input", }; diff --git a/android/native/jni/input_autodetect.c b/android/native/jni/input_autodetect.c index 16c783126d..f4842e840a 100644 --- a/android/native/jni/input_autodetect.c +++ b/android/native/jni/input_autodetect.c @@ -18,8 +18,6 @@ #include "jni_macros.h" #include "input_autodetect.h" -extern dpad_values_t dpad_state[MAX_PADS]; - static void input_autodetect_get_device_name(void *data, char *buf, size_t size, int id) { struct android_app *android_app = (struct android_app*)data; @@ -69,40 +67,11 @@ end: (*vm)->DetachCurrentThread(vm); } -void input_autodetect_init (void) -{ - int j, k; - for(j = 0; j < LAST_KEYCODE; j++) - keycode_lut[j] = 0; - - - if (g_settings.input.autodetect_enable) - return; - - for (j = 0; j < MAX_PADS; j++) - { - uint8_t shift = 8 + (j * 8); - for (k = 0; k < RARCH_FIRST_CUSTOM_BIND; k++) - { - if (g_settings.input.binds[j][k].valid && g_settings.input.binds[j][k].joykey && g_settings.input.binds[j][k].joykey < LAST_KEYCODE) - { - RARCH_LOG("binding %llu to %d (p%d)\n", g_settings.input.binds[j][k].joykey, k, j); - keycode_lut[g_settings.input.binds[j][k].joykey] |= ((k + 1) << shift); - } - } - } -} - -int zeus_id = -1; -int zeus_second_id = -1; -static unsigned zeus_port; - void input_autodetect_setup (void *data, char *msg, size_t sizeof_msg, unsigned port, unsigned id, int source) { struct android_app *android_app = (struct android_app*)data; - // Hack - we have to add '1' to the bit mask here because - // RETRO_DEVICE_ID_JOYPAD_B is 0 + unsigned device; char name_buf[256]; name_buf[0] = 0; @@ -112,362 +81,59 @@ void input_autodetect_setup (void *data, char *msg, size_t sizeof_msg, unsigned return; } - /* eight 8-bit values are packed into one uint64_t - * one for each of the 8 pads */ - uint8_t shift = 8 + (port * 8); - - g_settings.input.dpad_emulation[port] = DPAD_EMULATION_LSTICK; - char *current_ime = android_app->current_ime; input_autodetect_get_device_name(android_app, name_buf, sizeof(name_buf), id); RARCH_LOG("device name: %s\n", name_buf); - if (strstr(name_buf, "keypad-game-zeus") || strstr(name_buf, "keypad-zeus")) - { - if (zeus_id < 0) - { - RARCH_LOG("zeus_pad 1 detected: %d\n", id); - zeus_id = id; - zeus_port = port; - } - else - { - RARCH_LOG("zeus_pad 2 detected: %d\n", id); - zeus_second_id = id; - port = zeus_port; - shift = 8 + (port * 8); - } - } - - keycode_lut[AKEYCODE_MENU] |= ((RARCH_MENU_TOGGLE + 1) << shift); - if (g_settings.input.autodetect_enable) { + device = 0; - if (strstr(name_buf, "Logitech")) - { - if (strstr(name_buf, "RumblePad 2")) - { - keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); - keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); - } - else if (strstr(name_buf, "Dual Action")) - { - 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_Y] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_X+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); - keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_THUMBL] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); - keycode_lut[AKEYCODE_BUTTON_THUMBR] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); - keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - } - } + if (strstr(name_buf,"Logitech") && strstr(name_buf, "RumblePad 2")) + device = DEVICE_LOGITECH_RUMBLEPAD2; + else if (strstr(name_buf, "Logitech") && strstr(name_buf, "Dual Action")) + device = DEVICE_LOGITECH_DUAL_ACTION; else if (strstr(name_buf, "shooter-keypad")) - { - /* iControlpad Bluez IME */ - g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; - 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_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+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_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - - /* left analog stick */ - 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); - - /* right analog stick */ - // Left - 11 - // Right - 13 - // Down - 12 - // Up - 15 - } + device = DEVICE_ICONTROLPAD_BLUEZ_IME; else if (strstr(name_buf, "TTT THT Arcade console 2P USB Play")) - { - dpad_state[id].dzone_min = -2.00f; - dpad_state[id].dzone_max = 1.00f; - - /* same as Rumblepad 2 - merge? */ - //keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - - keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - - /* TODO - unsure about pad 2 still */ -#if 0 - keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - - keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_16] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); -#endif - } + device = DEVICE_TTT_THT_ARCADE; else if (strstr(name_buf, "TOMMO NEOGEOX Arcade Stick")) - { - g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; - 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_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - } - else if (strstr(name_buf, "MadCatz")) - { - if (strstr(name_buf, "PC USB Wired Stick")) - { - keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+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_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+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); /* request hack */ - - keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - - keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); /* request hack */ - - keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_BUTTON_MODE] |= ((RARCH_QUIT_KEY+1) << shift); - } - } - else if (strstr(name_buf, "Logicool")) - { - if (strstr(name_buf, "RumblePad 2")) - { - // Rumblepad 2 DInput */ - /* TODO: Add L3/R3 */ - 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_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - - keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - } - } + device = DEVICE_TOMMO_NEOGEOX_ARCADE; + else if (strstr(name_buf, "MadCatz") && strstr(name_buf, "PC USB Wired Stick")) + device = DEVICE_MADCATZ_PC_USB_STICK; + else if (strstr(name_buf, "Logicool") && strstr(name_buf, "RumblePad 2")) + device = DEVICE_LOGICOOL_RUMBLEPAD2; else if (strstr(name_buf, "Sun4i-keypad")) - { - // iDroid x360 - g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; - 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_INSERT] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_MINUS] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_SLASH] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_MOVE_END] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_LEFT_BRACKET] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_FORWARD_DEL] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_MEDIA_PLAY] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_EQUALS] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - - // use this for the RGUI toggle - keycode_lut[AKEYCODE_MENU] |= ((RARCH_MENU_TOGGLE+1) << shift); - - // Left Analog Up: 152 - // Left Analog Down: 146 - // Left Analog Right: 150 - // Left Analog Left: 148 - // Right Analog Up: 92 (AKEYCODE_PAGE_UP) - // Right Analog Down: 93 (AKEYCODE_PAGE_DOWN) - // Right Analog Right: 113 (AKEYCODE_CTRL_LEFT) - // Right Analog Left: 72 (AKEYCODE_RIGHT_BRACKET) - keycode_lut[AKEYCODE_NUMPAD_8] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - keycode_lut[AKEYCODE_NUMPAD_2] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - keycode_lut[AKEYCODE_NUMPAD_6] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - keycode_lut[AKEYCODE_NUMPAD_4] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - - } - else if (strstr(name_buf, "Zeemote")) - { - if (strstr(name_buf, "Steelseries free")) - { - keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - - keycode_lut[AKEYCODE_BUTTON_MODE] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+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); - } - } - else if (strstr(name_buf, "HuiJia USB GamePad") || - strstr(name_buf, "Smartjoy Family Super Smartjoy 2")) - { - dpad_state[id].dzone_min = -1.00f; - dpad_state[id].dzone_max = 1.00f; - - keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - - if (strstr(name_buf, "Smartjoy Family Super Smartjoy 2")) - { - keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - } - else if (strstr(name_buf, "HuiJia USB GamePad")) - { - keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - } - keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - } + device = DEVICE_IDROID_X360; + else if (strstr(name_buf, "Zeemote") && strstr(name_buf, "Steelseries free")) + device = DEVICE_ZEEMOTE_STEELSERIES; + else if (strstr(name_buf, "HuiJia USB GamePad")) + device = DEVICE_HUIJIA_USB_SNES; + else if (strstr(name_buf, "Smartjoy Family Super Smartjoy 2")) + device = DEVICE_SUPER_SMARTJOY; else if (strstr(name_buf, "Jess Tech Dual Analog Rumble Pad")) - { - /* Saitek Rumble P480 */ - keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); - keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); - } + device = DEVICE_SAITEK_RUMBLE_P480; else if (strstr(name_buf, "Microsoft")) { if (strstr(name_buf, "Dual Strike")) - { - keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X) << shift); - keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L) << shift); - keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R) << shift); - keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_L2) << shift); - } - else if (strstr(name_buf, "SideWinder") || strstr(name_buf, "X-Box") || - strstr(name_buf, "Xbox 360 Wireless Receiver")) - { - if (strstr(name_buf, "SideWinder")) - { - keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); - keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - } - else if (strstr(name_buf, "X-Box 360") || strstr(name_buf, "X-Box") + 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") || strstr(name_buf, "Xbox 360 Wireless Receiver")) - { - /* TODO: left and right triggers for Xbox 1*/ - 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_THUMBL] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); - keycode_lut[AKEYCODE_BUTTON_THUMBR] |= ((RETRO_DEVICE_ID_JOYPAD_R3+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_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+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); - } + device = DEVICE_MS_XBOX; } else if (strstr(name_buf, "WiseGroup")) { if (strstr(name_buf, "TigerGame") || strstr(name_buf, "Game Controller Adapter") || strstr(name_buf, "JC-PS102U") || strstr(name_buf, "Dual USB Joypad")) { - /* Mayflash PS2 to USB converters */ - keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - keycode_lut[AKEYCODE_BUTTON_16] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - if (strstr(name_buf, "WiseGroup")) - keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); + device = DEVICE_WISEGROUP_PLAYSTATION2; + else if (strstr(name_buf, "JC-PS102U")) + device = DEVICE_JCPS102_PLAYSTATION2; else - keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - - keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - - if (strstr(name_buf, "JC-PS102U") || strstr(name_buf, "WiseGroup")) - keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - else - keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - - keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); - keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); + device = DEVICE_GENERIC_PLAYSTATION2_CONVERTER; } } else if (strstr(name_buf, "PLAYSTATION(R)3") || strstr(name_buf, "Dualshock3") @@ -475,546 +141,71 @@ void input_autodetect_setup (void *data, char *msg, size_t sizeof_msg, unsigned (strstr(name_buf, "Gamepad 0") || strstr(name_buf, "Gamepad 1") || strstr(name_buf, "Gamepad 2") || strstr(name_buf, "Gamepad 3"))) { - bool do_invert = (strstr(name_buf, "Gamepad 0") || strstr(name_buf, "Gamepad 1") || - strstr(name_buf, "Gamepad 2") || strstr(name_buf, "Gamepad 3")); - - g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; - 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); - - if (do_invert) - { - keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - } + if (strstr(name_buf, "Gamepad 0") || strstr(name_buf, "Gamepad 1") || + strstr(name_buf, "Gamepad 2") || strstr(name_buf, "Gamepad 3")) + device = DEVICE_PLAYSTATION3_VERSION1; else - { - //PS button will be used for RGUI toggle - keycode_lut[AKEYCODE_BUTTON_1] |= ((RARCH_MENU_TOGGLE+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_A] |= ((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); - - if (do_invert) - { - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - } - else - { - 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_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); - keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_THUMBL] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); - keycode_lut[AKEYCODE_BUTTON_THUMBR] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); + device = DEVICE_PLAYSTATION3_VERSION2; } else if (strstr(name_buf, "MOGA")) - { - g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; - 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_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_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+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); - } + device = DEVICE_MOGA; else if (strstr(name_buf, "Sony Navigation Controller")) - { - keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - - keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); - keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - keycode_lut[AKEYCODE_UNKNOWN] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - } + device = DEVICE_PSMOVE_NAVI; else if (strstr(name_buf, "adc joystick")) - { - /* JXD S7300B */ - g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; - 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_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+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); - keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - - keycode_lut[AKEYCODE_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_SPACE] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - - //keycode_lut[AKEYCODE_VOLUME_UP] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - //keycode_lut[AKEYCODE_VOLUME_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - } + device = DEVICE_JXD_S7300B; else if (strstr(name_buf, "idroid:con")) - { - keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_BUTTON_11] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); - keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); - } + device = DEVICE_IDROID_CON; else if (strstr(name_buf, "NYKO PLAYPAD PRO")) - { - 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_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+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); - 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_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_THUMBL] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); - keycode_lut[AKEYCODE_BUTTON_THUMBR] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); - } + device = DEVICE_NYKO_PLAYPAD_PRO; else if (strstr(name_buf, "2-Axis, 8-Button")) - { - /* Genius MaxFire G-08XU */ - keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - } - else if (strstr(name_buf, "USB,2-axis 8-button gamepad") || - strstr(name_buf, "BUFFALO BGC-FC801")) - { - if (strstr(name_buf, "BUFFALO BGC-FC801")) - { - dpad_state[id].dzone_min = -1.00f; - dpad_state[id].dzone_max = 1.00f; - } - keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - } + device = DEVICE_GENIUS_MAXFIRE_G08XU; + else if (strstr(name_buf, "USB,2-axis 8-button gamepad")) + device = DEVICE_USB_2_AXIS_8_BUTTON_GAMEPAD; + else if (strstr(name_buf, "BUFFALO BGC-FC801")) + device = DEVICE_BUFFALO_BGC_FC801; else if (strstr(name_buf, "RetroUSB.com RetroPad")) - { - keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - } + device = DEVICE_RETROUSB_RETROPAD; else if (strstr(name_buf, "RetroUSB.com SNES RetroPort")) - { - keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+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_C] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - } + device = DEVICE_RETROUSB_SNES_RETROPORT; else if (strstr(name_buf, "CYPRESS USB")) - { - keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_L2+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_START+1) << shift); - } - else if (strstr(name_buf, "Mayflash Wii Classic") || - strstr(name_buf, "SZMy-power LTD CO. Dual Box WII")) - { - g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; - - if (strstr(name_buf, "Mayflash Wii Classic")) - { - keycode_lut[AKEYCODE_BUTTON_12] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - - keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - } - else if (strstr(name_buf, "SZMy-power LTD CO. Dual Box WII")) - { - keycode_lut[AKEYCODE_BUTTON_13] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - keycode_lut[AKEYCODE_BUTTON_15] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - keycode_lut[AKEYCODE_BUTTON_16] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_14] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - - keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - } - keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - } + device = DEVICE_CYPRESS_USB; + else if (strstr(name_buf, "Mayflash Wii Classic")) + device = DEVICE_MAYFLASH_WII_CLASSIC; + else if (strstr(name_buf, "SZMy-power LTD CO. Dual Box WII")) + device = DEVICE_SZMY_POWER_DUAL_BOX_WII; else if (strstr(name_buf, "Toodles 2008 ChImp")) - { - keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - } + device = DEVICE_TOODLES_2008_CHIMP; else if (strstr(name_buf, "joy_key")) - { - /* Archos Gamepad */ - 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_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+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); - keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+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); - } + device = DEVICE_ARCHOS_GAMEPAD; else if (strstr(name_buf, "matrix_keyboard")) - { - /* JXD S5110 */ - 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_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_SPACE] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_Y+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); - } + device = DEVICE_JXD_S5110; else if (strstr(name_buf, "keypad-zeus") || (strstr(name_buf, "keypad-game-zeus"))) - { - g_extern.lifecycle_mode_state |= (1ULL << MODE_INPUT_XPERIA_PLAY_HACK); - /* Xperia Play */ - /* X/o/square/triangle/R1/L1/D-pad */ - keycode_lut[AKEYCODE_DPAD_CENTER] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+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_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - - /* Xperia Play */ - /* Start/select */ - - /* TODO: menu button */ - /* Menu : 82 */ - keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - } + device = DEVICE_XPERIA_PLAY; else if (strstr(name_buf, "Broadcom Bluetooth HID")) - { - if ((g_settings.input.icade_count +1) < 4) - { - g_settings.input.icade_count++; + device = DEVICE_BROADCOM_BLUETOOTH_HID; + else if (strstr(name_buf, "USB Gamepad")) + device = DEVICE_THRUST_PREDATOR; + else if (strstr(name_buf, "DragonRise")) + device = DEVICE_DRAGONRISE; - switch(g_settings.input.icade_profile[g_settings.input.icade_count]) - { - case ICADE_PROFILE_RED_SAMURAI: - /* TODO: unsure about Select button here */ - /* TODO: hookup right stick - * RStick Up: 37 - * RStick Down: 39 - * RStick Left:38 - * RStick Right: 40 */ - - /* Red Samurai */ - 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_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_9] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift); - keycode_lut[AKEYCODE_0] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift); - keycode_lut[AKEYCODE_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_6] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - keycode_lut[AKEYCODE_7] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_8] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - - /* unsure if the person meant the SNES-mapping here or whether it's the pad */ - 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_3] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - break; - case ICADE_PROFILE_IPEGA_PG9017: - /* Todo: diagonals - patchy? */ - keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - 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; - } - } - } - else if (strstr(name_buf, "USB Gamepad") || strstr(name_buf, "DragonRise")) - { - /* Thrust Predator */ - /* DragonRise USB Gamepad */ - /* Missing: L3/R3 */ - - keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_4] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - - if (strstr(name_buf, "USB Gamepad")) - { - keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - } - else if (strstr(name_buf, "DragonRise")) - { - keycode_lut[AKEYCODE_BUTTON_5] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_6] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - } - } if (strstr(current_ime, "net.obsidianx.android.mogaime")) { - /* MOGA with MOGA IME app */ - - /* TODO: - * right stick up: 188 - * right stick down: 189 - * right stick left: 190 - * right stick right: 191 - */ + device = DEVICE_MOGA_IME; snprintf(name_buf, sizeof(name_buf), "MOGA IME"); - 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_BUTTON_START]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_BUTTON_SELECT]|= ((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); - keycode_lut[AKEYCODE_BUTTON_X]|= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Y]|= ((RETRO_DEVICE_ID_JOYPAD_X+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); } else if (strstr(current_ime, "com.ccpcreations.android.WiiUseAndroid")) { - // Player 1 - - /* Wiimote (IME) */ + device = DEVICE_CCPCREATIONS_WIIUSE_IME; snprintf(name_buf, sizeof(name_buf), "ccpcreations WiiUse"); - g_settings.input.dpad_emulation[port] = DPAD_EMULATION_NONE; - 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_1] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_3] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - keycode_lut[AKEYCODE_4] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - keycode_lut[AKEYCODE_5] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - keycode_lut[AKEYCODE_6] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - keycode_lut[AKEYCODE_M] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_P] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_E] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_B] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_F] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_G] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_C] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_LEFT_BRACKET] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - keycode_lut[AKEYCODE_RIGHT_BRACKET] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - keycode_lut[AKEYCODE_Z] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_H] |= ((RARCH_RESET+1) << shift); - 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_C] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_Z] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - - //player 2 - shift += 8; - keycode_lut[AKEYCODE_I] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - keycode_lut[AKEYCODE_K] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - keycode_lut[AKEYCODE_J] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - keycode_lut[AKEYCODE_O]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - keycode_lut[AKEYCODE_COMMA] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_PERIOD] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_VOLUME_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - keycode_lut[AKEYCODE_VOLUME_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - keycode_lut[AKEYCODE_MEDIA_PREVIOUS] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - keycode_lut[AKEYCODE_MEDIA_NEXT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - keycode_lut[AKEYCODE_MEDIA_PLAY] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_MEDIA_STOP] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_ENDCALL] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_CALL] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_PLUS] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_MINUS] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_BACKSLASH] |= ((RARCH_RESET+1) << shift); - keycode_lut[AKEYCODE_L] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_R] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_SEARCH] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - keycode_lut[AKEYCODE_TAB] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - - //player 3 - shift += 8; - keycode_lut[AKEYCODE_PAGE_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - keycode_lut[AKEYCODE_PAGE_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - keycode_lut[AKEYCODE_MEDIA_REWIND] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - keycode_lut[AKEYCODE_MEDIA_FAST_FORWARD]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - keycode_lut[AKEYCODE_SOFT_LEFT]|= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_SOFT_RIGHT]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_THUMBR]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_BUTTON_THUMBL]|= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_SPACE]|= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - keycode_lut[AKEYCODE_SYM]|= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - keycode_lut[AKEYCODE_EXPLORER]|= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - keycode_lut[AKEYCODE_ENVELOPE]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - keycode_lut[AKEYCODE_BUTTON_X]|= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Y]|= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BUTTON_A]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_B]|= ((RETRO_DEVICE_ID_JOYPAD_B+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); - keycode_lut[AKEYCODE_BUTTON_R2]|= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); - - //player 4 - shift += 8; - keycode_lut[AKEYCODE_N] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - keycode_lut[AKEYCODE_Q] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - keycode_lut[AKEYCODE_T] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); - keycode_lut[AKEYCODE_APOSTROPHE]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); - keycode_lut[AKEYCODE_NOTIFICATION]|= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_MUTE]|= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_BUTTON_START]|= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift); - keycode_lut[AKEYCODE_BUTTON_SELECT]|= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_CLEAR]|= ((RARCH_RESET+1) << shift); - keycode_lut[AKEYCODE_CAPS_LOCK] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift); - keycode_lut[AKEYCODE_SCROLL_LOCK] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift); - //keycode_lut[AKEYCODE_T] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift); -- Left meta - //keycode_lut[AKEYCODE_APOSTROPHE]|= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift); -- right meta - keycode_lut[AKEYCODE_META_FUNCTION_ON] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_SYSRQ] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_BREAK] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_MOVE_HOME] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_BUTTON_C] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_BUTTON_Z] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); - keycode_lut[AKEYCODE_GRAVE] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift); - keycode_lut[AKEYCODE_MEDIA_PAUSE] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift); } - else if (source == AINPUT_SOURCE_KEYBOARD) - { - // Keyboard - // TODO: Map L2/R2/L3/R3 - keycode_lut[AKEYCODE_Z] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); - keycode_lut[AKEYCODE_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); - keycode_lut[AKEYCODE_SHIFT_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift); - keycode_lut[AKEYCODE_ENTER] |= ((RETRO_DEVICE_ID_JOYPAD_START+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_X] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); - keycode_lut[AKEYCODE_S] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); - keycode_lut[AKEYCODE_Q] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift); - keycode_lut[AKEYCODE_W] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift); + if (source == AINPUT_SOURCE_KEYBOARD) + device = DEVICE_KEYBOARD_RETROPAD; - /* Misc control scheme */ - keycode_lut[AKEYCODE_F2] |= ((RARCH_SAVE_STATE_KEY+1) << shift); - keycode_lut[AKEYCODE_F4] |= ((RARCH_LOAD_STATE_KEY+1) << shift); - keycode_lut[AKEYCODE_F7] |= ((RARCH_STATE_SLOT_PLUS+1) << shift); - keycode_lut[AKEYCODE_F6] |= ((RARCH_STATE_SLOT_MINUS+1) << shift); - keycode_lut[AKEYCODE_SPACE] |= ((RARCH_FAST_FORWARD_KEY+1) << shift); - keycode_lut[AKEYCODE_L] |= ((RARCH_FAST_FORWARD_HOLD_KEY+1) << shift); - keycode_lut[AKEYCODE_BREAK] |= ((RARCH_PAUSE_TOGGLE+1) << shift); - keycode_lut[AKEYCODE_K] |= ((RARCH_FRAMEADVANCE+1) << shift); - keycode_lut[AKEYCODE_H] |= ((RARCH_RESET+1) << shift); - keycode_lut[AKEYCODE_R] |= ((RARCH_REWIND+1) << shift); - keycode_lut[AKEYCODE_F9] |= ((RARCH_MUTE+1) << shift); - - keycode_lut[AKEYCODE_ESCAPE] |= ((RARCH_QUIT_KEY+1) << shift); - } + if (driver.input->set_default_keybinds) + driver.input->set_default_keybinds(device, port, id); } if (name_buf[0] != 0) - snprintf(msg, sizeof_msg, "HID %d: %s, p: %d.\n", id, name_buf, port); + snprintf(msg, sizeof_msg, "Port %d: %s.\n", port, name_buf); } diff --git a/android/native/jni/input_autodetect.h b/android/native/jni/input_autodetect.h index 4619106678..bbac9d06bc 100644 --- a/android/native/jni/input_autodetect.h +++ b/android/native/jni/input_autodetect.h @@ -21,6 +21,53 @@ #define AKEY_EVENT_NO_ACTION 255 +enum { + DEVICE_NONE = 0, + DEVICE_LOGITECH_RUMBLEPAD2, + DEVICE_LOGITECH_DUAL_ACTION, + DEVICE_ICONTROLPAD_BLUEZ_IME, + DEVICE_TTT_THT_ARCADE, + DEVICE_TOMMO_NEOGEOX_ARCADE, + DEVICE_MADCATZ_PC_USB_STICK, + DEVICE_LOGICOOL_RUMBLEPAD2, + DEVICE_IDROID_X360, + DEVICE_ZEEMOTE_STEELSERIES, + DEVICE_HUIJIA_USB_SNES, + DEVICE_SUPER_SMARTJOY, + DEVICE_SAITEK_RUMBLE_P480, + DEVICE_MS_SIDEWINDER_DUAL_STRIKE, + DEVICE_MS_SIDEWINDER, + DEVICE_MS_XBOX, + DEVICE_WISEGROUP_PLAYSTATION2, + DEVICE_JCPS102_PLAYSTATION2, + DEVICE_GENERIC_PLAYSTATION2_CONVERTER, + DEVICE_PSMOVE_NAVI, + DEVICE_JXD_S7300B, + DEVICE_IDROID_CON, + DEVICE_GENIUS_MAXFIRE_G08XU, + DEVICE_USB_2_AXIS_8_BUTTON_GAMEPAD, + DEVICE_BUFFALO_BGC_FC801, + DEVICE_RETROUSB_RETROPAD, + DEVICE_RETROUSB_SNES_RETROPORT, + DEVICE_CYPRESS_USB, + DEVICE_MAYFLASH_WII_CLASSIC, + DEVICE_SZMY_POWER_DUAL_BOX_WII, + DEVICE_ARCHOS_GAMEPAD, + DEVICE_JXD_S5110, + DEVICE_XPERIA_PLAY, + DEVICE_BROADCOM_BLUETOOTH_HID, + DEVICE_THRUST_PREDATOR, + DEVICE_DRAGONRISE, + DEVICE_PLAYSTATION3_VERSION1, + DEVICE_PLAYSTATION3_VERSION2, + DEVICE_MOGA_IME, + DEVICE_NYKO_PLAYPAD_PRO, + DEVICE_TOODLES_2008_CHIMP, + DEVICE_MOGA, + DEVICE_CCPCREATIONS_WIIUSE_IME, + DEVICE_KEYBOARD_RETROPAD, +} android_input_device_enums; + enum { ICADE_PROFILE_RED_SAMURAI = 0, ICADE_PROFILE_IPEGA_PG9017, @@ -80,18 +127,6 @@ enum { #define LAST_KEYCODE AKEYCODE_ASSIST -typedef struct -{ - float dzone_min; - float dzone_max; -} dpad_values_t; - -extern uint64_t keycode_lut[LAST_KEYCODE]; -extern bool volume_enable; -extern int zeus_id; -extern int zeus_second_id; - -void input_autodetect_init (void); void input_autodetect_setup (void *data, char *msg, size_t sizeof_msg, unsigned port, unsigned id, int source); #endif diff --git a/driver.h b/driver.h index 26844d6f7e..0065720d0c 100644 --- a/driver.h +++ b/driver.h @@ -206,7 +206,7 @@ typedef struct input_driver int16_t (*input_state)(void *data, const struct retro_keybind **retro_keybinds, unsigned port, unsigned device, unsigned index, unsigned id); bool (*key_pressed)(void *data, int key); void (*free)(void *data); - void (*set_default_keybinds)(unsigned device, unsigned port); + void (*set_default_keybinds)(unsigned device, unsigned port, unsigned id); #ifdef RARCH_CONSOLE void (*set_analog_dpad_mapping)(unsigned device, unsigned map_dpad_enum, unsigned controller_id); #endif diff --git a/frontend/menu/rgui.c b/frontend/menu/rgui.c index aa44dbd14e..2c621a4d3c 100644 --- a/frontend/menu/rgui.c +++ b/frontend/menu/rgui.c @@ -900,7 +900,7 @@ static int rgui_settings_toggle_setting(unsigned setting, rgui_action_t action, g_settings.input.device[port]++; g_settings.input.device[port] %= RARCH_DEVICE_LAST; if (driver.input->set_default_keybinds) - driver.input->set_default_keybinds(g_settings.input.device[port], port); + driver.input->set_default_keybinds(g_settings.input.device[port], port, 0); driver.input->set_analog_dpad_mapping(g_settings.input.device[port], g_settings.input.dpad_emulation[port], port); break; #endif diff --git a/frontend/menu/rmenu.c b/frontend/menu/rmenu.c index 1caf69f77c..6cae19c96c 100644 --- a/frontend/menu/rmenu.c +++ b/frontend/menu/rmenu.c @@ -2042,7 +2042,7 @@ static int set_setting_action(void *data, unsigned switchvalue, uint64_t input) case SETTING_CONTROLS_DEFAULT_ALL: if((input & (1ULL << RMENU_DEVICE_NAV_LEFT)) || (input & (1ULL << RMENU_DEVICE_NAV_RIGHT)) || (input & (1ULL << RMENU_DEVICE_NAV_B)) || (input & (1ULL << RMENU_DEVICE_NAV_START))) if (driver.input->set_default_keybinds) - driver.input->set_default_keybinds(g_settings.input.device[currently_selected_controller_menu], currently_selected_controller_menu); + driver.input->set_default_keybinds(g_settings.input.device[currently_selected_controller_menu], currently_selected_controller_menu, 0); break; } diff --git a/frontend/menu/rmenu_xui.cpp b/frontend/menu/rmenu_xui.cpp index c827671e5d..283ba76cb6 100644 --- a/frontend/menu/rmenu_xui.cpp +++ b/frontend/menu/rmenu_xui.cpp @@ -535,7 +535,7 @@ HRESULT CRetroArchControls::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled break; case SETTING_CONTROLS_DEFAULT_ALL: if (driver.input->set_default_keybinds) - driver.input->set_default_keybinds(g_settings.input.device[controlno], controlno); + driver.input->set_default_keybinds(g_settings.input.device[controlno], controlno, 0); for(i = 0; i < RARCH_FIRST_META_KEY; i++) { diff --git a/gx/gx_input.c b/gx/gx_input.c index 7c89905396..15ebc3b3f3 100644 --- a/gx/gx_input.c +++ b/gx/gx_input.c @@ -242,8 +242,10 @@ static void gx_input_set_analog_dpad_mapping(unsigned device, unsigned map_dpad_ } } -static void gx_set_default_keybinds(unsigned device, unsigned port) +static void gx_set_default_keybinds(unsigned device, unsigned port, unsigned id) { + (void)id; + switch (device) { #ifdef HW_RVL @@ -343,7 +345,7 @@ static void *gx_input_init(void) #endif for(unsigned i = 0; i < MAX_PLAYERS; i++) - gx_set_default_keybinds(0, i); + gx_set_default_keybinds(0, i, 0); for(unsigned i = 0; i < MAX_PADS; i++) gx_input_set_analog_dpad_mapping(g_settings.input.device[i], g_settings.input.dpad_emulation[i], i); diff --git a/input/null.c b/input/null.c index c9abd0fa75..e72883f4b8 100644 --- a/input/null.c +++ b/input/null.c @@ -52,10 +52,11 @@ static void nullinput_input_free_input(void *data) } #ifdef RARCH_CONSOLE -static void nullinput_set_default_keybinds(unsigned device, unsigned port) +static void nullinput_set_default_keybinds(unsigned device, unsigned port, unsigned id) { (void)device; (void)port; + (void)id; } static void nullinput_set_analog_dpad_mapping(unsigned device, unsigned map_dpad_enum, unsigned controller_id) diff --git a/ps3/ps3_input.c b/ps3/ps3_input.c index f634ec5b3a..48a9238177 100644 --- a/ps3/ps3_input.c +++ b/ps3/ps3_input.c @@ -427,9 +427,10 @@ static void ps3_input_free_input(void *data) //cellPadEnd(); } -static void ps3_set_default_keybinds(unsigned device, unsigned port) +static void ps3_set_default_keybinds(unsigned device, unsigned port, unsigned id) { (void)device; + (void)id; for (int i = 0; i < RARCH_CUSTOM_BIND_LIST_END; i++) { @@ -449,7 +450,7 @@ static void* ps3_input_init(void) #endif for(unsigned i = 0; i < MAX_PLAYERS; i++) - ps3_set_default_keybinds(0, i); + ps3_set_default_keybinds(0, i, 0); for (unsigned i = 0; i < MAX_PADS; i++) ps3_input_set_analog_dpad_mapping(0, g_settings.input.dpad_emulation[i], i); diff --git a/psp/psp_input.c b/psp/psp_input.c index 3cfa346b38..026eddadc3 100644 --- a/psp/psp_input.c +++ b/psp/psp_input.c @@ -151,9 +151,10 @@ static void psp_free_input(void *data) (void)data; } -static void psp_set_default_keybinds(unsigned device, unsigned port) +static void psp_set_default_keybinds(unsigned device, unsigned port, unsigned id) { (void)device; + (void)id; for (unsigned i = 0; i < RARCH_CUSTOM_BIND_LIST_END; i++) { @@ -171,7 +172,7 @@ static void* psp_input_initialize(void) sceCtrlSetSamplingMode(DEFAULT_SAMPLING_MODE); for(unsigned i = 0; i < MAX_PLAYERS; i++) - psp_set_default_keybinds(0, i); + psp_set_default_keybinds(0, i, 0); return (void*)-1; } diff --git a/xdk/xdk_xinput_input.c b/xdk/xdk_xinput_input.c index 305aaf68f2..cfd7696f71 100644 --- a/xdk/xdk_xinput_input.c +++ b/xdk/xdk_xinput_input.c @@ -269,9 +269,10 @@ static void xdk_input_free_input(void *data) (void)data; } -static void xdk_set_default_keybinds(unsigned device, unsigned port) +static void xdk_set_default_keybinds(unsigned device, unsigned port, unsigned id) { (void)device; + (void)id; for (int i = 0; i < RARCH_CUSTOM_BIND_LIST_END; i++) { @@ -335,7 +336,7 @@ static void *xdk_input_init(void) #endif for(unsigned i = 0; i < MAX_PLAYERS; i++) - xdk_set_default_keybinds(0, i); + xdk_set_default_keybinds(0, i, 0); for(unsigned i = 0; i < MAX_PADS; i++) xdk_input_set_analog_dpad_mapping(0, g_settings.input.dpad_emulation[i], i); diff --git a/xenon/xenon360_input.c b/xenon/xenon360_input.c index 3d78c94bb9..da2c57d563 100644 --- a/xenon/xenon360_input.c +++ b/xenon/xenon360_input.c @@ -82,9 +82,10 @@ static void xenon360_input_free_input(void *data) (void)data; } -static void xenon360_input_set_default_keybinds(unsigned device, unsigned port) +static void xenon360_input_set_default_keybinds(unsigned device, unsigned port, unsigned id) { (void)device; + (void)id; for (unsigned i = 0; i < RARCH_CUSTOM_BIND_LIST_END; i++) { @@ -105,7 +106,7 @@ static void xenon360_input_set_analog_dpad_mapping(unsigned device, unsigned map static void* xenon360_input_init(void) { for(unsigned i = 0; i < MAX_PLAYERS; i++) - xenon360_input_set_default_keybinds(0, i); + xenon360_input_set_default_keybinds(0, i, 0); for(unsigned i = 0; i < MAX_PADS; i++) xenon360_input_set_analog_dpad_mapping(0, g_settings.input.dpad_emulation[i], i);