Add an API to allow illegal inputs
This commit is contained in:
parent
eaccd792ed
commit
cdc3321c36
@ -657,6 +657,7 @@ struct GB_gameboy_internal_s {
|
|||||||
bool objects_disabled;
|
bool objects_disabled;
|
||||||
bool background_disabled;
|
bool background_disabled;
|
||||||
bool joyp_accessed;
|
bool joyp_accessed;
|
||||||
|
bool illegal_inputs_allowed;
|
||||||
|
|
||||||
/* Timing */
|
/* Timing */
|
||||||
uint64_t last_sync;
|
uint64_t last_sync;
|
||||||
|
@ -30,11 +30,13 @@ void GB_update_joyp(GB_gameboy_t *gb)
|
|||||||
gb->io_registers[GB_IO_JOYP] |= (!gb->keys[current_player][i]) << i;
|
gb->io_registers[GB_IO_JOYP] |= (!gb->keys[current_player][i]) << i;
|
||||||
}
|
}
|
||||||
/* Forbid pressing two opposing keys, this breaks a lot of games; even if it's somewhat possible. */
|
/* 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)) {
|
if (likely(!gb->illegal_inputs_allowed)) {
|
||||||
gb->io_registers[GB_IO_JOYP] |= 2;
|
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;
|
if (!(gb->io_registers[GB_IO_JOYP] & 4)) {
|
||||||
|
gb->io_registers[GB_IO_JOYP] |= 8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -131,3 +133,8 @@ void GB_clear_joyp_accessed(GB_gameboy_t *gb)
|
|||||||
{
|
{
|
||||||
gb->joyp_accessed = false;
|
gb->joyp_accessed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GB_set_allow_illegal_inputs(GB_gameboy_t *gb, bool allow)
|
||||||
|
{
|
||||||
|
gb->illegal_inputs_allowed = allow;
|
||||||
|
}
|
||||||
|
@ -36,6 +36,7 @@ void GB_set_key_mask_for_player(GB_gameboy_t *gb, GB_key_mask_t mask, unsigned p
|
|||||||
void GB_icd_set_joyp(GB_gameboy_t *gb, uint8_t value);
|
void GB_icd_set_joyp(GB_gameboy_t *gb, uint8_t value);
|
||||||
bool GB_get_joyp_accessed(GB_gameboy_t *gb);
|
bool GB_get_joyp_accessed(GB_gameboy_t *gb);
|
||||||
void GB_clear_joyp_accessed(GB_gameboy_t *gb);
|
void GB_clear_joyp_accessed(GB_gameboy_t *gb);
|
||||||
|
void GB_set_allow_illegal_inputs(GB_gameboy_t *gb, bool allow);
|
||||||
|
|
||||||
|
|
||||||
#ifdef GB_INTERNAL
|
#ifdef GB_INTERNAL
|
||||||
|
Loading…
Reference in New Issue
Block a user