Fixes to safe reads, closes #422
This commit is contained in:
parent
5127cb0022
commit
eaccd792ed
@ -434,7 +434,9 @@ static uint8_t read_high_memory(GB_gameboy_t *gb, uint16_t addr)
|
|||||||
|
|
||||||
if (addr < 0xFF00) {
|
if (addr < 0xFF00) {
|
||||||
if (gb->oam_write_blocked && !GB_is_cgb(gb)) {
|
if (gb->oam_write_blocked && !GB_is_cgb(gb)) {
|
||||||
|
if (!gb->disable_oam_corruption) {
|
||||||
GB_trigger_oam_bug_read(gb, addr);
|
GB_trigger_oam_bug_read(gb, addr);
|
||||||
|
}
|
||||||
return 0xff;
|
return 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,6 +707,9 @@ uint8_t GB_read_memory(GB_gameboy_t *gb, uint16_t addr)
|
|||||||
|
|
||||||
uint8_t GB_safe_read_memory(GB_gameboy_t *gb, uint16_t addr)
|
uint8_t GB_safe_read_memory(GB_gameboy_t *gb, uint16_t addr)
|
||||||
{
|
{
|
||||||
|
if (unlikely(addr == 0xFF00 + GB_IO_JOYP)) {
|
||||||
|
return gb->io_registers[GB_IO_JOYP];
|
||||||
|
}
|
||||||
gb->disable_oam_corruption = true;
|
gb->disable_oam_corruption = true;
|
||||||
uint8_t data = read_map[addr >> 12](gb, addr);
|
uint8_t data = read_map[addr >> 12](gb, addr);
|
||||||
gb->disable_oam_corruption = false;
|
gb->disable_oam_corruption = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user