SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit b1187919d3c4526697d54d3e7c1287c15da73944 parent 2c71ca789f66b25910bd729d202948ed3e3fb78e Author: Lior Halphon <LIJI32@gmail.com> Date: Sun, 9 Jan 2022 16:43:32 +0200 Fixed a bug with the joy_accessed API Diffstat:
| M | Core/joypad.c | 10 | ++++++++-- |
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/Core/joypad.c b/Core/joypad.c @@ -59,7 +59,10 @@ void GB_update_joyp(GB_gameboy_t *gb) /* Todo: This assumes the keys *always* bounce, which is incorrect when emulating an SGB */ 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. */ - gb->io_registers[GB_IO_IF] |= 0x10; + if (!(gb->io_registers[GB_IO_IF] & 0x10)) { + gb->joyp_accessed = true; + gb->io_registers[GB_IO_IF] |= 0x10; + } } gb->io_registers[GB_IO_JOYP] |= 0xC0; @@ -72,7 +75,10 @@ void GB_icd_set_joyp(GB_gameboy_t *gb, uint8_t value) gb->io_registers[GB_IO_JOYP] |= value & 0xF; if (previous_state & ~(gb->io_registers[GB_IO_JOYP] & 0xF)) { - gb->io_registers[GB_IO_IF] |= 0x10; + if (!(gb->io_registers[GB_IO_IF] & 0x10)) { + gb->joyp_accessed = true; + gb->io_registers[GB_IO_IF] |= 0x10; + } } gb->io_registers[GB_IO_JOYP] |= 0xC0; }
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.