Merge pull request #1515 from TheKodeToad/sysprops
This commit is contained in:
commit
b376888f43
@ -388,7 +388,7 @@ QString BaseInstance::name() const
|
||||
|
||||
QString BaseInstance::windowTitle() const
|
||||
{
|
||||
return BuildConfig.LAUNCHER_DISPLAYNAME + ": " + name().replace(QRegularExpression("\\s+"), " ");
|
||||
return BuildConfig.LAUNCHER_DISPLAYNAME + ": " + name();
|
||||
}
|
||||
|
||||
// FIXME: why is this here? move it to MinecraftInstance!!!
|
||||
|
@ -710,7 +710,7 @@ QString MinecraftInstance::createLaunchScript(AuthSessionPtr session, MinecraftS
|
||||
{
|
||||
QString windowParams;
|
||||
if (settings()->get("LaunchMaximized").toBool())
|
||||
windowParams = "max";
|
||||
windowParams = "maximized";
|
||||
else
|
||||
windowParams =
|
||||
QString("%1x%2").arg(settings()->get("MinecraftWinWidth").toInt()).arg(settings()->get("MinecraftWinHeight").toInt());
|
||||
@ -718,6 +718,19 @@ QString MinecraftInstance::createLaunchScript(AuthSessionPtr session, MinecraftS
|
||||
launchScript += "windowParams " + windowParams + "\n";
|
||||
}
|
||||
|
||||
// launcher info
|
||||
{
|
||||
launchScript += "launcherBrand " + BuildConfig.LAUNCHER_NAME + "\n";
|
||||
launchScript += "launcherVersion " + BuildConfig.printableVersionString() + "\n";
|
||||
}
|
||||
|
||||
// instance info
|
||||
{
|
||||
launchScript += "instanceName " + name() + "\n";
|
||||
launchScript += "instanceIconKey " + name() + "\n";
|
||||
launchScript += "instanceIconPath icon.png\n"; // we already save a copy here
|
||||
}
|
||||
|
||||
// legacy auth
|
||||
if (session) {
|
||||
launchScript += "userName " + session->player_name + "\n";
|
||||
|
@ -105,13 +105,16 @@ public final class EntryPoint {
|
||||
return ExitCode.ABORT;
|
||||
}
|
||||
|
||||
setProperties(params);
|
||||
|
||||
String launcherType = params.getString("launcher");
|
||||
|
||||
try {
|
||||
LegacyProxy.applyOnlineFixes(params);
|
||||
|
||||
Launcher launcher;
|
||||
String type = params.getString("launcher");
|
||||
|
||||
switch (type) {
|
||||
switch (launcherType) {
|
||||
case "standard":
|
||||
launcher = new StandardLauncher(params);
|
||||
break;
|
||||
@ -121,7 +124,7 @@ public final class EntryPoint {
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid launcher type: " + type);
|
||||
throw new IllegalArgumentException("Invalid launcher type: " + launcherType);
|
||||
}
|
||||
|
||||
launcher.launch();
|
||||
@ -138,6 +141,39 @@ public final class EntryPoint {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setProperties(Parameters params) {
|
||||
String launcherBrand = params.getString("launcherBrand", null);
|
||||
String launcherVersion = params.getString("launcherVersion", null);
|
||||
String name = params.getString("instanceName", null);
|
||||
String iconId = params.getString("instanceIconKey", null);
|
||||
String iconPath = params.getString("instanceIconPath", null);
|
||||
String windowTitle = params.getString("windowTitle", null);
|
||||
String windowDimensions = params.getString("windowParams", null);
|
||||
|
||||
if (launcherBrand != null)
|
||||
System.setProperty("minecraft.launcher.brand", launcherBrand);
|
||||
if (launcherVersion != null)
|
||||
System.setProperty("minecraft.launcher.version", launcherVersion);
|
||||
|
||||
// set useful properties for mods
|
||||
if (name != null)
|
||||
System.setProperty("org.prismlauncher.instance.name", name);
|
||||
if (iconId != null)
|
||||
System.setProperty("org.prismlauncher.instance.icon.id", iconId);
|
||||
if (iconPath != null)
|
||||
System.setProperty("org.prismlauncher.instance.icon.path", iconPath);
|
||||
if (windowTitle != null)
|
||||
System.setProperty("org.prismlauncher.window.title", windowTitle);
|
||||
if (windowDimensions != null)
|
||||
System.setProperty("org.prismlauncher.window.dimensions", windowDimensions);
|
||||
|
||||
// set multimc properties for compatibility
|
||||
if (name != null)
|
||||
System.setProperty("multimc.instance.title", name);
|
||||
if (iconId != null)
|
||||
System.setProperty("multimc.instance.icon", iconId);
|
||||
}
|
||||
|
||||
private static PreLaunchAction parseLine(String input, Parameters params) throws ParseException {
|
||||
switch (input) {
|
||||
case "":
|
||||
|
@ -83,7 +83,7 @@ public abstract class AbstractLauncher implements Launcher {
|
||||
|
||||
String windowParams = params.getString("windowParams", null);
|
||||
|
||||
if ("max".equals(windowParams) || windowParams == null) {
|
||||
if ("maximized".equals(windowParams) || windowParams == null) {
|
||||
maximize = windowParams != null;
|
||||
|
||||
width = DEFAULT_WINDOW_WIDTH;
|
||||
|
Loading…
Reference in New Issue
Block a user