From 3d7d70e8dca89660567302abf87213ebc4ef8d61 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 1 Mar 2023 16:48:20 -0500 Subject: [PATCH] Add safe mode configuration flag Having a safe mode shortcut already requires teaching the launcher about safe mode, so might as well make it an easy config toggle --- .../java/net/runelite/launcher/ConfigurationFrame.java | 10 +++++++++- src/main/java/net/runelite/launcher/Launcher.java | 5 +++++ .../java/net/runelite/launcher/LauncherSettings.java | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/runelite/launcher/ConfigurationFrame.java b/src/main/java/net/runelite/launcher/ConfigurationFrame.java index ed868c2a..90491ea7 100644 --- a/src/main/java/net/runelite/launcher/ConfigurationFrame.java +++ b/src/main/java/net/runelite/launcher/ConfigurationFrame.java @@ -56,6 +56,7 @@ public class ConfigurationFrame extends JFrame private final JCheckBox chkboxNoDiffs; private final JCheckBox chkboxSkipTlsVerification; private final JCheckBox chkboxNoUpdates; + private final JCheckBox chkboxSafemode; private final JTextField txtScale; private final JTextArea txtClientArguments; private final JTextArea txtJvmArguments; @@ -85,7 +86,7 @@ private ConfigurationFrame(LauncherSettings settings) var topPanel = new JPanel(); topPanel.setBackground(DARKER_GRAY_COLOR); - topPanel.setLayout(new GridLayout(2, 2, 0, 0)); + topPanel.setLayout(new GridLayout(3, 2, 0, 0)); topPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0)); topPanel.add(chkboxDebug = checkbox( @@ -112,6 +113,12 @@ private ConfigurationFrame(LauncherSettings settings) Boolean.TRUE.equals(settings.noupdates) )); + topPanel.add(chkboxSafemode = checkbox( + "Safe mode", + "Launches the client in safe mode", + Boolean.TRUE.equals(settings.safemode) + )); + pane.add(topPanel); var midPanel = new JPanel(); @@ -190,6 +197,7 @@ private void save(ActionEvent l) settings.nodiffs = chkboxNoDiffs.isSelected(); settings.skipTlsVerification = chkboxSkipTlsVerification.isSelected(); settings.noupdates = chkboxNoUpdates.isSelected(); + settings.safemode = chkboxSafemode.isSelected(); var t = txtScale.getText(); settings.scale = null; diff --git a/src/main/java/net/runelite/launcher/Launcher.java b/src/main/java/net/runelite/launcher/Launcher.java index 71c2b78f..99962a5b 100644 --- a/src/main/java/net/runelite/launcher/Launcher.java +++ b/src/main/java/net/runelite/launcher/Launcher.java @@ -530,6 +530,11 @@ private static Collection getClientArgs(LauncherSettings settings) args.add("--debug"); } + if (settings.safemode) + { + args.add("--safe-mode"); + } + return args; } diff --git a/src/main/java/net/runelite/launcher/LauncherSettings.java b/src/main/java/net/runelite/launcher/LauncherSettings.java index 0e47aed1..e926bed5 100644 --- a/src/main/java/net/runelite/launcher/LauncherSettings.java +++ b/src/main/java/net/runelite/launcher/LauncherSettings.java @@ -64,6 +64,7 @@ class LauncherSettings boolean nodiffs; boolean skipTlsVerification; boolean noupdates; + boolean safemode; @Nullable Double scale; List clientArguments = Collections.emptyList(); @@ -138,6 +139,7 @@ String configurationStr() " nodiffs: {}" + System.lineSeparator() + " skip tls verification: {}" + System.lineSeparator() + " noupdates: {}" + System.lineSeparator() + + " safe mode: {}" + System.lineSeparator() + " scale: {}" + System.lineSeparator() + " client arguments: {}" + System.lineSeparator() + " jvm arguments: {}" + System.lineSeparator() + @@ -148,6 +150,7 @@ String configurationStr() nodiffs, skipTlsVerification, noupdates, + safemode, scale == null ? "system" : scale, clientArguments.isEmpty() ? "none" : clientArguments, jvmArguments.isEmpty() ? "none" : jvmArguments,