diff --git a/Makefile b/Makefile index 3e7941c..8c54b71 100644 --- a/Makefile +++ b/Makefile @@ -181,6 +181,10 @@ else endif endif +ifneq (,$(CYCLE_LIMIT)) + COMMONFLAGS += -DCYCLE_LIMIT=$(CYCLE_LIMIT) +endif + ifeq ($(BUILD),DEBUG) BUILDDIR := debug CFLAGS := -DDEBUG -D_DEBUG -g -O0 diff --git a/dosbox_pure_libretro.cpp b/dosbox_pure_libretro.cpp index 4f4ca7e..40ddef3 100644 --- a/dosbox_pure_libretro.cpp +++ b/dosbox_pure_libretro.cpp @@ -544,15 +544,30 @@ void DBP_SetRealModeCycles() (year > 1999 ? 500000 : // Pentium III, 600 MHz and later Cycles1981to1999[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<= 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 bool DBP_NeedFrameSkip(bool in_emulation)