Correctly emulate SGB border color 0

This commit is contained in:
Lior Halphon 2018-11-16 22:13:29 +02:00
parent e5e7ce8203
commit b698ce5d95
2 changed files with 595 additions and 588 deletions

View File

@ -393,6 +393,7 @@ void GB_sgb_render(GB_gameboy_t *gb)
}
}
if (gb->sgb->border_animation == 32) {
memcpy(&gb->sgb->border, &gb->sgb->pending_border, sizeof(gb->sgb->border));
}
@ -410,8 +411,13 @@ void GB_sgb_render(GB_gameboy_t *gb)
for (unsigned y = 0; y < 8; y++) {
for (unsigned x = 0; x < 8; x++) {
uint8_t color = gb->sgb->border.tiles[(tile & 0xFF) * 64 + (x ^ flip_x) + (y ^ flip_y) * 8] & 0xF;
if (color == 0 && gb_area) continue;
gb->screen[tile_x * 8 + x + (tile_y * 8 + y) * 0x100] = border_colors[palette * 16 + color];
if (color == 0) {
if (gb_area) continue;
gb->screen[tile_x * 8 + x + (tile_y * 8 + y) * 0x100] = colors[0];
}
else {
gb->screen[tile_x * 8 + x + (tile_y * 8 + y) * 0x100] = border_colors[color + palette * 16];
}
}
}
}

File diff suppressed because it is too large Load Diff