diff --git a/src/gb/video.c b/src/gb/video.c index 3857ffbf5..6458f89df 100644 --- a/src/gb/video.c +++ b/src/gb/video.c @@ -552,6 +552,10 @@ void GBVideoSetPalette(struct GBVideo* video, unsigned index, uint32_t color) { void GBVideoWriteSGBPacket(struct GBVideo* video, uint8_t* data) { int i; if (!(video->sgbCommandHeader & 7)) { + if ((data[0] >> 3) > SGB_OBJ_TRN) { + video->sgbCommandHeader = 0; + return; + } video->sgbCommandHeader = data[0]; } --video->sgbCommandHeader;