Fix launch

This commit is contained in:
Johannes Frohnmeyer 2022-09-18 20:11:06 +02:00
parent 58ffd7d11e
commit 3480e0d965
Signed by: Johannes
GPG Key ID: E76429612C2929F4
6 changed files with 16 additions and 7 deletions

View File

@ -1,6 +1,7 @@
package io.gitlab.jfronny.inceptum.launcher.api.account;
import io.gitlab.jfronny.commons.io.JFiles;
import io.gitlab.jfronny.commons.serialize.gson.api.GsonHolder;
import io.gitlab.jfronny.gson.reflect.TypeToken;
import io.gitlab.jfronny.inceptum.launcher.LauncherEnv;
import io.gitlab.jfronny.inceptum.common.*;

View File

@ -20,7 +20,7 @@ public class OauthTokenResponseDeserializer implements JsonDeserializer<OauthTok
oauthTokenResponse.userId = rootObject.get("user_id").getAsString();
if (rootObject.has("foci")) {
oauthTokenResponse.foci = rootObject.get("foci").getAsString();
oauthTokenResponse.foci = rootObject.get("foci").isJsonNull() ? null : rootObject.get("foci").getAsString();
}
if (rootObject.has("expires_at")) {

View File

@ -17,6 +17,7 @@ public class VersionInfo extends VersionsListInfo implements Cloneable {
@Override
public VersionInfo clone() {
VersionInfo clone = new VersionInfo();
clone.copyFrom(this);
if (arguments != null) clone.arguments = arguments.clone();
if (assetIndex != null) clone.assetIndex = assetIndex.clone();
clone.assets = assets;

View File

@ -10,4 +10,14 @@ public class VersionsListInfo {
public Date releaseTime;
public String sha1;
public Integer complianceLevel;
public void copyFrom(VersionsListInfo vli) {
this.id = vli.id;
this.type = vli.type;
this.url = vli.url;
this.time = vli.time == null ? null : new Date(vli.time.getTime());
this.releaseTime = vli.releaseTime == null ? null : new Date(vli.releaseTime.getTime());
this.sha1 = vli.sha1;
this.complianceLevel = vli.complianceLevel;
}
}

View File

@ -2,6 +2,7 @@ package io.gitlab.jfronny.inceptum.launcher.system.launch;
import io.gitlab.jfronny.commons.OSUtils;
import io.gitlab.jfronny.commons.io.JFiles;
import io.gitlab.jfronny.inceptum.common.api.MavenApi;
import io.gitlab.jfronny.inceptum.launcher.LauncherEnv;
import io.gitlab.jfronny.inceptum.common.*;
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.*;
@ -84,15 +85,13 @@ public class InstanceLauncher {
Path gameJar = MetaHolder.LIBRARIES_DIR.resolve("net/minecraft/" + launchType.name).resolve(versionDataSimple.id + ".jar");
classPath.append(gameJar);
classPath.append(File.pathSeparatorChar);
classPath.append(MetaHolder.LIBRARIES_DIR.resolve(DownloadLibrariesStep.getLaunchWrapperArtifact()));
classPath.append(MetaHolder.LIBRARIES_DIR.resolve(MavenApi.mavenNotationToJarPath(DownloadLibrariesStep.getLaunchWrapperArtifact())));
// JVM arguments
if (launchType == LaunchType.Client && versionInfo.arguments != null)
args.addAll(parse(versionInfo.arguments.jvm, versionInfo, instance, classPath.toString(), instancePath.toAbsolutePath().toString(), authInfo));
if (instance.minMem != null) args.add("-Xms" + instance.minMem);
if (instance.maxMem != null) args.add("-Xmx" + instance.maxMem);
if (instance.arguments != null && instance.arguments.jvm != null) args.addAll(instance.arguments.jvm);
// Native library path
args.add("-Djava.library.path=" + MetaHolder.NATIVES_DIR.resolve(instance.getMinecraftVersion()));
// Forceload natives
if (Files.exists(MetaHolder.FORCE_LOAD_PATH)) {
args.add("-Dinceptum.forceloadNatives=" + MetaHolder.FORCE_LOAD_PATH);
@ -117,9 +116,6 @@ public class InstanceLauncher {
}
args.add(fabricAddMods.substring(0, fabricAddMods.length() - 1));
}
// Add classpath to args
args.add("-cp");
args.add(classPath.toString());
// Wrapper class (launched by vm, launches main class)
args.add("io.gitlab.jfronny.inceptum.launchwrapper.Main");
// Main class

View File

@ -8,6 +8,7 @@ import java.util.stream.Stream;
public class Main {
public static void main(String[] args) throws ClassNotFoundException, IOException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
if (args.length == 0) throw new IllegalArgumentException("Missing class argument");
System.out.println("Starting Inceptum launchwrapper");
String forceloadNatives = System.getProperty("inceptum.forceloadNatives");
if (forceloadNatives != null) {