diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-01-12 22:17:14 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-01-12 22:17:14 +0100 |
commit | b589a12d1765f8df616779c53e614adef2e4c48e (patch) | |
tree | 83cdd87d532a36df1177987547c57058fd4f1777 /logic/MinecraftProcess.cpp | |
parent | 498520446fcd10003226822f5ada9c2fe90e8c63 (diff) | |
parent | fca4441229808891f460d5fbc4affd51e8896aa5 (diff) | |
download | MultiMC-b589a12d1765f8df616779c53e614adef2e4c48e.tar MultiMC-b589a12d1765f8df616779c53e614adef2e4c48e.tar.gz MultiMC-b589a12d1765f8df616779c53e614adef2e4c48e.tar.lz MultiMC-b589a12d1765f8df616779c53e614adef2e4c48e.tar.xz MultiMC-b589a12d1765f8df616779c53e614adef2e4c48e.zip |
Merge branch 'feature_better_launch' into develop
Diffstat (limited to 'logic/MinecraftProcess.cpp')
-rw-r--r-- | logic/MinecraftProcess.cpp | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/logic/MinecraftProcess.cpp b/logic/MinecraftProcess.cpp index b3959db9..9c69f1a7 100644 --- a/logic/MinecraftProcess.cpp +++ b/logic/MinecraftProcess.cpp @@ -14,13 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include "MultiMC.h" #include "MinecraftProcess.h" #include <QDataStream> #include <QFile> #include <QDir> -//#include <QImage> #include <QProcessEnvironment> #include "BaseInstance.h" @@ -59,11 +59,6 @@ MinecraftProcess::MinecraftProcess(BaseInstance *inst) : m_instance(inst) connect(this, SIGNAL(readyReadStandardOutput()), SLOT(on_stdOut())); } -void MinecraftProcess::setArguments(QStringList args) -{ - m_args = args; -} - void MinecraftProcess::setWorkdir(QString path) { QDir mcDir(path); @@ -197,13 +192,43 @@ void MinecraftProcess::launch() } m_instance->setLastLaunch(); + auto &settings = m_instance->settings(); + + //////////// java arguments //////////// + QStringList args; + { + // custom args go first. we want to override them if we have our own here. + args.append(m_instance->extraArguments()); + + // OSX dock icon and name + #ifdef OSX + args << "-Xdock:icon=icon.png"; + args << QString("-Xdock:name=\"%1\"").arg(windowTitle); + #endif + + // HACK: Stupid hack for Intel drivers. See: https://mojang.atlassian.net/browse/MCL-767 + #ifdef Q_OS_WIN32 + args << QString("-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_" + "minecraft.exe.heapdump"); + #endif + + args << QString("-Xms%1m").arg(settings.get("MinMemAlloc").toInt()); + args << QString("-Xmx%1m").arg(settings.get("MaxMemAlloc").toInt()); + args << QString("-XX:PermSize=%1m").arg(settings.get("PermGen").toInt()); + if(!m_nativeFolder.isEmpty()) + args << QString("-Djava.library.path=%1").arg(m_nativeFolder); + args << "-jar" << PathCombine(MMC->bin(), "jars", "NewLaunch.jar"); + } - emit log(QString("Minecraft folder is: '%1'").arg(workingDirectory())); QString JavaPath = m_instance->settings().get("JavaPath").toString(); - emit log(QString("Java path: '%1'").arg(JavaPath)); - QString allArgs = m_args.join("' '"); - emit log(QString("Arguments: '%1'").arg(censorPrivateInfo(allArgs))); - start(JavaPath, m_args); + emit log("MultiMC version: " + MMC->version().toString() + "\n\n"); + emit log("Minecraft folder is:\n" + workingDirectory() + "\n\n"); + emit log("Java path is:\n" + JavaPath + "\n\n"); + QString allArgs = args.join(", "); + emit log("Java Arguments:\n[" + censorPrivateInfo(allArgs) + "]\n\n"); + + // instantiate the launcher part + start(JavaPath, args); if (!waitForStarted()) { //: Error message displayed if instace can't start @@ -212,11 +237,13 @@ void MinecraftProcess::launch() emit launch_failed(m_instance); return; } + // send the launch script to the launcher part + QByteArray bytes = launchScript.toUtf8(); + writeData(bytes.constData(), bytes.length()); } MessageLevel::Enum MinecraftProcess::getLevel(const QString &line, MessageLevel::Enum level) { - if (line.contains("[INFO]") || line.contains("[CONFIG]") || line.contains("[FINE]") || line.contains("[FINER]") || line.contains("[FINEST]")) level = MessageLevel::Message; |