aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'launcher')
-rw-r--r--launcher/Application.cpp29
-rw-r--r--launcher/Application.h7
-rw-r--r--launcher/BaseInstance.h1
-rw-r--r--launcher/CMakeLists.txt111
-rw-r--r--launcher/FileSystem.h5
-rw-r--r--launcher/FileSystem_test.cpp44
-rw-r--r--launcher/GZip_test.cpp1
-rw-r--r--launcher/InstanceImportTask.cpp15
-rw-r--r--launcher/InstancePageProvider.h4
-rw-r--r--launcher/JavaCommon.cpp13
-rw-r--r--launcher/JavaCommon.h10
-rw-r--r--launcher/MMCZip.cpp2
-rw-r--r--launcher/NullInstance.h4
-rw-r--r--launcher/java/JavaChecker.cpp8
-rw-r--r--launcher/java/JavaUtils.cpp6
-rw-r--r--launcher/java/JavaUtils.h2
-rw-r--r--launcher/java/JavaVersion_test.cpp1
-rw-r--r--launcher/launch/steps/CheckJava.cpp25
-rw-r--r--launcher/launch/steps/CheckJava.h2
-rw-r--r--launcher/meta/Index_test.cpp1
-rw-r--r--launcher/minecraft/ComponentUpdateTask.cpp8
-rw-r--r--launcher/minecraft/GradleSpecifier_test.cpp1
-rw-r--r--launcher/minecraft/Library_test.cpp44
-rw-r--r--launcher/minecraft/MinecraftInstance.cpp50
-rw-r--r--launcher/minecraft/MinecraftInstance.h1
-rw-r--r--launcher/minecraft/MinecraftLoadAndCheck.cpp1
-rw-r--r--launcher/minecraft/MinecraftUpdate.cpp2
-rw-r--r--launcher/minecraft/MinecraftUpdate.h2
-rw-r--r--launcher/minecraft/MojangDownloadInfo.h2
-rw-r--r--launcher/minecraft/MojangVersionFormat_test.cpp8
-rw-r--r--launcher/minecraft/PackProfile.cpp1
-rw-r--r--launcher/minecraft/ParseUtils_test.cpp2
-rw-r--r--launcher/minecraft/auth/AccountData.cpp2
-rw-r--r--launcher/minecraft/auth/AccountList.cpp22
-rw-r--r--launcher/minecraft/auth/AccountList.h4
-rw-r--r--launcher/minecraft/auth/MinecraftAccount.cpp4
-rw-r--r--launcher/minecraft/auth/steps/YggdrasilStep.cpp1
-rw-r--r--launcher/minecraft/launch/DirectJavaLaunch.cpp22
-rw-r--r--launcher/minecraft/launch/LauncherPartLaunch.cpp30
-rw-r--r--launcher/minecraft/mod/ModFolderModel.cpp14
-rw-r--r--launcher/minecraft/mod/ModFolderModel_test.cpp3
-rw-r--r--launcher/minecraft/mod/testdata/test_folder/assets/minecraft/textures/blah.txt1
-rw-r--r--launcher/minecraft/mod/testdata/test_folder/pack.mcmeta6
-rw-r--r--launcher/minecraft/mod/testdata/test_folder/pack.nfo1
-rw-r--r--launcher/minecraft/update/AssetUpdateTask.cpp2
-rw-r--r--launcher/minecraft/update/FMLLibrariesTask.cpp1
-rw-r--r--launcher/minecraft/update/LibrariesTask.cpp1
-rw-r--r--launcher/modplatform/flame/FileResolvingTask.cpp4
-rw-r--r--launcher/modplatform/packwiz/Packwiz_test.cpp1
-rw-r--r--launcher/modplatform/technic/TechnicPackProcessor.cpp14
-rw-r--r--launcher/mojang/PackageManifest_test.cpp1
-rw-r--r--launcher/news/NewsEntry.cpp2
-rw-r--r--launcher/settings/INIFile_test.cpp1
-rw-r--r--launcher/tasks/ConcurrentTask.cpp144
-rw-r--r--launcher/tasks/ConcurrentTask.h58
-rw-r--r--launcher/tasks/Task_test.cpp1
-rw-r--r--launcher/ui/MainWindow.cpp114
-rw-r--r--launcher/ui/MainWindow.h2
-rw-r--r--launcher/ui/dialogs/AboutDialog.ui27
-rw-r--r--launcher/ui/dialogs/NewsDialog.cpp49
-rw-r--r--launcher/ui/dialogs/NewsDialog.h30
-rw-r--r--launcher/ui/dialogs/NewsDialog.ui113
-rw-r--r--launcher/ui/pages/global/AccountListPage.cpp18
-rw-r--r--launcher/ui/pages/global/JavaPage.cpp5
-rw-r--r--launcher/ui/pages/global/MinecraftPage.cpp13
-rw-r--r--launcher/ui/pages/global/MinecraftPage.ui60
-rw-r--r--launcher/ui/pages/instance/ExternalResourcesPage.cpp297
-rw-r--r--launcher/ui/pages/instance/ExternalResourcesPage.h73
-rw-r--r--launcher/ui/pages/instance/ExternalResourcesPage.ui (renamed from launcher/ui/pages/instance/ModFolderPage.ui)49
-rw-r--r--launcher/ui/pages/instance/InstanceSettingsPage.cpp32
-rw-r--r--launcher/ui/pages/instance/InstanceSettingsPage.ui68
-rw-r--r--launcher/ui/pages/instance/ModFolderPage.cpp381
-rw-r--r--launcher/ui/pages/instance/ModFolderPage.h112
-rw-r--r--launcher/ui/pages/instance/ResourcePackPage.h20
-rw-r--r--launcher/ui/pages/instance/ShaderPackPage.h16
-rw-r--r--launcher/ui/pages/instance/TexturePackPage.h18
-rw-r--r--launcher/ui/pages/modplatform/ModModel.cpp10
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameModel.cpp16
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameModel.h1
-rw-r--r--launcher/ui/pages/modplatform/flame/FlamePage.cpp25
-rw-r--r--launcher/ui/pages/modplatform/flame/FlamePage.ui2
-rw-r--r--launcher/ui/pages/modplatform/legacy_ftb/Page.ui6
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp26
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModel.h1
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp35
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthPage.ui3
-rw-r--r--launcher/ui/pages/modplatform/technic/TechnicModel.cpp5
-rw-r--r--launcher/ui/widgets/JavaSettingsWidget.cpp5
-rw-r--r--launcher/updater/DownloadTask_test.cpp32
-rw-r--r--launcher/updater/UpdateChecker_test.cpp19
90 files changed, 1615 insertions, 821 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index ab3110a3..0ef641ba 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -226,7 +226,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
setOrganizationName(BuildConfig.LAUNCHER_NAME);
setOrganizationDomain(BuildConfig.LAUNCHER_DOMAIN);
setApplicationName(BuildConfig.LAUNCHER_NAME);
- setApplicationDisplayName(BuildConfig.LAUNCHER_DISPLAYNAME);
+ setApplicationDisplayName(QString("%1 %2").arg(BuildConfig.LAUNCHER_DISPLAYNAME, BuildConfig.printableVersionString()));
setApplicationVersion(BuildConfig.printableVersionString());
setDesktopFileName(BuildConfig.LAUNCHER_DESKTOPFILENAME);
startTime = QDateTime::currentDateTime();
@@ -334,10 +334,6 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
// on macOS, touch the root to force Finder to reload the .app metadata (and fix any icon change issues)
FS::updateTimestamp(m_rootPath);
#endif
-
-#ifdef LAUNCHER_JARS_LOCATION
- m_jarsPath = TOSTRING(LAUNCHER_JARS_LOCATION);
-#endif
}
QString adjustedBy;
@@ -626,6 +622,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
m_settings->registerSetting("JavaPath", "");
m_settings->registerSetting("JavaTimestamp", 0);
m_settings->registerSetting("JavaArchitecture", "");
+ m_settings->registerSetting("JavaRealArchitecture", "");
m_settings->registerSetting("JavaVersion", "");
m_settings->registerSetting("JavaVendor", "");
m_settings->registerSetting("LastHostname", "");
@@ -637,6 +634,11 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
m_settings->registerSetting("UseNativeOpenAL", false);
m_settings->registerSetting("UseNativeGLFW", false);
+ // Peformance related options
+ m_settings->registerSetting("EnableFeralGamemode", false);
+ m_settings->registerSetting("EnableMangoHud", false);
+ m_settings->registerSetting("UseDiscreteGpu", false);
+
// Game time
m_settings->registerSetting("ShowGameTime", true);
m_settings->registerSetting("ShowGlobalGameTime", true);
@@ -1556,13 +1558,22 @@ shared_qobject_ptr<Meta::Index> Application::metadataIndex()
return m_metadataIndex;
}
-QString Application::getJarsPath()
+QString Application::getJarPath(QString jarFile)
{
- if(m_jarsPath.isEmpty())
+ QStringList potentialPaths = {
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)
+ FS::PathCombine(m_rootPath, "share/jars"),
+#endif
+ FS::PathCombine(m_rootPath, "jars"),
+ FS::PathCombine(applicationDirPath(), "jars")
+ };
+ for(QString p : potentialPaths)
{
- return FS::PathCombine(QCoreApplication::applicationDirPath(), "jars");
+ QString jarPath = FS::PathCombine(p, jarFile);
+ if (QFileInfo(jarPath).isFile())
+ return jarPath;
}
- return FS::PathCombine(m_rootPath, m_jarsPath);
+ return {};
}
QString Application::getMSAClientID()
diff --git a/launcher/Application.h b/launcher/Application.h
index 09007160..18461ad8 100644
--- a/launcher/Application.h
+++ b/launcher/Application.h
@@ -157,7 +157,11 @@ public:
shared_qobject_ptr<Meta::Index> metadataIndex();
- QString getJarsPath();
+ /*!
+ * Finds and returns the full path to a jar file.
+ * Returns a null-string if it could not be found.
+ */
+ QString getJarPath(QString jarFile);
QString getMSAClientID();
QString getCurseKey();
@@ -241,7 +245,6 @@ private:
std::shared_ptr<GenericPageProvider> m_globalSettingsProvider;
std::map<QString, std::unique_ptr<ITheme>> m_themes;
std::unique_ptr<MCEditTool> m_mcedit;
- QString m_jarsPath;
QSet<QString> m_features;
QMap<QString, std::shared_ptr<BaseProfilerFactory>> m_profilers;
diff --git a/launcher/BaseInstance.h b/launcher/BaseInstance.h
index 66177614..2a94dcc6 100644
--- a/launcher/BaseInstance.h
+++ b/launcher/BaseInstance.h
@@ -188,6 +188,7 @@ public:
* Create envrironment variables for running the instance
*/
virtual QProcessEnvironment createEnvironment() = 0;
+ virtual QProcessEnvironment createLaunchEnvironment() = 0;
/*!
* Returns a matcher that can maps relative paths within the instance to whether they are 'log files'
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index b8db803b..eb5a68cd 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -4,8 +4,6 @@ project(application)
######## Sources and headers ########
-include (UnitTest)
-
set(CORE_SOURCES
# LOGIC - Base classes and infrastructure
BaseInstaller.h
@@ -90,16 +88,11 @@ set(CORE_SOURCES
MMCTime.cpp
)
-add_unit_test(FileSystem
- SOURCES FileSystem_test.cpp
- LIBS Launcher_logic
- DATA testdata
- )
+ecm_add_test(FileSystem_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME FileSystem) # TODO: needs testdata
-add_unit_test(GZip
- SOURCES GZip_test.cpp
- LIBS Launcher_logic
- )
+ecm_add_test(GZip_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME GZip)
set(PATHMATCHER_SOURCES
# Path matchers
@@ -168,16 +161,10 @@ if (Launcher_UPDATER_BASE)
updater/DownloadTask.cpp
)
- add_unit_test(UpdateChecker
- SOURCES updater/UpdateChecker_test.cpp
- LIBS Launcher_logic
- DATA updater/testdata
- )
- add_unit_test(DownloadTask
- SOURCES updater/DownloadTask_test.cpp
- LIBS Launcher_logic
- DATA updater/testdata
- )
+ ecm_add_test(updater/UpdateChecker_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME UpdateChecker)
+ ecm_add_test(updater/DownloadTask_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME DownloadTask)
endif()
# Backend for the news bar... there's usually no news.
@@ -359,10 +346,8 @@ set(MINECRAFT_SOURCES
mojang/PackageManifest.cpp
minecraft/Agent.h)
-add_unit_test(GradleSpecifier
- SOURCES minecraft/GradleSpecifier_test.cpp
- LIBS Launcher_logic
- )
+ecm_add_test(minecraft/GradleSpecifier_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME GradleSpecifier)
if(BUILD_TESTING)
add_executable(PackageManifest
@@ -382,28 +367,20 @@ if(BUILD_TESTING)
)
endif()
-add_unit_test(MojangVersionFormat
- SOURCES minecraft/MojangVersionFormat_test.cpp
- LIBS Launcher_logic
- DATA minecraft/testdata
- )
+# TODO: needs minecraft/testdata
+ecm_add_test(minecraft/MojangVersionFormat_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME MojangVersionFormat)
-add_unit_test(Library
- SOURCES minecraft/Library_test.cpp
- LIBS Launcher_logic
- )
+ecm_add_test(minecraft/Library_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME Library)
# FIXME: shares data with FileSystem test
-add_unit_test(ModFolderModel
- SOURCES minecraft/mod/ModFolderModel_test.cpp
- DATA testdata
- LIBS Launcher_logic
- )
+# TODO: needs testdata
+ecm_add_test(minecraft/mod/ModFolderModel_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME ModFolderModel)
-add_unit_test(ParseUtils
- SOURCES minecraft/ParseUtils_test.cpp
- LIBS Launcher_logic
- )
+ecm_add_test(minecraft/ParseUtils_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME ParseUtils)
# the screenshots feature
set(SCREENSHOTS_SOURCES
@@ -418,14 +395,14 @@ set(TASKS_SOURCES
# Tasks
tasks/Task.h
tasks/Task.cpp
+ tasks/ConcurrentTask.h
+ tasks/ConcurrentTask.cpp
tasks/SequentialTask.h
tasks/SequentialTask.cpp
)
-add_unit_test(Task
- SOURCES tasks/Task_test.cpp
- LIBS Launcher_logic
- )
+ecm_add_test(tasks/Task_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME Task)
set(SETTINGS_SOURCES
# Settings
@@ -443,10 +420,8 @@ set(SETTINGS_SOURCES
settings/SettingsObject.h
)
-add_unit_test(INIFile
- SOURCES settings/INIFile_test.cpp
- LIBS Launcher_logic
- )
+ecm_add_test(settings/INIFile_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ TEST_NAME INIFile)
set(JAVA_SOURCES
java/JavaChecker.h
@@ -463,10 +438,8 @@ set(JAVA_SOURCES
java/JavaVersion.cpp
)
-add_unit_test(JavaVersion
- SOURCES java/JavaVersion_test.cpp
- LIBS Launcher_logic
- )
+ecm_add_test(java/JavaVersion_test.cpp LINK_LIBRARIES L