Skip to content

Commit

Permalink
Additional MC args
Browse files Browse the repository at this point in the history
  • Loading branch information
Novampr committed Aug 5, 2024
1 parent 27ab49c commit 3d930e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/main/java/pojlib/API.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public static void startGame(
String memoryValue,
String questModel,
String mainClass,
String[] additionalArgs
String[] additionalArgs,
String[] mcAdditionalArgs
) {
String[] mcArgs = {"--username", username, "--version", versionName, "--gameDir", gameDir,
"--assetsDir", assetsDir, "--assetIndex", assetIndex, "--uuid", formattedUuid,
Expand All @@ -55,7 +56,7 @@ public static void startGame(
JREUtils.redirectAndPrintJRELog(activity);
VLoader.setAndroidInitInfo(activity);
try {
JREUtils.launchJavaVM(activity, allArgs, mcArgs, gameDir, memoryValue, questModel, mainClass);
JREUtils.launchJavaVM(activity, allArgs, mcArgs, mcAdditionalArgs, gameDir, memoryValue, questModel, mainClass);
} catch (Throwable t) {
throw new RuntimeException("JVM has stopped.", t);
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/pojlib/util/JREUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public static void setJavaEnvironment(Activity activity, String gameDir, String
setLdLibraryPath(jvmLibraryPath+":"+LD_LIBRARY_PATH);
}

public static int launchJavaVM(Activity activity, List<String> JVMArgs, String[] mcArgs, String gameDir, String memoryValue, String questModel, String mainClass) throws Throwable {
public static int launchJavaVM(Activity activity, List<String> JVMArgs, String[] mcArgs, String[] mcAdditionalArgs, String gameDir, String memoryValue, String questModel, String mainClass) throws Throwable {
relocateLibPath(activity);
setJavaEnvironment(activity, gameDir, questModel);

Expand Down Expand Up @@ -200,6 +200,7 @@ public static int launchJavaVM(Activity activity, List<String> JVMArgs, String[]
userArgs.add(0,"java"); //argv[0] is the program name according to C standard.
userArgs.add(mainClass);
userArgs.addAll(Arrays.asList(mcArgs));
userArgs.addAll(Arrays.asList(mcAdditionalArgs));

int exitCode = VMLauncher.launchJVM(userArgs.toArray(new String[0]));
Logger.getInstance(activity).appendToLog("Java Exit code: " + exitCode);
Expand Down

0 comments on commit 3d930e6

Please sign in to comment.