Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2023-08-11 00:37:27 +01:00
parent e2d77f21ba
commit f6d8c9659c
No known key found for this signature in database
GPG Key ID: 5E39D70B4C93C38E
3 changed files with 31 additions and 15 deletions

View File

@ -626,7 +626,7 @@ QString MinecraftInstance::createLaunchScript(AuthSessionPtr session, MinecraftS
{ {
QString windowParams; QString windowParams;
if (settings()->get("LaunchMaximized").toBool()) if (settings()->get("LaunchMaximized").toBool())
windowParams = "max"; windowParams = "maximized";
else else
windowParams = windowParams =
QString("%1x%2").arg(settings()->get("MinecraftWinWidth").toInt()).arg(settings()->get("MinecraftWinHeight").toInt()); QString("%1x%2").arg(settings()->get("MinecraftWinWidth").toInt()).arg(settings()->get("MinecraftWinHeight").toInt());
@ -637,7 +637,8 @@ QString MinecraftInstance::createLaunchScript(AuthSessionPtr session, MinecraftS
// instance info // instance info
{ {
launchScript += "instanceName " + name() + "\n"; launchScript += "instanceName " + name() + "\n";
launchScript += "instanceIconKey " + iconKey() + "\n"; launchScript += "instanceIconKey " + name() + "\n";
launchScript += "instanceIconPath icon.png\n"; // we already save a copy here
} }
// legacy auth // legacy auth

View File

@ -105,19 +105,8 @@ public final class EntryPoint {
return ExitCode.ABORT; return ExitCode.ABORT;
} }
// populate properties to provide mods with more info setProperties(params);
String name = params.getString("instanceName", "");
String iconKey = params.getString("instanceIconKey", "default");
System.setProperty("org.prismlauncher.instance.name", name);
System.setProperty("org.prismlauncher.instance.icon.id", iconKey);
System.setProperty("org.prismlauncher.instance.icon.path", "icon.png");
// set multimc properties for compatibility
System.setProperty("multimc.instance.title", name);
System.setProperty("multimc.instance.icon", iconKey);
// launch the game
String launcherType = params.getString("launcher"); String launcherType = params.getString("launcher");
try { try {
@ -150,6 +139,32 @@ public final class EntryPoint {
} }
} }
private static void setProperties(Parameters params) {
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);
// 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 { private static PreLaunchAction parseLine(String input, Parameters params) throws ParseException {
switch (input) { switch (input) {
case "": case "":

View File

@ -83,7 +83,7 @@ public abstract class AbstractLauncher implements Launcher {
String windowParams = params.getString("windowParams", null); String windowParams = params.getString("windowParams", null);
if ("max".equals(windowParams) || windowParams == null) { if ("maximized".equals(windowParams) || windowParams == null) {
maximize = windowParams != null; maximize = windowParams != null;
width = DEFAULT_WINDOW_WIDTH; width = DEFAULT_WINDOW_WIDTH;