NOISSUE finalize support for new mojang version format
This commit is contained in:
@@ -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)
|
||||
{
|
||||
QFileInfo finfo(native->storagePath());
|
||||
launchScript += "ext " + finfo.absoluteFilePath() + "\n";
|
||||
lib->getApplicableFiles(currentSystem, jar, native, native32, native64);
|
||||
}
|
||||
for(auto file: jar)
|
||||
{
|
||||
launchScript += "cp " + file + "\n";
|
||||
}
|
||||
for(auto file: native)
|
||||
{
|
||||
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 ;)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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")
|
||||
auto dls = lib->getDownloads(currentSystem, metacache.get(), failedFiles);
|
||||
for(auto dl : dls)
|
||||
{
|
||||
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
|
||||
{
|
||||
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);
|
||||
|
||||
@@ -63,6 +63,5 @@ private:
|
||||
std::shared_ptr<Task> versionUpdateTask;
|
||||
|
||||
OneSixInstance *m_inst = nullptr;
|
||||
QString jarHashOnEntry;
|
||||
QList<FMLlib> fmlLibsToProcess;
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user