mirror of
https://github.com/UltimMC/Launcher.git
synced 2026-01-03 22:22:11 +00:00
Revert "Merge pull request #9 from MultiMC/develop"
This reverts commitccc86e4e02, reversing changes made to306c655ab5.
This commit is contained in:
@@ -15,7 +15,7 @@ void CreateGameFolders::executeTask()
|
||||
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"));
|
||||
emitFailed("Couldn't create the main game folder");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ void DirectJavaLaunch::executeTask()
|
||||
// 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);
|
||||
auto mcArgs = minecraftInstance->processMinecraftArgs(m_session);
|
||||
args.append(mcArgs);
|
||||
|
||||
QString wrapperCommandStr = instance->getWrapperCommand().trimmed();
|
||||
@@ -66,9 +66,9 @@ void DirectJavaLaunch::executeTask()
|
||||
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));
|
||||
QString reason = tr("The wrapper command \"%1\" couldn't be found.").arg(wrapperCommand);
|
||||
emit logLine(reason, MessageLevel::Fatal);
|
||||
emitFailed(reason);
|
||||
return;
|
||||
}
|
||||
emit logLine("Wrapper command is:\n" + wrapperCommandStr + "\n\n", MessageLevel::MultiMC);
|
||||
@@ -87,17 +87,18 @@ void DirectJavaLaunch::on_state(LoggedProcess::State state)
|
||||
{
|
||||
case LoggedProcess::FailedToStart:
|
||||
{
|
||||
//: Error message displayed if instance can't start
|
||||
const char *reason = QT_TR_NOOP("Could not launch minecraft!");
|
||||
//: Error message displayed if instace can't start
|
||||
QString reason = tr("Could not launch minecraft!");
|
||||
emit logLine(reason, MessageLevel::Fatal);
|
||||
emitFailed(tr(reason));
|
||||
emitFailed(reason);
|
||||
return;
|
||||
}
|
||||
case LoggedProcess::Aborted:
|
||||
case LoggedProcess::Crashed:
|
||||
|
||||
{
|
||||
m_parent->setPid(-1);
|
||||
emitFailed(tr("Game crashed."));
|
||||
emitFailed("Game crashed.");
|
||||
return;
|
||||
}
|
||||
case LoggedProcess::Finished:
|
||||
@@ -107,7 +108,7 @@ void DirectJavaLaunch::on_state(LoggedProcess::State state)
|
||||
auto exitCode = m_process.exitCode();
|
||||
if(exitCode != 0)
|
||||
{
|
||||
emitFailed(tr("Game crashed."));
|
||||
emitFailed("Game crashed.");
|
||||
return;
|
||||
}
|
||||
//FIXME: make this work again
|
||||
@@ -117,7 +118,7 @@ void DirectJavaLaunch::on_state(LoggedProcess::State state)
|
||||
break;
|
||||
}
|
||||
case LoggedProcess::Running:
|
||||
emit logLine(QString("Minecraft process ID: %1\n\n").arg(m_process.processId()), MessageLevel::MultiMC);
|
||||
emit logLine(tr("Minecraft process ID: %1\n\n").arg(m_process.processId()), MessageLevel::MultiMC);
|
||||
m_parent->setPid(m_process.processId());
|
||||
m_parent->instance()->setLastLaunch();
|
||||
break;
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#include <LoggedProcess.h>
|
||||
#include <minecraft/auth/AuthSession.h>
|
||||
|
||||
#include "MinecraftServerTarget.h"
|
||||
|
||||
class DirectJavaLaunch: public LaunchStep
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -40,12 +38,6 @@ public:
|
||||
{
|
||||
m_session = session;
|
||||
}
|
||||
|
||||
void setServerToJoin(MinecraftServerTargetPtr serverToJoin)
|
||||
{
|
||||
m_serverToJoin = std::move(serverToJoin);
|
||||
}
|
||||
|
||||
private slots:
|
||||
void on_state(LoggedProcess::State state);
|
||||
|
||||
@@ -53,6 +45,5 @@ private:
|
||||
LoggedProcess m_process;
|
||||
QString m_command;
|
||||
AuthSessionPtr m_session;
|
||||
MinecraftServerTargetPtr m_serverToJoin;
|
||||
};
|
||||
|
||||
|
||||
@@ -94,9 +94,9 @@ void ExtractNatives::executeTask()
|
||||
{
|
||||
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));
|
||||
auto reason = tr("Couldn't extract native jar '%1' to destination '%2'").arg(source, outputPath);
|
||||
emit logLine(reason, MessageLevel::Fatal);
|
||||
emitFailed(reason);
|
||||
}
|
||||
}
|
||||
emitSucceeded();
|
||||
|
||||
@@ -59,7 +59,7 @@ void LauncherPartLaunch::executeTask()
|
||||
auto instance = m_parent->instance();
|
||||
std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance);
|
||||
|
||||
m_launchScript = minecraftInstance->createLaunchScript(m_session, m_serverToJoin);
|
||||
m_launchScript = minecraftInstance->createLaunchScript(m_session);
|
||||
QStringList args = minecraftInstance->javaArguments();
|
||||
QString allArgs = args.join(", ");
|
||||
emit logLine("Java Arguments:\n[" + m_parent->censorPrivateInfo(allArgs) + "]\n\n", MessageLevel::MultiMC);
|
||||
@@ -118,9 +118,9 @@ void LauncherPartLaunch::executeTask()
|
||||
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));
|
||||
QString reason = tr("The wrapper command \"%1\" couldn't be found.").arg(wrapperCommand);
|
||||
emit logLine(reason, MessageLevel::Fatal);
|
||||
emitFailed(reason);
|
||||
return;
|
||||
}
|
||||
emit logLine("Wrapper command is:\n" + wrapperCommandStr + "\n\n", MessageLevel::MultiMC);
|
||||
@@ -140,16 +140,17 @@ void LauncherPartLaunch::on_state(LoggedProcess::State state)
|
||||
case LoggedProcess::FailedToStart:
|
||||
{
|
||||
//: Error message displayed if instace can't start
|
||||
const char *reason = QT_TR_NOOP("Could not launch minecraft!");
|
||||
QString reason = tr("Could not launch minecraft!");
|
||||
emit logLine(reason, MessageLevel::Fatal);
|
||||
emitFailed(tr(reason));
|
||||
emitFailed(reason);
|
||||
return;
|
||||
}
|
||||
case LoggedProcess::Aborted:
|
||||
case LoggedProcess::Crashed:
|
||||
|
||||
{
|
||||
m_parent->setPid(-1);
|
||||
emitFailed(tr("Game crashed."));
|
||||
emitFailed("Game crashed.");
|
||||
return;
|
||||
}
|
||||
case LoggedProcess::Finished:
|
||||
@@ -159,7 +160,7 @@ void LauncherPartLaunch::on_state(LoggedProcess::State state)
|
||||
auto exitCode = m_process.exitCode();
|
||||
if(exitCode != 0)
|
||||
{
|
||||
emitFailed(tr("Game crashed."));
|
||||
emitFailed("Game crashed.");
|
||||
return;
|
||||
}
|
||||
//FIXME: make this work again
|
||||
@@ -169,7 +170,7 @@ void LauncherPartLaunch::on_state(LoggedProcess::State state)
|
||||
break;
|
||||
}
|
||||
case LoggedProcess::Running:
|
||||
emit logLine(QString("Minecraft process ID: %1\n\n").arg(m_process.processId()), MessageLevel::MultiMC);
|
||||
emit logLine(tr("Minecraft process ID: %1\n\n").arg(m_process.processId()), MessageLevel::MultiMC);
|
||||
m_parent->setPid(m_process.processId());
|
||||
m_parent->instance()->setLastLaunch();
|
||||
// send the launch script to the launcher part
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#include <LoggedProcess.h>
|
||||
#include <minecraft/auth/AuthSession.h>
|
||||
|
||||
#include "MinecraftServerTarget.h"
|
||||
|
||||
class LauncherPartLaunch: public LaunchStep
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -41,11 +39,6 @@ public:
|
||||
m_session = session;
|
||||
}
|
||||
|
||||
void setServerToJoin(MinecraftServerTargetPtr serverToJoin)
|
||||
{
|
||||
m_serverToJoin = std::move(serverToJoin);
|
||||
}
|
||||
|
||||
private slots:
|
||||
void on_state(LoggedProcess::State state);
|
||||
|
||||
@@ -54,7 +47,5 @@ private:
|
||||
QString m_command;
|
||||
AuthSessionPtr m_session;
|
||||
QString m_launchScript;
|
||||
MinecraftServerTargetPtr m_serverToJoin;
|
||||
|
||||
bool mayProceed = false;
|
||||
};
|
||||
|
||||
@@ -1,66 +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 "MinecraftServerTarget.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
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 MultiMC when entering server addresses.
|
||||
if (fullAddress.startsWith("["))
|
||||
{
|
||||
int bracket = fullAddress.indexOf("]");
|
||||
if (bracket > 0)
|
||||
{
|
||||
QString ipv6 = fullAddress.mid(1, bracket - 1);
|
||||
QString port = fullAddress.mid(bracket + 1).trimmed();
|
||||
|
||||
if (port.startsWith(":") && !ipv6.isEmpty())
|
||||
{
|
||||
port = port.mid(1);
|
||||
split = QStringList({ ipv6, port });
|
||||
}
|
||||
else
|
||||
{
|
||||
split = QStringList({ipv6});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (split.size() > 2)
|
||||
{
|
||||
split = QStringList({fullAddress});
|
||||
}
|
||||
|
||||
QString realAddress = split[0];
|
||||
|
||||
quint16 realPort = 25565;
|
||||
if (split.size() > 1)
|
||||
{
|
||||
bool ok;
|
||||
realPort = split[1].toUInt(&ok);
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
realPort = 25565;
|
||||
}
|
||||
}
|
||||
|
||||
return MinecraftServerTarget { realAddress, realPort };
|
||||
}
|
||||
@@ -1,30 +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 <memory>
|
||||
|
||||
#include <QString>
|
||||
#include <multimc_logic_export.h>
|
||||
|
||||
struct MinecraftServerTarget {
|
||||
QString address;
|
||||
quint16 port;
|
||||
|
||||
static MULTIMC_LOGIC_EXPORT MinecraftServerTarget parse(const QString &fullAddress);
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<MinecraftServerTarget> MinecraftServerTargetPtr;
|
||||
@@ -101,6 +101,6 @@ void PrintInstanceInfo::executeTask()
|
||||
#endif
|
||||
|
||||
logLines(log, MessageLevel::MultiMC);
|
||||
logLines(instance->verboseDescription(m_session, m_serverToJoin), MessageLevel::MultiMC);
|
||||
logLines(instance->verboseDescription(m_session), MessageLevel::MultiMC);
|
||||
emitSucceeded();
|
||||
}
|
||||
|
||||
@@ -18,15 +18,13 @@
|
||||
#include <launch/LaunchStep.h>
|
||||
#include <memory>
|
||||
#include "minecraft/auth/AuthSession.h"
|
||||
#include "minecraft/launch/MinecraftServerTarget.h"
|
||||
|
||||
// FIXME: temporary wrapper for existing task.
|
||||
class PrintInstanceInfo: public LaunchStep
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PrintInstanceInfo(LaunchTask *parent, AuthSessionPtr session, MinecraftServerTargetPtr serverToJoin) :
|
||||
LaunchStep(parent), m_session(session), m_serverToJoin(serverToJoin) {};
|
||||
explicit PrintInstanceInfo(LaunchTask *parent, AuthSessionPtr session) : LaunchStep(parent), m_session(session) {};
|
||||
virtual ~PrintInstanceInfo(){};
|
||||
|
||||
virtual void executeTask();
|
||||
@@ -36,6 +34,5 @@ public:
|
||||
}
|
||||
private:
|
||||
AuthSessionPtr m_session;
|
||||
MinecraftServerTargetPtr m_serverToJoin;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#include "VerifyJavaInstall.h"
|
||||
|
||||
#include <launch/LaunchTask.h>
|
||||
#include <minecraft/MinecraftInstance.h>
|
||||
#include <minecraft/PackProfile.h>
|
||||
#include <minecraft/VersionFilterData.h>
|
||||
|
||||
void VerifyJavaInstall::executeTask() {
|
||||
auto m_inst = std::dynamic_pointer_cast<MinecraftInstance>(m_parent->instance());
|
||||
|
||||
auto javaVersion = m_inst->getJavaVersion();
|
||||
auto minecraftComponent = m_inst->getPackProfile()->getComponent("net.minecraft");
|
||||
|
||||
// Java 16 requirement
|
||||
if (minecraftComponent->getReleaseDateTime() >= g_VersionFilterData.java16BeginsDate) {
|
||||
if (javaVersion.major() < 16) {
|
||||
emit logLine("Minecraft 21w19a and above require the use of Java 16",
|
||||
MessageLevel::Fatal);
|
||||
emitFailed(tr("Minecraft 21w19a and above require the use of Java 16"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Java 8 requirement
|
||||
else if (minecraftComponent->getReleaseDateTime() >= g_VersionFilterData.java8BeginsDate) {
|
||||
if (javaVersion.major() < 8) {
|
||||
emit logLine("Minecraft 17w13a and above require the use of Java 8",
|
||||
MessageLevel::Fatal);
|
||||
emitFailed(tr("Minecraft 17w13a and above require the use of Java 8"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
emitSucceeded();
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <launch/LaunchStep.h>
|
||||
|
||||
class VerifyJavaInstall : public LaunchStep {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VerifyJavaInstall(LaunchTask *parent) : LaunchStep(parent) {
|
||||
};
|
||||
~VerifyJavaInstall() override = default;
|
||||
|
||||
void executeTask() override;
|
||||
bool canAbort() const override {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user