Potential logic bug fixes

This commit is contained in:
Lior Halphon 2022-01-16 00:50:08 +02:00
parent dbe9035c55
commit 3133687e68
2 changed files with 6 additions and 1 deletions

View File

@ -1613,6 +1613,7 @@ void GB_display_run(GB_gameboy_t *gb, unsigned cycles, bool force)
if (unlikely(GB_is_dma_active(gb))) {
unsigned offset = cycles - gb->display_cycles; // Time passed in 8MHz ticks
cycles = gb->display_cycles;
if (offset) {
if (!gb->cgb_double_speed) {
offset >>= 1; // Convert to T-cycles

View File

@ -292,7 +292,11 @@ static uint8_t read_mbc_rom(GB_gameboy_t *gb, uint16_t addr)
static uint8_t read_vram(GB_gameboy_t *gb, uint16_t addr)
{
GB_display_sync(gb);
if (!GB_is_dma_active(gb)) {
/* Prevent syncing from a DMA read. Batching doesn't happen during DMA anyway. */
GB_display_sync(gb);
}
if (unlikely(gb->vram_read_blocked)) {
return 0xFF;
}