Fix InjectAuthlib

This commit is contained in:
Dāvis Mosāns
2021-12-10 02:32:04 +02:00
parent ee46b67d09
commit 92e1a0fa08
4 changed files with 11 additions and 7 deletions

View File

@@ -862,6 +862,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
m_metacache->addBase("translations", QDir("translations").absolutePath());
m_metacache->addBase("icons", QDir("cache/icons").absolutePath());
m_metacache->addBase("meta", QDir("meta").absolutePath());
m_metacache->addBase("injectors", QDir("injectors").absolutePath());
m_metacache->Load();
qDebug() << "<> Cache initialized.";
}

View File

@@ -29,6 +29,7 @@
#include "minecraft/launch/ScanModFolders.h"
#include "minecraft/launch/InjectAuthlib.h"
#include "minecraft/launch/VerifyJavaInstall.h"
#include "minecraft/auth/AccountList.h"
#include "java/JavaUtils.h"
@@ -311,7 +312,9 @@ QStringList MinecraftInstance::javaArguments() const
{
QStringList args;
args.append(m_injector->javaArg);
if (m_injector) {
args.append(m_injector->javaArg);
}
// custom args go first. we want to override them if we have our own here.
args.append(extraArguments());

View File

@@ -2,7 +2,7 @@
#include <launch/LaunchTask.h>
#include <minecraft/MinecraftInstance.h>
#include <FileSystem.h>
#include <Env.h>
#include <Application.h>
#include <Json.h>
InjectAuthlib::InjectAuthlib(LaunchTask *parent, AuthlibInjectorPtr* injector) : LaunchStep(parent)
@@ -20,7 +20,7 @@ void InjectAuthlib::executeTask()
auto latestVersionInfo = QString("https://authlib-injector.yushi.moe/artifact/latest.json");
auto netJob = new NetJob("Injector versions info download");
MetaEntryPtr entry = ENV->metacache()->resolveEntry("injectors", "version.json");
MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("injectors", "version.json");
if (!m_offlineMode)
{
entry->setStale(true);
@@ -30,7 +30,7 @@ void InjectAuthlib::executeTask()
jobPtr.reset(netJob);
QObject::connect(netJob, &NetJob::succeeded, this, &InjectAuthlib::onVersionDownloadSucceeded);
QObject::connect(netJob, &NetJob::failed, this, &InjectAuthlib::onDownloadFailed);
jobPtr->start();
jobPtr->start(APPLICATION->network());
}
else
{
@@ -96,7 +96,7 @@ void InjectAuthlib::onVersionDownloadSucceeded()
if (!m_offlineMode)
{
auto netJob = new NetJob("Injector download");
MetaEntryPtr entry = ENV->metacache()->resolveEntry("injectors", m_versionName);
MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("injectors", m_versionName);
entry->setStale(true);
auto task = Net::Download::makeCached(QUrl(downloadUrl), entry);
netJob->addNetAction(task);
@@ -104,7 +104,7 @@ void InjectAuthlib::onVersionDownloadSucceeded()
jobPtr.reset(netJob);
QObject::connect(netJob, &NetJob::succeeded, this, &InjectAuthlib::onDownloadSucceeded);
QObject::connect(netJob, &NetJob::failed, this, &InjectAuthlib::onDownloadFailed);
jobPtr->start();
jobPtr->start(APPLICATION->network());
}
else
{

View File

@@ -50,7 +50,7 @@ private slots:
void onDownloadFailed(QString reason);
private:
shared_qobject_ptr<Task> jobPtr;
shared_qobject_ptr<NetJob> jobPtr;
bool m_aborted = false;
bool m_offlineMode;