Wii: Drawing polish (closes #988)
Vicki Pfau vi@endrift.com
Thu, 22 Mar 2018 20:38:18 -0700
2 files changed,
22 insertions(+),
5 deletions(-)
M
CHANGES
→
CHANGES
@@ -54,6 +54,7 @@ - GBA: Fix SharkPort saves for EEPROM games
- Qt: Fix opening in fullscreen (fixes mgba.io/i/993) - Python: Fix package directory - GB Memory: Fix OAM DMA blocking regions (fixes mgba.io/i/1013) + - Wii: Fix various setup and teardown drawing issues (fixes mgba.io/i/988) Misc: - GBA Timer: Use global cycles for timers - GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722)
M
src/platform/wii/main.c
→
src/platform/wii/main.c
@@ -194,18 +194,20 @@
free(framebuffer[0]); free(framebuffer[1]); + VIDEO_SetBlack(true); + VIDEO_Configure(vmode); + framebuffer[0] = SYS_AllocateFramebuffer(vmode); framebuffer[1] = SYS_AllocateFramebuffer(vmode); + VIDEO_ClearFrameBuffer(vmode, framebuffer[0], COLOR_BLACK); + VIDEO_ClearFrameBuffer(vmode, framebuffer[1], COLOR_BLACK); - VIDEO_SetBlack(true); - VIDEO_Configure(vmode); VIDEO_SetNextFramebuffer(framebuffer[whichFb]); VIDEO_Flush(); VIDEO_WaitVSync(); if (vmode->viTVMode & VI_NON_INTERLACE) { VIDEO_WaitVSync(); } - VIDEO_SetBlack(false); GX_SetViewport(0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1); f32 yscale = GX_GetYScaleFactor(vmode->efbHeight, vmode->xfbHeight);@@ -238,6 +240,9 @@ }
int main(int argc, char* argv[]) { VIDEO_Init(); + VIDEO_SetBlack(true); + VIDEO_Flush(); + VIDEO_WaitVSync(); PAD_Init(); WPAD_Init(); WPAD_SetDataFormat(0, WPAD_FMT_BTNS_ACC_IR);@@ -481,6 +486,10 @@ };
mGUIInit(&runner, "wii"); reconfigureScreen(&runner); + // Make sure screen is properly initialized by drawing a blank frame + _drawStart(); + _drawEnd(); + _mapKey(&runner.params.keyMap, GCN1_INPUT, PAD_BUTTON_A, GUI_INPUT_SELECT); _mapKey(&runner.params.keyMap, GCN1_INPUT, PAD_BUTTON_B, GUI_INPUT_BACK); _mapKey(&runner.params.keyMap, GCN1_INPUT, PAD_TRIGGER_Z, GUI_INPUT_CANCEL);@@ -516,6 +525,9 @@ mGUIRun(&runner, argv[1]);
} else { mGUIRunloop(&runner); } + VIDEO_SetBlack(true); + VIDEO_Flush(); + VIDEO_WaitVSync(); mGUIDeinit(&runner); #ifdef FIXED_ROM_BUFFER@@ -546,6 +558,8 @@ audioBufferSize = 0;
} static void _drawStart(void) { + VIDEO_SetBlack(false); + u32 level = 0; _CPU_ISR_Disable(level); if (referenceRetraceCount > retraceCount) {@@ -563,12 +577,11 @@ GX_SetViewport(0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1);
} static void _drawEnd(void) { - whichFb = !whichFb; - GX_CopyDisp(framebuffer[whichFb], GX_TRUE); GX_DrawDone(); VIDEO_SetNextFramebuffer(framebuffer[whichFb]); VIDEO_Flush(); + whichFb = !whichFb; u32 level = 0; _CPU_ISR_Disable(level);@@ -713,6 +726,9 @@ void _gameUnloaded(struct mGUIRunner* runner) {
UNUSED(runner); AUDIO_StopDMA(); frameLimiter = true; + VIDEO_SetBlack(true); + VIDEO_Flush(); + VIDEO_WaitVSync(); } void _gameLoaded(struct mGUIRunner* runner) {