(Android) Input - implement GameMID default binds

This commit is contained in:
twinaphex 2014-06-12 03:00:26 +02:00
parent 9e844b06b3
commit ba5ebbdb7d
3 changed files with 31 additions and 27 deletions

View File

@ -512,7 +512,7 @@ static void handle_hotplug(void *data, unsigned *port, unsigned id,
else if (strstr(device_name, "2Axes 11Keys Game Pad"))
device = DEVICE_TOMEE_NES_USB;
else if (strstr(device_name, "rk29-keypad") || strstr(device_name, "GAMEMID"))
device = DEVICE_GAMEMID;
strlcpy(name_buf, "GameMID", sizeof(name_buf));
else if (strstr(device_name, "USB Gamepad"))
device = DEVICE_DEFENDER_GAME_RACER_CLASSIC;
else if (strstr(device_name, "HOLTEK JC - U912F vibration game"))

View File

@ -55,32 +55,6 @@ static void android_input_set_keybinds(void *data, unsigned device,
android->keycode_lut[AKEYCODE_BUTTON_9] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
android->keycode_lut[AKEYCODE_BUTTON_10] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
break;
case DEVICE_GAMEMID:
g_settings.input.device[port] = device;
strlcpy(g_settings.input.device_names[port], "GameMID",
sizeof(g_settings.input.device_names[port]));
android->keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
android->keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
android->keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
android->keycode_lut[AKEYCODE_DPAD_RIGHT] |= ((RETRO_DEVICE_ID_JOYPAD_RIGHT+1) << shift);
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
android->keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
android->keycode_lut[AKEYCODE_BUTTON_L2] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
android->keycode_lut[AKEYCODE_BUTTON_R2] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
android->keycode_lut[AKEYCODE_BUTTON_THUMBR] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
android->keycode_lut[AKEYCODE_BUTTON_THUMBL] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
/* left analog stick - TODO */
/* right analog stick - TODO */
/* menu button? */
break;
case DEVICE_ICONTROLPAD_HID_JOYSTICK:
g_settings.input.device[port] = device;
strlcpy(g_settings.input.device_names[port], "iControlPad HID Joystick profile",

View File

@ -156,6 +156,32 @@ DECL_AXIS(r_x_minus, -2) \
DECL_AXIS(r_y_plus, +3) \
DECL_AXIS(r_y_minus, -3)
#define GAMEMID_DEFAULT_BINDS \
DECL_BTN(a, 97) \
DECL_BTN(b, 96) \
DECL_BTN(x, 100) \
DECL_BTN(y, 99) \
DECL_BTN(start, 108) \
DECL_BTN(select, 109) \
DECL_BTN(up, 19) \
DECL_BTN(down, 20) \
DECL_BTN(left, 21) \
DECL_BTN(right, 22) \
DECL_BTN(l, 102) \
DECL_BTN(r, 103) \
DECL_BTN(l2, 104) \
DECL_BTN(r2, 105) \
DECL_BTN(l3, 106) \
DECL_BTN(r3, 107) \
DECL_AXIS(l_x_plus, +0) \
DECL_AXIS(l_x_minus, -0) \
DECL_AXIS(l_y_plus, +1) \
DECL_AXIS(l_y_minus, -1) \
DECL_AXIS(r_x_plus, +2) \
DECL_AXIS(r_x_minus, -2) \
DECL_AXIS(r_y_plus, +3) \
DECL_AXIS(r_y_minus, -3)
#define PS3_DEFAULT_BINDS \
DECL_BTN(a, 97) \
DECL_BTN(b, 96) \
@ -264,6 +290,10 @@ const char* const input_builtin_autoconfs[] =
"input_driver = \"android\" \n"
SAMSUNG_EIGP20_DEFAULT_BINDS,
"input_device = \"GameMID\" \n"
"input_driver = \"android\" \n"
GAMEMID_DEFAULT_BINDS,
"input_device = \"OUYA\" \n"
"input_driver = \"android\" \n"
OUYA_DEFAULT_BINDS,