Пример #1
0
MinecraftProcess *LegacyInstance::prepareForLaunch(MojangAccountPtr account)
{
	MinecraftProcess *proc = new MinecraftProcess(this);

	QIcon icon = MMC->icons()->getIcon(iconKey());
	auto pixmap = icon.pixmap(128, 128);
	pixmap.save(PathCombine(minecraftRoot(), "icon.png"), "PNG");

	// create the launch script
	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(MMC->settings()->get("LWJGLDir").toString() + "/" + lwjglVersion())
							.absolutePath();
		launchScript += "userName " + account->currentProfile()->name + "\n";
		launchScript += "sessionId " + account->sessionId() + "\n";
		launchScript += "windowTitle " + windowTitle() + "\n";
		launchScript += "windowParams " + windowParams + "\n";
		launchScript += "lwjgl " + lwjgl + "\n";
		launchScript += "launch legacy\n";
	}
	proc->setLaunchScript(launchScript);

	// set the process work path
	proc->setWorkdir(minecraftRoot());

	return proc;
}
Пример #2
0
MinecraftProcess *LegacyInstance::prepareForLaunch(MojangAccountPtr account)
{
	MinecraftProcess *proc = new MinecraftProcess(this);

	QIcon icon = MMC->icons()->getIcon(iconKey());
	auto pixmap = icon.pixmap(128, 128);
	pixmap.save(PathCombine(minecraftRoot(), "icon.png"), "PNG");

	// extract the legacy launcher
	QFile(":/java/launcher.jar").copy(PathCombine(minecraftRoot(), LAUNCHER_FILE));

	// set the process arguments
	{
		QStringList args;

		// window size
		QString windowSize;
		if (settings().get("LaunchMaximized").toBool())
			windowSize = "max";
		else
			windowSize = QString("%1x%2").arg(settings().get("MinecraftWinWidth").toInt()).arg(
				settings().get("MinecraftWinHeight").toInt());

		// window title
		QString windowTitle;
		windowTitle.append("MultiMC: ").append(name());

		// Java arguments
		args.append(Util::Commandline::splitArgs(settings().get("JvmArgs").toString()));

#ifdef OSX
		// OSX dock icon and name
		args << "-Xdock:icon=icon.png";
		args << QString("-Xdock:name=\"%1\"").arg(windowTitle);
#endif

		QString lwjgl = QDir(MMC->settings()->get("LWJGLDir").toString() + "/" + lwjglVersion())
							.absolutePath();

		// launcher arguments
		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());
/**
* 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 << "-jar" << LAUNCHER_FILE;
		args << account->currentProfile()->name();
		args << account->sessionId();
		args << windowTitle;
		args << windowSize;
		args << lwjgl;
		proc->setArguments(args);
	}

	// set the process work path
	proc->setWorkdir(minecraftRoot());

	return proc;
}