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:
dajoho 2023-08-15 22:57:26 +02:00
parent 3eca30e6dc
commit a474155711
2 changed files with 14 additions and 0 deletions

Binary file not shown.

View file

@ -920,6 +920,9 @@ AxisCorrect(SDL_Joystick * joystick, int which, int value)
{
struct axis_correct *correct;
SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick);
char pandoryGUID[1024];
correct = &joystick->hwdata->abs_correct[which];
if (correct->used) {
value *= 2;
@ -941,6 +944,17 @@ AxisCorrect(SDL_Joystick * joystick, int which, int value)
if (value > 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;
}