shithub: cstory

Download patch

ref: c5691d75701962c3603a068131adb9a543c8b1e8
parent: 22c998719123fdddda7dff33ed070a905bf131a9
author: Clownacy <Clownacy@users.noreply.github.com>
date: Fri Apr 24 20:03:20 EDT 2020

Fix Wii U port when TV is set to 1080p

WUT's bugged. See here:
https://github.com/devkitPro/wut/issues/119

It apparently got this bug from the Decaf emulator. Maybe I should
tell those guys too.

--- a/src/Backends/Rendering/WiiU.cpp
+++ b/src/Backends/Rendering/WiiU.cpp
@@ -169,21 +169,21 @@
 										// Calculate centred viewports
 										switch (GX2GetSystemTVScanMode())
 										{
-											case GX2_TV_SCAN_MODE_NONE:	// lolwut
-												break;
-
-											case GX2_TV_SCAN_MODE_480I:
-											case GX2_TV_SCAN_MODE_480P:
+											// For now, we have to match WUT's broken behaviour (its `GX2TVScanMode`
+											// enum is missing values, and the rest are off-by-one)
+											//case GX2_TV_SCAN_MODE_576I:
+											case GX2_TV_SCAN_MODE_480I:	// Actually 576i
+											case GX2_TV_SCAN_MODE_480P:	// Actually 480i
 												CalculateViewport(854, 480, &tv_viewport);
 												break;
 
-											case GX2_TV_SCAN_MODE_720P:
-											case 4:	// Why the hell doesn't WUT have an enum for this? It always returns this value for me!
+											case GX2_TV_SCAN_MODE_720P:	// Actually 480p
+											default:	// Funnel the *real* 1080p into this
 												CalculateViewport(1280, 720, &tv_viewport);
 												break;
 
-											case GX2_TV_SCAN_MODE_1080I:
-											case GX2_TV_SCAN_MODE_1080P:
+											case GX2_TV_SCAN_MODE_1080I:	// Actually invalid
+											case GX2_TV_SCAN_MODE_1080P:	// Actually 1080i
 												CalculateViewport(1920, 1080, &tv_viewport);
 												break;
 										}
--- a/src/Backends/WiiU/Window-Software.cpp
+++ b/src/Backends/WiiU/Window-Software.cpp
@@ -154,21 +154,21 @@
 				// Calculate centred viewports
 				switch (GX2GetSystemTVScanMode())
 				{
-					case GX2_TV_SCAN_MODE_NONE:	// lolwut
-						break;
-
-					case GX2_TV_SCAN_MODE_480I:
-					case GX2_TV_SCAN_MODE_480P:
+					// For now, we have to match WUT's broken behaviour (its `GX2TVScanMode`
+					// enum is missing values, and the rest are off-by-one)
+					//case GX2_TV_SCAN_MODE_576I:
+					case GX2_TV_SCAN_MODE_480I:	// Actually 576i
+					case GX2_TV_SCAN_MODE_480P:	// Actually 480i
 						CalculateViewport(854, 480, &tv_viewport);
 						break;
 
-					case GX2_TV_SCAN_MODE_720P:
-					case 4:	// Why the hell doesn't WUT have an enum for this? It always returns this value for me!
+					case GX2_TV_SCAN_MODE_720P:	// Actually 480p
+					default:	// Funnel the *real* 1080p into this
 						CalculateViewport(1280, 720, &tv_viewport);
 						break;
 
-					case GX2_TV_SCAN_MODE_1080I:
-					case GX2_TV_SCAN_MODE_1080P:
+					case GX2_TV_SCAN_MODE_1080I:	// Actually invalid
+					case GX2_TV_SCAN_MODE_1080P:	// Actually 1080i
 						CalculateViewport(1920, 1080, &tv_viewport);
 						break;
 				}