mirror of
https://github.com/libretro/RetroArch
synced 2025-01-26 18:35:22 +00:00
(Android) Should autodetect keyboards now and configure them
This commit is contained in:
parent
c64af4d3d0
commit
e76ce3d525
@ -302,6 +302,41 @@ void input_autodetect_setup(unsigned port, unsigned id, int source)
|
||||
keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
||||
}
|
||||
}
|
||||
else if (source == AINPUT_SOURCE_KEYBOARD)
|
||||
{
|
||||
snprintf(msg, sizeof(msg), "RetroPad #%d is: Keyboard.\n", port);
|
||||
// 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);
|
||||
keycode_lut[AKEYCODE_BACK] |= ((RARCH_QUIT_KEY+1) << shift);
|
||||
}
|
||||
else if (strstr(current_ime, "com.ccpcreations.android.WiiUseAndroid"))
|
||||
{
|
||||
// Player 1
|
||||
@ -431,40 +466,6 @@ void input_autodetect_setup(unsigned port, unsigned id, int source)
|
||||
keycode_lut[AKEYCODE_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
||||
keycode_lut[AKEYCODE_HOME] |= ((RARCH_RESET+1) << shift);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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);
|
||||
keycode_lut[AKEYCODE_BACK] |= ((RARCH_QUIT_KEY+1) << shift);
|
||||
}
|
||||
|
||||
if (name_buf[0] != 0)
|
||||
RARCH_LOG("Device %d: %s, port: %d.\n", id, name_buf, port);
|
||||
@ -477,8 +478,6 @@ void input_autodetect_setup(unsigned port, unsigned id, int source)
|
||||
snprintf(msg, sizeof(msg), "RetroPad #%d is: Touchscreen.\n", port);
|
||||
else if (source == AINPUT_SOURCE_MOUSE)
|
||||
snprintf(msg, sizeof(msg), "RetroPad #%d is: Mouse.\n", port);
|
||||
else if (source == AINPUT_SOURCE_KEYBOARD)
|
||||
snprintf(msg, sizeof(msg), "RetroPad #%d is: Keyboard.\n", port);
|
||||
else if (name_buf[0] != 0)
|
||||
snprintf(msg, sizeof(msg), "HID [%s] unbound.\n", name_buf);
|
||||
timeout_val = 120;
|
||||
|
@ -9,11 +9,13 @@
|
||||
android:key="savestate_auto_save"
|
||||
android:summary="Automatically saves and restores game state."
|
||||
android:title="Auto save state" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="Rewinding" >
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="rewind_enable"
|
||||
android:summary="Allow rewinding a game in real-time (WARNING - CPU intensive)."
|
||||
android:title="Rewind" />
|
||||
android:summary="WARNING - very CPU intensive - will decrease ingame performance."
|
||||
android:title="Enable" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
<PreferenceScreen android:title="Video Config" >
|
||||
@ -118,4 +120,4 @@
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
||||
</PreferenceScreen>
|
||||
</PreferenceScreen>
|
||||
|
Loading…
x
Reference in New Issue
Block a user