]> git.sesse.net Git - pistorm/commitdiff
Fix scaling VS aspect ratio things, fix P2D data problems
authorbeeanyew <beeanyew@gmail.com>
Wed, 12 May 2021 00:49:25 +0000 (02:49 +0200)
committerbeeanyew <beeanyew@gmail.com>
Wed, 12 May 2021 00:49:25 +0000 (02:49 +0200)
platforms/amiga/rtg/rtg-output-raylib.c
platforms/amiga/rtg/rtg.c

index 672eab730b9ba22dd7098f92c5c2283dc4ee3c9c..8fd02c7859274e9c29021fbdc4edba2eed6997bc 100644 (file)
 
 #define RTG_INIT_ERR(a) { printf(a); *data->running = 0; }
 
+//#define DEBUG_RAYLIB_RTG
+
+#ifdef DEBUG_RAYLIB_RTG
+#define DEBUG printf
+#else
+#define DEBUG(...)
+#endif
+
 uint8_t busy = 0, rtg_on = 0, rtg_initialized = 0;
 extern uint8_t *rtg_mem;
 extern uint32_t framebuffer_addr;
@@ -179,13 +187,26 @@ reinit_raylib:;
             }
         }
     } else if (dstscale.width > GetScreenWidth() || dstscale.height > GetScreenHeight()) {
-        if (dstscale.width > GetScreenWidth()) {
-            dstscale.height = dstscale.height * ((float)GetScreenWidth() / (float)width);
-            dstscale.width = GetScreenWidth();
-        }
         if (dstscale.height > GetScreenHeight()) {
+            DEBUG("[H > SH]\n");
+            DEBUG("Adjusted width from %d to", (int)dstscale.width);
             dstscale.width = dstscale.width * ((float)GetScreenHeight() / (float)height);
+            DEBUG("%d.\n", (int)dstscale.width);
+            DEBUG("Adjusted height from %d to", (int)dstscale.height);
             dstscale.height = GetScreenHeight();
+            DEBUG("%d.\n", (int)dstscale.height);
+        }
+        if (dstscale.width > GetScreenWidth()) {
+            // First scaling attempt failed, do not double adjust, re-adjust
+            dstscale.width = width;
+            dstscale.height = height;
+            DEBUG("[W > SW]\n");
+            DEBUG("Adjusted height from %d to", (int)dstscale.height);
+            dstscale.height = dstscale.height * ((float)GetScreenWidth() / (float)width);
+            DEBUG("%d.\n", (int)dstscale.height);
+            DEBUG("Adjusted width from %d to", (int)dstscale.width);
+            dstscale.width = GetScreenWidth();
+            DEBUG("%d.\n", (int)dstscale.width);
         }
     }
 
index 8ef6a017aeed1ef9304353520c2f4e71f073b804..2f823921b6328e1c743e1f7ab7daf7606f49d454 100644 (file)
@@ -59,7 +59,7 @@ int init_rtg_data(struct emulator_config *cfg_) {
         return 0;
     }
 
-    m68k_add_ram_range(PIGFX_RTG_BASE + PIGFX_REG_SIZE, 40 * SIZE_MEGA - PIGFX_REG_SIZE, rtg_mem);
+    m68k_add_ram_range(PIGFX_RTG_BASE + PIGFX_REG_SIZE, 32 * SIZE_MEGA - PIGFX_REG_SIZE, rtg_mem);
     add_mapping(cfg_, MAPTYPE_RAM_NOALLOC, PIGFX_RTG_BASE + PIGFX_REG_SIZE, 40 * SIZE_MEGA - PIGFX_REG_SIZE, -1, (char *)rtg_mem, "rtg_mem");
     return 1;
 }
@@ -76,8 +76,6 @@ void shutdown_rtg() {
     }
 }
 
-//void rtg_update_screen();
-
 unsigned int rtg_get_fb() {
     return PIGFX_RTG_BASE + PIGFX_REG_SIZE + framebuffer_addr_adj;
 }