diff --git a/src/dosbox.cpp b/src/dosbox.cpp index 7f461963..95fa429e 100644 --- a/src/dosbox.cpp +++ b/src/dosbox.cpp @@ -229,10 +229,11 @@ void increaseticks() { //Make it return ticksRemain and set it in the function a Bit32s ratio = (ticksScheduled * (CPU_CyclePercUsed*90*1024/100/100)) / ticksDone; Bit32s new_cmax = CPU_CycleMax; Bit64s cproc = (Bit64s)CPU_CycleMax * (Bit64s)ticksScheduled; + double ratioremoved = 0.0; //increase scope for logging if (cproc > 0) { /* ignore the cycles added due to the IO delay code in order to have smoother auto cycle adjustments */ - double ratioremoved = (double) CPU_IODelayRemoved / (double) cproc; + ratioremoved = (double) CPU_IODelayRemoved / (double) cproc; if (ratioremoved < 1.0) { double ratio_not_removed = 1 - ratioremoved; ratio = (Bit32s)((double)ratio * ratio_not_removed); @@ -265,13 +266,14 @@ void increaseticks() { //Make it return ticksRemain and set it in the function a if (new_cmax < CPU_CYCLES_LOWER_LIMIT) new_cmax = CPU_CYCLES_LOWER_LIMIT; /* - LOG(LOG_MISC,LOG_ERROR)("cyclelog: current %06d cmax %06d ratio %05d done %03d sched %03d Add %d", + LOG(LOG_MISC,LOG_ERROR)("cyclelog: current %06d cmax %06d ratio %05d done %03d sched %03d Add %d rr %4.2f", CPU_CycleMax, new_cmax, ratio, ticksDone, ticksScheduled, - ticksAdded); + ticksAdded, + ratioremoved); */ /* ratios below 1% are considered to be dropouts due to @@ -284,7 +286,7 @@ void increaseticks() { //Make it return ticksRemain and set it in the function a CPU_CycleMax = new_cmax; if (CPU_CycleLimit > 0) { if (CPU_CycleMax > CPU_CycleLimit) CPU_CycleMax = CPU_CycleLimit; - } + } else if (CPU_CycleMax > 2000000) CPU_CycleMax = 2000000; //Hardcoded limit, if no limit was specified. } }