More system properties because yes!! 🎉

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

View File

@ -385,7 +385,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!!!

View File

@ -634,6 +634,12 @@ QString MinecraftInstance::createLaunchScript(AuthSessionPtr session, MinecraftS
launchScript += "windowParams " + windowParams + "\n";
}
// instance info
{
launchScript += "instanceName " + name() + "\n";
launchScript += "instanceIconKey " + iconKey() + "\n";
}
// legacy auth
if (session) {
launchScript += "userName " + session->player_name + "\n";

View File

@ -105,11 +105,25 @@ public final class EntryPoint {
return ExitCode.ABORT;
}
// populate properties to provide mods with more info
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");
try {
Launcher launcher;
String type = params.getString("launcher");
switch (type) {
switch (launcherType) {
case "standard":
launcher = new StandardLauncher(params);
break;
@ -119,7 +133,7 @@ public final class EntryPoint {
break;
default:
throw new IllegalArgumentException("Invalid launcher type: " + type);
throw new IllegalArgumentException("Invalid launcher type: " + launcherType);
}
launcher.launch();