summaryrefslogtreecommitdiffstats
path: root/logic/minecraft
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-05-23 16:07:47 +0200
committerPetr Mrázek <peterix@gmail.com>2015-05-23 16:07:47 +0200
commitce99fabe1396ed2956dc7ecb468760ef88f98765 (patch)
tree603f7c6f1a0f27805b21843ec3f829354ad0ff77 /logic/minecraft
parent0e0ddf5494ab4a264b0dc18c4b94809844300dc0 (diff)
downloadMultiMC-ce99fabe1396ed2956dc7ecb468760ef88f98765.tar
MultiMC-ce99fabe1396ed2956dc7ecb468760ef88f98765.tar.gz
MultiMC-ce99fabe1396ed2956dc7ecb468760ef88f98765.tar.lz
MultiMC-ce99fabe1396ed2956dc7ecb468760ef88f98765.tar.xz
MultiMC-ce99fabe1396ed2956dc7ecb468760ef88f98765.zip
GH-992 Add a transaction/locking mechanism to settings objects
This can cut the FTB loading by ~66% - worth it, but not ideal. Real solution will have to be implemented later.
Diffstat (limited to 'logic/minecraft')
-rw-r--r--logic/minecraft/LegacyInstance.cpp12
-rw-r--r--logic/minecraft/MinecraftProcess.cpp18
-rw-r--r--logic/minecraft/OneSixInstance.cpp10
3 files changed, 20 insertions, 20 deletions
diff --git a/logic/minecraft/LegacyInstance.cpp b/logic/minecraft/LegacyInstance.cpp
index 282504b3..387975fa 100644
--- a/logic/minecraft/LegacyInstance.cpp
+++ b/logic/minecraft/LegacyInstance.cpp
@@ -106,12 +106,12 @@ BaseProcess *LegacyInstance::prepareForLaunch(AuthSessionPtr account)
{
// window size
QString windowParams;
- if (settings().get("LaunchMaximized").toBool())
+ if (settings()->get("LaunchMaximized").toBool())
windowParams = "max";
else
windowParams = QString("%1x%2")
- .arg(settings().get("MinecraftWinWidth").toInt())
- .arg(settings().get("MinecraftWinHeight").toInt());
+ .arg(settings()->get("MinecraftWinWidth").toInt())
+ .arg(settings()->get("MinecraftWinHeight").toInt());
QString lwjgl = QDir(m_lwjglFolderSetting->get().toString() + "/" + lwjglVersion())
.absolutePath();
@@ -273,14 +273,14 @@ QString LegacyInstance::intendedVersionId() const
bool LegacyInstance::setIntendedVersionId(QString version)
{
- settings().set("IntendedJarVersion", version);
+ settings()->set("IntendedJarVersion", version);
setShouldUpdate(true);
return true;
}
bool LegacyInstance::shouldUpdate() const
{
- QVariant var = settings().get("ShouldUpdate");
+ QVariant var = settings()->get("ShouldUpdate");
if (!var.isValid() || var.toBool() == false)
{
return intendedVersionId() != currentVersionId();
@@ -290,7 +290,7 @@ bool LegacyInstance::shouldUpdate() const
void LegacyInstance::setShouldUpdate(bool val)
{
- settings().set("ShouldUpdate", val);
+ settings()->set("ShouldUpdate", val);
}
QString LegacyInstance::defaultBaseJar() const
diff --git a/logic/minecraft/MinecraftProcess.cpp b/logic/minecraft/MinecraftProcess.cpp
index fc2c8a39..d52eb97c 100644
--- a/logic/minecraft/MinecraftProcess.cpp
+++ b/logic/minecraft/MinecraftProcess.cpp
@@ -117,7 +117,7 @@ QMap<QString, QString> MinecraftProcess::getVariables() const
out.insert("INST_ID", mcInstance->id());
out.insert("INST_DIR", QDir(mcInstance->instanceRoot()).absolutePath());
out.insert("INST_MC_DIR", QDir(mcInstance->minecraftRoot()).absolutePath());
- out.insert("INST_JAVA", mcInstance->settings().get("JavaPath").toString());
+ out.insert("INST_JAVA", mcInstance->settings()->get("JavaPath").toString());
out.insert("INST_JAVA_ARGS", javaArguments().join(' '));
return out;
}
@@ -141,14 +141,14 @@ QStringList MinecraftProcess::javaArguments() const
"minecraft.exe.heapdump");
#endif
- args << QString("-Xms%1m").arg(m_instance->settings().get("MinMemAlloc").toInt());
- args << QString("-Xmx%1m").arg(m_instance->settings().get("MaxMemAlloc").toInt());
+ args << QString("-Xms%1m").arg(m_instance->settings()->get("MinMemAlloc").toInt());
+ args << QString("-Xmx%1m").arg(m_instance->settings()->get("MaxMemAlloc").toInt());
// No PermGen in newer java.
- auto javaVersion = m_instance->settings().get("JavaVersion");
+ auto javaVersion = m_instance->settings()->get("JavaVersion");
if(Strings::naturalCompare(javaVersion.toString(), "1.8.0", Qt::CaseInsensitive) < 0)
{
- auto permgen = m_instance->settings().get("PermGen").toInt();
+ auto permgen = m_instance->settings()->get("PermGen").toInt();
if (permgen != 64)
{
args << QString("-XX:PermSize=%1m").arg(permgen);
@@ -176,7 +176,7 @@ void MinecraftProcess::arm()
m_instance->setLastLaunch();
- QString JavaPath = m_instance->settings().get("JavaPath").toString();
+ QString JavaPath = m_instance->settings()->get("JavaPath").toString();
emit log("Java path is:\n" + JavaPath + "\n\n");
auto realJavaPath = QStandardPaths::findExecutable(JavaPath);
@@ -191,7 +191,7 @@ void MinecraftProcess::arm()
{
QFileInfo javaInfo(realJavaPath);
qlonglong javaUnixTime = javaInfo.lastModified().toMSecsSinceEpoch();
- auto storedUnixTime = m_instance->settings().get("JavaTimestamp").toLongLong();
+ auto storedUnixTime = m_instance->settings()->get("JavaTimestamp").toLongLong();
// if they are not the same, check!
if(javaUnixTime != storedUnixTime)
{
@@ -229,8 +229,8 @@ void MinecraftProcess::arm()
return;
}
emit log(tr("Java version is %1!\n").arg(version), MessageLevel::MultiMC);
- m_instance->settings().set("JavaVersion", version);
- m_instance->settings().set("JavaTimestamp", javaUnixTime);
+ m_instance->settings()->set("JavaVersion", version);
+ m_instance->settings()->set("JavaTimestamp", javaUnixTime);
}
}
diff --git a/logic/minecraft/OneSixInstance.cpp b/logic/minecraft/OneSixInstance.cpp
index 8e2d1043..c551dc9b 100644
--- a/logic/minecraft/OneSixInstance.cpp
+++ b/logic/minecraft/OneSixInstance.cpp
@@ -170,12 +170,12 @@ BaseProcess *OneSixInstance::prepareForLaunch(AuthSessionPtr session)
// window size, title and state, legacy
{
QString windowParams;
- if (settings().get("LaunchMaximized").toBool())
+ if (settings()->get("LaunchMaximized").toBool())
windowParams = "max";
else
windowParams = QString("%1x%2")
- .arg(settings().get("MinecraftWinWidth").toInt())
- .arg(settings().get("MinecraftWinHeight").toInt());
+ .arg(settings()->get("MinecraftWinWidth").toInt())
+ .arg(settings()->get("MinecraftWinHeight").toInt());
launchScript += "windowTitle " + windowTitle() + "\n";
launchScript += "windowParams " + windowParams + "\n";
}
@@ -260,7 +260,7 @@ std::shared_ptr<ModList> OneSixInstance::texturePackList() const
bool OneSixInstance::setIntendedVersionId(QString version)
{
- settings().set("IntendedVersion", version);
+ settings()->set("IntendedVersion", version);
if(getMinecraftProfile())
{
clearProfile();
@@ -283,7 +283,7 @@ QList< Mod > OneSixInstance::getJarMods() const
QString OneSixInstance::intendedVersionId() const
{
- return settings().get("IntendedVersion").toString();
+ return settings()->get("IntendedVersion").toString();
}
void OneSixInstance::setShouldUpdate(bool)