summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-09-27 15:39:13 +0200
committerPetr Mrázek <peterix@gmail.com>2017-09-27 15:39:13 +0200
commitc51512f94036b7d13b98cb02b8e8c1e549e7b448 (patch)
treed44cc40472bf619cdb1a91238c02eaca4e6d0c78 /api
parent9a2d203c0d95e51ea02e3e62fef6289973777e84 (diff)
downloadMultiMC-c51512f94036b7d13b98cb02b8e8c1e549e7b448.tar
MultiMC-c51512f94036b7d13b98cb02b8e8c1e549e7b448.tar.gz
MultiMC-c51512f94036b7d13b98cb02b8e8c1e549e7b448.tar.lz
MultiMC-c51512f94036b7d13b98cb02b8e8c1e549e7b448.tar.xz
MultiMC-c51512f94036b7d13b98cb02b8e8c1e549e7b448.zip
NOISSUE use classparser for importing Legacy instances with undecided Minecraft versions
Diffstat (limited to 'api')
-rw-r--r--api/logic/CMakeLists.txt2
-rw-r--r--api/logic/minecraft/legacy/LegacyInstance.cpp4
-rw-r--r--api/logic/minecraft/legacy/LegacyUpgradeTask.cpp16
3 files changed, 15 insertions, 7 deletions
diff --git a/api/logic/CMakeLists.txt b/api/logic/CMakeLists.txt
index a99d22ab..38b15286 100644
--- a/api/logic/CMakeLists.txt
+++ b/api/logic/CMakeLists.txt
@@ -448,7 +448,7 @@ set_target_properties(MultiMC_logic PROPERTIES CXX_VISIBILITY_PRESET hidden VISI
generate_export_header(MultiMC_logic)
# Link
-target_link_libraries(MultiMC_logic xz-embedded MultiMC_unpack200 systeminfo MultiMC_quazip ${NBT_NAME} ${ZLIB_LIBRARIES})
+target_link_libraries(MultiMC_logic xz-embedded MultiMC_unpack200 systeminfo MultiMC_quazip MultiMC_classparser ${NBT_NAME} ${ZLIB_LIBRARIES})
qt5_use_modules(MultiMC_logic Core Xml Network Concurrent)
# Mark and export headers
diff --git a/api/logic/minecraft/legacy/LegacyInstance.cpp b/api/logic/minecraft/legacy/LegacyInstance.cpp
index 21acf675..0b69acf2 100644
--- a/api/logic/minecraft/legacy/LegacyInstance.cpp
+++ b/api/logic/minecraft/legacy/LegacyInstance.cpp
@@ -31,8 +31,8 @@ LegacyInstance::LegacyInstance(SettingsObjectPtr globalSettings, SettingsObjectP
{
settings->registerSetting("NeedsRebuild", true);
settings->registerSetting("ShouldUpdate", false);
- settings->registerSetting("JarVersion", "Unknown");
- settings->registerSetting("IntendedJarVersion", "");
+ settings->registerSetting("JarVersion", QString());
+ settings->registerSetting("IntendedJarVersion", QString());
/*
* custom base jar has no default. it is determined in code... see the accessor methods for
*it
diff --git a/api/logic/minecraft/legacy/LegacyUpgradeTask.cpp b/api/logic/minecraft/legacy/LegacyUpgradeTask.cpp
index cb0572ed..e41d87cb 100644
--- a/api/logic/minecraft/legacy/LegacyUpgradeTask.cpp
+++ b/api/logic/minecraft/legacy/LegacyUpgradeTask.cpp
@@ -8,6 +8,7 @@
#include "LegacyInstance.h"
#include "minecraft/MinecraftInstance.h"
#include "minecraft/MinecraftProfile.h"
+#include "classparser.h"
LegacyUpgradeTask::LegacyUpgradeTask(SettingsObjectPtr settings, const QString & stagingPath, InstancePtr origInstance, const QString & newName)
{
@@ -50,7 +51,6 @@ static QString decideVersion(const QString& currentVersion, const QString& inten
return intendedVersion;
}
}
- // TODO: possibly add fallback to the old jar/classfile analysis method from MultiMC4
return QString();
}
@@ -74,9 +74,17 @@ void LegacyUpgradeTask::copyFinished()
QString preferredVersionNumber = decideVersion(legacyInst->currentVersionId(), legacyInst->intendedVersionId());
if(preferredVersionNumber.isNull())
{
- // FIXME: let the user decide
- emitFailed(tr("Could not decide Minecraft version."));
- return;
+ // try to decide version based on the jar(s?)
+ preferredVersionNumber = classparser::GetMinecraftJarVersion(legacyInst->baseJar());
+ if(preferredVersionNumber.isNull())
+ {
+ preferredVersionNumber = classparser::GetMinecraftJarVersion(legacyInst->runnableJar());
+ if(preferredVersionNumber.isNull())
+ {
+ emitFailed(tr("Could not decide Minecraft version."));
+ return;
+ }
+ }
}
inst->setComponentVersion("net.minecraft", preferredVersionNumber);