Skip to content

Commit d332998

Browse files
committed
default game options
This sets Linux installs to use window mode on first launch. The user can always change this. We also lower the game volume so you don't die when it launches.
1 parent c660dad commit d332998

File tree

1 file changed

+17
-0
lines changed
  • src/main/java/lol/hyper/customlauncher

1 file changed

+17
-0
lines changed

src/main/java/lol/hyper/customlauncher/Main.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424
import lol.hyper.customlauncher.updater.UpdateChecker;
2525
import lol.hyper.githubreleaseapi.GitHubRelease;
2626
import lol.hyper.githubreleaseapi.GitHubReleaseAPI;
27+
import org.apache.commons.lang3.SystemUtils;
2728
import org.apache.logging.log4j.LogManager;
2829
import org.apache.logging.log4j.Logger;
2930
import org.json.JSONArray;
31+
import org.json.JSONObject;
3032

3133
import javax.imageio.ImageIO;
3234
import javax.swing.*;
@@ -73,6 +75,21 @@ public static void main(String[] args) throws IOException, InterruptedException
7375
if (!TTR_INSTALL_DIR.exists()) {
7476
Files.createDirectory(TTR_INSTALL_DIR.toPath());
7577
logger.info("Creating TTR install folder at " + TTR_INSTALL_DIR.getAbsolutePath());
78+
JSONObject options = new JSONObject();
79+
// TTR on linux has a bug with fullscreen mode
80+
// we set TTR to be windowed mode on first launch
81+
// the user can always change this
82+
if (SystemUtils.IS_OS_LINUX) {
83+
JSONObject videoSettings = new JSONObject();
84+
videoSettings.put("display-mode", "window");
85+
options.put("video", videoSettings);
86+
}
87+
// lower the game audio so the user doesn't die when it launches
88+
JSONObject audioSettings = new JSONObject();
89+
audioSettings.put("music-volume", 10);
90+
audioSettings.put("sfx-volume", 10);
91+
options.put("audio", audioSettings);
92+
JSONManager.writeFile(options, new File("ttr-files/settings.json"));
7693
}
7794

7895
// load the icon

0 commit comments

Comments
 (0)