mirror of https://github.com/mgba-emu/mgba.git
GB Video: Improved video timings
This commit is contained in:
parent
59e61c31ea
commit
c4cfff4581
1
CHANGES
1
CHANGES
|
@ -21,6 +21,7 @@ Misc:
|
|||
- All: Only update version info if needed
|
||||
- FFmpeg: Encoding cleanup
|
||||
- GB Memory: Initialize RAM pattern for GBC
|
||||
- GB Video: Improved video timings
|
||||
|
||||
0.5.0: (2016-09-19)
|
||||
Features:
|
||||
|
|
|
@ -110,7 +110,7 @@ int32_t GBVideoProcessEvents(struct GBVideo* video, int32_t cycles) {
|
|||
video->p->memory.io[REG_LY] = video->ly;
|
||||
video->stat = GBRegisterSTATSetLYC(video->stat, lyc == video->ly);
|
||||
if (video->ly < GB_VIDEO_VERTICAL_PIXELS) {
|
||||
video->nextMode = GB_VIDEO_MODE_2_LENGTH;
|
||||
video->nextMode = GB_VIDEO_MODE_2_LENGTH + (video->p->memory.io[REG_SCX] & 7);
|
||||
video->mode = 2;
|
||||
if (!GBRegisterSTATIsHblankIRQ(video->stat) && GBRegisterSTATIsOAMIRQ(video->stat)) {
|
||||
video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT);
|
||||
|
@ -142,7 +142,8 @@ int32_t GBVideoProcessEvents(struct GBVideo* video, int32_t cycles) {
|
|||
if (video->ly == GB_VIDEO_VERTICAL_TOTAL_PIXELS + 1) {
|
||||
video->ly = 0;
|
||||
video->p->memory.io[REG_LY] = video->ly;
|
||||
video->nextMode = GB_VIDEO_MODE_2_LENGTH;
|
||||
// TODO: Cache SCX & 7 in case it changes during mode 2
|
||||
video->nextMode = GB_VIDEO_MODE_2_LENGTH + (video->p->memory.io[REG_SCX] & 7);
|
||||
video->mode = 2;
|
||||
if (GBRegisterSTATIsOAMIRQ(video->stat)) {
|
||||
video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT);
|
||||
|
@ -175,11 +176,12 @@ int32_t GBVideoProcessEvents(struct GBVideo* video, int32_t cycles) {
|
|||
video->dotCounter = 0;
|
||||
video->nextEvent = GB_VIDEO_HORIZONTAL_LENGTH;
|
||||
video->x = 0;
|
||||
video->nextMode = GB_VIDEO_MODE_3_LENGTH_BASE + video->objMax * 12;
|
||||
// TODO: Estimate sprite timings better
|
||||
video->nextMode = GB_VIDEO_MODE_3_LENGTH_BASE + video->objMax * 11 - (video->p->memory.io[REG_SCX] & 7);
|
||||
video->mode = 3;
|
||||
break;
|
||||
case 3:
|
||||
video->nextMode = GB_VIDEO_MODE_0_LENGTH_BASE - video->objMax * 12;
|
||||
video->nextMode = GB_VIDEO_MODE_0_LENGTH_BASE - video->objMax * 11;
|
||||
video->mode = 0;
|
||||
if (GBRegisterSTATIsHblankIRQ(video->stat)) {
|
||||
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,
|
||||
|
||||
// TODO: Figure out exact lengths
|
||||
GB_VIDEO_MODE_2_LENGTH = 78,
|
||||
GB_VIDEO_MODE_3_LENGTH_BASE = 160,
|
||||
GB_VIDEO_MODE_0_LENGTH_BASE = 218,
|
||||
GB_VIDEO_MODE_2_LENGTH = 83,
|
||||
GB_VIDEO_MODE_3_LENGTH_BASE = 158,
|
||||
GB_VIDEO_MODE_0_LENGTH_BASE = 215,
|
||||
|
||||
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