diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-02-28 19:33:05 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-02-28 19:33:05 +0100 |
commit | 1a9793197fadaa25520e2cbb7f5d26e23eca2572 (patch) | |
tree | 9d8884d63d60a0e072f733b60c49a1661c48f12f /logic/minecraft/legacy/LegacyInstance.cpp | |
parent | 9497b7e96cfac6e60a53fe05c0ca945ecc839533 (diff) | |
download | PrismLauncher-1a9793197fadaa25520e2cbb7f5d26e23eca2572.tar.gz PrismLauncher-1a9793197fadaa25520e2cbb7f5d26e23eca2572.tar.bz2 PrismLauncher-1a9793197fadaa25520e2cbb7f5d26e23eca2572.zip |
GH-1502 move launch script generation to the Minecraft launch step
Diffstat (limited to 'logic/minecraft/legacy/LegacyInstance.cpp')
-rw-r--r-- | logic/minecraft/legacy/LegacyInstance.cpp | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/logic/minecraft/legacy/LegacyInstance.cpp b/logic/minecraft/legacy/LegacyInstance.cpp index 056079f6..6650598d 100644 --- a/logic/minecraft/legacy/LegacyInstance.cpp +++ b/logic/minecraft/legacy/LegacyInstance.cpp @@ -105,31 +105,10 @@ std::shared_ptr<Task> LegacyInstance::createUpdateTask() std::shared_ptr<LaunchTask> LegacyInstance::createLaunchTask(AuthSessionPtr session) { - QString launchScript; QIcon icon = ENV.icons()->getIcon(iconKey()); auto pixmap = icon.pixmap(128, 128); pixmap.save(FS::PathCombine(minecraftRoot(), "icon.png"), "PNG"); - // create the launch script - { - // window size - QString windowParams; - if (settings()->get("LaunchMaximized").toBool()) - windowParams = "max"; - else - windowParams = QString("%1x%2") - .arg(settings()->get("MinecraftWinWidth").toInt()) - .arg(settings()->get("MinecraftWinHeight").toInt()); - - QString lwjgl = QDir(m_lwjglFolderSetting->get().toString() + "/" + lwjglVersion()) - .absolutePath(); - launchScript += "userName " + session->player_name + "\n"; - launchScript += "sessionId " + session->session + "\n"; - launchScript += "windowTitle " + windowTitle() + "\n"; - launchScript += "windowParams " + windowParams + "\n"; - launchScript += "lwjgl " + lwjgl + "\n"; - launchScript += "launcher legacy\n"; - } auto process = LaunchTask::create(std::dynamic_pointer_cast<MinecraftInstance>(getSharedPtr())); auto pptr = process.get(); @@ -163,7 +142,7 @@ std::shared_ptr<LaunchTask> LegacyInstance::createLaunchTask(AuthSessionPtr sess { auto step = std::make_shared<LaunchMinecraft>(pptr); step->setWorkingDirectory(minecraftRoot()); - step->setLaunchScript(launchScript); + step->setAuthSession(session); process->appendStep(step); } // run post-exit command if that's needed @@ -261,6 +240,31 @@ std::shared_ptr<Task> LegacyInstance::createJarModdingTask() return std::make_shared<JarModTask>(std::dynamic_pointer_cast<LegacyInstance>(shared_from_this())); } +QString LegacyInstance::createLaunchScript(AuthSessionPtr session) +{ + QString launchScript; + + // window size + QString windowParams; + if (settings()->get("LaunchMaximized").toBool()) + { + windowParams = "max"; + } + else + { + windowParams = QString("%1x%2").arg(settings()->get("MinecraftWinWidth").toInt()).arg(settings()->get("MinecraftWinHeight").toInt()); + } + + QString lwjgl = QDir(m_lwjglFolderSetting->get().toString() + "/" + lwjglVersion()).absolutePath(); + launchScript += "userName " + session->player_name + "\n"; + launchScript += "sessionId " + session->session + "\n"; + launchScript += "windowTitle " + windowTitle() + "\n"; + launchScript += "windowParams " + windowParams + "\n"; + launchScript += "lwjgl " + lwjgl + "\n"; + launchScript += "launcher legacy\n"; + return launchScript; +} + void LegacyInstance::cleanupAfterRun() { // FIXME: delete the launcher and icons and whatnot. |