mirror of https://github.com/mgba-emu/mgba.git
GB Video: Prevent dot clock from going negative
This commit is contained in:
parent
c292f7ea93
commit
54cd85d236
|
@ -257,6 +257,9 @@ void GBVideoProcessDots(struct GBVideo* video) {
|
||||||
video->x = video->dotCounter + video->eventDiff + (video->p->cpu->cycles >> video->p->doubleSpeed);
|
video->x = video->dotCounter + video->eventDiff + (video->p->cpu->cycles >> video->p->doubleSpeed);
|
||||||
if (video->x > GB_VIDEO_HORIZONTAL_PIXELS) {
|
if (video->x > GB_VIDEO_HORIZONTAL_PIXELS) {
|
||||||
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) {
|
if (video->x == GB_VIDEO_HORIZONTAL_PIXELS) {
|
||||||
video->dotCounter = INT_MIN;
|
video->dotCounter = INT_MIN;
|
||||||
|
|
Loading…
Reference in New Issue