all repos — mgba @ 54cd85d236f149c66994dd1bc6334ac63effc058

mGBA Game Boy Advance Emulator

GB Video: Prevent dot clock from going negative
Jeffrey Pfau jeffrey@endrift.com
Mon, 12 Sep 2016 20:15:40 -0700
commit

54cd85d236f149c66994dd1bc6334ac63effc058

parent

c292f7ea93a0d653b56891bf1adb318ab9ac3063

1 files changed, 3 insertions(+), 0 deletions(-)

jump to
M src/gb/video.csrc/gb/video.c

@@ -257,6 +257,9 @@ int oldX = video->x;

video->x = video->dotCounter + video->eventDiff + (video->p->cpu->cycles >> video->p->doubleSpeed); if (video->x > GB_VIDEO_HORIZONTAL_PIXELS) { video->x = GB_VIDEO_HORIZONTAL_PIXELS; + } else if (video->x < 0) { + mLOG(GB, FATAL, "Video dot clock went negative!"); + video->x = oldX; } if (video->x == GB_VIDEO_HORIZONTAL_PIXELS) { video->dotCounter = INT_MIN;