Fixed a bug with the joy_accessed API
This commit is contained in:
parent
2c71ca789f
commit
b1187919d3
@ -59,8 +59,11 @@ void GB_update_joyp(GB_gameboy_t *gb)
|
|||||||
/* Todo: This assumes the keys *always* bounce, which is incorrect when emulating an SGB */
|
/* Todo: This assumes the keys *always* bounce, which is incorrect when emulating an SGB */
|
||||||
if (previous_state != (gb->io_registers[GB_IO_JOYP] & 0xF)) {
|
if (previous_state != (gb->io_registers[GB_IO_JOYP] & 0xF)) {
|
||||||
/* The joypad interrupt DOES occur on CGB (Tested on CGB-E), unlike what some documents say. */
|
/* The joypad interrupt DOES occur on CGB (Tested on CGB-E), unlike what some documents say. */
|
||||||
|
if (!(gb->io_registers[GB_IO_IF] & 0x10)) {
|
||||||
|
gb->joyp_accessed = true;
|
||||||
gb->io_registers[GB_IO_IF] |= 0x10;
|
gb->io_registers[GB_IO_IF] |= 0x10;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gb->io_registers[GB_IO_JOYP] |= 0xC0;
|
gb->io_registers[GB_IO_JOYP] |= 0xC0;
|
||||||
}
|
}
|
||||||
@ -72,8 +75,11 @@ void GB_icd_set_joyp(GB_gameboy_t *gb, uint8_t value)
|
|||||||
gb->io_registers[GB_IO_JOYP] |= value & 0xF;
|
gb->io_registers[GB_IO_JOYP] |= value & 0xF;
|
||||||
|
|
||||||
if (previous_state & ~(gb->io_registers[GB_IO_JOYP] & 0xF)) {
|
if (previous_state & ~(gb->io_registers[GB_IO_JOYP] & 0xF)) {
|
||||||
|
if (!(gb->io_registers[GB_IO_IF] & 0x10)) {
|
||||||
|
gb->joyp_accessed = true;
|
||||||
gb->io_registers[GB_IO_IF] |= 0x10;
|
gb->io_registers[GB_IO_IF] |= 0x10;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
gb->io_registers[GB_IO_JOYP] |= 0xC0;
|
gb->io_registers[GB_IO_JOYP] |= 0xC0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user