diff --git a/src/gba/renderers/video-glsl.c b/src/gba/renderers/video-glsl.c index b7c6cb0ff..1b5f3a0c6 100644 --- a/src/gba/renderers/video-glsl.c +++ b/src/gba/renderers/video-glsl.c @@ -35,10 +35,19 @@ static const GLchar* _fragmentShader = "vec4 backgroundMode0(int bgcnt, int hofs, int vofs) {\n" " int charBase = ((bgcnt / 4) & 3) * 8192;\n" " int screenBase = ((bgcnt / 256) & 0x1F) * 1024;\n" + " int size = bgcnt >> 14;\n" " int localX = hofs + int(x);\n" " int localY = vofs + int(y);\n" " int xBase = localX & 0xF8;\n" " int yBase = localY & 0xF8;\n" + " if (size == 1) {\n" + " xBase += (localX & 0x100) << 5;\n" + " } else if (size == 2) {\n" + " yBase += localY & 0x100;\n" + " } else if (size == 3) {\n" + " xBase += (localX & 0x100) << 5;\n" + " yBase += (localY & 0x100) << 1;\n" + " }\n" " screenBase = screenBase + (xBase / 8) + (yBase * 4);\n" " int mapData = DESERIALIZE(texture2D(vram, VRAM_INDEX(screenBase)));\n" " charBase = charBase + ((mapData & 0x3FF) * 16) + (localX & 0x4) / 4 + (localY & 0x7) * 2;\n"