Window Y still advances if WX=166

This commit is contained in:
Lior Halphon 2020-02-24 23:59:18 +02:00
parent 7456beb7b9
commit b37a0b285a

View File

@ -1037,17 +1037,19 @@ abort_fetching_object:
/* Handle window */ /* Handle window */
/* Todo: verify timings */ /* Todo: verify timings */
if (!gb->wx_triggered && gb->wy_triggered && (gb->io_registers[GB_IO_LCDC] & 0x20)) { if (!gb->wx_triggered && gb->wy_triggered && (gb->io_registers[GB_IO_LCDC] & 0x20)) {
if (gb->io_registers[GB_IO_WX] >= 166) { if (gb->io_registers[GB_IO_WX] >= 167) {
// Too late to enable the window // Too late to enable the window
} }
else if (gb->io_registers[GB_IO_WX] == (uint8_t) (gb->position_in_line + 7) || else if (gb->io_registers[GB_IO_WX] == (uint8_t) (gb->position_in_line + 7) ||
gb->io_registers[GB_IO_WX] == (uint8_t) (gb->position_in_line + 6)) { gb->io_registers[GB_IO_WX] == (uint8_t) (gb->position_in_line + 6)) {
gb->wx_triggered = true;
gb->window_y++; gb->window_y++;
fifo_clear(&gb->bg_fifo); if (gb->io_registers[GB_IO_WX] != 166) {
gb->bg_fifo_paused = true; gb->wx_triggered = true;
gb->oam_fifo_paused = true; fifo_clear(&gb->bg_fifo);
gb->fetcher_state = 1; gb->bg_fifo_paused = true;
gb->oam_fifo_paused = true;
gb->fetcher_state = 1;
}
} }
} }