diff --git a/src/gb/renderers/software.c b/src/gb/renderers/software.c index dff2089f6..9074c01fa 100644 --- a/src/gb/renderers/software.c +++ b/src/gb/renderers/software.c @@ -175,6 +175,9 @@ static void GBVideoSoftwareRendererDrawBackground(struct GBVideoSoftwareRenderer } int topY = (((y + sy) >> 3) & 0x1F) * 0x20; int bottomY = (y + sy) & 7; + if (startX < 0) { + startX = 0; + } int x; for (x = startX; x < endX; ++x) { int topX = ((x + sx) >> 3) & 0x1F; @@ -204,6 +207,9 @@ static void GBVideoSoftwareRendererDrawObj(struct GBVideoSoftwareRenderer* rende if (obj->x - 8 > startX) { startX = obj->x - 8; } + if (startX < 0) { + startX = 0; + } uint8_t* data = renderer->d.vram; int tileOffset = 0; int bottomY;