Permalink
Browse files

GB Video: Prevent dot clock from going negative

  • Loading branch information...
1 parent c292f7e commit 54cd85d236f149c66994dd1bc6334ac63effc058 @endrift endrift committed Sep 13, 2016
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/gb/video.c
View
@@ -257,6 +257,9 @@ void GBVideoProcessDots(struct GBVideo* video) {
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;

0 comments on commit 54cd85d

Please sign in to comment.