Skip to content

Commit dd25419

Browse files
committed
Wii U / Video: Fixed resume of video afrer the home menu close
This bug happens just when V-Sync is off and attempting to open and close the home menu. To fix the black/frozen screen it's just enough to call the GX2SetSwapInterval(0); right after entering the foreground back.
1 parent e24b719 commit dd25419

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/video/wiiu/SDL_wiiuvideo.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#include <gx2/state.h>
5757
#include <gx2r/mem.h>
5858
#include <gx2r/surface.h>
59+
#include <gx2/swap.h>
5960

6061
#define DRC_SCREEN_WIDTH 854
6162
#define DRC_SCREEN_HEIGHT 480
@@ -120,6 +121,9 @@ static int WIIU_ForegroundAcquired(_THIS)
120121
window = window->next;
121122
}
122123

124+
// Restore V-Sync state
125+
GX2SetSwapInterval(videodata->prevSwapInterval);
126+
123127
return 0;
124128
}
125129

@@ -135,6 +139,11 @@ static int WIIU_ForegroundReleased(_THIS)
135139
videodata = (WIIU_VideoData *) _this->driverdata;
136140
window = _this->windows;
137141

142+
// To avoid the black screen problem after resume when swap interval is 0,
143+
// remember it, and restore when entering back the foreground
144+
videodata->prevSwapInterval = GX2GetSwapInterval();
145+
GX2SetSwapInterval(1);
146+
138147
// make sure the GPU is done drawing
139148
GX2DrawDone();
140149

@@ -170,6 +179,11 @@ static int WIIU_ForegroundReleased(_THIS)
170179
window = window->next;
171180
}
172181

182+
if (videodata->prevSwapInterval == 0) {
183+
/* Do that again to avoid a short black frame after resume */
184+
GX2SwapScanBuffers();
185+
}
186+
173187
WIIU_GfxHeap_MEM1Destroy();
174188
WIIU_GfxHeap_ForegroundDestroy();
175189

src/video/wiiu/SDL_wiiuvideo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ struct WIIU_VideoData
4747
uint32_t tvHeight;
4848
void *tvScanBuffer;
4949
uint32_t tvScanBufferSize;
50+
uint32_t prevSwapInterval;
5051

5152
GX2DrcRenderMode drcRenderMode;
5253
void *drcScanBuffer;

0 commit comments

Comments
 (0)