Added Android support for cheap G910 gamepad.

This commit is contained in:
Chris Merrett 2013-10-22 22:31:48 +01:00
parent fbd2747122
commit 3ec7065238
4 changed files with 40 additions and 2 deletions

View File

@ -1327,12 +1327,35 @@ static void android_input_set_keybinds(void *data, unsigned device,
keycode_lut[AKEYCODE_Q] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
keycode_lut[AKEYCODE_P] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
keycode_lut[AKEYCODE_R] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
keycode_lut[AKEYCODE_Y] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
keycode_lut[AKEYCODE_Y] |= ((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);
break;
case ICADE_PROFILE_G910:
strlcpy(g_settings.input.device_names[port], "G910",
sizeof(g_settings.input.device_names[port]));
/* Face buttons map to SNES layout, not button labels on gamepad -- SNES layout has A to the right of B */
keycode_lut[AKEYCODE_NUMPAD_LCK_3] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift); /* Button labeled X on gamepad */
keycode_lut[AKEYCODE_NUMPAD_LCK_0] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift); /* Button labeled A on gamepad */
keycode_lut[AKEYCODE_NUMPAD_LCK_1] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift); /* Button labeled B on gamepad */
keycode_lut[AKEYCODE_NUMPAD_LCK_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift); /* Button labeled Y on gamepad */
keycode_lut[AKEYCODE_NUMPAD_LCK_6] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
keycode_lut[AKEYCODE_NUMPAD_LCK_8] |= ((RETRO_DEVICE_ID_JOYPAD_L2+1) << shift);
keycode_lut[AKEYCODE_NUMPAD_LCK_2] |= ((RETRO_DEVICE_ID_JOYPAD_L3+1) << shift);
keycode_lut[AKEYCODE_NUMPAD_LCK_7] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
keycode_lut[AKEYCODE_NUMPAD_LCK_9] |= ((RETRO_DEVICE_ID_JOYPAD_R2+1) << shift);
keycode_lut[AKEYCODE_NUMPAD_LCK_5] |= ((RETRO_DEVICE_ID_JOYPAD_R3+1) << shift);
keycode_lut[AKEYCODE_NUMPAD_SUB] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
keycode_lut[AKEYCODE_OTHR_108] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
/* These don't work, in gamepad mode the dpad sends AXIS_HAT_X and AXIS_HAT_Y motion events
instead of button events, so they get processed by engine_handle_dpad_getaxisvalue() */
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);
break;
case ICADE_PROFILE_GAMESTOP_WIRELESS:
strlcpy(g_settings.input.device_names[port], "Gamestop Wireless",
sizeof(g_settings.input.device_names[port]));

View File

