pandory500: fix _second_ udev bug
After removing all the extra axes it appears that the remaining D-PAD Y-axis occasionally triggers a D-PAD X-axis movement. This commit detects these values and normalises them to 0.
This commit is contained in:
parent
3eca30e6dc
commit
a474155711
2 changed files with 14 additions and 0 deletions
BIN
src/joystick/linux/.SDL_sysjoystick.c.swp
Normal file
BIN
src/joystick/linux/.SDL_sysjoystick.c.swp
Normal file
Binary file not shown.
|
@ -920,6 +920,9 @@ AxisCorrect(SDL_Joystick * joystick, int which, int value)
|
||||||
{
|
{
|
||||||
struct axis_correct *correct;
|
struct axis_correct *correct;
|
||||||
|
|
||||||
|
SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick);
|
||||||
|
char pandoryGUID[1024];
|
||||||
|
|
||||||
correct = &joystick->hwdata->abs_correct[which];
|
correct = &joystick->hwdata->abs_correct[which];
|
||||||
if (correct->used) {
|
if (correct->used) {
|
||||||
value *= 2;
|
value *= 2;
|
||||||
|
@ -941,6 +944,17 @@ AxisCorrect(SDL_Joystick * joystick, int which, int value)
|
||||||
if (value > 32767)
|
if (value > 32767)
|
||||||
return 32767;
|
return 32767;
|
||||||
|
|
||||||
|
|
||||||
|
// Pandory500 retrogames-udev-bug - correct spurious axis movement
|
||||||
|
SDL_JoystickGetGUIDString(joystick->hwdata->guid, pandoryGUID, sizeof(pandoryGUID));
|
||||||
|
if ( strcmp(pandoryGUID, "03000000591c00002600000010010000") == 0 // 'Retro Games LTD THEGamepad'
|
||||||
|
|| strcmp(pandoryGUID, "03000000591c00002300000010010000") == 0 // ' THEC64 Joystick THEC64 Joystick '
|
||||||
|
) {
|
||||||
|
if (value == 127 || value == 255) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue