Merge remote-tracking branch 'runelite/master'
This commit is contained in:
@@ -46,7 +46,7 @@ public interface FpsConfig extends Config
|
||||
|
||||
@Range(
|
||||
min = 1,
|
||||
max = 50
|
||||
max = 360
|
||||
)
|
||||
@ConfigItem(
|
||||
keyName = "maxFps",
|
||||
@@ -72,7 +72,7 @@ public interface FpsConfig extends Config
|
||||
|
||||
@Range(
|
||||
min = 1,
|
||||
max = 50
|
||||
max = 360
|
||||
)
|
||||
@ConfigItem(
|
||||
keyName = "maxFpsUnfocused",
|
||||
|
||||
@@ -78,6 +78,7 @@ import net.runelite.api.hooks.DrawCallbacks;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginInstantiationException;
|
||||
@@ -387,7 +388,10 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
|
||||
}
|
||||
|
||||
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())
|
||||
{
|
||||
@@ -459,6 +463,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
|
||||
{
|
||||
client.setGpu(false);
|
||||
client.setDrawCallbacks(null);
|
||||
client.setUnlockedFps(false);
|
||||
|
||||
invokeOnMainThread(() ->
|
||||
{
|
||||
@@ -529,6 +534,23 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
|
||||
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
|
||||
{
|
||||
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.UIScalingMode;
|
||||
|
||||
@ConfigGroup("gpu")
|
||||
@ConfigGroup(GpuPluginConfig.GROUP)
|
||||
public interface GpuPluginConfig extends Config
|
||||
{
|
||||
String GROUP = "gpu";
|
||||
|
||||
@Range(
|
||||
max = MAX_DISTANCE
|
||||
)
|
||||
@@ -146,4 +148,15 @@ public interface GpuPluginConfig extends Config
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "unlockFps",
|
||||
name = "Unlock FPS",
|
||||
description = "Removes the 50 FPS cap for camera movement",
|
||||
position = 10
|
||||
)
|
||||
default boolean unlockFps()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -62,7 +61,6 @@ import net.runelite.client.ui.components.IconTextField;
|
||||
class SkillCalculator extends JPanel
|
||||
{
|
||||
private static final int MAX_XP = 200_000_000;
|
||||
private static final DecimalFormat XP_FORMAT = new DecimalFormat("#.#");
|
||||
|
||||
private final UICalculatorInputArea uiInput;
|
||||
private final Client client;
|
||||
@@ -203,7 +201,7 @@ class SkillCalculator extends JPanel
|
||||
|
||||
int actionCount = 0;
|
||||
int neededXP = targetXP - currentXP;
|
||||
double xp = 0;
|
||||
int xp = 0;
|
||||
|
||||
for (UIActionSlot slot : combinedActionSlots)
|
||||
{
|
||||
@@ -213,7 +211,8 @@ class SkillCalculator extends JPanel
|
||||
if (neededXP > 0)
|
||||
{
|
||||
assert xp != 0;
|
||||
actionCount = (int) Math.ceil(neededXP / xp);
|
||||
neededXP *= 10;
|
||||
actionCount = (neededXP - 1) / xp + 1;
|
||||
}
|
||||
|
||||
combinedActionSlot.setText(formatXPActionString(xp, actionCount, "exp - "));
|
||||
@@ -344,11 +343,12 @@ class SkillCalculator extends JPanel
|
||||
int neededXP = targetXP - currentXP;
|
||||
SkillAction action = slot.getAction();
|
||||
final float bonus = action.isIgnoreBonus() ? 1f : xpFactor;
|
||||
final double xp = Math.round(action.getXp() * bonus * 10f) / 10d;
|
||||
final int xp = Math.round(action.getXp() * bonus * 10f);
|
||||
|
||||
if (neededXP > 0)
|
||||
{
|
||||
actionCount = (int) Math.ceil(neededXP / xp);
|
||||
neededXP *= 10;
|
||||
actionCount = (neededXP - 1) / xp + 1;
|
||||
}
|
||||
|
||||
slot.setText("Lvl. " + action.getLevel() + " (" + formatXPActionString(xp, actionCount, "exp) - "));
|
||||
@@ -360,9 +360,11 @@ class SkillCalculator extends JPanel
|
||||
updateCombinedAction();
|
||||
}
|
||||
|
||||
private static String formatXPActionString(double xp, int actionCount, String expExpression)
|
||||
private static String formatXPActionString(int xp, int actionCount, String expExpression)
|
||||
{
|
||||
return XP_FORMAT.format(xp) + expExpression + NumberFormat.getIntegerInstance().format(actionCount) + (actionCount == 1 ? " action" : " actions");
|
||||
int integer = xp / 10;
|
||||
int frac = xp % 10;
|
||||
return (frac != 0 ? (integer + "." + frac) : integer) + expExpression + NumberFormat.getIntegerInstance().format(actionCount) + (actionCount == 1 ? " action" : " actions");
|
||||
}
|
||||
|
||||
private void updateInputFields()
|
||||
|
||||
@@ -85,7 +85,7 @@ class UIActionSlot extends JPanel
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private double value;
|
||||
private int value;
|
||||
|
||||
UIActionSlot(SkillAction action, ClientThread clientThread, ItemManager itemManager, JLabel uiIcon)
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@ public enum FletchingAction implements ItemSkillAction
|
||||
ARROW_SHAFT(ItemID.ARROW_SHAFT, 1, 0.33f),
|
||||
HEADLESS_ARROW(ItemID.HEADLESS_ARROW, 1, 1),
|
||||
BRONZE_ARROW(ItemID.BRONZE_ARROW, 1, 1.3f),
|
||||
BRONZE_JAVELIN(ItemID.BRONZE_JAVELIN, 3, 1),
|
||||
OGRE_ARROW(ItemID.OGRE_ARROW, 5, 1),
|
||||
SHORTBOW_U(ItemID.SHORTBOW_U, 5, 5),
|
||||
SHORTBOW(ItemID.SHORTBOW, 5, 5),
|
||||
@@ -47,6 +48,7 @@ public enum FletchingAction implements ItemSkillAction
|
||||
LONGBOW_U(ItemID.LONGBOW_U, 10, 10),
|
||||
OPAL_BOLTS(ItemID.OPAL_BOLTS, 11, 1.6f),
|
||||
IRON_ARROW(ItemID.IRON_ARROW, 15, 2.5f),
|
||||
IRON_JAVELIN(ItemID.IRON_JAVELIN, 17, 2),
|
||||
OAK_SHORTBOW_U(ItemID.OAK_SHORTBOW_U, 20, 16.5f),
|
||||
OAK_SHORTBOW(ItemID.OAK_SHORTBOW, 20, 16.5f),
|
||||
IRON_DART(ItemID.IRON_DART, 22, 3.8f),
|
||||
@@ -57,6 +59,7 @@ public enum FletchingAction implements ItemSkillAction
|
||||
OAK_LONGBOW(ItemID.OAK_LONGBOW, 25, 25),
|
||||
OAK_SHIELD(ItemID.OAK_SHIELD, 27, 50),
|
||||
STEEL_ARROW(ItemID.STEEL_ARROW, 30, 5),
|
||||
STEEL_JAVELIN(ItemID.STEEL_JAVELIN, 32, 5),
|
||||
KEBBIT_BOLTS(ItemID.KEBBIT_BOLTS, 32, 1),
|
||||
WILLOW_SHORTBOW_U(ItemID.WILLOW_SHORTBOW_U, 35, 33.3f),
|
||||
WILLOW_SHORTBOW(ItemID.WILLOW_SHORTBOW, 35, 33.3f),
|
||||
@@ -77,6 +80,7 @@ public enum FletchingAction implements ItemSkillAction
|
||||
TEAK_STOCK(ItemID.TEAK_STOCK, 46, 27),
|
||||
STEEL_CROSSBOW_U(ItemID.STEEL_CROSSBOW_U, 46, 54),
|
||||
STEEL_CROSSBOW(ItemID.STEEL_CROSSBOW, 46, 27),
|
||||
MITHRIL_JAVELIN(ItemID.MITHRIL_JAVELIN, 47, 8),
|
||||
MAPLE_SHORTBOW_U(ItemID.MAPLE_SHORTBOW_U, 50, 50),
|
||||
MAPLE_SHORTBOW(ItemID.MAPLE_SHORTBOW, 50, 50),
|
||||
BARBED_BOLTS(ItemID.BARBED_BOLTS, 51, 9.5f),
|
||||
@@ -98,6 +102,7 @@ public enum FletchingAction implements ItemSkillAction
|
||||
MAHOGANY_STOCK(ItemID.MAHOGANY_STOCK, 61, 41),
|
||||
ADAMANT_CROSSBOW_U(ItemID.ADAMANT_CROSSBOW_U, 61, 82),
|
||||
ADAMANT_CROSSBOW(ItemID.ADAMANT_CROSSBOW, 61, 41),
|
||||
ADAMANT_JAVELIN(ItemID.ADAMANT_JAVELIN, 62, 10),
|
||||
RUBY_BOLTS(ItemID.RUBY_BOLTS, 63, 6.3f),
|
||||
DIAMOND_BOLTS(ItemID.DIAMOND_BOLTS, 65, 7),
|
||||
YEW_SHORTBOW(ItemID.YEW_SHORTBOW, 65, 67.5f),
|
||||
@@ -114,6 +119,7 @@ public enum FletchingAction implements ItemSkillAction
|
||||
ONYX_BOLTS(ItemID.ONYX_BOLTS, 73, 9.4f),
|
||||
RUNE_ARROW(ItemID.RUNE_ARROW, 75, 12.5f),
|
||||
AMETHYST_BROAD_BOLTS(ItemID.AMETHYST_BROAD_BOLTS, 76, 10.6f),
|
||||
RUNE_JAVELIN(ItemID.RUNE_JAVELIN, 77, 12.4f),
|
||||
MAGIC_STOCK(ItemID.MAGIC_STOCK, 78, 70),
|
||||
DRAGON_CROSSBOW_U(ItemID.DRAGON_CROSSBOW_U, 78, 135),
|
||||
DRAGON_CROSSBOW(ItemID.DRAGON_CROSSBOW, 78, 70),
|
||||
@@ -128,6 +134,7 @@ public enum FletchingAction implements ItemSkillAction
|
||||
MAGIC_SHIELD(ItemID.MAGIC_SHIELD, 87, 183),
|
||||
AMETHYST_DART(ItemID.AMETHYST_DART, 90, 21),
|
||||
DRAGON_ARROW(ItemID.DRAGON_ARROW, 90, 15),
|
||||
DRAGON_JAVELIN(ItemID.DRAGON_JAVELIN, 92, 15),
|
||||
REDWOOD_SHIELD(ItemID.REDWOOD_SHIELD, 92, 216),
|
||||
DRAGON_DART(ItemID.DRAGON_DART, 95, 25),
|
||||
;
|
||||
|
||||
@@ -78,7 +78,7 @@ import okhttp3.Response;
|
||||
public class ClientLoader implements Supplier<Applet>
|
||||
{
|
||||
private static final String INJECTED_CLIENT_NAME = "/injected-client.oprs";
|
||||
private static final int NUM_ATTEMPTS = 0;
|
||||
private static final int NUM_ATTEMPTS = 6;
|
||||
private static File LOCK_FILE = new File(RuneLite.CACHE_DIR, "cache.lock");
|
||||
private static File VANILLA_CACHE = new File(RuneLite.CACHE_DIR, "vanilla.cache");
|
||||
private static File PATCHED_CACHE = new File(RuneLite.CACHE_DIR, "patched.cache");
|
||||
@@ -266,7 +266,10 @@ public class ClientLoader implements Supplier<Applet>
|
||||
|
||||
private void updateVanilla(RSConfig config) throws IOException, VerificationException
|
||||
{
|
||||
Certificate[] jagexCertificateChain = getJagexCertificateChain();
|
||||
Certificate[][] jagexCertificateChains = {
|
||||
loadCertificateChain("jagex.crt"),
|
||||
loadCertificateChain("jagex2021.crt")
|
||||
};
|
||||
|
||||
// Get the mtime of the first thing in the vanilla cache
|
||||
// we check this against what the server gives us to let us skip downloading and patching the whole thing
|
||||
@@ -283,7 +286,7 @@ public class ClientLoader implements Supplier<Applet>
|
||||
JarEntry je = vanillaCacheTest.getNextJarEntry();
|
||||
if (je != null)
|
||||
{
|
||||
verifyJarEntry(je, jagexCertificateChain);
|
||||
verifyJarEntry(je, jagexCertificateChains);
|
||||
vanillaCacheMTime = je.getLastModifiedTime().toMillis();
|
||||
}
|
||||
else
|
||||
@@ -362,7 +365,7 @@ public class ClientLoader implements Supplier<Applet>
|
||||
}
|
||||
|
||||
networkJIS.skip(Long.MAX_VALUE);
|
||||
verifyJarEntry(je, jagexCertificateChain);
|
||||
verifyJarEntry(je, jagexCertificateChains);
|
||||
long vanillaClientMTime = je.getLastModifiedTime().toMillis();
|
||||
if (!vanillaCacheIsInvalid && vanillaClientMTime != vanillaCacheMTime)
|
||||
{
|
||||
@@ -379,7 +382,7 @@ public class ClientLoader implements Supplier<Applet>
|
||||
{
|
||||
// as with the request stream, its important to not early close vanilla too
|
||||
JarInputStream vanillaCacheTest = new JarInputStream(Channels.newInputStream(vanilla));
|
||||
verifyWholeJar(vanillaCacheTest, jagexCertificateChain);
|
||||
verifyWholeJar(vanillaCacheTest, jagexCertificateChains);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -395,7 +398,7 @@ public class ClientLoader implements Supplier<Applet>
|
||||
OutputStream out = Channels.newOutputStream(vanilla);
|
||||
out.write(preRead.toByteArray());
|
||||
copyStream.setOut(out);
|
||||
verifyWholeJar(networkJIS, jagexCertificateChain);
|
||||
verifyWholeJar(networkJIS, jagexCertificateChains);
|
||||
copyStream.skip(Long.MAX_VALUE); // write the trailer to the file too
|
||||
out.flush();
|
||||
vanilla.truncate(vanilla.position());
|
||||
@@ -612,9 +615,9 @@ public class ClientLoader implements Supplier<Applet>
|
||||
return rs;
|
||||
}
|
||||
|
||||
private static Certificate[] getJagexCertificateChain()
|
||||
private static Certificate[] loadCertificateChain(String name)
|
||||
{
|
||||
try (InputStream in = ClientLoader.class.getResourceAsStream("jagex.crt"))
|
||||
try (InputStream in = ClientLoader.class.getResourceAsStream(name))
|
||||
{
|
||||
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
|
||||
Collection<? extends Certificate> certificates = certificateFactory.generateCertificates(in);
|
||||
@@ -626,28 +629,33 @@ public class ClientLoader implements Supplier<Applet>
|
||||
}
|
||||
}
|
||||
|
||||
private void verifyJarEntry(JarEntry je, Certificate[] certs) throws VerificationException
|
||||
private void verifyJarEntry(JarEntry je, Certificate[][] chains) throws VerificationException
|
||||
{
|
||||
switch (je.getName())
|
||||
if (je.getName().equals("META-INF/JAGEXLTD.SF") || je.getName().equals("META-INF/JAGEXLTD.RSA"))
|
||||
{
|
||||
case "META-INF/JAGEXLTD.SF":
|
||||
case "META-INF/JAGEXLTD.RSA":
|
||||
// You can't sign the signing files
|
||||
return;
|
||||
default:
|
||||
if (!Arrays.equals(je.getCertificates(), certs))
|
||||
{
|
||||
throw new VerificationException("Unable to verify jar entry: " + je.getName());
|
||||
}
|
||||
// You can't sign the signing files
|
||||
return;
|
||||
}
|
||||
|
||||
// Jar entry must match one of the trusted certificate chains
|
||||
Certificate[] entryCertificates = je.getCertificates();
|
||||
for (Certificate[] chain : chains)
|
||||
{
|
||||
if (Arrays.equals(entryCertificates, chain))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new VerificationException("Unable to verify jar entry: " + je.getName());
|
||||
}
|
||||
|
||||
private void verifyWholeJar(JarInputStream jis, Certificate[] certs) throws IOException, VerificationException
|
||||
private void verifyWholeJar(JarInputStream jis, Certificate[][] chains) throws IOException, VerificationException
|
||||
{
|
||||
for (JarEntry je; (je = jis.getNextJarEntry()) != null; )
|
||||
{
|
||||
jis.skip(Long.MAX_VALUE);
|
||||
verifyJarEntry(je, certs);
|
||||
verifyJarEntry(je, chains);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user