Match controller left stick ranges to N64 (#32)

This commit is contained in:
Nadia Holmquist Pedersen 2021-02-19 23:33:54 +01:00 committed by GitHub
parent 5e8cedf304
commit 73a093348e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View file

@ -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;
}
}

View file

@ -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;
}