all repos — mgba @ 0080fab314192b5b24beb338f2f83fbe9f3c1e82

mGBA Game Boy Advance Emulator

GB Video: Revert video IRQ change, disable OAM IRQ if Hblank IRQ is enabled
Jeffrey Pfau jeffrey@endrift.com
Fri, 20 May 2016 19:04:06 -0700
commit

0080fab314192b5b24beb338f2f83fbe9f3c1e82

parent

feb5ad226090f844b4283c4f7f18f25a95c9071b

1 files changed, 1 insertions(+), 10 deletions(-)

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

@@ -90,7 +90,6 @@ if (video->nextEvent != INT_MAX) {

video->nextMode -= video->eventDiff; } video->nextEvent = INT_MAX; - video->p->memory.io[REG_IF] &= ~(1 << GB_IRQ_LCDSTAT); GBVideoProcessDots(video); if (video->nextMode <= 0) { int lyc = video->p->memory.io[REG_LYC];

@@ -105,9 +104,8 @@ video->stat = GBRegisterSTATSetLYC(video->stat, lyc == video->ly);

if (video->ly < GB_VIDEO_VERTICAL_PIXELS) { video->nextMode = GB_VIDEO_MODE_2_LENGTH; video->mode = 2; - if (GBRegisterSTATIsOAMIRQ(video->stat)) { + if (!GBRegisterSTATIsHblankIRQ(video->stat) && GBRegisterSTATIsOAMIRQ(video->stat)) { video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT); - video->nextEvent = 4; } } else { video->nextMode = GB_VIDEO_HORIZONTAL_LENGTH;

@@ -137,11 +135,9 @@ if (GBRegisterSTATIsVblankIRQ(video->stat) || GBRegisterSTATIsOAMIRQ(video->stat)) {

video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT); } video->p->memory.io[REG_IF] |= (1 << GB_IRQ_VBLANK); - video->nextEvent = 4; } if (GBRegisterSTATIsLYCIRQ(video->stat) && lyc == video->ly) { video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT); - video->nextEvent = 4; } GBUpdateIRQs(video->p); break;

@@ -155,7 +151,6 @@ video->nextMode = GB_VIDEO_MODE_2_LENGTH;

video->mode = 2; if (GBRegisterSTATIsOAMIRQ(video->stat)) { video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT); - video->nextEvent = 4; GBUpdateIRQs(video->p); } break;

@@ -173,7 +168,6 @@

video->stat = GBRegisterSTATSetLYC(video->stat, lyc == video->p->memory.io[REG_LY]); if (GBRegisterSTATIsLYCIRQ(video->stat) && lyc == video->p->memory.io[REG_LY]) { video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT); - video->nextEvent = 4; GBUpdateIRQs(video->p); } if (video->p->memory.mbcType == GB_MBC7 && video->p->memory.rotation && video->p->memory.rotation->sample) {

@@ -193,7 +187,6 @@ video->nextMode = GB_VIDEO_MODE_0_LENGTH_BASE - video->objMax * 12;

video->mode = 0; if (GBRegisterSTATIsHblankIRQ(video->stat)) { video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT); - video->nextEvent = 4; GBUpdateIRQs(video->p); } if (video->ly < GB_VIDEO_VERTICAL_PIXELS && video->p->memory.isHdma && video->p->memory.io[REG_HDMA5] != 0xFF) {

@@ -268,7 +261,6 @@ video->stat = GBRegisterSTATSetMode(video->stat, 2);

video->stat = GBRegisterSTATSetLYC(video->stat, video->ly == video->p->memory.io[REG_LYC]); if (GBRegisterSTATIsLYCIRQ(video->stat) && video->ly == video->p->memory.io[REG_LYC]) { video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT); - video->nextEvent = 4; GBUpdateIRQs(video->p); } video->p->memory.io[REG_STAT] = video->stat;

@@ -293,7 +285,6 @@ void GBVideoWriteSTAT(struct GBVideo* video, GBRegisterSTAT value) {

video->stat = (video->stat & 0x7) | (value & 0x78); if (video->p->model == GB_MODEL_DMG && video->mode == 1) { video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT); - video->nextEvent = 4; GBUpdateIRQs(video->p); } }