Skip to content

Commit 1b11163

Browse files
committed
Fix HOME menu hang by forcing VSYNC on Wii U
Implement workaround for SDL bug where GX2SetSwapInterval(0) causes black screen after returning from HOME menu. When leaving foreground, GX2 silently restores swap interval to 1, but SDL doesn't reapply zero-interval mode after regaining foreground, causing render thread to stop presenting frames. Changes: - Force VSYNC enabled on Wii U in SetVideoMode() renderer creation - Prevent VSYNC toggle from disabling VSYNC on Wii U in all games - Add detailed comments explaining the SDL bug and workaround - Only affects Wii U builds via __WIIU__ preprocessor guards This workaround keeps GX2SetSwapInterval(1) active so the system's reset matches what SDL expects, preventing the black screen hang. Long-term solution: Rebuild SDL with PR devkitPro/SDL#107 which adds proper GX2SetSwapInterval(0) reapplication in WIIU_ForegroundAcquired().
1 parent 66c7ba8 commit 1b11163

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

src/doom/m_crispy.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,13 @@ void M_CrispyToggleVsync(int choice)
592592
return;
593593
}
594594

595+
#ifdef __WIIU__
596+
// Prevent disabling VSYNC on Wii U to avoid HOME menu hang issue
597+
// SDL bug: GX2SetSwapInterval(0) causes black screen after HOME menu
598+
return;
599+
#else
595600
crispy->post_rendering_hook = M_CrispyToggleVsyncHook;
601+
#endif // __WIIU__
596602
}
597603

598604
static int hookchoice;

src/heretic/mn_menu.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,9 +1568,15 @@ static void CrispyVsyncHook(void)
15681568

15691569
static boolean CrispyVsync(int option)
15701570
{
1571+
#ifdef __WIIU__
1572+
// Prevent disabling VSYNC on Wii U to avoid HOME menu hang issue
1573+
// SDL bug: GX2SetSwapInterval(0) causes black screen after HOME menu
1574+
return true;
1575+
#else
15711576
crispy->post_rendering_hook = CrispyVsyncHook;
15721577

15731578
return true;
1579+
#endif // __WIIU__
15741580
}
15751581

15761582
static boolean CrispyBrightmaps(int option)

src/hexen/mn_menu.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,13 @@ static void CrispyVsyncHook(void)
16061606

16071607
static void CrispyVsync(int option)
16081608
{
1609+
#ifdef __WIIU__
1610+
// Prevent disabling VSYNC on Wii U to avoid HOME menu hang issue
1611+
// SDL bug: GX2SetSwapInterval(0) causes black screen after HOME menu
1612+
return;
1613+
#else
16091614
crispy->post_rendering_hook = CrispyVsyncHook;
1615+
#endif // __WIIU__
16101616
}
16111617

16121618
static void CrispyBrightmaps(int option)

src/i_video.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,10 +1510,19 @@ static void SetVideoMode(void)
15101510
// Turn on vsync if we aren't in a -timedemo
15111511
if (!singletics && mode.refresh_rate > 0)
15121512
{
1513+
#ifdef __WIIU__
1514+
// Force VSYNC on Wii U to prevent HOME menu hang issue
1515+
// When leaving foreground, GX2 silently restores swap interval to 1
1516+
// SDL doesn't reapply zero-interval mode after regaining foreground
1517+
// Keeping VSYNC enabled avoids this SDL bug
1518+
renderer_flags |= SDL_RENDERER_PRESENTVSYNC;
1519+
crispy->vsync = true; // Ensure config matches
1520+
#else
15131521
if (crispy->vsync) // [crispy] uncapped vsync
15141522
{
15151523
renderer_flags |= SDL_RENDERER_PRESENTVSYNC;
15161524
}
1525+
#endif // __WIIU__
15171526
}
15181527

15191528
if (force_software_renderer)

0 commit comments

Comments
 (0)