From 1b81c08de8fd10035d5ae060b81747c6b880c906 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 24 Mar 2021 18:58:40 -0700 Subject: [PATCH] GB Video: Don't rendering negative batches --- CHANGES | 1 + src/gb/renderers/software.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index cafec635b..330f9d992 100644 --- a/CHANGES +++ b/CHANGES @@ -89,6 +89,7 @@ Other fixes: - GB Video: Fix SGB video logs - GB Video: Discard SGB packets in non-SGB mVLs - GB Video: Fix deserializing negative LX state + - GB Video: Don't rendering negative batches - GBA: Fix loading multiboot ELF files (fixes mgba.io/i/1949) - GBA: Fix loading subsequent save files (fixes mgba.io/i/2067) - mGUI: Don't attempt to preload files larger than can fit in RAM diff --git a/src/gb/renderers/software.c b/src/gb/renderers/software.c index 542aec901..f023d99b4 100644 --- a/src/gb/renderers/software.c +++ b/src/gb/renderers/software.c @@ -565,6 +565,9 @@ static void GBVideoSoftwareRendererDrawRange(struct GBVideoRenderer* renderer, i struct GBVideoSoftwareRenderer* softwareRenderer = (struct GBVideoSoftwareRenderer*) renderer; softwareRenderer->lastY = y; softwareRenderer->lastX = endX; + if (startX >= endX) { + return; + } uint8_t* maps = &softwareRenderer->d.vram[GB_BASE_MAP]; if (GBRegisterLCDCIsTileMap(softwareRenderer->lcdc)) { maps += GB_SIZE_MAP;