aboutsummaryrefslogtreecommitdiff
path: root/patches/dosbox-pure/0001-add-auto-cycle-limit.patch
blob: 69baeb98562002fb3dda1543bb54471493ab93e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
diff --git a/dosbox_pure_libretro.cpp b/dosbox_pure_libretro.cpp
index 6a03631..dc4f70d 100644
--- a/dosbox_pure_libretro.cpp
+++ b/dosbox_pure_libretro.cpp
@@ -451,15 +451,30 @@ void DBP_SetRealModeCycles()
 		(year >  1993 ? 60000 : // Pentium 90 MHz
 		Cycles1981to1993[year - 1981]))); // Matching speed for year
 
+#ifdef CYCLE_LIMIT
+	if (CPU_CycleMax > CYCLE_LIMIT)
+	{
+		CPU_CycleMax = CYCLE_LIMIT;
+		CPU_AutoDetermineMode &= ~(CPU_AUTODETERMINE_CYCLES|(CPU_AUTODETERMINE_CYCLES<<CPU_AUTODETERMINE_SHIFT));
+		CPU_CycleAutoAdjust = true;
+		// Switch to dynamic core
+		if (CPU_AutoDetermineMode & CPU_AUTODETERMINE_CORE)
+		{
+#else
+
 	// Switch to dynamic core for newer real mode games 
 	if (CPU_CycleMax >= 8192 && (CPU_AutoDetermineMode & CPU_AUTODETERMINE_CORE))
 	{
+#endif
 		#if (C_DYNAMIC_X86)
 		if (cpudecoder != CPU_Core_Dyn_X86_Run) { void CPU_Core_Dyn_X86_Cache_Init(bool); CPU_Core_Dyn_X86_Cache_Init(true); cpudecoder = CPU_Core_Dyn_X86_Run; }
 		#elif (C_DYNREC)
 		if (cpudecoder != CPU_Core_Dynrec_Run)  { void CPU_Core_Dynrec_Cache_Init(bool);  CPU_Core_Dynrec_Cache_Init(true);  cpudecoder = CPU_Core_Dynrec_Run;  }
 		#endif
 	}
+#ifdef CYCLE_LIMIT
+	}
+#endif
 }
 
 static void DBP_UnlockSpeed(bool unlock, int start_frame_skip = 0, bool skip_once = false)