diff --git a/src/yugecin/opsudance/core/DisplayContainer.java b/src/yugecin/opsudance/core/DisplayContainer.java index a889eb06..13b536b1 100644 --- a/src/yugecin/opsudance/core/DisplayContainer.java +++ b/src/yugecin/opsudance/core/DisplayContainer.java @@ -252,7 +252,9 @@ public class DisplayContainer implements ErrorDumpable, SkinChangedListener { } Display.processMessages(); - Display.sync(targetUpdatesPerSecond); + if (targetUpdatesPerSecond >= 60) { + Display.sync(targetUpdatesPerSecond); + } } } diff --git a/src/yugecin/opsudance/core/state/specialstates/FpsRenderState.java b/src/yugecin/opsudance/core/state/specialstates/FpsRenderState.java index ca34e153..9186db35 100644 --- a/src/yugecin/opsudance/core/state/specialstates/FpsRenderState.java +++ b/src/yugecin/opsudance/core/state/specialstates/FpsRenderState.java @@ -60,7 +60,7 @@ public class FpsRenderState implements ResolutionChangedListener { } private String getText(int value, String unit) { - if (OPTION_USE_FPS_DELTAS.state) { + if (OPTION_USE_FPS_DELTAS.state || value > 1000) { return String.format("%.2fms", 1000f / value); } return value + " " + unit; diff --git a/src/yugecin/opsudance/options/Options.java b/src/yugecin/opsudance/options/Options.java index f828e2ad..6181d6a3 100644 --- a/src/yugecin/opsudance/options/Options.java +++ b/src/yugecin/opsudance/options/Options.java @@ -214,16 +214,34 @@ public class Options { } }; - public static final NumericOption OPTION_TARGET_UPS = new NumericOption("target UPS", "targetUPS", "Higher values result in less input lag and smoother cursor trail, but may cause high CPU usage.", 480, 20, 1000) { + public static final int[] targetUPS = { 60, 120, 240, 480, 960, 1000, -1 }; + + public static final NumericOption OPTION_TARGET_UPS = new NumericOption("target UPS", "targetUPS", "Higher values result in less input lag and smoother cursor trail, but may cause high CPU usage.", 2, 0, targetUPS.length - 1) { @Override public String getValueString () { - return String.format("%dups", val); + if (targetUPS[val] == -1) { + return "unlimited"; + } + return String.valueOf(targetUPS[val]); } @Override - public void setValue ( int value){ + public void setValue(int value) { + if (value < 0 || targetUPS.length <= value) { + return; + } + final int ups = targetUPS[value]; + final int fps = targetFPS[targetFPSIndex]; super.setValue(value); - displayContainer.setUPS(value); + displayContainer.setUPS(ups); + if (ups != -1 && fps > ups) { + for (int i = targetFPSIndex - 1; i >= 0; i--) { + if (targetFPS[i] >= ups) { + OPTION_TARGET_FPS.clickListItem(i); + break; + } + } + } } }; @@ -255,7 +273,16 @@ public class Options { @Override public void clickListItem(int index){ targetFPSIndex = index; - displayContainer.setFPS(targetFPS[targetFPSIndex]); + int fps = targetFPS[targetFPSIndex]; + displayContainer.setFPS(fps); + if (targetUPS[OPTION_TARGET_UPS.val] < fps) { + for (int i = 0; i < targetUPS.length; i++) { + if (targetUPS[i] >= fps) { + OPTION_TARGET_UPS.setValue(i); + break; + } + } + } } @Override