Skip to content

Commit

Permalink
feat: forward launcher arguments to runelite process
Browse files Browse the repository at this point in the history
  • Loading branch information
notmeta committed Nov 17, 2024
1 parent 05d4f88 commit c7caa08
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import javax.swing.ImageIcon
import javax.swing.SwingUtilities
import javax.swing.UIManager

public fun main() {
public fun main(args: Array<String>) {
if (args.isNotEmpty()) {
System.setProperty("net.rsprox.gui.args", args.joinToString("|"))
}
Locale.setDefault(Locale.US)
SplashScreen.init()
SplashScreen.stage(0.0, "Preparing", "Setting up environment")
Expand Down
7 changes: 4 additions & 3 deletions launcher/src/main/kotlin/net/rsprox/launcher/Launcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import java.util.Locale
import kotlin.io.path.Path
import kotlin.io.path.absolutePathString

public fun main() {
public fun main(args: Array<String>) {
Locale.setDefault(Locale.US)
SplashScreen.init()
SplashScreen.stage(0.0, "Preparing", "Setting up environment")
Expand All @@ -29,7 +29,7 @@ public fun main() {
val builder =
ProcessBuilder()
.inheritIO()
.command(launcher.getLaunchArgs())
.command(launcher.getLaunchArgs(args))

SplashScreen.stop()
builder.start()
Expand Down Expand Up @@ -61,7 +61,7 @@ public class Launcher {
Files.createDirectories(artifactRepo)
}

public fun getLaunchArgs(): List<String> {
public fun getLaunchArgs(launcherArgs: Array<String>): List<String> {
clean()
download()

Expand All @@ -78,6 +78,7 @@ public class Launcher {
"-cp",
classpath.toString(),
bootstrap.proxy.mainClass,
*launcherArgs
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class RuneliteLauncher {
clean()
download()

val guiArgs = System.getProperty("net.rsprox.gui.args")?.split("|") ?: emptyList()
val classpath = StringBuilder()
for (artifact in bootstrap.artifacts) {
if (classpath.isNotEmpty()) {
Expand All @@ -55,7 +56,6 @@ public class RuneliteLauncher {
}

return listOf(
"java",
"-cp",
classpath.toString(),
bootstrap.launcher.mainClass,
Expand All @@ -64,6 +64,7 @@ public class RuneliteLauncher {
"--jav_config=$javConfig",
"--socket_id=$socket",
"--developer-mode",
*guiArgs.toTypedArray(),
)
}

Expand Down

0 comments on commit c7caa08

Please sign in to comment.