gpu: add uncap fps option
This commit is contained in:
@@ -1951,4 +1951,6 @@ public interface Client extends GameEngine
|
|||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
ClanSettings getClanSettings(int clanId);
|
ClanSettings getClanSettings(int clanId);
|
||||||
|
|
||||||
|
void setUnlockedFps(boolean unlock);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ import net.runelite.api.hooks.DrawCallbacks;
|
|||||||
import net.runelite.client.callback.ClientThread;
|
import net.runelite.client.callback.ClientThread;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
|
import net.runelite.client.events.ConfigChanged;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.plugins.PluginInstantiationException;
|
import net.runelite.client.plugins.PluginInstantiationException;
|
||||||
@@ -387,7 +388,10 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.gl = glContext.getGL().getGL4();
|
this.gl = glContext.getGL().getGL4();
|
||||||
gl.setSwapInterval(0);
|
|
||||||
|
final boolean unlockFps = this.config.unlockFps();
|
||||||
|
client.setUnlockedFps(unlockFps);
|
||||||
|
gl.setSwapInterval(unlockFps ? 1 : 0);
|
||||||
|
|
||||||
if (log.isDebugEnabled())
|
if (log.isDebugEnabled())
|
||||||
{
|
{
|
||||||
@@ -459,6 +463,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
|
|||||||
{
|
{
|
||||||
client.setGpu(false);
|
client.setGpu(false);
|
||||||
client.setDrawCallbacks(null);
|
client.setDrawCallbacks(null);
|
||||||
|
client.setUnlockedFps(false);
|
||||||
|
|
||||||
invokeOnMainThread(() ->
|
invokeOnMainThread(() ->
|
||||||
{
|
{
|
||||||
@@ -529,6 +534,23 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
|
|||||||
return configManager.getConfig(GpuPluginConfig.class);
|
return configManager.getConfig(GpuPluginConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onConfigChanged(ConfigChanged configChanged)
|
||||||
|
{
|
||||||
|
if (configChanged.getGroup().equals(GpuPluginConfig.GROUP))
|
||||||
|
{
|
||||||
|
if (configChanged.getKey().equals("unlockFps"))
|
||||||
|
{
|
||||||
|
boolean unlockFps = Boolean.parseBoolean(configChanged.getNewValue());
|
||||||
|
clientThread.invokeLater(() ->
|
||||||
|
{
|
||||||
|
client.setUnlockedFps(unlockFps);
|
||||||
|
invokeOnMainThread(() -> gl.setSwapInterval(unlockFps ? 1 : 0));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void initProgram() throws ShaderException
|
private void initProgram() throws ShaderException
|
||||||
{
|
{
|
||||||
String versionHeader = OSType.getOSType() == OSType.Linux ? LINUX_VERSION_HEADER : WINDOWS_VERSION_HEADER;
|
String versionHeader = OSType.getOSType() == OSType.Linux ? LINUX_VERSION_HEADER : WINDOWS_VERSION_HEADER;
|
||||||
|
|||||||
@@ -34,9 +34,11 @@ import net.runelite.client.plugins.gpu.config.AntiAliasingMode;
|
|||||||
import net.runelite.client.plugins.gpu.config.ColorBlindMode;
|
import net.runelite.client.plugins.gpu.config.ColorBlindMode;
|
||||||
import net.runelite.client.plugins.gpu.config.UIScalingMode;
|
import net.runelite.client.plugins.gpu.config.UIScalingMode;
|
||||||
|
|
||||||
@ConfigGroup("gpu")
|
@ConfigGroup(GpuPluginConfig.GROUP)
|
||||||
public interface GpuPluginConfig extends Config
|
public interface GpuPluginConfig extends Config
|
||||||
{
|
{
|
||||||
|
String GROUP = "gpu";
|
||||||
|
|
||||||
@Range(
|
@Range(
|
||||||
max = MAX_DISTANCE
|
max = MAX_DISTANCE
|
||||||
)
|
)
|
||||||
@@ -146,4 +148,15 @@ public interface GpuPluginConfig extends Config
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "unlockFps",
|
||||||
|
name = "Unlock FPS",
|
||||||
|
description = "Removes the 50 FPS cap for camera movement",
|
||||||
|
position = 10
|
||||||
|
)
|
||||||
|
default boolean unlockFps()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user