summaryrefslogtreecommitdiffstats
path: root/logic/minecraft/onesix
diff options
context:
space:
mode:
Diffstat (limited to 'logic/minecraft/onesix')
-rw-r--r--logic/minecraft/onesix/OneSixInstance.cpp56
-rw-r--r--logic/minecraft/onesix/OneSixProfileStrategy.cpp2
-rw-r--r--logic/minecraft/onesix/OneSixUpdate.cpp67
-rw-r--r--logic/minecraft/onesix/OneSixUpdate.h1
-rw-r--r--logic/minecraft/onesix/OneSixVersionFormat.cpp12
5 files changed, 50 insertions, 88 deletions
diff --git a/logic/minecraft/onesix/OneSixInstance.cpp b/logic/minecraft/onesix/OneSixInstance.cpp
index 328c3b38..8d46eefc 100644
--- a/logic/minecraft/onesix/OneSixInstance.cpp
+++ b/logic/minecraft/onesix/OneSixInstance.cpp
@@ -180,24 +180,6 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session)
launchScript += "jarmod " + jarmod->originalName + " (" + jarmod->name + ")\n";
}
- // libraries and class path.
- {
- auto libs = m_profile->getLibraries();
- for (auto lib : libs)
- {
- launchScript += "cp " + QFileInfo(lib->storagePath()).absoluteFilePath() + "\n";
- }
- auto jarMods = getJarMods();
- if (!jarMods.isEmpty())
- {
- launchScript += "cp " + QDir(instanceRoot()).absoluteFilePath("minecraft.jar") + "\n";
- }
- else
- {
- QString relpath = m_profile->getMinecraftVersion() + "/" + m_profile->getMinecraftVersion() + ".jar";
- launchScript += "cp " + versionsPath().absoluteFilePath(relpath) + "\n";
- }
- }
auto mainClass = m_profile->getMainClass();
if (!mainClass.isEmpty())
{
@@ -234,15 +216,43 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session)
launchScript += "sessionId " + session->session + "\n";
}
- // native libraries (mostly LWJGL)
+ // libraries and class path.
{
- QDir natives_dir(FS::PathCombine(instanceRoot(), "natives/"));
- for (auto native : m_profile->getNativeLibraries())
+ auto libs = m_profile->getLibraries();
+
+ QStringList jar, native, native32, native64;
+ for (auto lib : libs)
+ {
+ lib->getApplicableFiles(currentSystem, jar, native, native32, native64);
+ }
+ for(auto file: jar)
+ {
+ launchScript += "cp " + file + "\n";
+ }
+ for(auto file: native)
{
- QFileInfo finfo(native->storagePath());
- launchScript += "ext " + finfo.absoluteFilePath() + "\n";
+ launchScript += "ext " + file + "\n";
}
+ for(auto file: native32)
+ {
+ launchScript += "ext32 " + file + "\n";
+ }
+ for(auto file: native64)
+ {
+ launchScript += "ext64 " + file + "\n";
+ }
+ QDir natives_dir(FS::PathCombine(instanceRoot(), "natives/"));
launchScript += "natives " + natives_dir.absolutePath() + "\n";
+ auto jarMods = getJarMods();
+ if (!jarMods.isEmpty())
+ {
+ launchScript += "cp " + QDir(instanceRoot()).absoluteFilePath("minecraft.jar") + "\n";
+ }
+ else
+ {
+ QString relpath = m_profile->getMinecraftVersion() + "/" + m_profile->getMinecraftVersion() + ".jar";
+ launchScript += "cp " + versionsPath().absoluteFilePath(relpath) + "\n";
+ }
}
// traits. including legacyLaunch and others ;)
diff --git a/logic/minecraft/onesix/OneSixProfileStrategy.cpp b/logic/minecraft/onesix/OneSixProfileStrategy.cpp
index aaaa9d97..af42286d 100644
--- a/logic/minecraft/onesix/OneSixProfileStrategy.cpp
+++ b/logic/minecraft/onesix/OneSixProfileStrategy.cpp
@@ -54,7 +54,7 @@ void OneSixProfileStrategy::upgradeDeprecatedFiles()
auto file = ProfileUtils::parseJsonFile(QFileInfo(sourceFile), false);
ProfileUtils::removeLwjglFromPatch(file);
file->fileId = "net.minecraft";
- file->version = file->id;
+ file->version = file->minecraftVersion;
file->name = "Minecraft";
auto data = OneSixVersionFormat::versionFileToJson(file, false).toJson();
QSaveFile newPatchFile(mcJson);
diff --git a/logic/minecraft/onesix/OneSixUpdate.cpp b/logic/minecraft/onesix/OneSixUpdate.cpp
index 10d1e294..1c2cd196 100644
--- a/logic/minecraft/onesix/OneSixUpdate.cpp
+++ b/logic/minecraft/onesix/OneSixUpdate.cpp
@@ -14,6 +14,7 @@
*/
#include "Env.h"
+#include <minecraft/forge/ForgeXzDownload.h>
#include "OneSixUpdate.h"
#include "OneSixInstance.h"
@@ -29,7 +30,6 @@
#include "minecraft/MinecraftVersionList.h"
#include "minecraft/MinecraftProfile.h"
#include "minecraft/Library.h"
-#include "minecraft/forge/ForgeMirrors.h"
#include "net/URLConstants.h"
#include "minecraft/AssetsUtils.h"
#include "Exception.h"
@@ -95,7 +95,7 @@ void OneSixUpdate::assetIndexStart()
auto metacache = ENV.metacache();
auto entry = metacache->resolveEntry("asset_indexes", localPath);
- entry->stale = true;
+ entry->setStale(true);
job->addNetAction(CacheDownload::make(indexUrl, entry));
jarlibDownloadJob.reset(job);
@@ -174,88 +174,41 @@ void OneSixUpdate::jarlibStart()
{
QString version_id = profile->getMinecraftVersion();
QString localPath = version_id + "/" + version_id + ".jar";
- QString urlstr = "http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + localPath;
+ QString urlstr = profile->getMainJarUrl();
auto job = new NetJob(tr("Libraries for instance %1").arg(inst->name()));
auto metacache = ENV.metacache();
auto entry = metacache->resolveEntry("versions", localPath);
job->addNetAction(CacheDownload::make(QUrl(urlstr), entry));
- jarHashOnEntry = entry->md5sum;
-
jarlibDownloadJob.reset(job);
}
- auto libs = profile->getNativeLibraries();
- libs.append(profile->getLibraries());
+ auto libs = profile->getLibraries();
auto metacache = ENV.metacache();
- QList<ForgeXzDownloadPtr> ForgeLibs;
QList<LibraryPtr> brokenLocalLibs;
+ QStringList failedFiles;
for (auto lib : libs)
{
- if (lib->hint() == "local")
- {
- if (!lib->filesExist(m_inst->librariesPath()))
- brokenLocalLibs.append(lib);
- continue;
- }
-
- QString raw_storage = lib->storageSuffix();
- QString raw_dl = lib->url();
-
- auto f = [&](QString storage, QString dl)
- {
- auto entry = metacache->resolveEntry("libraries", storage);
- if (entry->stale)
- {
- if (lib->hint() == "forge-pack-xz")
- {
- ForgeLibs.append(ForgeXzDownload::make(storage, entry));
- }
- else
- {
- jarlibDownloadJob->addNetAction(CacheDownload::make(dl, entry));
- }
- }
- };
- if (raw_storage.contains("${arch}"))
- {
- QString cooked_storage = raw_storage;
- QString cooked_dl = raw_dl;
- f(cooked_storage.replace("${arch}", "32"), cooked_dl.replace("${arch}", "32"));
- cooked_storage = raw_storage;
- cooked_dl = raw_dl;
- f(cooked_storage.replace("${arch}", "64"), cooked_dl.replace("${arch}", "64"));
- }
- else
+ auto dls = lib->getDownloads(currentSystem, metacache.get(), failedFiles);
+ for(auto dl : dls)
{
- f(raw_storage, raw_dl);
+ jarlibDownloadJob->addNetAction(dl);
}
}
if (!brokenLocalLibs.empty())
{
jarlibDownloadJob.reset();
- QStringList failed;
- for (auto brokenLib : brokenLocalLibs)
- {
- failed.append(brokenLib->files());
- }
- QString failed_all = failed.join("\n");
+
+ QString failed_all = failedFiles.join("\n");
emitFailed(tr("Some libraries marked as 'local' are missing their jar "
"files:\n%1\n\nYou'll have to correct this problem manually. If this is "
"an externally tracked instance, make sure to run it at least once "
"outside of MultiMC.").arg(failed_all));
return;
}
- // TODO: think about how to propagate this from the original json file... or IF AT ALL
- QString forgeMirrorList = "http://files.minecraftforge.net/mirror-brand.list";
- if (!ForgeLibs.empty())
- {
- jarlibDownloadJob->addNetAction(
- ForgeMirrors::make(ForgeLibs, jarlibDownloadJob, forgeMirrorList));
- }
connect(jarlibDownloadJob.get(), SIGNAL(succeeded()), SLOT(jarlibFinished()));
connect(jarlibDownloadJob.get(), &NetJob::failed, this, &OneSixUpdate::jarlibFailed);
diff --git a/logic/minecraft/onesix/OneSixUpdate.h b/logic/minecraft/onesix/OneSixUpdate.h
index 6901e3d6..b5195364 100644
--- a/logic/minecraft/onesix/OneSixUpdate.h
+++ b/logic/minecraft/onesix/OneSixUpdate.h
@@ -63,6 +63,5 @@ private:
std::shared_ptr<Task> versionUpdateTask;
OneSixInstance *m_inst = nullptr;
- QString jarHashOnEntry;
QList<FMLlib> fmlLibsToProcess;
};
diff --git a/logic/minecraft/onesix/OneSixVersionFormat.cpp b/logic/minecraft/onesix/OneSixVersionFormat.cpp
index b5e05b22..49a18563 100644
--- a/logic/minecraft/onesix/OneSixVersionFormat.cpp
+++ b/logic/minecraft/onesix/OneSixVersionFormat.cpp
@@ -19,16 +19,16 @@ LibraryPtr OneSixVersionFormat::libraryFromJson(const QJsonObject &libObj, const
{
LibraryPtr out = MojangVersionFormat::libraryFromJson(libObj, filename);
readString(libObj, "MMC-hint", out->m_hint);
- readString(libObj, "MMC-absulute_url", out->m_absolute_url);
- readString(libObj, "MMC-absoluteUrl", out->m_absolute_url);
+ readString(libObj, "MMC-absulute_url", out->m_absoluteURL);
+ readString(libObj, "MMC-absoluteUrl", out->m_absoluteURL);
return out;
}
QJsonObject OneSixVersionFormat::libraryToJson(Library *library)
{
QJsonObject libRoot = MojangVersionFormat::libraryToJson(library);
- if (library->m_absolute_url.size())
- libRoot.insert("MMC-absoluteUrl", library->m_absolute_url);
+ if (library->m_absoluteURL.size())
+ libRoot.insert("MMC-absoluteUrl", library->m_absoluteURL);
if (library->m_hint.size())
libRoot.insert("MMC-hint", library->m_hint);
return libRoot;
@@ -64,7 +64,7 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
out->name = root.value("name").toString();
out->fileId = root.value("fileId").toString();
out->version = root.value("version").toString();
- out->mcVersion = root.value("mcVersion").toString();
+ out->dependsOnMinecraftVersion = root.value("mcVersion").toString();
out->filename = filename;
MojangVersionFormat::readVersionProperties(root, out.get());
@@ -167,7 +167,7 @@ QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch
writeString(root, "name", patch->name);
writeString(root, "fileId", patch->fileId);
writeString(root, "version", patch->version);
- writeString(root, "mcVersion", patch->mcVersion);
+ writeString(root, "mcVersion", patch->dependsOnMinecraftVersion);
MojangVersionFormat::writeVersionProperties(patch.get(), root);