Skip to content

Commit

Permalink
Add safe mode configuration flag
Browse files Browse the repository at this point in the history
Having a safe mode shortcut already requires teaching the launcher about safe mode, so might as well make it an easy config toggle
  • Loading branch information
Adam- committed Mar 1, 2023
1 parent 5c9e463 commit 3d7d70e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/net/runelite/launcher/ConfigurationFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand All @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/net/runelite/launcher/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,11 @@ private static Collection<String> getClientArgs(LauncherSettings settings)
args.add("--debug");
}

if (settings.safemode)
{
args.add("--safe-mode");
}

return args;
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/net/runelite/launcher/LauncherSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class LauncherSettings
boolean nodiffs;
boolean skipTlsVerification;
boolean noupdates;
boolean safemode;
@Nullable
Double scale;
List<String> clientArguments = Collections.emptyList();
Expand Down Expand Up @@ -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() +
Expand All @@ -148,6 +150,7 @@ String configurationStr()
nodiffs,
skipTlsVerification,
noupdates,
safemode,
scale == null ? "system" : scale,
clientArguments.isEmpty() ? "none" : clientArguments,
jvmArguments.isEmpty() ? "none" : jvmArguments,
Expand Down

0 comments on commit 3d7d70e

Please sign in to comment.