NOISSUE fix problems in old curse packs
Added: * jarmod importing * fixing of bad minecraft versions * mapping of undefined 'recommended' forge versions to something appropriate * some fake guessing of pack icons * fixes for some more issues found with the pack manifest format
This commit is contained in:
parent
6a525db78d
commit
77a1d39f6b
@ -175,6 +175,12 @@ void InstanceImportTask::extractAborted()
|
||||
|
||||
void InstanceImportTask::processCurse(const QFileInfo & manifest)
|
||||
{
|
||||
const static QMap<QString,QString> forgemap = {
|
||||
{"1.2.5", "3.4.9.171"},
|
||||
{"1.4.2", "6.0.1.355"},
|
||||
{"1.4.7", "6.6.2.534"},
|
||||
{"1.5.2", "7.8.1.737"}
|
||||
};
|
||||
Curse::Manifest pack;
|
||||
try
|
||||
{
|
||||
@ -187,7 +193,6 @@ void InstanceImportTask::processCurse(const QFileInfo & manifest)
|
||||
return;
|
||||
}
|
||||
m_packRoot = manifest.absolutePath();
|
||||
QString configPath = FS::PathCombine(m_packRoot, "instance.cfg");
|
||||
if(!pack.overrides.isEmpty())
|
||||
{
|
||||
QString overridePath = FS::PathCombine(m_packRoot, pack.overrides);
|
||||
@ -213,17 +218,70 @@ void InstanceImportTask::processCurse(const QFileInfo & manifest)
|
||||
qWarning() << "Unknown mod loader in curse manifest:" << id;
|
||||
}
|
||||
|
||||
QString configPath = FS::PathCombine(m_packRoot, "instance.cfg");
|
||||
auto instanceSettings = std::make_shared<INISettingsObject>(configPath);
|
||||
instanceSettings->registerSetting("InstanceType", "Legacy");
|
||||
instanceSettings->set("InstanceType", "OneSix");
|
||||
OneSixInstance instance(m_globalSettings, instanceSettings, m_packRoot);
|
||||
instance.setIntendedVersionId(pack.minecraft.version);
|
||||
auto mcVersion = pack.minecraft.version;
|
||||
// Hack to correct some 'special curse sauce'...
|
||||
if(mcVersion.endsWith('.'))
|
||||
{
|
||||
mcVersion.remove(QRegExp("[.]+$"));
|
||||
qWarning() << "Mysterious trailing dots removed from Minecraft version while importing Curse pack.";
|
||||
}
|
||||
instance.setComponentVersion("net.minecraft", mcVersion);
|
||||
if(!forgeVersion.isEmpty())
|
||||
{
|
||||
// FIXME: dirty, nasty, hack. Proper solution requires dependency resolution and knowledge of the metadata.
|
||||
if(forgeVersion == "recommended")
|
||||
{
|
||||
if(forgemap.contains(mcVersion))
|
||||
{
|
||||
forgeVersion = forgemap[mcVersion];
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << "Could not map recommended forge version for" << mcVersion;
|
||||
}
|
||||
}
|
||||
instance.setComponentVersion("net.minecraftforge", forgeVersion);
|
||||
}
|
||||
instance.setName(m_instName);
|
||||
if (m_instIcon != "default")
|
||||
{
|
||||
instance.setIconKey(m_instIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pack.name.contains("Direwolf20"))
|
||||
{
|
||||
instance.setIconKey("steve");
|
||||
}
|
||||
else if(pack.name.contains("FTB") || pack.name.contains("Feed The Beast"))
|
||||
{
|
||||
instance.setIconKey("ftb_logo");
|
||||
}
|
||||
}
|
||||
instance.init();
|
||||
QString jarmodsPath = FS::PathCombine(m_packRoot, "minecraft", "jarmods");
|
||||
QFileInfo jarmodsInfo(jarmodsPath);
|
||||
if(jarmodsInfo.isDir())
|
||||
{
|
||||
// install all the jar mods
|
||||
qDebug() << "Found jarmods:";
|
||||
QDir jarmodsDir(jarmodsPath);
|
||||
QStringList jarMods;
|
||||
for (auto info: jarmodsDir.entryInfoList(QDir::NoDotAndDotDot | QDir::Files))
|
||||
{
|
||||
qDebug() << info.fileName();
|
||||
jarMods.push_back(info.absoluteFilePath());
|
||||
}
|
||||
auto profile = instance.getMinecraftProfile();
|
||||
profile->installJarMods(jarMods);
|
||||
// nuke the original files
|
||||
FS::deletePath(jarmodsPath);
|
||||
}
|
||||
instance.setName(m_instName);
|
||||
m_curseResolver.reset(new Curse::FileResolvingTask(pack));
|
||||
connect(m_curseResolver.get(), &Curse::FileResolvingTask::succeeded, [&]()
|
||||
{
|
||||
|
@ -18,7 +18,8 @@ static void loadModloaderV1(Curse::Modloader & m, QJsonObject & modLoader)
|
||||
static void loadMinecraftV1(Curse::Minecraft & m, QJsonObject & minecraft)
|
||||
{
|
||||
m.version = Json::requireString(minecraft, "version");
|
||||
// FIXME: default unknown, assuming empty. Meaning also unknown.
|
||||
// extra libraries... apparently only used for a custom Minecraft launcher in the 1.2.5 FTB retro pack
|
||||
// intended use is likely hardcoded in the Curse client, the manifest says nothing
|
||||
m.libraries = Json::ensureString(minecraft, QString("libraries"), QString());
|
||||
auto arr = Json::ensureArray(minecraft, "modLoaders", QJsonArray());
|
||||
for (const auto & item : arr)
|
||||
@ -34,9 +35,9 @@ static void loadManifestV1(Curse::Manifest & m, QJsonObject & manifest)
|
||||
{
|
||||
auto mc = Json::requireObject(manifest, "minecraft");
|
||||
loadMinecraftV1(m.minecraft, mc);
|
||||
m.name = Json::requireString(manifest, "name");
|
||||
m.version = Json::requireString(manifest, "version");
|
||||
m.author = Json::requireString(manifest, "author");
|
||||
m.name = Json::ensureString(manifest, QString("name"), "Unnamed");
|
||||
m.version = Json::ensureString(manifest, QString("version"), QString());
|
||||
m.author = Json::ensureString(manifest, QString("author"), "Anonymous Coward");
|
||||
auto arr = Json::ensureArray(manifest, "files", QJsonArray());
|
||||
for (const auto & item : arr)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user