mirror of
https://github.com/MorsGames/sm64plus.git
synced 2025-01-22 15:42:58 -05:00
Match controller left stick ranges to N64 (#32)
This commit is contained in:
parent
5e8cedf304
commit
73a093348e
2 changed files with 8 additions and 5 deletions
|
@ -88,9 +88,10 @@ static void controller_sdl_read(OSContPad *pad) {
|
|||
|
||||
uint32_t magnitude_sq = (uint32_t)(leftx * leftx) + (uint32_t)(lefty * lefty);
|
||||
if (magnitude_sq > (uint32_t)(DEADZONE * DEADZONE)) {
|
||||
pad->stick_x = leftx / 0x100;
|
||||
int stick_y = -lefty / 0x100;
|
||||
pad->stick_y = stick_y == 128 ? 127 : stick_y;
|
||||
// Game expects stick coordinates within -80..80
|
||||
// 32768 / 409 = ~80
|
||||
pad->stick_x = leftx / 409;
|
||||
pad->stick_y = -lefty / 409;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,10 @@ static void xinput_read(OSContPad *pad) {
|
|||
|
||||
uint32_t magnitude_sq = (uint32_t)(gp->sThumbLX * gp->sThumbLX) + (uint32_t)(gp->sThumbLY * gp->sThumbLY);
|
||||
if (magnitude_sq > (uint32_t)(DEADZONE * DEADZONE)) {
|
||||
pad->stick_x = gp->sThumbLX / 0x100;
|
||||
pad->stick_y = gp->sThumbLY / 0x100;
|
||||
// Game expects stick coordinates within -80..80
|
||||
// 32768 / 409 = ~80
|
||||
pad->stick_x = gp->sThumbLX / 409;
|
||||
pad->stick_y = gp->sThumbLY / 409;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue