aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/launch
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/minecraft/launch')
-rw-r--r--launcher/minecraft/launch/ClaimAccount.cpp8
-rw-r--r--launcher/minecraft/launch/ClaimAccount.h17
-rw-r--r--launcher/minecraft/launch/CreateGameFolders.cpp14
-rw-r--r--launcher/minecraft/launch/CreateGameFolders.h18
-rw-r--r--launcher/minecraft/launch/DirectJavaLaunch.cpp166
-rw-r--r--launcher/minecraft/launch/DirectJavaLaunch.h58
-rw-r--r--launcher/minecraft/launch/ExtractNatives.cpp46
-rw-r--r--launcher/minecraft/launch/ExtractNatives.h14
-rw-r--r--launcher/minecraft/launch/LauncherPartLaunch.cpp106
-rw-r--r--launcher/minecraft/launch/LauncherPartLaunch.h36
-rw-r--r--launcher/minecraft/launch/MinecraftServerTarget.cpp31
-rw-r--r--launcher/minecraft/launch/MinecraftServerTarget.h2
-rw-r--r--launcher/minecraft/launch/ModMinecraftJar.cpp27
-rw-r--r--launcher/minecraft/launch/ModMinecraftJar.h15
-rw-r--r--launcher/minecraft/launch/PrintInstanceInfo.cpp79
-rw-r--r--launcher/minecraft/launch/PrintInstanceInfo.h18
-rw-r--r--launcher/minecraft/launch/ReconstructAssets.cpp7
-rw-r--r--launcher/minecraft/launch/ReconstructAssets.h12
-rw-r--r--launcher/minecraft/launch/ScanModFolders.cpp14
-rw-r--r--launcher/minecraft/launch/ScanModFolders.h19
-rw-r--r--launcher/minecraft/launch/VerifyJavaInstall.cpp24
-rw-r--r--launcher/minecraft/launch/VerifyJavaInstall.h11
22 files changed, 203 insertions, 539 deletions
diff --git a/launcher/minecraft/launch/ClaimAccount.cpp b/launcher/minecraft/launch/ClaimAccount.cpp
index 1cd7c0da..a3de1516 100644
--- a/launcher/minecraft/launch/ClaimAccount.cpp
+++ b/launcher/minecraft/launch/ClaimAccount.cpp
@@ -4,10 +4,9 @@
#include "Application.h"
#include "minecraft/auth/AccountList.h"
-ClaimAccount::ClaimAccount(LaunchTask* parent, AuthSessionPtr session): LaunchStep(parent)
+ClaimAccount::ClaimAccount(LaunchTask* parent, AuthSessionPtr session) : LaunchStep(parent)
{
- if(session->status == AuthSession::Status::PlayableOnline && !session->demo)
- {
+ if (session->status == AuthSession::Status::PlayableOnline && !session->demo) {
auto accounts = APPLICATION->accounts();
m_account = accounts->getAccountByProfileName(session->player_name);
}
@@ -15,8 +14,7 @@ ClaimAccount::ClaimAccount(LaunchTask* parent, AuthSessionPtr session): LaunchSt
void ClaimAccount::executeTask()
{
- if(m_account)
- {
+ if (m_account) {
lock.reset(new UseLock(m_account));
emitSucceeded();
}
diff --git a/launcher/minecraft/launch/ClaimAccount.h b/launcher/minecraft/launch/ClaimAccount.h
index cb4de23f..3d47539a 100644
--- a/launcher/minecraft/launch/ClaimAccount.h
+++ b/launcher/minecraft/launch/ClaimAccount.h
@@ -18,20 +18,17 @@
#include <launch/LaunchStep.h>
#include <minecraft/auth/MinecraftAccount.h>
-class ClaimAccount: public LaunchStep
-{
+class ClaimAccount : public LaunchStep {
Q_OBJECT
-public:
- explicit ClaimAccount(LaunchTask *parent, AuthSessionPtr session);
- virtual ~ClaimAccount() {};
+ public:
+ explicit ClaimAccount(LaunchTask* parent, AuthSessionPtr session);
+ virtual ~ClaimAccount(){};
void executeTask() override;
void finalize() override;
- bool canAbort() const override
- {
- return false;
- }
-private:
+ bool canAbort() const override { return false; }
+
+ private:
std::unique_ptr<UseLock> lock;
MinecraftAccountPtr m_account;
};
diff --git a/launcher/minecraft/launch/CreateGameFolders.cpp b/launcher/minecraft/launch/CreateGameFolders.cpp
index 4081e72e..36f5e640 100644
--- a/launcher/minecraft/launch/CreateGameFolders.cpp
+++ b/launcher/minecraft/launch/CreateGameFolders.cpp
@@ -1,27 +1,23 @@
#include "CreateGameFolders.h"
-#include "minecraft/MinecraftInstance.h"
-#include "launch/LaunchTask.h"
#include "FileSystem.h"
+#include "launch/LaunchTask.h"
+#include "minecraft/MinecraftInstance.h"
-CreateGameFolders::CreateGameFolders(LaunchTask* parent): LaunchStep(parent)
-{
-}
+CreateGameFolders::CreateGameFolders(LaunchTask* parent) : LaunchStep(parent) {}
void CreateGameFolders::executeTask()
{
auto instance = m_parent->instance();
std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance);
- if(!FS::ensureFolderPathExists(minecraftInstance->gameRoot()))
- {
+ if (!FS::ensureFolderPathExists(minecraftInstance->gameRoot())) {
emit logLine("Couldn't create the main game folder", MessageLevel::Error);
emitFailed(tr("Couldn't create the main game folder"));
return;
}
// HACK: this is a workaround for MCL-3732 - 'server-resource-packs' folder is created.
- if(!FS::ensureFolderPathExists(FS::PathCombine(minecraftInstance->gameRoot(), "server-resource-packs")))
- {
+ if (!FS::ensureFolderPathExists(FS::PathCombine(minecraftInstance->gameRoot(), "server-resource-packs"))) {
emit logLine("Couldn't create the 'server-resource-packs' folder", MessageLevel::Error);
}
emitSucceeded();
diff --git a/launcher/minecraft/launch/CreateGameFolders.h b/launcher/minecraft/launch/CreateGameFolders.h
index 9c7d3c94..44524ded 100644
--- a/launcher/minecraft/launch/CreateGameFolders.h
+++ b/launcher/minecraft/launch/CreateGameFolders.h
@@ -15,23 +15,17 @@
#pragma once
-#include <launch/LaunchStep.h>
#include <LoggedProcess.h>
+#include <launch/LaunchStep.h>
#include <minecraft/auth/AuthSession.h>
// Create the main .minecraft for the instance and any other necessary folders
-class CreateGameFolders: public LaunchStep
-{
+class CreateGameFolders : public LaunchStep {
Q_OBJECT
-public:
- explicit CreateGameFolders(LaunchTask *parent);
- virtual ~CreateGameFolders() {};
+ public:
+ explicit CreateGameFolders(LaunchTask* parent);
+ virtual ~CreateGameFolders(){};
virtual void executeTask();
- virtual bool canAbort() const
- {
- return false;
- }
+ virtual bool canAbort() const { return false; }
};
-
-
diff --git a/launcher/minecraft/launch/DirectJavaLaunch.cpp b/launcher/minecraft/launch/DirectJavaLaunch.cpp
deleted file mode 100644
index ca55cd2e..00000000
--- a/launcher/minecraft/launch/DirectJavaLaunch.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/* Copyright 2013-2021 MultiMC Contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "DirectJavaLaunch.h"
-
-#include <QStandardPaths>
-
-#include <launch/LaunchTask.h>
-#include <minecraft/MinecraftInstance.h>
-#include <FileSystem.h>
-#include <Commandline.h>
-
-#include "Application.h"
-
-#ifdef Q_OS_LINUX
-#include "gamemode_client.h"
-#endif
-
-DirectJavaLaunch::DirectJavaLaunch(LaunchTask *parent) : LaunchStep(parent)
-{
- connect(&m_process, &LoggedProcess::log, this, &DirectJavaLaunch::logLines);
- connect(&m_process, &LoggedProcess::stateChanged, this, &DirectJavaLaunch::on_state);
-}
-
-void DirectJavaLaunch::executeTask()
-{
- auto instance = m_parent->instance();
- std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance);
- QStringList args = minecraftInstance->javaArguments();
-
- args.append("-Djava.library.path=" + minecraftInstance->getNativePath());
-
- auto classPathEntries = minecraftInstance->getClassPath();
- args.append("-cp");
- QString classpath;
-#ifdef Q_OS_WIN32
- classpath = classPathEntries.join(';');
-#else
- classpath = classPathEntries.join(':');
-#endif
- args.append(classpath);
- args.append(minecraftInstance->getMainClass());
-
- QString allArgs = args.join(", ");
- emit logLine("Java Arguments:\n[" + m_parent->censorPrivateInfo(allArgs) + "]\n\n", MessageLevel::Launcher);
-
- auto javaPath = FS::ResolveExecutable(instance->settings()->get("JavaPath").toString());
-
- m_process.setProcessEnvironment(instance->createLaunchEnvironment());
-
- // make detachable - this will keep the process running even if the object is destroyed
- m_process.setDetachable(true);
-
- auto mcArgs = minecraftInstance->processMinecraftArgs(m_session, m_serverToJoin);
- args.append(mcArgs);
-
- QString wrapperCommandStr = instance->getWrapperCommand().trimmed();
- if(!wrapperCommandStr.isEmpty())
- {
- auto wrapperArgs = Commandline::splitArgs(wrapperCommandStr);
- auto wrapperCommand = wrapperArgs.takeFirst();
- auto realWrapperCommand = QStandardPaths::findExecutable(wrapperCommand);
- if (realWrapperCommand.isEmpty())
- {
- const char *reason = QT_TR_NOOP("The wrapper command \"%1\" couldn't be found.");
- emit logLine(QString(reason).arg(wrapperCommand), MessageLevel::Fatal);
- emitFailed(tr(reason).arg(wrapperCommand));
- return;
- }
- emit logLine("Wrapper command is:\n" + wrapperCommandStr + "\n\n", MessageLevel::Launcher);
- args.prepend(javaPath);
- m_process.start(wrapperCommand, wrapperArgs + args);
- }
- else
- {
- m_process.start(javaPath, args);
- }
-
-#ifdef Q_OS_LINUX
- if (instance->settings()->get("EnableFeralGamemode").toBool() && APPLICATION->capabilities() & Application::SupportsGameMode)
- {
- auto pid = m_process.processId();
- if (pid)
- {
- gamemode_request_start_for(pid);
- }
- }
-#endif
-}
-
-void DirectJavaLaunch::on_state(LoggedProcess::State state)
-{
- switch(state)
- {
- case LoggedProcess::FailedToStart:
- {
- //: Error message displayed if instance can't start
- const char *reason = QT_TR_NOOP("Could not launch Minecraft!");
- emit logLine(reason, MessageLevel::Fatal);
- emitFailed(tr(reason));
- return;
- }
- case LoggedProcess::Aborted:
- case LoggedProcess::Crashed:
- {
- m_parent->setPid(-1);
- emitFailed(tr("Game crashed."));
- return;
- }
- case LoggedProcess::Finished:
- {
- m_parent->setPid(-1);
- // if the exit code wasn't 0, report this as a crash
- auto exitCode = m_process.exitCode();
- if(exitCode != 0)
- {
- emitFailed(tr("Game crashed."));
- return;
- }
- //FIXME: make this work again
- // m_postlaunchprocess.processEnvironment().insert("INST_EXITCODE", QString(exitCode));
- // run post-exit
- emitSucceeded();
- break;
- }
- case LoggedProcess::Running:
- emit logLine(QString("Minecraft process ID: %1\n\n").arg(m_process.processId()), MessageLevel::Launcher);
- m_parent->setPid(m_process.processId());
- m_parent->instance()->setLastLaunch();
- break;
- default:
- break;
- }
-}
-
-void DirectJavaLaunch::setWorkingDirectory(const QString &wd)
-{
- m_process.setWorkingDirectory(wd);
-}
-
-void DirectJavaLaunch::proceed()
-{
- // nil
-}
-
-bool DirectJavaLaunch::abort()
-{
- auto state = m_process.state();
- if (state == LoggedProcess::Running || state == LoggedProcess::Starting)
- {
- m_process.kill();
- }
- return true;
-}
-
diff --git a/launcher/minecraft/launch/DirectJavaLaunch.h b/launcher/minecraft/launch/DirectJavaLaunch.h
deleted file mode 100644
index 58b119b8..00000000
--- a/launcher/minecraft/launch/DirectJavaLaunch.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright 2013-2021 MultiMC Contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <launch/LaunchStep.h>
-#include <LoggedProcess.h>
-#include <minecraft/auth/AuthSession.h>
-
-#include "MinecraftServerTarget.h"
-
-class DirectJavaLaunch: public LaunchStep
-{
- Q_OBJECT
-public:
- explicit DirectJavaLaunch(LaunchTask *parent);
- virtual ~DirectJavaLaunch() {};
-
- virtual void executeTask();
- virtual bool abort();
- virtual void proceed();
- virtual bool canAbort() const
- {
- return true;
- }
- void setWorkingDirectory(const QString &wd);
- void setAuthSession(AuthSessionPtr session)
- {
- m_session = session;
- }
-
- void setServerToJoin(MinecraftServerTargetPtr serverToJoin)
- {
- m_serverToJoin = std::move(serverToJoin);
- }
-
-private slots:
- void on_state(LoggedProcess::State state);
-
-private:
- LoggedProcess m_process;
- QString m_command;
- AuthSessionPtr m_session;
- MinecraftServerTargetPtr m_serverToJoin;
-};
-
diff --git a/launcher/minecraft/launch/ExtractNatives.cpp b/launcher/minecraft/launch/ExtractNatives.cpp
index 7d5f4179..cebeaedd 100644
--- a/launcher/minecraft/launch/ExtractNatives.cpp
+++ b/launcher/minecraft/launch/ExtractNatives.cpp
@@ -14,26 +14,25 @@
*/
#include "ExtractNatives.h"
-#include <minecraft/MinecraftInstance.h>
#include <launch/LaunchTask.h>
+#include <minecraft/MinecraftInstance.h>
#include <quazip/quazip.h>
#include <quazip/quazipdir.h>
-#include "MMCZip.h"
-#include "FileSystem.h"
#include <QDir>
+#include "FileSystem.h"
+#include "MMCZip.h"
#ifdef major
- #undef major
+#undef major
#endif
#ifdef minor
- #undef minor
+#undef minor
#endif
-static QString replaceSuffix (QString target, const QString &suffix, const QString &replacement)
+static QString replaceSuffix(QString target, const QString& suffix, const QString& replacement)
{
- if (!target.endsWith(suffix))
- {
+ if (!target.endsWith(suffix)) {
return target;
}
target.resize(target.length() - suffix.length());
@@ -43,17 +42,14 @@ static QString replaceSuffix (QString target, const QString &suffix, const QStri
static bool unzipNatives(QString source, QString targetFolder, bool applyJnilibHack, bool nativeOpenAL, bool nativeGLFW)
{
QuaZip zip(source);
- if(!zip.open(QuaZip::mdUnzip))
- {
+ if (!zip.open(QuaZip::mdUnzip)) {
return false;
}
QDir directory(targetFolder);
- if (!zip.goToFirstFile())
- {
+ if (!zip.goToFirstFile()) {
return false;
}
- do
- {
+ do {
QString name = zip.getCurrentFileName();
auto lowercase = name.toLower();
if (nativeGLFW && name.contains("glfw")) {
@@ -62,19 +58,16 @@ static bool unzipNatives(QString source, QString targetFolder, bool applyJnilibH
if (nativeOpenAL && name.contains("openal")) {
continue;
}
- if(applyJnilibHack)
- {
+ if (applyJnilibHack) {
name = replaceSuffix(name, ".jnilib", ".dylib");
}
QString absFilePath = directory.absoluteFilePath(name);
- if (!JlCompress::extractFile(&zip, "", absFilePath))
- {
+ if (!JlCompress::extractFile(&zip, "", absFilePath)) {
return false;
}
} while (zip.goToNextFile());
zip.close();
- if(zip.getZipError()!=0)
- {
+ if (zip.getZipError() != 0) {
return false;
}
return true;
@@ -85,8 +78,7 @@ void ExtractNatives::executeTask()
auto instance = m_parent->instance();
std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance);
auto toExtract = minecraftInstance->getNativeJars();
- if(toExtract.isEmpty())
- {
+ if (toExtract.isEmpty()) {
emitSucceeded();
return;
}
@@ -94,14 +86,12 @@ void ExtractNatives::executeTask()
bool nativeOpenAL = settings->get("UseNativeOpenAL").toBool();
bool nativeGLFW = settings->get("UseNativeGLFW").toBool();
- auto outputPath = minecraftInstance->getNativePath();
+ auto outputPath = minecraftInstance->getNativePath();
auto javaVersion = minecraftInstance->getJavaVersion();
bool jniHackEnabled = javaVersion.major() >= 8;
- for(const auto &source: toExtract)
- {
- if(!unzipNatives(source, outputPath, jniHackEnabled, nativeOpenAL, nativeGLFW))
- {
- const char *reason = QT_TR_NOOP("Couldn't extract native jar '%1' to destination '%2'");
+ for (const auto& source : toExtract) {
+ if (!unzipNatives(source, outputPath, jniHackEnabled, nativeOpenAL, nativeGLFW)) {
+ const char* reason = QT_TR_NOOP("Couldn't extract native jar '%1' to destination '%2'");
emit logLine(QString(reason).arg(source, outputPath), MessageLevel::Fatal);
emitFailed(tr(reason).arg(source, outputPath));
}
diff --git a/launcher/minecraft/launch/ExtractNatives.h b/launcher/minecraft/launch/ExtractNatives.h
index 094fcd6b..2ab8816b 100644
--- a/launcher/minecraft/launch/ExtractNatives.h
+++ b/launcher/minecraft/launch/ExtractNatives.h
@@ -20,19 +20,13 @@
#include "minecraft/auth/AuthSession.h"
// FIXME: temporary wrapper for existing task.
-class ExtractNatives: public LaunchStep
-{
+class ExtractNatives : public LaunchStep {
Q_OBJECT
-public:
- explicit ExtractNatives(LaunchTask *parent) : LaunchStep(parent){};
+ public:
+ explicit ExtractNatives(LaunchTask* parent) : LaunchStep(parent){};
virtual ~ExtractNatives(){};
void executeTask() override;
- bool canAbort() const override
- {
- return false;
- }
+ bool canAbort() const override { return false; }
void finalize() override;
};
-
-
diff --git a/launcher/minecraft/launch/LauncherPartLaunch.cpp b/launcher/minecraft/launch/LauncherPartLaunch.cpp
index 8ecf715d..05562ef2 100644
--- a/launcher/minecraft/launch/LauncherPartLaunch.cpp
+++ b/launcher/minecraft/launch/LauncherPartLaunch.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
*
* This program is free software: you can redistribute it and/or modify
@@ -35,29 +35,27 @@
#include "LauncherPartLaunch.h"
-#include <QStandardPaths>
#include <QRegularExpression>
+#include <QStandardPaths>
+#include "Application.h"
+#include "Commandline.h"
+#include "FileSystem.h"
#include "launch/LaunchTask.h"
#include "minecraft/MinecraftInstance.h"
-#include "FileSystem.h"
-#include "Commandline.h"
-#include "Application.h"
#ifdef Q_OS_LINUX
#include "gamemode_client.h"
#endif
-LauncherPartLaunch::LauncherPartLaunch(LaunchTask *parent) : LaunchStep(parent)
+LauncherPartLaunch::LauncherPartLaunch(LaunchTask* parent) : LaunchStep(parent)
{
auto instance = parent->instance();
- if (instance->settings()->get("CloseAfterLaunch").toBool())
- {
- std::shared_ptr<QMetaObject::Connection> connection{new QMetaObject::Connection};
+ if (instance->settings()->get("CloseAfterLaunch").toBool()) {
+ std::shared_ptr<QMetaObject::Connection> connection{ new QMetaObject::Connection };
*connection = connect(&m_process, &LoggedProcess::log, this, [=](QStringList lines, MessageLevel::Enum level) {
qDebug() << lines;
- if (lines.filter(QRegularExpression(".*Setting user.+", QRegularExpression::CaseInsensitiveOption)).length() != 0)
- {
+ if (lines.filter(QRegularExpression(".*Setting user.+", QRegularExpression::CaseInsensitiveOption)).length() != 0) {
APPLICATION->closeAllWindows();
disconnect(*connection);
}
@@ -71,7 +69,7 @@ LauncherPartLaunch::LauncherPartLaunch(LaunchTask *parent) : LaunchStep(parent)
#ifdef Q_OS_WIN
// returns 8.3 file format from long path
#include <windows.h>
-QString shortPathName(const QString & file)
+QString shortPathName(const QString& file)
{
auto input = file.toStdWString();
std::wstring output;
@@ -81,15 +79,15 @@ QString shortPathName(const QString & file)
// when it succeeds, it returns length excluding null character
// See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa364989(v=vs.85).aspx
output.resize(length);
- GetShortPathNameW(input.c_str(),(LPWSTR)output.c_str(),length);
- output.resize(length-1);
+ GetShortPathNameW(input.c_str(), (LPWSTR)output.c_str(), length);
+ output.resize(length - 1);
QString ret = QString::fromStdWString(output);
return ret;
}
#endif
// if the string survives roundtrip through local 8bit encoding...
-bool fitsInLocal8bit(const QString & string)
+bool fitsInLocal8bit(const QString& string)
{
return string == QString::fromLocal8Bit(string.toLocal8Bit());
}
@@ -97,9 +95,8 @@ bool fitsInLocal8bit(const QString & string)
void LauncherPartLaunch::executeTask()
{
QString jarPath = APPLICATION->getJarPath("NewLaunch.jar");
- if (jarPath.isEmpty())
- {
- const char *reason = QT_TR_NOOP("Launcher library could not be found. Please check your installation.");
+ if (jarPath.isEmpty()) {
+ const char* reason = QT_TR_NOOP("Launcher library could not be found. Please check your installation.");
emit logLine(tr(reason), MessageLevel::Fatal);
emitFailed(tr(reason));
return;
@@ -125,12 +122,9 @@ void LauncherPartLaunch::executeTask()
auto natPath = minecraftInstance->getNativePath();
#ifdef Q_OS_WIN
- if (!fitsInLocal8bit(natPath))
- {
+ if (!fitsInLocal8bit(natPath)) {
args << "-Djava.library.path=" + shortPathName(natPath);
- }
- else
- {
+ } else {
args << "-Djava.library.path=" + natPath;
}
#else
@@ -140,14 +134,10 @@ void LauncherPartLaunch::executeTask()
args << "-cp";
#ifdef Q_OS_WIN
QStringList processed;
- for(auto & item: classPath)
- {
- if (!fitsInLocal8bit(item))
- {
+ for (auto& item : classPath) {
+ if (!fitsInLocal8bit(item)) {
processed << shortPathName(item);
- }
- else
- {
+ } else {
processed << item;
}
}
@@ -160,14 +150,12 @@ void LauncherPartLaunch::executeTask()
qDebug() << args.join(' ');
QString wrapperCommandStr = instance->getWrapperCommand().trimmed();
- if(!wrapperCommandStr.isEmpty())
- {
+ if (!wrapperCommandStr.isEmpty()) {
auto wrapperArgs = Commandline::splitArgs(wrapperCommandStr);
auto wrapperCommand = wrapperArgs.takeFirst();
auto realWrapperCommand = QStandardPaths::findExecutable(wrapperCommand);
- if (realWrapperCommand.isEmpty())
- {
- const char *reason = QT_TR_NOOP("The wrapper command \"%1\" couldn't be found.");
+ if (realWrapperCommand.isEmpty()) {
+ const char* reason = QT_TR_NOOP("The wrapper command \"%1\" couldn't be found.");
emit logLine(QString(reason).arg(wrapperCommand), MessageLevel::Fatal);
emitFailed(tr(reason).arg(wrapperCommand));
return;
@@ -175,18 +163,14 @@ void LauncherPartLaunch::executeTask()
emit logLine("Wrapper command is:\n" + wrapperCommandStr + "\n\n", MessageLevel::Launcher);
args.prepend(javaPath);
m_process.start(wrapperCommand, wrapperArgs + args);
- }
- else
- {
+ } else {
m_process.start(javaPath, args);
}
#ifdef Q_OS_LINUX
- if (instance->settings()->get("EnableFeralGamemode").toBool() && APPLICATION->capabilities() & Application::SupportsGameMode)
- {
+ if (instance->settings()->get("EnableFeralGamemode").toBool() && APPLICATION->capabilities() & Application::SupportsGameMode) {
auto pid = m_process.processId();
- if (pid)
- {
+ if (pid) {
gamemode_request_start_for(pid);
}
}
@@ -195,25 +179,21 @@ void LauncherPartLaunch::executeTask()
void LauncherPartLaunch::on_state(LoggedProcess::State state)
{
- switch(state)
- {
- case LoggedProcess::FailedToStart:
- {
+ switch (state) {
+ case LoggedProcess::FailedToStart: {
//: Error message displayed if instace can't start
- const char *reason = QT_TR_NOOP("Could not launch Minecraft!");
+ const char* reason = QT_TR_NOOP("Could not launch Minecraft!");
emit logLine(reason, MessageLevel::Fatal);
emitFailed(tr(reason));
return;
}
case LoggedProcess::Aborted:
- case LoggedProcess::Crashed:
- {
+ case LoggedProcess::Crashed: {
m_parent->setPid(-1);
emitFailed(tr("Game crashed."));
return;
}
- case LoggedProcess::Finished:
- {
+ case LoggedProcess::Finished: {
auto instance = m_parent->instance();
if (instance->settings()->get("CloseAfterLaunch").toBool())
APPLICATION->showMainWindow();
@@ -221,14 +201,13 @@ void LauncherPartLaunch::on_state(LoggedProcess::State state)
m_parent->setPid(-1);
// if the exit code wasn't 0, report this as a crash
auto exitCode = m_process.exitCode();
- if(exitCode != 0)
- {
+ if (exitCode != 0) {
emitFailed(tr("Game crashed."));
return;
}
- //FIXME: make this work again
- // m_postlaunchprocess.processEnvironment().insert("INST_EXITCODE", QString(exitCode));
- // run post-exit
+ // FIXME: make this work again
+ // m_postlaunchprocess.processEnvironment().insert("INST_EXITCODE", QString(exitCode));
+ // run post-exit
emitSucceeded();
break;
}
@@ -247,15 +226,14 @@ void LauncherPartLaunch::on_state(LoggedProcess::State state)
}
}
-void LauncherPartLaunch::setWorkingDirectory(const QString &wd)
+void LauncherPartLaunch::setWorkingDirectory(const QString& wd)
{
m_process.setWorkingDirectory(wd);
}
void LauncherPartLaunch::proceed()
{
- if(mayProceed)
- {
+ if (mayProceed) {
QString launchString("launch\n");
m_process.write(launchString.toUtf8());
mayProceed = false;
@@ -264,17 +242,13 @@ void LauncherPartLaunch::proceed()
bool LauncherPartLaunch::abort()
{
- if(mayProceed)
- {
+ if (mayProceed) {
mayProceed = false;
QString launchString("abort\n");
m_process.write(launchString.toUtf8());
- }
- else
- {
+ } else {
auto state = m_process.state();
- if (state == LoggedProcess::Running || state == LoggedProcess::Starting)
- {
+ if (state == LoggedProcess::Running || state == LoggedProcess::Starting) {
m_process.kill();
}
}
diff --git a/launcher/minecraft/launch/LauncherPartLaunch.h b/launcher/minecraft/launch/LauncherPartLaunch.h
index 6a7ee0e5..9f6ca1e7 100644
--- a/launcher/minecraft/launch/LauncherPartLaunch.h
+++ b/launcher/minecraft/launch/LauncherPartLaunch.h
@@ -15,41 +15,31 @@
#pragma once
-#include <launch/LaunchStep.h>
#include <LoggedProcess.h>
+#include <launch/LaunchStep.h>
#include <minecraft/auth/AuthSession.h>
#include "MinecraftServerTarget.h"
-class LauncherPartLaunch: public LaunchStep
-{
+class LauncherPartLaunch : public LaunchStep {
Q_OBJECT
-public:
- explicit LauncherPartLaunch(LaunchTask *parent);
- virtual ~LauncherPartLaunch() {};
+ public:
+ explicit LauncherPartLaunch(LaunchTask* parent);
+ virtual ~LauncherPartLaunch(){};
virtual void executeTask();
virtual bool abort();
virtual void proceed();
- virtual bool canAbort() const
- {
- return true;
- }
- void setWorkingDirectory(const QString &wd);
- void setAuthSession(AuthSessionPtr session)
- {
- m_session = session;
- }
-
- void setServerToJoin(MinecraftServerTargetPtr serverToJoin)
- {
- m_serverToJoin = std::move(serverToJoin);
- }
-
-private slots:
+ virtual bool canAbort() const { return true; }
+ void setWorkingDirectory(const QString& wd);
+ void setAuthSession(AuthSessionPtr session) { m_session = session; }
+
+ void setServerToJoin(MinecraftServerTargetPtr serverToJoin) { m_serverToJoin = std::move(serverToJoin); }
+
+ private slots:
void on_state(LoggedProcess::State state);
-private:
+ private:
LoggedProcess m_process;
QString m_command;
AuthSessionPtr m_session;
diff --git a/launcher/minecraft/launch/MinecraftServerTarget.cpp b/launcher/minecraft/launch/MinecraftServerTarget.cpp
index a3383ec0..e201efab 100644
--- a/launcher/minecraft/launch/MinecraftServerTarget.cpp
+++ b/launcher/minecraft/launch/MinecraftServerTarget.cpp
@@ -18,50 +18,43 @@
#include <QStringList>
// FIXME: the way this is written, it can't ever do any sort of validation and can accept total junk
-MinecraftServerTarget MinecraftServerTarget::parse(const QString &fullAddress) {
+MinecraftServerTarget MinecraftServerTarget::parse(const QString& fullAddress)
+{
QStringList split = fullAddress.split(":");
// The logic below replicates the exact logic minecraft uses for parsing server addresses.
// While the conversion is not lossless and eats errors, it ensures the same behavior
// within Minecraft and Prism Launcher when entering server addresses.
- if (fullAddress.startsWith("["))
- {
+ if (fullAddress.startsWith("[")) {
int bracket = fullAddress.indexOf("]");
- if (bracket > 0)
- {
+ if (bracket > 0) {
QString ipv6 = fullAddress.mid(1, bracket - 1);
QString port = fullAddress.mid(bracket + 1).trimmed();
- if (port.startsWith(":") && !ipv6.isEmpty())
- {
+ if (port.startsWith(":") && !ipv6.isEmpty()) {
port = port.mid(1);
split = QStringList({ ipv6, port });
- }
- else
- {
- split = QStringList({ipv6});
+ } else {
+ split = QStringList({ ipv6 });
}
}
}
- if (split.size() > 2)
- {
- split = QStringList({fullAddress});
+ if (split.size() > 2) {
+ split = QStringList({ fullAddress });
}
QString realAddress = split[0];
quint16 realPort = 25565;
- if (split.size() > 1)
- {
+ if (split.size() > 1) {
bool ok;
realPort = split[1].toUInt(&ok);
- if (!ok)
- {
+ if (!ok) {
realPort = 25565;
}
}
- return MinecraftServerTarget { realAddress, realPort };
+ return MinecraftServerTarget{ realAddress, realPort };
}
diff --git a/launcher/minecraft/launch/MinecraftServerTarget.h b/launcher/minecraft/launch/MinecraftServerTarget.h
index a402421a..af8d6550 100644
--- a/launcher/minecraft/launch/MinecraftServerTarget.h
+++ b/launcher/minecraft/launch/MinecraftServerTarget.h
@@ -23,7 +23,7 @@ struct MinecraftServerTarget {
QString address;
quint16 port;
- static MinecraftServerTarget parse(const QString &fullAddress);
+ static MinecraftServerTarget parse(const QString& fullAddress);
};
typedef std::shared_ptr<MinecraftServerTarget> MinecraftServerTargetPtr;
diff --git a/launcher/minecraft/launch/ModMinecraftJar.cpp b/launcher/minecraft/launch/ModMinecraftJar.cpp
index 1d6eecf2..6e73333b 100644
--- a/launcher/minecraft/launch/ModMinecraftJar.cpp
+++ b/launcher/minecraft/launch/ModMinecraftJar.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
*
* This program is free software: you can redistribute it and/or modify
@@ -34,9 +34,9 @@
*/
#include "ModMinecraftJar.h"
-#include "launch/LaunchTask.h"
-#include "MMCZip.h"
#include "FileSystem.h"
+#include "MMCZip.h"
+#include "launch/LaunchTask.h"
#include "minecraft/MinecraftInstance.h"
#include "minecraft/PackProfile.h"
@@ -44,20 +44,17 @@ void ModMinecraftJar::executeTask()
{
auto m_inst = std::dynamic_pointer_cast<MinecraftInstance>(m_parent->instance());
- if(!m_inst->getJarMods().size())
- {
+ if (!m_inst->getJarMods().size()) {
emitSucceeded();
return;
}
// nuke obsolete stripped jar(s) if needed
- if(!FS::ensureFolderPathExists(m_inst->binRoot()))
- {
+ if (!FS::ensureFolderPathExists(m_inst->binRoot())) {
emitFailed(tr("Couldn't create the bin folder for Minecraft.jar"));
}
auto finalJarPath = QDir(m_inst->binRoot()).absoluteFilePath("minecraft.jar");
- if(!removeJar())
- {
+ if (!removeJar()) {
emitFailed(tr("Couldn't remove stale jar file: %1").arg(finalJarPath));
}
@@ -65,14 +62,12 @@ void ModMinecraftJar::executeTask()
auto components = m_inst->getPackProfile();
auto profile = components->getProfile();
auto jarMods = m_inst->getJarMods();
- if(jarMods.size())
- {
+ if (jarMods.size()) {
auto mainJar = profile->getMainJar();
QStringList jars, temp1, temp2, temp3, temp4;
mainJar->getApplicableFiles(m_inst->runtimeContext(), jars, temp1, temp2, temp3, m_inst->getLocalLibraryPath());
auto sourceJarPath = jars[0];
- if(!MMCZip::createModdedJar(sourceJarPath, finalJarPath, jarMods))
- {
+ if (!MMCZip::createModdedJar(sourceJarPath, finalJarPath, jarMods)) {
emitFailed(tr("Failed to create the custom Minecraft jar file."));
return;
}
@@ -90,10 +85,8 @@ bool ModMinecraftJar::removeJar()
auto m_inst = std::dynamic_pointer_cast<MinecraftInstance>(m_parent->instance());
auto finalJarPath = QDir(m_inst->binRoot()).absoluteFilePath("minecraft.jar");
QFile finalJar(finalJarPath);
- if(finalJar.exists())
- {
- if(!finalJar.remove())
- {
+ if (finalJar.exists()) {
+ if (!finalJar.remove()) {
return false;
}
}
diff --git a/launcher/minecraft/launch/ModMinecraftJar.h b/launcher/minecraft/launch/ModMinecraftJar.h
index 081c6a91..12e73b5f 100644
--- a/launcher/minecraft/launch/ModMinecraftJar.h
+++ b/launcher/minecraft/launch/ModMinecraftJar.h
@@ -18,19 +18,16 @@
#include <launch/LaunchStep.h>
#include <memory>
-class ModMinecraftJar: public LaunchStep
-{
+class ModMinecraftJar : public LaunchStep {
Q_OBJECT
-public:
- explicit ModMinecraftJar(LaunchTask *parent) : LaunchStep(parent) {};
+ public:
+ explicit ModMinecraftJar(LaunchTask* parent) : LaunchStep(parent){};
virtual ~ModMinecraftJar(){};
virtual void executeTask() override;
- virtual bool canAbort() const override
- {
- return false;
- }
+ virtual bool canAbort() const override { return false; }
void finalize() override;
-private:
+
+ private:
bool removeJar();
};
diff --git a/launcher/minecraft/launch/PrintInstanceInfo.cpp b/launcher/minecraft/launch/PrintInstanceInfo.cpp
index e8fbcb9b..e3a45b03 100644
--- a/launcher/minecraft/launch/PrintInstanceInfo.cpp
+++ b/launcher/minecraft/launch/PrintInstanceInfo.cpp
@@ -16,50 +16,44 @@
#include <fstream>
#include <string>
-#include "PrintInstanceInfo.h"
#include <launch/LaunchTask.h>
+#include "PrintInstanceInfo.h"
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
namespace {
#if defined(Q_OS_LINUX)
-void probeProcCpuinfo(QStringList &log)
+void probeProcCpuinfo(QStringList& log)
{
std::ifstream cpuin("/proc/cpuinfo");
- for (std::string line; std::getline(cpuin, line);)
- {
- if (strncmp(line.c_str(), "model name", 10) == 0)
- {
+ for (std::string line; std::getline(cpuin, line);) {
+ if (strncmp(line.c_str(), "model name", 10) == 0) {
log << QString::fromStdString(line.substr(13, std::string::npos));
break;
}
}
}
-void runLspci(QStringList &log)
+void runLspci(QStringList& log)
{
// FIXME: fixed size buffers...
char buff[512];
int gpuline = -1;
int cline = 0;
- FILE * lspci = popen("lspci -k", "r");
+ FILE* lspci = popen("lspci -k", "r");
if (!lspci)
return;
- while (fgets(buff, 512, lspci) != NULL)
- {
+ while (fgets(buff, 512, lspci) != NULL) {
std::string str(buff);
if (str.length() < 9)
continue;
- if (str.substr(8, 3) == "VGA")
- {
+ if (str.substr(8, 3) == "VGA") {
gpuline = cline;
log << QString::fromStdString(str.substr(35, std::string::npos));
}
- if (gpuline > -1 && gpuline != cline)
- {
- if (cline - gpuline < 3)
- {
+ if (gpuline > -1 && gpuline != cline) {
+ if (cline - gpuline < 3) {
log << QString::fromStdString(str.substr(1, std::string::npos));
}
}
@@ -68,54 +62,47 @@ void runLspci(QStringList &log)
pclose(lspci);
}
#elif defined(Q_OS_FREEBSD)
-void runSysctlHwModel(QStringList &log)
+void runSysctlHwModel(QStringList& log)
{
char buff[512];
- FILE *hwmodel = popen("sysctl hw.model", "r");
- while (fgets(buff, 512, hwmodel) != NULL)
- {
- log << QString::fromUtf8(buff);
- break;
+ FILE* hwmodel = popen("sysctl hw.model", "r");
+ while (fgets(buff, 512, hwmodel) != NULL) {
+ log << QString::fromUtf8(buff);
+ break;
}
pclose(hwmodel);
}
-void runPciconf(QStringList &log)
+void runPciconf(QStringList& log)
{
char buff[512];
std::string strcard;
- FILE *pciconf = popen("pciconf -lv -a vgapci0", "r");
- while (fgets(buff, 512, pciconf) != NULL)
- {
- if (strncmp(buff, " vendor", 10) == 0)
- {
- std::string str(buff);
- strcard.append(str.substr(str.find_first_of("'") + 1, str.find_last_not_of("'") - (str.find_first_of("'") + 2)));
- strcard.append(" ");
- }
- else if (strncmp(buff, " device", 10) == 0)
- {
- std::string str2(buff);
- strcard.append(str2.substr(str2.find_first_of("'") + 1, str2.find_last_not_of("'") - (str2.find_first_of("'") + 2)));
- }
- log << QString::fromStdString(strcard);
- break;
+ FILE* pciconf = popen("pciconf -lv -a vgapci0", "r");
+ while (fgets(buff, 512, pciconf) != NULL) {
+ if (strncmp(buff, " vendor", 10) == 0) {
+ std::string str(buff);
+ strcard.append(str.substr(str.find_first_of("'") + 1, str.find_last_not_of("'") - (str.find_first_of("'") + 2)));
+ strcard.append(" ");
+ } else if (strncmp(buff, " device", 10) == 0) {
+ std::string str2(buff);
+ strcard.append(str2.substr(str2.find_first_of("'") + 1, str2.find_last_not_of("'") - (str2.find_first_of("'") + 2)));
+ }
+ log << QString::fromStdString(strcard);
+ break;
}
pclose(pciconf);
}
#endif
-void runGlxinfo(QStringList & log)
+void runGlxinfo(QStringList& log)
{
// FIXME: fixed size buffers...
char buff[512];
- FILE *glxinfo = popen("glxinfo", "r");
+ FILE* glxinfo = popen("glxinfo", "r");
if (!glxinfo)
return;
- while (fgets(buff, 512, glxinfo) != NULL)
- {
- if (strncmp(buff, "OpenGL version string:", 22) == 0)
- {
+ while (fgets(buff, 512, glxinfo) != NULL) {
+ if (strncmp(buff, "OpenGL version string:", 22) == 0) {
log << QString::fromUtf8(buff);
break;
}
@@ -123,7 +110,7 @@ void runGlxinfo(QStringList & log)
pclose(glxinfo);
}
-}
+} // namespace
#endif
void PrintInstanceInfo::executeTask()
diff --git a/launcher/minecraft/launch/PrintInstanceInfo.h b/launcher/minecraft/launch/PrintInstanceInfo.h
index fdc30f31..8e1c41b6 100644
--- a/launcher/minecraft/launch/PrintInstanceInfo.h
+++ b/launcher/minecraft/launch/PrintInstanceInfo.h
@@ -21,21 +21,17 @@
#include "minecraft/launch/MinecraftServerTarget.h"
// FIXME: temporary wrapper for existing task.
-class PrintInstanceInfo: public LaunchStep
-{
+class PrintInstanceInfo : public LaunchStep {
Q_OBJECT
-public:
- explicit PrintInstanceInfo(LaunchTask *parent, AuthSessionPtr session, MinecraftServerTargetPtr serverToJoin) :
- LaunchStep(parent), m_session(session), m_serverToJoin(serverToJoin) {};
+ public:
+ explicit PrintInstanceInfo(LaunchTask* parent, AuthSessionPtr session, MinecraftServerTargetPtr serverToJoin)
+ : LaunchStep(parent), m_session(session), m_serverToJoin(serverToJoin){};
virtual ~PrintInstanceInfo(){};
virtual void executeTask();
- virtual bool canAbort() const
- {
- return false;
- }
-private:
+ virtual bool canAbort() const { return false; }
+
+ private:
AuthSessionPtr m_session;
MinecraftServerTargetPtr m_serverToJoin;
};
-
diff --git a/launcher/minecraft/launch/ReconstructAssets.cpp b/launcher/minecraft/launch/ReconstructAssets.cpp
index 4d206665..843ccc55 100644
--- a/launcher/minecraft/launch/ReconstructAssets.cpp
+++ b/launcher/minecraft/launch/ReconstructAssets.cpp
@@ -14,10 +14,10 @@
*/
#include "ReconstructAssets.h"
+#include "launch/LaunchTask.h"
+#include "minecraft/AssetsUtils.h"
#include "minecraft/MinecraftInstance.h"
#include "minecraft/PackProfile.h"
-#include "minecraft/AssetsUtils.h"
-#include "launch/LaunchTask.h"
void ReconstructAssets::executeTask()
{
@@ -27,8 +27,7 @@ void ReconstructAssets::executeTask()
auto profile = components->getProfile();
auto assets = profile->getMinecraftAssets();
- if(!AssetsUtils::reconstructAssets(assets->id, minecraftInstance->resourcesDir()))
- {
+ if (!AssetsUtils::reconstructAssets(assets->id, minecraftInstance->resourcesDir())) {
emit logLine("Failed to reconstruct Minecraft assets.", MessageLevel::Error);
}
diff --git a/launcher/minecraft/launch/ReconstructAssets.h b/launcher/minecraft/launch/ReconstructAssets.h
index 58d7febd..bd867c8d 100644
--- a/launcher/minecraft/launch/ReconstructAssets.h
+++ b/launcher/minecraft/launch/ReconstructAssets.h
@@ -18,16 +18,12 @@
#include <launch/LaunchStep.h>
#include <memory>
-class ReconstructAssets: public LaunchStep
-{
+class ReconstructAssets : public LaunchStep {
Q_OBJECT
-public:
- explicit ReconstructAssets(LaunchTask *parent) : LaunchStep(parent){};
+ public:
+ explicit ReconstructAssets(LaunchTask* parent) : LaunchStep(parent){};
virtual ~ReconstructAssets(){};
void executeTask() override;
- bool canAbort() const override
- {
- return false;
- }
+ bool canAbort() const override { return false; }
};
diff --git a/launcher/minecraft/launch/ScanModFolders.cpp b/launcher/minecraft/launch/ScanModFolders.cpp
index 71e7638c..7e08a4e3 100644
--- a/launcher/minecraft/launch/ScanModFolders.cpp
+++ b/launcher/minecraft/launch/ScanModFolders.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
*
* This program is free software: you can redistribute it and/or modify
@@ -34,9 +34,9 @@
*/
#include "ScanModFolders.h"
-#include "launch/LaunchTask.h"
-#include "MMCZip.h"
#include "FileSystem.h"
+#include "MMCZip.h"
+#include "launch/LaunchTask.h"
#include "minecraft/MinecraftInstance.h"
#include "minecraft/mod/ModFolderModel.h"
@@ -46,19 +46,19 @@ void ScanModFolders::executeTask()
auto loaders = m_inst->loaderModList();
connect(loaders.get(), &ModFolderModel::updateFinished, this, &ScanModFolders::modsDone);
- if(!loaders->update()) {
+ if (!loaders->update()) {
m_modsDone = true;
}
auto cores = m_inst->coreModList();
connect(cores.get(), &ModFolderModel::updateFinished, this, &ScanModFolders::coreModsDone);
- if(!cores->update()) {
+ if (!cores->update()) {
m_coreModsDone = true;
}
auto nils = m_inst->nilModList();
connect(nils.get(), &ModFolderModel::updateFinished, this, &ScanModFolders::nilModsDone);
- if(!nils->update()) {
+ if (!nils->update()) {
m_nilModsDone = true;
}
checkDone();
@@ -84,7 +84,7 @@ void ScanModFolders::nilModsDone()
void ScanModFolders::checkDone()
{
- if(m_modsDone && m_coreModsDone && m_nilModsDone) {
+ if (m_modsDone && m_coreModsDone && m_nilModsDone) {
emitSucceeded();
}
}
diff --git a/launcher/minecraft/launch/ScanModFolders.h b/launcher/minecraft/launch/ScanModFolders.h
index 111a5850..a5b75825 100644
--- a/launcher/minecraft/launch/ScanModFolders.h
+++ b/launcher/minecraft/launch/ScanModFolders.h
@@ -18,26 +18,23 @@
#include <launch/LaunchStep.h>
#include <memory>
-class ScanModFolders: public LaunchStep
-{
+class ScanModFolders : public LaunchStep {
Q_OBJECT
-public:
- explicit ScanModFolders(LaunchTask *parent) : LaunchStep(parent) {};
+ public:
+ explicit ScanModFolders(LaunchTask* parent) : LaunchStep(parent){};
virtual ~ScanModFolders(){};
virtual void executeTask() override;
- virtual bool canAbort() const override
- {
- return false;
- }
-private slots:
+ virtual bool canAbort() const override { return false; }
+ private slots:
void coreModsDone();
void modsDone();
void nilModsDone();
-private:
+
+ private:
void checkDone();
-private: // DATA
+ private: // DATA
bool m_modsDone = false;
bool m_nilModsDone = false;
bool m_coreModsDone = false;
diff --git a/launcher/minecraft/launch/VerifyJavaInstall.cpp b/launcher/minecraft/launch/VerifyJavaInstall.cpp
index 6ae666b4..cdd1f7fd 100644
--- a/launcher/minecraft/launch/VerifyJavaInstall.cpp
+++ b/launcher/minecraft/launch/VerifyJavaInstall.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
*
* This program is free software: you can redistribute it and/or modify
@@ -36,10 +36,11 @@
#include "VerifyJavaInstall.h"
#include "java/JavaVersion.h"
-#include "minecraft/PackProfile.h"
#include "minecraft/MinecraftInstance.h"
+#include "minecraft/PackProfile.h"
-void VerifyJavaInstall::executeTask() {
+void VerifyJavaInstall::executeTask()
+{
auto instance = std::dynamic_pointer_cast<MinecraftInstance>(m_parent->instance());
auto packProfile = instance->getPackProfile();
auto settings = instance->settings();
@@ -50,28 +51,27 @@ void VerifyJavaInstall::executeTask() {
JavaVersion javaVersion(storedVersion);
- if (compatibleMajors.isEmpty() || compatibleMajors.contains(javaVersion.major()))
- {
+ if (compatibleMajors.isEmpty() || compatibleMajors.contains(javaVersion.major())) {
emitSucceeded();
return;
}
-
- if (ignoreCompatibility)
- {
+ if (ignoreCompatibility) {
emit logLine(tr("Java major version is incompatible. Things might break."), MessageLevel::Warning);
emitSucceeded();
return;
}
emit logLine(tr("This instance is not compatible with Java version %1.\n"
- "Please switch to one of the following Java versions for this instance:").arg(javaVersion.major()),
+ "Please switch to one of the following Java versions for this instance:")
+ .arg(javaVersion.major()),
MessageLevel::Error);
- for (auto major : compatibleMajors)
- {
+ for (auto major : compatibleMajors) {
emit logLine(tr("Java version %1").arg(major), MessageLevel::Error);
}
- emit logLine(tr("Go to instance Java settings to change your Java version or disable the Java compatibility check if you know what you're doing."), MessageLevel::Error);
+ emit logLine(tr("Go to instance Java settings to change your Java version or disable the Java compatibility check if you know what "
+ "you're doing."),
+ MessageLevel::Error);
emitFailed(QString("Incompatible Java major version"));
}
diff --git a/launcher/minecraft/launch/VerifyJavaInstall.h b/launcher/minecraft/launch/VerifyJavaInstall.h
index 9139c0fa..dabbf3b2 100644
--- a/launcher/minecraft/launch/VerifyJavaInstall.h
+++ b/launcher/minecraft/launch/VerifyJavaInstall.h
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
*
* This program is free software: you can redistribute it and/or modify
@@ -41,13 +41,10 @@
class VerifyJavaInstall : public LaunchStep {
Q_OBJECT
-public:
- explicit VerifyJavaInstall(LaunchTask *parent) : LaunchStep(parent) {
- };
+ public:
+ explicit VerifyJavaInstall(LaunchTask* parent) : LaunchStep(parent){};
~VerifyJavaInstall() override = default;
void executeTask() override;
- bool canAbort() const override {
- return false;
- }
+ bool canAbort() const override { return false; }
};