summaryrefslogtreecommitdiffstats
path: root/wonkoclient/WonkoClient.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-04-09 23:51:01 +0200
committerPetr Mrázek <peterix@gmail.com>2016-04-30 23:59:23 +0200
commitfcd4a482f759cd58ee319a51082d0146b7e426e2 (patch)
tree52bd8227d4889d7e02b3cce43c24d48fec825e60 /wonkoclient/WonkoClient.cpp
parent00e5968bd28ab1df33b3a39dbac8cda99aa2a0d2 (diff)
downloadMultiMC-fcd4a482f759cd58ee319a51082d0146b7e426e2.tar
MultiMC-fcd4a482f759cd58ee319a51082d0146b7e426e2.tar.gz
MultiMC-fcd4a482f759cd58ee319a51082d0146b7e426e2.tar.lz
MultiMC-fcd4a482f759cd58ee319a51082d0146b7e426e2.tar.xz
MultiMC-fcd4a482f759cd58ee319a51082d0146b7e426e2.zip
NOISSUE tiny skeleton for a CLI wonko client
Diffstat (limited to 'wonkoclient/WonkoClient.cpp')
-rw-r--r--wonkoclient/WonkoClient.cpp85
1 files changed, 85 insertions, 0 deletions
diff --git a/wonkoclient/WonkoClient.cpp b/wonkoclient/WonkoClient.cpp
new file mode 100644
index 00000000..83efb285
--- /dev/null
+++ b/wonkoclient/WonkoClient.cpp
@@ -0,0 +1,85 @@
+//
+// Created by robotbrain on 3/27/16.
+//
+
+#include <minecraft/MinecraftVersionList.h>
+#include <Env.h>
+#include <minecraft/liteloader/LiteLoaderVersionList.h>
+#include <minecraft/forge/ForgeVersionList.h>
+#include <minecraft/legacy/LwjglVersionList.h>
+#include <java/JavaInstallList.h>
+#include <settings/INISettingsObject.h>
+#include <resources/Resource.h>
+#include "WonkoClient.h"
+#include <icons/IconList.h>
+
+
+WonkoClient &WonkoClient::getInstance() {
+ static WonkoClient instance;
+ return instance;
+}
+
+void WonkoClient::registerLists() {
+ ENV.initHttpMetaCache();
+ auto mcList = std::make_shared<MinecraftVersionList>();
+ ENV.registerVersionList("net.minecraft", mcList);
+ runTask(mcList->getLoadTask());
+ auto llList = std::make_shared<LiteLoaderVersionList>();
+ ENV.registerVersionList("com.mumfrey.liteloader", llList);
+ runTask(llList->getLoadTask());
+ auto forgeList = std::make_shared<ForgeVersionList>();
+ ENV.registerVersionList("net.minecraftforge", forgeList);
+ runTask(forgeList->getLoadTask());
+ auto lwjglList = std::make_shared<LWJGLVersionList>();
+ ENV.registerVersionList("org.lwjgl.legacy", lwjglList);
+ runTask(lwjglList->getLoadTask());
+ auto javaList = std::make_shared<JavaInstallList>();
+ ENV.registerVersionList("com.java", javaList);
+}
+
+WonkoClient::WonkoClient() {
+ m_settings.reset(new INISettingsObject("multimc.cfg", this));
+ m_instanceList.reset(new InstanceList(m_settings, ".", this));
+}
+
+void WonkoClient::runTask(Task *pTask) {
+ if (pTask == nullptr)
+ return;
+ QEventLoop loop;
+ QObject::connect(pTask, &Task::finished, &loop, &QEventLoop::quit);
+ pTask->start();
+ loop.exec();
+ delete pTask;
+}
+
+void WonkoClient::initGlobalSettings()
+{
+ m_settings->registerSetting("ShowConsole", true);
+ m_settings->registerSetting("RaiseConsole", true);
+ m_settings->registerSetting("AutoCloseConsole", true);
+ m_settings->registerSetting("LogPrePostOutput", true);
+ // Window Size
+ m_settings->registerSetting({"LaunchMaximized", "MCWindowMaximize"}, false);
+ m_settings->registerSetting({"MinecraftWinWidth", "MCWindowWidth"}, 854);
+ m_settings->registerSetting({"MinecraftWinHeight", "MCWindowHeight"}, 480);
+
+ // Memory
+ m_settings->registerSetting({"MinMemAlloc", "MinMemoryAlloc"}, 512);
+ m_settings->registerSetting({"MaxMemAlloc", "MaxMemoryAlloc"}, 1024);
+ m_settings->registerSetting("PermGen", 128);
+
+ // Java Settings
+ m_settings->registerSetting("JavaPath", "");
+ m_settings->registerSetting("JavaTimestamp", 0);
+ m_settings->registerSetting("JavaVersion", "");
+ m_settings->registerSetting("LastHostname", "");
+ m_settings->registerSetting("JavaDetectionHack", "");
+ m_settings->registerSetting("JvmArgs", "");
+
+ // Wrapper command for launch
+ m_settings->registerSetting("WrapperCommand", "");
+
+ // Custom Commands
+ m_settings->registerSetting({"PreLaunchCommand", "PreLaunchCmd"}, "");
+ m_settings->registerSetting({"PostExitCommand", "PostExitCmd"}, "");
+}