Forbid pressing two opposing direction keys. Fixes Pocket Bomberman (U).

This commit is contained in:
Lior Halphon 2016-09-21 02:15:02 +03:00
parent 6f2b36cacb
commit bc3cab7dfa
1 changed files with 7 additions and 0 deletions

View File

@ -22,6 +22,13 @@ void GB_update_joyp(GB_gameboy_t *gb)
for (uint8_t i = 0; i < 4; i++) {
gb->io_registers[GB_IO_JOYP] |= (!gb->keys[i]) << i;
}
/* Forbid pressing two opposing keys, this breaks a lot of games; even if it's somewhat possible. */
if (!(gb->io_registers[GB_IO_JOYP] & 1)) {
gb->io_registers[GB_IO_JOYP] |= 2;
}
if (!(gb->io_registers[GB_IO_JOYP] & 4)) {
gb->io_registers[GB_IO_JOYP] |= 8;
}
break;
case 1: