all repos — mgba @ 965f2745398f08f115de731fbcf50d4be52a49ac

mGBA Game Boy Advance Emulator

GB Video: Fix GBC background masking
Jeffrey Pfau jeffrey@endrift.com
Mon, 15 Feb 2016 22:53:02 -0800
commit

965f2745398f08f115de731fbcf50d4be52a49ac

parent

f33a70a9dc2503a3e308c53037efced7e2044913

1 files changed, 2 insertions(+), 2 deletions(-)

jump to
M src/gb/renderers/software.csrc/gb/renderers/software.c

@@ -282,7 +282,7 @@ if (GBRegisterLCDCIsObjSize(renderer->lcdc) && y - obj->y >= -8) {

++tileOffset; } } - uint8_t mask = GBObjAttributesIsPriority(obj->attr) ? 0 : 0x20; + uint8_t mask = GBObjAttributesIsPriority(obj->attr) ? ~0x1C : ~0x3F; int p; if (renderer->model >= GB_MODEL_CGB) { p = (GBObjAttributesGetCGBPalette(obj->attr) + 8) * 4;

@@ -306,7 +306,7 @@ uint8_t tileDataUpper = data[(objTile * 8 + bottomY) * 2 + 1];

tileDataUpper >>= bottomX; tileDataLower >>= bottomX; color_t current = renderer->row[x]; - if (((tileDataUpper | tileDataLower) & 1) && current <= mask) { + if (((tileDataUpper | tileDataLower) & 1) && !(current & mask)) { renderer->row[x] = p | ((tileDataUpper & 1) << 1) | (tileDataLower & 1); } }