MCPcopy Create free account
hub / github.com/ElyPrismLauncher/Launcher / launch

Method launch

launcher/Application.cpp:1536–1578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1534}
1535
1536bool Application::launch(BaseInstance* instance,
1537 LaunchMode mode,
1538 MinecraftTarget::Ptr targetToJoin,
1539 MinecraftAccountPtr accountToUse,
1540 const QString& offlineName)
1541{
1542 if (m_updateRunning) {
1543 qDebug() << "Cannot launch instances while an update is running. Please try again when updates are completed.";
1544 } else if (instance->canLaunch()) {
1545 QMutexLocker locker(&m_instanceExtrasMutex);
1546 auto& extras = m_instanceExtras[instance->id()];
1547 auto window = extras.window;
1548 if (window) {
1549 if (!window->saveAll()) {
1550 return false;
1551 }
1552 }
1553 auto& controller = extras.controller;
1554 controller.reset(new LaunchController());
1555 controller->setInstance(instance);
1556 controller->setLaunchMode(mode);
1557 controller->setProfiler(profilers().value(instance->settings()->get("Profiler").toString(), nullptr).get());
1558 controller->setTargetToJoin(targetToJoin);
1559 controller->setAccountToUse(accountToUse);
1560 controller->setOfflineName(offlineName);
1561 if (window) {
1562 controller->setParentWidget(window);
1563 } else if (m_mainWindow) {
1564 controller->setParentWidget(m_mainWindow);
1565 }
1566 connect(controller.get(), &LaunchController::finished, this, &Application::controllerFinished);
1567 addRunningInstance();
1568 QMetaObject::invokeMethod(controller.get(), &Task::start, Qt::QueuedConnection);
1569 return true;
1570 } else if (instance->isRunning()) {
1571 showInstanceWindow(instance, "console");
1572 return true;
1573 } else if (instance->canEdit()) {
1574 showInstanceWindow(instance);
1575 return true;
1576 }
1577 return false;
1578}
1579
1580bool Application::kill(BaseInstance* instance)
1581{

Callers

nothing calls this directly

Calls 15

setLaunchModeMethod · 0.80
setProfilerMethod · 0.80
valueMethod · 0.80
setAccountToUseMethod · 0.80
setOfflineNameMethod · 0.80
setParentWidgetMethod · 0.80
canLaunchMethod · 0.45
idMethod · 0.45
saveAllMethod · 0.45
resetMethod · 0.45
setInstanceMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected