mirror of https://github.com/mgba-emu/mgba.git
GB: Improve accuracy of video timings
This commit is contained in:
parent
273d2db575
commit
98922b7a87
|
@ -179,11 +179,11 @@ int32_t GBVideoProcessEvents(struct GBVideo* video, int32_t cycles) {
|
||||||
video->dotCounter = 0;
|
video->dotCounter = 0;
|
||||||
video->nextEvent = GB_VIDEO_HORIZONTAL_LENGTH;
|
video->nextEvent = GB_VIDEO_HORIZONTAL_LENGTH;
|
||||||
video->x = 0;
|
video->x = 0;
|
||||||
video->nextMode = GB_VIDEO_MODE_3_LENGTH_BASE + video->objMax * 8;
|
video->nextMode = GB_VIDEO_MODE_3_LENGTH_BASE + video->objMax * 12;
|
||||||
video->mode = 3;
|
video->mode = 3;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
video->nextMode = GB_VIDEO_MODE_0_LENGTH_BASE - video->objMax * 8;
|
video->nextMode = GB_VIDEO_MODE_0_LENGTH_BASE - video->objMax * 12;
|
||||||
video->mode = 0;
|
video->mode = 0;
|
||||||
if (GBRegisterSTATIsHblankIRQ(video->stat)) {
|
if (GBRegisterSTATIsHblankIRQ(video->stat)) {
|
||||||
video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT);
|
video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT);
|
||||||
|
|
|
@ -19,9 +19,9 @@ enum {
|
||||||
GB_VIDEO_VERTICAL_TOTAL_PIXELS = GB_VIDEO_VERTICAL_PIXELS + GB_VIDEO_VBLANK_PIXELS,
|
GB_VIDEO_VERTICAL_TOTAL_PIXELS = GB_VIDEO_VERTICAL_PIXELS + GB_VIDEO_VBLANK_PIXELS,
|
||||||
|
|
||||||
// TODO: Figure out exact lengths
|
// TODO: Figure out exact lengths
|
||||||
GB_VIDEO_MODE_2_LENGTH = 85,
|
GB_VIDEO_MODE_2_LENGTH = 80,
|
||||||
GB_VIDEO_MODE_3_LENGTH_BASE = 167,
|
GB_VIDEO_MODE_3_LENGTH_BASE = 176,
|
||||||
GB_VIDEO_MODE_0_LENGTH_BASE = 204,
|
GB_VIDEO_MODE_0_LENGTH_BASE = 200,
|
||||||
|
|
||||||
GB_VIDEO_HORIZONTAL_LENGTH = GB_VIDEO_MODE_0_LENGTH_BASE + GB_VIDEO_MODE_2_LENGTH + GB_VIDEO_MODE_3_LENGTH_BASE,
|
GB_VIDEO_HORIZONTAL_LENGTH = GB_VIDEO_MODE_0_LENGTH_BASE + GB_VIDEO_MODE_2_LENGTH + GB_VIDEO_MODE_3_LENGTH_BASE,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue