diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-11-24 06:36:16 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-11-24 06:36:16 +0100 |
commit | ca297fca79a7b1b96e41ba5abed4956af9383c16 (patch) | |
tree | 5c6cf2a486c4015f5e52842acb412e39b8498acd /logic/LegacyInstance.cpp | |
parent | 4124faf474908e4d79d93b0f624bf8fd81bd9972 (diff) | |
download | MultiMC-ca297fca79a7b1b96e41ba5abed4956af9383c16.tar MultiMC-ca297fca79a7b1b96e41ba5abed4956af9383c16.tar.gz MultiMC-ca297fca79a7b1b96e41ba5abed4956af9383c16.tar.lz MultiMC-ca297fca79a7b1b96e41ba5abed4956af9383c16.tar.xz MultiMC-ca297fca79a7b1b96e41ba5abed4956af9383c16.zip |
Prepare for rework of instance launch/update
Added missing licenses
Added a Java functionality checker (detects 32/64bit java)
Refactor of *Update - no longer based on BaseUpdate, but Task directly
Fixed runner script to not derp up on 32bit linux. Could add more detection and error reporting there.
Resources are now split into graphics and generated. Generated resources are placed in the build tree and included from there.
Used the Java checker in the main settings dialog (TODO: instance settings).
Partial support for ${arch}-using libraries - both 32 and 64 variants of ${arch} are downloaded.
Diffstat (limited to 'logic/LegacyInstance.cpp')
-rw-r--r-- | logic/LegacyInstance.cpp | 55 |
1 files changed, 11 insertions, 44 deletions
diff --git a/logic/LegacyInstance.cpp b/logic/LegacyInstance.cpp index 9a91b839..07e302f5 100644 --- a/logic/LegacyInstance.cpp +++ b/logic/LegacyInstance.cpp @@ -44,7 +44,7 @@ LegacyInstance::LegacyInstance(const QString &rootDir, SettingsObject *settings, settings->registerSetting(new Setting("IntendedJarVersion", "")); } -BaseUpdate *LegacyInstance::doUpdate() +Task *LegacyInstance::doUpdate() { auto list = jarModList(); return new LegacyUpdate(this, this); @@ -59,7 +59,7 @@ MinecraftProcess *LegacyInstance::prepareForLaunch(LoginResponse response) pixmap.save(PathCombine(minecraftRoot(), "icon.png"), "PNG"); // extract the legacy launcher - QFile(":/launcher/launcher.jar").copy(PathCombine(minecraftRoot(), LAUNCHER_FILE)); + QFile(":/java/launcher.jar").copy(PathCombine(minecraftRoot(), LAUNCHER_FILE)); // set the process arguments { @@ -108,11 +108,11 @@ MinecraftProcess *LegacyInstance::prepareForLaunch(LoginResponse response) args << windowTitle; args << windowSize; args << lwjgl; - proc->setMinecraftArguments(args); + proc->setArguments(args); } // set the process work path - proc->setMinecraftWorkdir(minecraftRoot()); + proc->setWorkdir(minecraftRoot()); return proc; } @@ -227,56 +227,18 @@ QString LegacyInstance::instanceConfigFolder() const return PathCombine(minecraftRoot(), "config"); } -/* -bool LegacyInstance::shouldUpdateCurrentVersion() const -{ - QFileInfo jar(runnableJar()); - return jar.lastModified().toUTC().toMSecsSinceEpoch() != lastCurrentVersionUpdate(); -} - -void LegacyInstance::updateCurrentVersion(bool keepCurrent) -{ - QFileInfo jar(runnableJar()); - - if(!jar.exists()) - { - setLastCurrentVersionUpdate(0); - setCurrentVersionId("Unknown"); - return; - } - - qint64 time = jar.lastModified().toUTC().toMSecsSinceEpoch(); - - setLastCurrentVersionUpdate(time); - if (!keepCurrent) - { - // TODO: Implement GetMinecraftJarVersion function. - QString newVersion = -"Unknown";//javautils::GetMinecraftJarVersion(jar.absoluteFilePath()); - setCurrentVersionId(newVersion); - } -} -qint64 LegacyInstance::lastCurrentVersionUpdate() const -{ - I_D(LegacyInstance); - return d->m_settings->get ( "lastVersionUpdate" ).value<qint64>(); -} -void LegacyInstance::setLastCurrentVersionUpdate ( qint64 val ) -{ - I_D(LegacyInstance); - d->m_settings->set ( "lastVersionUpdate", val ); -} -*/ bool LegacyInstance::shouldRebuild() const { I_D(LegacyInstance); return d->m_settings->get("NeedsRebuild").toBool(); } + void LegacyInstance::setShouldRebuild(bool val) { I_D(LegacyInstance); d->m_settings->set("NeedsRebuild", val); } + QString LegacyInstance::currentVersionId() const { I_D(LegacyInstance); @@ -294,22 +256,26 @@ QString LegacyInstance::lwjglVersion() const I_D(LegacyInstance); return d->m_settings->get("LwjglVersion").toString(); } + void LegacyInstance::setLWJGLVersion(QString val) { I_D(LegacyInstance); d->m_settings->set("LwjglVersion", val); } + QString LegacyInstance::intendedVersionId() const { I_D(LegacyInstance); return d->m_settings->get("IntendedJarVersion").toString(); } + bool LegacyInstance::setIntendedVersionId(QString version) { settings().set("IntendedJarVersion", version); setShouldUpdate(true); return true; } + bool LegacyInstance::shouldUpdate() const { I_D(LegacyInstance); @@ -320,6 +286,7 @@ bool LegacyInstance::shouldUpdate() const } return true; } + void LegacyInstance::setShouldUpdate(bool val) { settings().set("ShouldUpdate", val); |