diff options
author | Sefa Eyeoglu <contact@scrumplex.net> | 2022-06-04 11:59:12 +0200 |
---|---|---|
committer | Sefa Eyeoglu <contact@scrumplex.net> | 2022-06-04 11:59:12 +0200 |
commit | 778baa6dbe9a7710b86771262bbe435bdd6ee574 (patch) | |
tree | 51341c50d0a226cdd3abd8a944e6480baf2ffb5a /launcher/InstanceList.cpp | |
parent | cf4949b4f5a29757b3dd24cdca3a010f10e6dadb (diff) | |
download | PrismLauncher-778baa6dbe9a7710b86771262bbe435bdd6ee574.tar.gz PrismLauncher-778baa6dbe9a7710b86771262bbe435bdd6ee574.tar.bz2 PrismLauncher-778baa6dbe9a7710b86771262bbe435bdd6ee574.zip |
fix: always store InstanceType
Diffstat (limited to 'launcher/InstanceList.cpp')
-rw-r--r-- | launcher/InstanceList.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/launcher/InstanceList.cpp b/launcher/InstanceList.cpp index 847d897e..3e3c81f7 100644 --- a/launcher/InstanceList.cpp +++ b/launcher/InstanceList.cpp @@ -547,8 +547,20 @@ InstancePtr InstanceList::loadInstance(const InstanceId& id) auto instanceRoot = FS::PathCombine(m_instDir, id); auto instanceSettings = std::make_shared<INISettingsObject>(FS::PathCombine(instanceRoot, "instance.cfg")); InstancePtr inst; - // TODO: Handle incompatible instances - inst.reset(new MinecraftInstance(m_globalSettings, instanceSettings, instanceRoot)); + + instanceSettings->registerSetting("InstanceType", ""); + + QString inst_type = instanceSettings->get("InstanceType").toString(); + + // NOTE: Some PolyMC versions didn't save the InstanceType properly. We will just bank on the probability that this is probably a OneSix instance + if (inst_type == "OneSix" || inst_type.isEmpty()) + { + inst.reset(new MinecraftInstance(m_globalSettings, instanceSettings, instanceRoot)); + } + else + { + inst.reset(new NullInstance(m_globalSettings, instanceSettings, instanceRoot)); + } qDebug() << "Loaded instance " << inst->name() << " from " << inst->instanceRoot(); return inst; } |