git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 4c904d11ffe3053dfa217f7b5be8acb30e9a2a36
parent aa5fc484d1d8155a3b8bbc145cf32b4c05c334a0
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Tue,  3 Dec 2024 23:34:04 +0200

Handle single-color OBP values better in the object viewer

Diffstat:
MCore/display.c10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Core/display.c b/Core/display.c @@ -2389,6 +2389,14 @@ uint8_t GB_get_oam_info(GB_gameboy_t *gb, GB_oam_info_t *dest, uint8_t *object_h if (GB_is_cgb(gb) && (flags & 0x8)) { vram_address += 0x2000; } + + uint8_t dmg_palette = gb->io_registers[palette? GB_IO_OBP1:GB_IO_OBP0]; + if (dmg_palette == 0xFF) { + dmg_palette = 0xFC; + } + else if (dmg_palette == 0x00) { + dmg_palette = 0x03; + } for (unsigned y = 0; y < *object_height; y++) { unrolled for (unsigned x = 0; x < 8; x++) { @@ -2396,7 +2404,7 @@ uint8_t GB_get_oam_info(GB_gameboy_t *gb, GB_oam_info_t *dest, uint8_t *object_h ((gb->vram[vram_address + 1] >> ((~x)&7)) & 1) << 1 ); if (!gb->cgb_mode) { - color = (gb->io_registers[palette? GB_IO_OBP1:GB_IO_OBP0] >> (color << 1)) & 3; + color = (dmg_palette >> (color << 1)) & 3; } dest[i].image[((flags & 0x20)?7-x:x) + ((flags & 0x40)?*object_height - 1 -y:y) * 8] = gb->object_palettes_rgb[palette * 4 + color]; }

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.