shithub: zelda3

Download patch

ref: b58163ce438509e01397ffade076a15d696231fa
parent: c1c8c7f8300ca36c2e482eb116e2095335cc03a0
author: Snesrev <[email protected]>
date: Tue Oct 4 19:06:04 EDT 2022

Add DisableFrameDelay

--- a/config.c
+++ b/config.c
@@ -314,6 +314,8 @@
       return true;
     } else if (StringEqualsNoCase(key, "DisplayPerfInTitle")) {
       return ParseBool(value, &g_config.display_perf_title);
+    } else if (StringEqualsNoCase(key, "DisableFrameDelay")) {
+      return ParseBool(value, &g_config.disable_frame_delay);
     }
   } else if (section == 4) {
     if (StringEqualsNoCase(key, "ItemSwitchLR")) {
--- a/config.h
+++ b/config.h
@@ -54,6 +54,7 @@
   bool no_sprite_limits;
   bool display_perf_title;
   bool enable_msu;
+  bool disable_frame_delay;
   uint32 features0;
 
   const char *link_graphics;
--- a/main.c
+++ b/main.c
@@ -397,21 +397,22 @@
     // if vsync isn't working, delay manually
     curTick = SDL_GetTicks();
 
-    static const uint8 delays[3] = { 17, 17, 16 }; // 60 fps
-#if 1
-    lastTick += delays[frameCtr % 3];
 
-    if (lastTick > curTick) {
-      uint32 delta = lastTick - curTick;
-      if (delta > 500) {
-        lastTick = curTick - 500;
-        delta = 500;
+    if (!g_config.disable_frame_delay) {
+      static const uint8 delays[3] = { 17, 17, 16 }; // 60 fps
+      lastTick += delays[frameCtr % 3];
+
+      if (lastTick > curTick) {
+        uint32 delta = lastTick - curTick;
+        if (delta > 500) {
+          lastTick = curTick - 500;
+          delta = 500;
+        }
+        SDL_Delay(delta);
+      } else if (curTick - lastTick > 500) {
+        lastTick = curTick;
       }
-      SDL_Delay(delta);
-    } else if (curTick - lastTick > 500) {
-      lastTick = curTick;
     }
-#endif
   }
   if (g_config.autosave)
     HandleCommand(kKeys_Save + 0, true);