mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-20 07:42:38 +00:00
(input/connect) Cleanup axis functions
This commit is contained in:
parent
2efb1600a8
commit
b4be9b7e03
@ -81,7 +81,9 @@ static int16_t hidpad_nesusb_get_axis(void *data, unsigned axis)
|
||||
val = device->data[4 + axis];
|
||||
val = (val << 8) - 0x8000;
|
||||
|
||||
return (abs(val) > 0x1000) ? val : 0;
|
||||
if (abs(val) > 0x1000)
|
||||
return val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hidpad_nesusb_packet_handler(void *data, uint8_t *packet, uint16_t size)
|
||||
|
@ -98,7 +98,9 @@ static int16_t hidpad_ps2adapter_get_axis(void *data, unsigned axis)
|
||||
|
||||
val = (val << 8) - 0x8000;
|
||||
|
||||
return (abs(val) > 0x1000) ? val : 0;
|
||||
if (abs(val) > 0x1000)
|
||||
return val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define PS2_H_GET(a) (a & 0x0F) /*HAT MASK = 0x0F */
|
||||
|
@ -154,7 +154,9 @@ static int16_t hidpad_ps3_get_axis(void *data, unsigned axis)
|
||||
val = device->data[7 + axis];
|
||||
val = (val << 8) - 0x8000;
|
||||
|
||||
return (abs(val) > 0x1000) ? val : 0;
|
||||
if (abs(val) > 0x1000)
|
||||
return val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hidpad_ps3_packet_handler(void *data,
|
||||
|
@ -99,7 +99,10 @@ static int16_t hidpad_psxadapter_get_axis(void *data, unsigned axis)
|
||||
|
||||
val = (val << 8) - 0x8000;
|
||||
|
||||
return (abs(val) > 0x1000) ? val : 0; /* hard coded deadzone */
|
||||
/* hard coded deadzone */
|
||||
if (abs(val) > 0x1000)
|
||||
return val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define PSX_H_GET(a) (a & 0x0F) /*HAT MASK = 0x0F */
|
||||
|
@ -97,15 +97,17 @@ static int16_t hidpad_retrode_get_axis(void *data, unsigned axis)
|
||||
|
||||
/* map Retrode values to a known gamepad (VID=0x0079, PID=0x0011) */
|
||||
if (val == 0x9C)
|
||||
val = 0x00; /* axis=0 left, axis=1 up */
|
||||
val = 0x00; /* axis=0 left, axis=1 up */
|
||||
else if (val == 0x64)
|
||||
val = 0xFF; /* axis=0 right, axis=1 down */
|
||||
val = 0xFF; /* axis=0 right, axis=1 down */
|
||||
else
|
||||
val = 0x7F; /* no button pressed */
|
||||
val = 0x7F; /* no button pressed */
|
||||
|
||||
val = (val << 8) - 0x8000;
|
||||
|
||||
return (abs(val) > 0x1000) ? val : 0;
|
||||
if (abs(val) > 0x1000)
|
||||
return val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hidpad_retrode_packet_handler(void *data, uint8_t *packet, uint16_t size)
|
||||
|
@ -82,7 +82,9 @@ static int16_t hidpad_snesusb_get_axis(void *data, unsigned axis)
|
||||
val = device->data[1 + axis];
|
||||
val = (val << 8) - 0x8000;
|
||||
|
||||
return (abs(val) > 0x1000) ? val : 0;
|
||||
if (abs(val) > 0x1000)
|
||||
return val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hidpad_snesusb_packet_handler(void *data, uint8_t *packet, uint16_t size)
|
||||
|
@ -95,7 +95,9 @@ static int16_t hidpad_wiiugca_get_axis(void *data, unsigned axis)
|
||||
else
|
||||
val = (val << 8) - 0x8000;
|
||||
|
||||
return (abs(val) > 0x1000) ? val : 0;
|
||||
if (abs(val) > 0x1000)
|
||||
return val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hidpad_wiiugca_packet_handler(void *data, uint8_t *packet, uint16_t size)
|
||||
|
Loading…
x
Reference in New Issue
Block a user