Introduce a penalty for a lot of idling, which changes the up and downscale algorithm, as the chance of having errors in the input data is a lot larger when there is a lot of idling. The upscale has its strength reduced and the downscale has it increased.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4042
This commit is contained in:
parent
9be90ad587
commit
a2d1450246
1 changed files with 6 additions and 3 deletions
|
@ -234,7 +234,8 @@ void increaseticks() { //Make it return ticksRemain and set it in the function a
|
|||
to have smoother auto cycle adjustments */
|
||||
double ratioremoved = (double) CPU_IODelayRemoved / (double) cproc;
|
||||
if (ratioremoved < 1.0) {
|
||||
ratio = (Bit32s)((double)ratio * (1 - ratioremoved));
|
||||
double ratio_not_removed = 1 - ratioremoved;
|
||||
ratio = (Bit32s)((double)ratio * ratio_not_removed);
|
||||
|
||||
/* Don't allow very high ratio which can cause us to lock as we don't scale down
|
||||
* for very low ratios. High ratio might result because of timing resolution */
|
||||
|
@ -250,10 +251,12 @@ void increaseticks() { //Make it return ticksRemain and set it in the function a
|
|||
ratio = 800;
|
||||
|
||||
if (ratio <= 1024) {
|
||||
double r = 2.0 /(1.0 + 1024.0/(static_cast<double>(ratio)));
|
||||
// ratio_not_removed = 1.0; //enabling this restores the old formula
|
||||
double r = (1.0 + ratio_not_removed) /(ratio_not_removed + 1024.0/(static_cast<double>(ratio)));
|
||||
new_cmax = 1 + static_cast<Bit32s>(CPU_CycleMax * r);
|
||||
} else {
|
||||
Bit64s cmax_scaled = (Bit64s)CPU_CycleMax * (Bit64s)ratio;
|
||||
Bit64s ratio_with_removed = (Bit64s) ((((double)ratio - 1024.0) * ratio_not_removed) + 1024.0);
|
||||
Bit64s cmax_scaled = (Bit64s)CPU_CycleMax * ratio_with_removed;
|
||||
new_cmax = (Bit32s)(1 + (CPU_CycleMax >> 1) + cmax_scaled / (Bit64s)2048);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue