all repos — mgba @ c623970d0feeb61fdfa13c513468907dbd55c0f6

mGBA Game Boy Advance Emulator

Wii: Drawing polish (closes #988)
Vicki Pfau vi@endrift.com
Thu, 22 Mar 2018 20:38:18 -0700
commit

c623970d0feeb61fdfa13c513468907dbd55c0f6

parent

de514621e070044ade4d14faed445b5191c210b7

2 files changed, 22 insertions(+), 5 deletions(-)

jump to
M CHANGESCHANGES

@@ -26,6 +26,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: Improve multiboot image detection - GB MBC: Remove erroneous bank 0 wrapping
M src/platform/wii/main.csrc/platform/wii/main.c

@@ -190,18 +190,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);

@@ -234,6 +236,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);

@@ -473,6 +478,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);

@@ -508,6 +517,9 @@ mGUIRun(&runner, argv[1]);

} else { mGUIRunloop(&runner); } + VIDEO_SetBlack(true); + VIDEO_Flush(); + VIDEO_WaitVSync(); mGUIDeinit(&runner); free(fifo);

@@ -534,6 +546,8 @@ audioBufferSize = 0;

} static void _drawStart(void) { + VIDEO_SetBlack(false); + u32 level = 0; _CPU_ISR_Disable(level); if (referenceRetraceCount > retraceCount) {

@@ -551,12 +565,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);

@@ -701,6 +714,9 @@ void _gameUnloaded(struct mGUIRunner* runner) {

UNUSED(runner); AUDIO_StopDMA(); frameLimiter = true; + VIDEO_SetBlack(true); + VIDEO_Flush(); + VIDEO_WaitVSync(); } void _gameLoaded(struct mGUIRunner* runner) {