Fix analog calculation

Analog read would overflow and become -1 instead of 128 when analog
reached maximum value.

Signed-off-by: Saggi Mizrahi <ficoos@gmail.com>
This commit is contained in:
Saggi Mizrahi 2012-08-03 19:15:16 -04:00
parent 03fcaf14d4
commit eb25ec04ca

View File

@ -84,7 +84,7 @@ void InputDevice_DualAnalog::UpdateInput(const void *data)
{
int32 tmp;
tmp = 32768 + MDFN_de32lsb((const uint8 *)data + stick * 16 + axis * 8 + 4) - ((int32)MDFN_de32lsb((const uint8 *)data + stick * 16 + axis * 8 + 8) * 32768 / 32767);
tmp = 32768 + MDFN_de32lsb((const uint8 *)data + stick * 16 + axis * 8 + 4) - ((int32)MDFN_de32lsb((const uint8 *)data + stick * 16 + axis * 8 + 8) * 32768 / 32768);
tmp >>= 8;
axes[stick][axis] = tmp;