@ -26,10 +26,23 @@ enum {
ICADE_PROFILE_IPEGA_PG9017,
ICADE_PROFILE_IPEGA_PG9017_MODE2,
ICADE_PROFILE_GAMESTOP_WIRELESS,
ICADE_PROFILE_G910,
} icade_profile_enums;
enum {
AKEYCODE_META_FUNCTION_ON = 8,
AKEYCODE_NUMPAD_LCK_0 = 96,
AKEYCODE_NUMPAD_LCK_1 = 97,
AKEYCODE_NUMPAD_LCK_2 = 98,
AKEYCODE_NUMPAD_LCK_3 = 99,
AKEYCODE_NUMPAD_LCK_4 = 100,
AKEYCODE_NUMPAD_LCK_5 = 101,
AKEYCODE_NUMPAD_LCK_6 = 102,
AKEYCODE_NUMPAD_LCK_7 = 103,
AKEYCODE_NUMPAD_LCK_8 = 104,
AKEYCODE_NUMPAD_LCK_9 = 105,
AKEYCODE_OTHR_108 = 108,
AKEYCODE_NUMPAD_SUB = 109,
AKEYCODE_ESCAPE = 111,
AKEYCODE_FORWARD_DEL = 112,
AKEYCODE_CTRL_LEFT = 113,

View File

@ -9,5 +9,5 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="40px"
android:text="The following pads have been added to the autodetection list:\n\n* Logitech/Logicool Rumblepad 2\n* Microsoft Sidewinder USB (ISSUE - diagonals not working).\n* Microsoft Xbox 360 Wired/Wireless.\n* PS3 Sixaxis/DualShock 3 (using either USB or Dancingpixelstudios' IME app)\n* MOGA (using either 'root' gamepad mode or official IME app)\n* JXD S5110\n* Snakebyte idroid\n* Logitech Dual Action\n* Mayflash Super Joy Box 3 Pro\n* RetroUSB SNES RetroPort\n* RetroUSB NES RetroPad\n* Buffalo SNES Pad\n* Elecom PS1/PS2 to USB\n* Archos gamepad\n* Xbox 1 (Titanium X-Joy Converter) (ISSUE - diagonals not working).\n* Red Samurai (IME app Bluetooth or gamepad mode)\n* Xperia Play\n* Trust Raptor\n* Logitech F710\n* DragonRise USB\n* Madcatz PS3 fighting stick\n* iControlPad (HID joystick profile or SPP profile in tandem with Bluez IME)\n* iPega (gamepad mode, select it in iCade profile)\n* PC2JAMMA-USB (TODO - TEST)\n* Genius MaxFire G-08XU\n* Zeemote Steelseries\n* Saitek Rumblepad\n* Super Smart Joy\n* Groupwise PS2 to USB converter\n* Toodles 2008 Chimp\n* Sega Saturn USB pad\n* Mayflash Wii Classic\n* Mayflash PS2 to USB\n* Nintendo Wii (using ccpcreations.WiiUse IME app)\n* Nyko Playpad Pro\n*Nvidia Shield" />
android:text="The following pads have been added to the autodetection list:\n\n* Logitech/Logicool Rumblepad 2\n* Microsoft Sidewinder USB (ISSUE - diagonals not working).\n* Microsoft Xbox 360 Wired/Wireless.\n* PS3 Sixaxis/DualShock 3 (using either USB or Dancingpixelstudios' IME app)\n* MOGA (using either 'root' gamepad mode or official IME app)\n* JXD S5110\n* Snakebyte idroid\n* Logitech Dual Action\n* Mayflash Super Joy Box 3 Pro\n* RetroUSB SNES RetroPort\n* RetroUSB NES RetroPad\n* Buffalo SNES Pad\n* Elecom PS1/PS2 to USB\n* Archos gamepad\n* Xbox 1 (Titanium X-Joy Converter) (ISSUE - diagonals not working).\n* Red Samurai (IME app Bluetooth or gamepad mode)\n* Xperia Play\n* Trust Raptor\n* Logitech F710\n* DragonRise USB\n* Madcatz PS3 fighting stick\n* iControlPad (HID joystick profile or SPP profile in tandem with Bluez IME)\n* iPega (gamepad mode, select it in iCade profile)\n* G910 (gamepad mode, select it in iCade profile)\n* PC2JAMMA-USB (TODO - TEST)\n* Genius MaxFire G-08XU\n* Zeemote Steelseries\n* Saitek Rumblepad\n* Super Smart Joy\n* Groupwise PS2 to USB converter\n* Toodles 2008 Chimp\n* Sega Saturn USB pad\n* Mayflash Wii Classic\n* Mayflash PS2 to USB\n* Nintendo Wii (using ccpcreations.WiiUse IME app)\n* Nyko Playpad Pro\n*Nvidia Shield" />
</LinearLayout>

View File

@ -49,6 +49,7 @@
<item>iPega PG-9017</item>
<item>iPega PG-9017 (Mode 2)</item>
<item>Gamestop Wireless</item>
<item>G910</item>
</string-array>
<string-array name="icade_profiles_values" translatable="false">
@ -56,6 +57,7 @@
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
</string-array>
<string-array name="key_bind_values" translatable="false">