all repos — mgba @ 8ac697f31085caab31dc7652aabfac876a452b25

mGBA Game Boy Advance Emulator

GBA BIOS: Fix MidiKey2Freq BIOS reads
Jeffrey Pfau jeffrey@endrift.com
Tue, 11 Oct 2016 22:01:13 -0700
commit

8ac697f31085caab31dc7652aabfac876a452b25

parent

4cbcc41e35665f7b5fcd5fd0f911c80a0efbe81c

2 files changed, 6 insertions(+), 0 deletions(-)

jump to
M CHANGESCHANGES

@@ -5,6 +5,7 @@ Bugfixes:

- LR35902: Fix core never exiting with certain event patterns - GB Timer: Improve DIV reset behavior - GBA Memory: Fix misaligned BIOS reads + - GBA BIOS: Fix MidiKey2Freq BIOS reads Misc: - SDL: Remove scancode key input - GBA Video: Clean up unused timers
M src/gba/bios.csrc/gba/bios.c

@@ -244,7 +244,12 @@ }

static void _MidiKey2Freq(struct GBA* gba) { struct ARMCore* cpu = gba->cpu; + + int oldRegion = gba->memory.activeRegion; + gba->memory.activeRegion = REGION_BIOS; uint32_t key = cpu->memory.load32(cpu, cpu->gprs[0] + 4, 0); + gba->memory.activeRegion = oldRegion; + cpu->gprs[0] = key / powf(2, (180.f - cpu->gprs[1] - cpu->gprs[2] / 256.f) / 12.f); }