mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-25 08:59:58 +00:00
(Android) Maps PS3 pad correctly now
This commit is contained in:
parent
8a58858d84
commit
acefa9bfc4
@ -26,6 +26,14 @@
|
||||
#define MAX_PADS 8
|
||||
#define MAX_TOUCH 8
|
||||
|
||||
enum
|
||||
{
|
||||
DPAD_EMULATION_NONE = 0,
|
||||
DPAD_EMULATION_LSTICK,
|
||||
DPAD_EMULATION_RSTICK,
|
||||
DPAD_EMULATION_LAST
|
||||
};
|
||||
|
||||
enum {
|
||||
AKEYCODE_ESCAPE = 111,
|
||||
AKEYCODE_BREAK = 121,
|
||||
@ -118,10 +126,10 @@ static void setup_keycode_lut(unsigned port, unsigned id)
|
||||
return;
|
||||
}
|
||||
|
||||
//not yet bound - connected - do so now
|
||||
|
||||
char name_buf[256];
|
||||
|
||||
g_settings.input.dpad_emulation[port] = DPAD_EMULATION_LSTICK;
|
||||
|
||||
get_device_name(name_buf, sizeof(name_buf), id);
|
||||
RARCH_LOG("Device %d: %s, port: %d.\n", id, name_buf, port);
|
||||
|
||||
@ -249,10 +257,11 @@ static void setup_keycode_lut(unsigned port, unsigned id)
|
||||
else if (strstr(name_buf, "PLAYSTATION(R)3"))
|
||||
{
|
||||
snprintf(msg, sizeof(msg), "RetroPad #%d is: DualShock3/Sixaxis.\n", port);
|
||||
//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);
|
||||
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_A] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
||||
keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
||||
@ -384,7 +393,7 @@ static void android_input_poll(void *data)
|
||||
char msg[128];
|
||||
#endif
|
||||
|
||||
if(type_event == AINPUT_EVENT_TYPE_MOTION)
|
||||
if(type_event == AINPUT_EVENT_TYPE_MOTION && (g_settings.input.dpad_emulation[state_id] != DPAD_EMULATION_NONE))
|
||||
{
|
||||
action = AMotionEvent_getAction(event);
|
||||
size_t motion_pointer = action >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
|
||||
@ -427,7 +436,7 @@ static void android_input_poll(void *data)
|
||||
snprintf(msg, sizeof(msg), "Pad %d : x = %.2f, y = %.2f, src %d.\n", state_id, x, y, source);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
else if (type_event == AINPUT_EVENT_TYPE_KEY)
|
||||
{
|
||||
int keycode = AKeyEvent_getKeyCode(event);
|
||||
|
||||
|
@ -173,9 +173,9 @@ struct settings
|
||||
struct retro_keybind binds[MAX_PLAYERS][RARCH_BIND_LIST_END];
|
||||
float axis_threshold;
|
||||
int joypad_map[MAX_PLAYERS];
|
||||
unsigned dpad_emulation[MAX_PLAYERS];
|
||||
#ifdef RARCH_CONSOLE
|
||||
unsigned currently_selected_controller_no;
|
||||
unsigned dpad_emulation[MAX_PLAYERS];
|
||||
unsigned map_dpad_to_stick;
|
||||
unsigned device[MAX_PLAYERS];
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user