GBA BIOS: Fix ArcTan sign in HLE BIOS

This commit is contained in:
Vicki Pfau 2017-04-20 17:53:01 -07:00
parent f437ba1806
commit e37091595b
2 changed files with 3 additions and 2 deletions

View File

@ -19,6 +19,7 @@ Bugfixes:
- SDL: Fix race condition with audio thread when starting - SDL: Fix race condition with audio thread when starting
- FFmpeg: Fix overflow and general issues with audio encoding - FFmpeg: Fix overflow and general issues with audio encoding
- Qt: Fix crash when changing audio settings after a game is closed - Qt: Fix crash when changing audio settings after a game is closed
- GBA BIOS: Fix ArcTan sign in HLE BIOS
Misc: Misc:
- Qt: Improved HiDPI support - Qt: Improved HiDPI support
- Feature: Support ImageMagick 7 - Feature: Support ImageMagick 7

View File

@ -270,7 +270,7 @@ static void _Div(struct GBA* gba, int32_t num, int32_t denom) {
} }
} }
static int16_t _ArcTan(int16_t i) { static int16_t _ArcTan(int32_t i) {
int32_t a = -((i * i) >> 14); int32_t a = -((i * i) >> 14);
int32_t b = ((0xA9 * a) >> 14) + 0x390; int32_t b = ((0xA9 * a) >> 14) + 0x390;
b = ((b * a) >> 14) + 0x91C; b = ((b * a) >> 14) + 0x91C;
@ -355,7 +355,7 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
cpu->gprs[0] = sqrt((uint32_t) cpu->gprs[0]); cpu->gprs[0] = sqrt((uint32_t) cpu->gprs[0]);
break; break;
case 0x9: case 0x9:
cpu->gprs[0] = (uint16_t) _ArcTan(cpu->gprs[0]); cpu->gprs[0] = _ArcTan(cpu->gprs[0]);
break; break;
case 0xA: case 0xA:
cpu->gprs[0] = (uint16_t) _ArcTan2(cpu->gprs[0], cpu->gprs[1]); cpu->gprs[0] = (uint16_t) _ArcTan2(cpu->gprs[0], cpu->gprs[1]);