diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index 3ebdfd304..a0c883951 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -471,6 +471,7 @@ struct VramConfiguration { case BBGEXTPAL: return "BBGEXTPAL"; case AOBJEXTPAL: return "AOBJEXTPAL"; case BOBJEXTPAL: return "BOBJEXTPAL"; + default: return "UNHANDLED CASE"; } } @@ -1729,13 +1730,13 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val) #endif if(val & (1<<15)) { - //LOG("Main core on top\n"); + LOG("Main core on top\n"); MainScreen.offset = 0; SubScreen.offset = 192; } else { - //LOG("Main core on bottom (%04X)\n", val); + LOG("Main core on bottom\n"); MainScreen.offset = 192; SubScreen.offset = 0; } @@ -1951,14 +1952,14 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val) case REG_DISPA_DISPCAPCNT : { u32 v = (T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x64) & 0xFFFF0000) | val; - GPU_set_DISPCAPCNT(val); + GPU_set_DISPCAPCNT(v); T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x64, v); return; } case REG_DISPA_DISPCAPCNT + 2: { - u32 v = (T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x64) & 0xFFFF) | val; - GPU_set_DISPCAPCNT(val); + u32 v = (T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x64) & 0xFFFF) | ((u32)val << 16); + GPU_set_DISPCAPCNT(v); T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x64, v); return; } diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 2b7b7c069..e874bc47a 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -1815,7 +1815,7 @@ u32 NDS_exec(s32 nb) if(MMU.DMAStartTime[1][3] == 1) MMU_doDMA(3); } - else if(nds.VCount==215) + else if(nds.VCount==214) { gfx3d_VBlankEndSignal(false); } diff --git a/desmume/src/gfx3d.cpp b/desmume/src/gfx3d.cpp index 429a3c1f2..d14d74ef0 100644 --- a/desmume/src/gfx3d.cpp +++ b/desmume/src/gfx3d.cpp @@ -1343,14 +1343,24 @@ static void gfx3d_FlushFIFO() void gfx3d_glFlush(u32 v) { - gfx3d.frameCtr++; - - gfx3d_FlushFIFO(); - - //assert(!flushPending); flushPending = TRUE; gfx3d.sortmode = BIT0(v); gfx3d.wbuffer = BIT1(v); +} + +void gfx3d_VBlankSignal() +{ + //the 3d buffers are swapped when a vblank begins. + //so, if we have a redraw pending, now is a safe time to do it + if(!flushPending) + { + gfx3d_FlushFIFO(); + return; + } + + gfx3d.frameCtr++; + + gfx3d_FlushFIFO(); // reset clInd = 0; @@ -1378,17 +1388,6 @@ void gfx3d_glFlush(u32 v) //switch to the new lists twiddleLists(); -} - -void gfx3d_VBlankSignal() -{ - //the 3d buffers are swapped when a vblank begins. - //so, if we have a redraw pending, now is a safe time to do it - if(!flushPending) - { - gfx3d_FlushFIFO(); - return; - } flushPending = FALSE; drawPending = TRUE;