aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-06-11 19:29:46 +0200
committerGitHub <noreply@github.com>2022-06-11 19:29:46 +0200
commit51258ab28ca72b7910f8db88d870d290babf7c00 (patch)
tree624c4999643b53d17643c281d633f656c7b6c98a /launcher
parent2d261607dfbf11d7253682f58ea169a54e0368c8 (diff)
parent778baa6dbe9a7710b86771262bbe435bdd6ee574 (diff)
downloadPrismLauncher-51258ab28ca72b7910f8db88d870d290babf7c00.tar.gz
PrismLauncher-51258ab28ca72b7910f8db88d870d290babf7c00.tar.bz2
PrismLauncher-51258ab28ca72b7910f8db88d870d290babf7c00.zip
Merge pull request #709 from Scrumplex/fix-instancetypes
Always store InstanceType
Diffstat (limited to 'launcher')
-rw-r--r--launcher/BaseInstance.cpp2
-rw-r--r--launcher/InstanceList.cpp16
-rw-r--r--launcher/minecraft/MinecraftInstance.cpp2
3 files changed, 17 insertions, 3 deletions
diff --git a/launcher/BaseInstance.cpp b/launcher/BaseInstance.cpp
index 2fb31d94..0240afa8 100644
--- a/launcher/BaseInstance.cpp
+++ b/launcher/BaseInstance.cpp
@@ -59,7 +59,7 @@ BaseInstance::BaseInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr s
m_settings->registerSetting("lastLaunchTime", 0);
m_settings->registerSetting("totalTimePlayed", 0);
m_settings->registerSetting("lastTimePlayed", 0);
- m_settings->registerSetting("InstanceType", "OneSix");
+ m_settings->registerSetting("InstanceType", "");
// Custom Commands
auto commandSetting = m_settings->registerSetting({"OverrideCommands","OverrideLaunchCmd"}, false);
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;
}
diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp
index 2f339014..e99d30fe 100644
--- a/launcher/minecraft/MinecraftInstance.cpp
+++ b/launcher/minecraft/MinecraftInstance.cpp
@@ -168,6 +168,8 @@ MinecraftInstance::MinecraftInstance(SettingsObjectPtr globalSettings, SettingsO
m_settings->registerOverride(globalSettings->getSetting("CloseAfterLaunch"), miscellaneousOverride);
m_settings->registerOverride(globalSettings->getSetting("QuitAfterGameStop"), miscellaneousOverride);
+ m_settings->set("InstanceType", "OneSix");
+
m_components.reset(new PackProfile(this));
}