mirror of
https://github.com/libretro/Genesis-Plus-GX.git
synced 2024-11-23 16:29:40 +00:00
[Wii] fixed back support for third-party Classic Controllers reporting invalid analog sticks calibration data
This commit is contained in:
parent
1e3d094860
commit
a8645fb051
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX input support
|
* Genesis Plus GX input support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2018)
|
* Copyright Eke-Eke (2007-2019)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
@ -523,6 +523,15 @@ static int wpad_StickX(WPADData *data, u8 right)
|
|||||||
int max = js->max.x;
|
int max = js->max.x;
|
||||||
int center = js->center.x;
|
int center = js->center.x;
|
||||||
|
|
||||||
|
/* some 3rd party controllers return invalid analog sticks calibration data */
|
||||||
|
if ((min >= center) || (max <= center))
|
||||||
|
{
|
||||||
|
/* force default calibration settings */
|
||||||
|
min = js->min.x = 0;
|
||||||
|
max = js->max.x = right ? 32 : 64;
|
||||||
|
center = js->center.x = right ? 16 : 32;
|
||||||
|
}
|
||||||
|
|
||||||
/* value returned could be above calibration limits */
|
/* value returned could be above calibration limits */
|
||||||
if (pos > max) return 127;
|
if (pos > max) return 127;
|
||||||
if (pos < min) return -128;
|
if (pos < min) return -128;
|
||||||
@ -572,6 +581,15 @@ static int wpad_StickY(WPADData *data, u8 right)
|
|||||||
int max = js->max.y;
|
int max = js->max.y;
|
||||||
int center = js->center.y;
|
int center = js->center.y;
|
||||||
|
|
||||||
|
/* some 3rd party controllers return invalid analog sticks calibration data */
|
||||||
|
if ((min >= center) || (max <= center))
|
||||||
|
{
|
||||||
|
/* force default calibration settings */
|
||||||
|
min = js->min.y = 0;
|
||||||
|
max = js->max.y = right ? 32 : 64;
|
||||||
|
center = js->center.y = right ? 16 : 32;
|
||||||
|
}
|
||||||
|
|
||||||
/* value returned could be above calibration limits */
|
/* value returned could be above calibration limits */
|
||||||
if (pos > max) return 127;
|
if (pos > max) return 127;
|
||||||
if (pos < min) return -128;
|
if (pos < min) return -128;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX input support
|
* Genesis Plus GX input support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2018)
|
* Copyright Eke-Eke (2007-2019)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
|
Loading…
Reference in New Issue
Block a user