foxygit / fake-08-xbox360 Log in
commit f7b8a0677647ab0affc122e2d74b09480844b30e
Author:     jtothebell <j.to.the.bell@gmail.com>
AuthorDate: Mon Apr 12 07:36:19 2021 -0600
Commit:     jtothebell <j.to.the.bell@gmail.com>
CommitDate: Mon Apr 12 07:36:19 2021 -0600

    Honor stretch settings on 3ds and wiiu
---
 platform/3ds/source/3dsHost.cpp   |  4 +++-
 platform/wiiu/source/WiiUHost.cpp | 40 +++++++++++++++++++++++++++------------
 2 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/platform/3ds/source/3dsHost.cpp b/platform/3ds/source/3dsHost.cpp
index 56b750c..7da7cdd 100644
--- a/platform/3ds/source/3dsHost.cpp
+++ b/platform/3ds/source/3dsHost.cpp
@@ -230,6 +230,8 @@ void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
     gfxSetScreenFormat(GFX_BOTTOM, GSP_RGB565_OES);

     numFramesToClear = 2;
+
+    loadSettingsIni();
 }

 void Host::oneTimeCleanup(){
@@ -358,7 +360,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap){
             }
         }
 	}
-	else if (stretch == StretchAndOverflow) {
+	else if (stretch == StretchAndOverflow || stretch == PixelPerfectStretch) {
 		//assume landscape, hardcoded double for now (3ds)
         int ratio = 2;
         int stretchedWidth = PicoScreenWidth * ratio;
diff --git a/platform/wiiu/source/WiiUHost.cpp b/platform/wiiu/source/WiiUHost.cpp
index 408bba5..2c324e9 100644
--- a/platform/wiiu/source/WiiUHost.cpp
+++ b/platform/wiiu/source/WiiUHost.cpp
@@ -131,6 +131,31 @@ void audioSetup(){
     */
 }

+
+void _changeStretch(StretchOption newStretch){
+    if (newStretch == PixelPerfect) {
+        screenWidth = PicoScreenWidth;
+        screenHeight = PicoScreenHeight;
+    }
+    else if (newStretch == StretchToFit) {
+        screenWidth = WIN_HEIGHT;
+        screenHeight = WIN_HEIGHT;
+    }
+    else if (newStretch == StretchToFill) {
+        screenWidth = WIN_WIDTH;
+        screenHeight = WIN_HEIGHT;
+    }
+    else if (newStretch == PixelPerfectStretch) {
+        screenWidth = SCREEN_SIZE_X;
+        screenHeight = SCREEN_SIZE_Y;
+    }
+
+    DestR.x = WIN_WIDTH / 2 - screenWidth / 2;
+    DestR.y = WIN_HEIGHT / 2 - screenHeight / 2;
+    DestR.w = screenWidth;
+    DestR.h = screenHeight;
+}
+
 Host::Host() {
     struct stat st = {0};

@@ -217,6 +242,8 @@ void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
     _paletteColors = paletteColors;

     loadSettingsIni();
+
+    _changeStretch(stretch);
 }

 void Host::oneTimeCleanup(){
@@ -238,29 +265,18 @@ void Host::changeStretch(){
     if (stretchKeyPressed) {
         if (stretch == PixelPerfectStretch) {
             stretch = PixelPerfect;
-            screenWidth = PicoScreenWidth;
-            screenHeight = PicoScreenHeight;
         }
         else if (stretch == PixelPerfect) {
             stretch = StretchToFit;
-            screenWidth = WIN_HEIGHT;
-            screenHeight = WIN_HEIGHT;
         }
         else if (stretch == StretchToFit) {
             stretch = StretchToFill;
-            screenWidth = WIN_WIDTH;
-            screenHeight = WIN_HEIGHT;
         }
         else if (stretch == StretchToFill) {
             stretch = PixelPerfectStretch;
-            screenWidth = SCREEN_SIZE_X;
-            screenHeight = SCREEN_SIZE_Y;
         }

-        DestR.x = WIN_WIDTH / 2 - screenWidth / 2;
-        DestR.y = WIN_HEIGHT / 2 - screenHeight / 2;
-        DestR.w = screenWidth;
-        DestR.h = screenHeight;
+        _changeStretch(stretch);
     }
 }