-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
contrib/prismlauncher: default to native libs
-1 workaround required
- Loading branch information
1 parent
96a7a65
commit fdc2ede
Showing
3 changed files
with
337 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
prismlauncher |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,321 @@ | ||
Patch-Source: https://gitlab.alpinelinux.org/alpine/aports/-/blob/7ba7df46c734e011ceeca6df1f1995704a435244/community/prismlauncher/0001-system-jemalloc.patch | ||
-- | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -223,12 +223,15 @@ set(Launcher_QT_VERSION_MAJOR "6" CACHE STRING "Major Qt version to build agains | ||
if(UNIX AND APPLE) | ||
set(Launcher_GLFW_LIBRARY_NAME "libglfw.dylib" CACHE STRING "Name of native glfw library") | ||
set(Launcher_OPENAL_LIBRARY_NAME "libopenal.dylib" CACHE STRING "Name of native openal library") | ||
+ set(Launcher_JEMALLOC_LIBRARY_NAME "libjemalloc.dylib" CACHE STRING "Name of native jemalloc library") | ||
elseif(UNIX) | ||
set(Launcher_GLFW_LIBRARY_NAME "libglfw.so" CACHE STRING "Name of native glfw library") | ||
set(Launcher_OPENAL_LIBRARY_NAME "libopenal.so" CACHE STRING "Name of native openal library") | ||
+ set(Launcher_JEMALLOC_LIBRARY_NAME "libjemalloc.so" CACHE STRING "Name of native jemalloc library") | ||
elseif(WIN32) | ||
set(Launcher_GLFW_LIBRARY_NAME "glfw.dll" CACHE STRING "Name of native glfw library") | ||
set(Launcher_OPENAL_LIBRARY_NAME "OpenAL.dll" CACHE STRING "Name of native openal library") | ||
+ set(Launcher_JEMALLOC_LIBRARY_NAME "jemalloc.dll" CACHE STRING "Name of native jemalloc library") | ||
endif() | ||
|
||
# API Keys | ||
--- a/buildconfig/BuildConfig.cpp.in | ||
+++ b/buildconfig/BuildConfig.cpp.in | ||
@@ -120,6 +120,7 @@ Config::Config() | ||
|
||
GLFW_LIBRARY_NAME = "@Launcher_GLFW_LIBRARY_NAME@"; | ||
OPENAL_LIBRARY_NAME = "@Launcher_OPENAL_LIBRARY_NAME@"; | ||
+ JEMALLOC_LIBRARY_NAME = "@Launcher_JEMALLOC_LIBRARY_NAME@"; | ||
|
||
BUG_TRACKER_URL = "@Launcher_BUG_TRACKER_URL@"; | ||
TRANSLATIONS_URL = "@Launcher_TRANSLATIONS_URL@"; | ||
--- a/buildconfig/BuildConfig.h | ||
+++ b/buildconfig/BuildConfig.h | ||
@@ -154,6 +154,7 @@ class Config { | ||
|
||
QString GLFW_LIBRARY_NAME; | ||
QString OPENAL_LIBRARY_NAME; | ||
+ QString JEMALLOC_LIBRARY_NAME; | ||
|
||
QString BUG_TRACKER_URL; | ||
QString TRANSLATIONS_URL; | ||
--- a/launcher/Application.cpp | ||
+++ b/launcher/Application.cpp | ||
@@ -635,10 +635,12 @@ | ||
m_settings->registerSetting("OnlineFixes", false); | ||
|
||
// Native library workarounds | ||
- m_settings->registerSetting("UseNativeOpenAL", false); | ||
- m_settings->registerSetting("CustomOpenALPath", ""); | ||
- m_settings->registerSetting("UseNativeGLFW", false); | ||
- m_settings->registerSetting("CustomGLFWPath", ""); | ||
+ m_settings->registerSetting("UseNativeOpenAL", true); | ||
+ m_settings->registerSetting("CustomOpenALPath", "/usr/lib/libopenal.so.1"); | ||
+ m_settings->registerSetting("UseNativeGLFW", true); | ||
+ m_settings->registerSetting("CustomGLFWPath", "/usr/lib/libglfw.so.3"); | ||
+ m_settings->registerSetting("UseNativeJemalloc", true); | ||
+ m_settings->registerSetting("CustomJemallocPath", "/usr/lib/libjemalloc.so.2"); | ||
|
||
// Peformance related options | ||
m_settings->registerSetting("EnableFeralGamemode", false); | ||
@@ -1659,7 +1661,8 @@ void Application::detectLibraries() | ||
#ifdef Q_OS_LINUX | ||
m_detectedGLFWPath = MangoHud::findLibrary(BuildConfig.GLFW_LIBRARY_NAME); | ||
m_detectedOpenALPath = MangoHud::findLibrary(BuildConfig.OPENAL_LIBRARY_NAME); | ||
- qDebug() << "Detected native libraries:" << m_detectedGLFWPath << m_detectedOpenALPath; | ||
+ m_detectedJemallocPath = MangoHud::findLibrary(BuildConfig.JEMALLOC_LIBRARY_NAME); | ||
+ qDebug() << "Detected native libraries:" << m_detectedGLFWPath << m_detectedOpenALPath << m_detectedJemallocPath; | ||
#endif | ||
} | ||
|
||
--- a/launcher/Application.h | ||
+++ b/launcher/Application.h | ||
@@ -287,6 +287,7 @@ class Application : public QApplication { | ||
public: | ||
QString m_detectedGLFWPath; | ||
QString m_detectedOpenALPath; | ||
+ QString m_detectedJemallocPath; | ||
QString m_instanceIdToLaunch; | ||
QString m_serverToJoin; | ||
QString m_profileToUse; | ||
--- a/launcher/minecraft/MinecraftInstance.cpp | ||
+++ b/launcher/minecraft/MinecraftInstance.cpp | ||
@@ -172,6 +172,8 @@ void MinecraftInstance::loadSpecificSettings() | ||
m_settings->registerOverride(global_settings->getSetting("CustomOpenALPath"), nativeLibraryWorkaroundsOverride); | ||
m_settings->registerOverride(global_settings->getSetting("UseNativeGLFW"), nativeLibraryWorkaroundsOverride); | ||
m_settings->registerOverride(global_settings->getSetting("CustomGLFWPath"), nativeLibraryWorkaroundsOverride); | ||
+ m_settings->registerOverride(global_settings->getSetting("UseNativeJemalloc"), nativeLibraryWorkaroundsOverride); | ||
+ m_settings->registerOverride(global_settings->getSetting("CustomJemallocPath"), nativeLibraryWorkaroundsOverride); | ||
|
||
// Performance related options | ||
auto performanceOverride = m_settings->registerSetting("OverridePerformance", false); | ||
@@ -446,6 +448,7 @@ QStringList MinecraftInstance::extraArguments() | ||
{ | ||
QString openALPath; | ||
QString glfwPath; | ||
+ QString jemallocPath; | ||
|
||
if (settings()->get("UseNativeOpenAL").toBool()) { | ||
openALPath = APPLICATION->m_detectedOpenALPath; | ||
@@ -459,14 +462,23 @@ QStringList MinecraftInstance::extraArguments() | ||
if (!customPath.isEmpty()) | ||
glfwPath = customPath; | ||
} | ||
+ if (settings()->get("UseNativeJemalloc").toBool()) { | ||
+ jemallocPath = APPLICATION->m_detectedJemallocPath; | ||
+ auto customPath = settings()->get("CustomJemallocPath").toString(); | ||
+ if (!customPath.isEmpty()) | ||
+ jemallocPath = customPath; | ||
+ } | ||
|
||
QFileInfo openALInfo(openALPath); | ||
QFileInfo glfwInfo(glfwPath); | ||
+ QFileInfo jemallocInfo(jemallocPath); | ||
|
||
if (!openALPath.isEmpty() && openALInfo.exists()) | ||
list.append("-Dorg.lwjgl.openal.libname=" + openALInfo.absoluteFilePath()); | ||
if (!glfwPath.isEmpty() && glfwInfo.exists()) | ||
list.append("-Dorg.lwjgl.glfw.libname=" + glfwInfo.absoluteFilePath()); | ||
+ if (!jemallocPath.isEmpty() && jemallocInfo.exists()) | ||
+ list.append("-Dorg.lwjgl.system.jemalloc.libname=" + jemallocInfo.absoluteFilePath()); | ||
} | ||
|
||
return list; | ||
@@ -809,11 +821,14 @@ QStringList MinecraftInstance::verboseDescription(AuthSessionPtr session, Minecr | ||
auto settings = this->settings(); | ||
bool nativeOpenAL = settings->get("UseNativeOpenAL").toBool(); | ||
bool nativeGLFW = settings->get("UseNativeGLFW").toBool(); | ||
- if (nativeOpenAL || nativeGLFW) { | ||
+ bool nativeJemalloc = settings->get("UseNativeJemalloc").toBool(); | ||
+ if (nativeOpenAL || nativeGLFW || nativeJemalloc) { | ||
if (nativeOpenAL) | ||
out << "Using system OpenAL."; | ||
if (nativeGLFW) | ||
out << "Using system GLFW."; | ||
+ if (nativeJemalloc) | ||
+ out << "Using system Jemalloc."; | ||
out << ""; | ||
} | ||
|
||
--- a/launcher/ui/pages/global/MinecraftPage.cpp | ||
+++ b/launcher/ui/pages/global/MinecraftPage.cpp | ||
@@ -53,6 +53,7 @@ MinecraftPage::MinecraftPage(QWidget* parent) : QWidget(parent), ui(new Ui::Mine | ||
ui->setupUi(this); | ||
connect(ui->useNativeGLFWCheck, &QAbstractButton::toggled, this, &MinecraftPage::onUseNativeGLFWChanged); | ||
connect(ui->useNativeOpenALCheck, &QAbstractButton::toggled, this, &MinecraftPage::onUseNativeOpenALChanged); | ||
+ connect(ui->useNativeJemallocCheck, &QAbstractButton::toggled, this, &MinecraftPage::onUseNativeJemallocChanged); | ||
loadSettings(); | ||
updateCheckboxStuff(); | ||
} | ||
@@ -90,6 +91,11 @@ void MinecraftPage::onUseNativeOpenALChanged(bool checked) | ||
ui->lineEditOpenALPath->setEnabled(checked); | ||
} | ||
|
||
+void MinecraftPage::onUseNativeJemallocChanged(bool checked) | ||
+{ | ||
+ ui->lineEditJemallocPath->setEnabled(checked); | ||
+} | ||
+ | ||
void MinecraftPage::applySettings() | ||
{ | ||
auto s = APPLICATION->settings(); | ||
@@ -104,6 +110,8 @@ void MinecraftPage::applySettings() | ||
s->set("CustomGLFWPath", ui->lineEditGLFWPath->text()); | ||
s->set("UseNativeOpenAL", ui->useNativeOpenALCheck->isChecked()); | ||
s->set("CustomOpenALPath", ui->lineEditOpenALPath->text()); | ||
+ s->set("UseNativeJemalloc", ui->useNativeJemallocCheck->isChecked()); | ||
+ s->set("CustomJemallocPath", ui->lineEditJemallocPath->text()); | ||
|
||
// Peformance related options | ||
s->set("EnableFeralGamemode", ui->enableFeralGamemodeCheck->isChecked()); | ||
@@ -148,6 +156,13 @@ void MinecraftPage::loadSettings() | ||
if (!APPLICATION->m_detectedOpenALPath.isEmpty()) | ||
ui->lineEditOpenALPath->setPlaceholderText(tr("Auto detected path: %1").arg(APPLICATION->m_detectedOpenALPath)); | ||
#endif | ||
+ ui->useNativeJemallocCheck->setChecked(s->get("UseNativeJemalloc").toBool()); | ||
+ ui->lineEditJemallocPath->setText(s->get("CustomJemallocPath").toString()); | ||
+ ui->lineEditJemallocPath->setPlaceholderText(tr("Path to %1 library file").arg(BuildConfig.JEMALLOC_LIBRARY_NAME)); | ||
+#ifdef Q_OS_LINUX | ||
+ if (!APPLICATION->m_detectedJemallocPath.isEmpty()) | ||
+ ui->lineEditJemallocPath->setPlaceholderText(tr("Auto detected path: %1").arg(APPLICATION->m_detectedJemallocPath)); | ||
+#endif | ||
|
||
ui->enableFeralGamemodeCheck->setChecked(s->get("EnableFeralGamemode").toBool()); | ||
ui->enableMangoHud->setChecked(s->get("EnableMangoHud").toBool()); | ||
--- a/launcher/ui/pages/global/MinecraftPage.h | ||
+++ b/launcher/ui/pages/global/MinecraftPage.h | ||
@@ -72,6 +72,7 @@ class MinecraftPage : public QWidget, public BasePage { | ||
|
||
void onUseNativeGLFWChanged(bool checked); | ||
void onUseNativeOpenALChanged(bool checked); | ||
+ void onUseNativeJemallocChanged(bool checked); | ||
|
||
private: | ||
Ui::MinecraftPage* ui; | ||
--- a/launcher/ui/pages/global/MinecraftPage.ui | ||
+++ b/launcher/ui/pages/global/MinecraftPage.ui | ||
@@ -270,6 +270,30 @@ | ||
</property> | ||
</widget> | ||
</item> | ||
+ <item row="4" column="0"> | ||
+ <widget class="QCheckBox" name="useNativeJemallocCheck"> | ||
+ <property name="text"> | ||
+ <string>Use system installation of &Jemalloc</string> | ||
+ </property> | ||
+ </widget> | ||
+ </item> | ||
+ <item row="5" column="0"> | ||
+ <widget class="QLabel" name="labelJemallocPath"> | ||
+ <property name="text"> | ||
+ <string>&Jemalloc library path</string> | ||
+ </property> | ||
+ <property name="buddy"> | ||
+ <cstring>lineEditJemallocPath</cstring> | ||
+ </property> | ||
+ </widget> | ||
+ </item> | ||
+ <item row="5" column="1"> | ||
+ <widget class="QLineEdit" name="lineEditJemallocPath"> | ||
+ <property name="enabled"> | ||
+ <bool>false</bool> | ||
+ </property> | ||
+ </widget> | ||
+ </item> | ||
</layout> | ||
</widget> | ||
</item> | ||
--- a/launcher/ui/pages/instance/InstanceSettingsPage.cpp | ||
+++ b/launcher/ui/pages/instance/InstanceSettingsPage.cpp | ||
@@ -70,6 +70,7 @@ InstanceSettingsPage::InstanceSettingsPage(BaseInstance* inst, QWidget* parent) | ||
|
||
connect(ui->useNativeGLFWCheck, &QAbstractButton::toggled, this, &InstanceSettingsPage::onUseNativeGLFWChanged); | ||
connect(ui->useNativeOpenALCheck, &QAbstractButton::toggled, this, &InstanceSettingsPage::onUseNativeOpenALChanged); | ||
+ connect(ui->useNativeJemallocCheck, &QAbstractButton::toggled, this, &InstanceSettingsPage::onUseNativeJemallocChanged); | ||
|
||
loadSettings(); | ||
|
||
@@ -218,11 +219,15 @@ void InstanceSettingsPage::applySettings() | ||
m_settings->set("CustomGLFWPath", ui->lineEditGLFWPath->text()); | ||
m_settings->set("UseNativeOpenAL", ui->useNativeOpenALCheck->isChecked()); | ||
m_settings->set("CustomOpenALPath", ui->lineEditOpenALPath->text()); | ||
+ m_settings->set("UseNativeJemalloc", ui->useNativeJemallocCheck->isChecked()); | ||
+ m_settings->set("CustomJemallocPath", ui->lineEditJemallocPath->text()); | ||
} else { | ||
m_settings->reset("UseNativeGLFW"); | ||
m_settings->reset("CustomGLFWPath"); | ||
m_settings->reset("UseNativeOpenAL"); | ||
m_settings->reset("CustomOpenALPath"); | ||
+ m_settings->reset("UseNativeJemalloc"); | ||
+ m_settings->reset("CustomJemallocPath"); | ||
} | ||
|
||
// Performance | ||
@@ -351,6 +356,13 @@ void InstanceSettingsPage::loadSettings() | ||
#else | ||
ui->lineEditOpenALPath->setPlaceholderText(tr("Path to %1 library file").arg(BuildConfig.OPENAL_LIBRARY_NAME)); | ||
#endif | ||
+ ui->useNativeJemallocCheck->setChecked(m_settings->get("UseNativeJemalloc").toBool()); | ||
+ ui->lineEditJemallocPath->setText(m_settings->get("CustomJemallocPath").toString()); | ||
+#ifdef Q_OS_LINUX | ||
+ ui->lineEditJemallocPath->setPlaceholderText(APPLICATION->m_detectedJemallocPath); | ||
+#else | ||
+ ui->lineEditJemallocPath->setPlaceholderText(tr("Path to %1 library file").arg(BuildConfig.JEMALLOC_LIBRARY_NAME)); | ||
+#endif | ||
|
||
// Performance | ||
ui->perfomanceGroupBox->setChecked(m_settings->get("OverridePerformance").toBool()); | ||
@@ -456,6 +468,11 @@ void InstanceSettingsPage::onUseNativeOpenALChanged(bool checked) | ||
ui->lineEditOpenALPath->setEnabled(checked); | ||
} | ||
|
||
+void InstanceSettingsPage::onUseNativeJemallocChanged(bool checked) | ||
+{ | ||
+ ui->lineEditJemallocPath->setEnabled(checked); | ||
+} | ||
+ | ||
void InstanceSettingsPage::updateAccountsMenu() | ||
{ | ||
ui->instanceAccountSelector->clear(); | ||
--- a/launcher/ui/pages/instance/InstanceSettingsPage.h | ||
+++ b/launcher/ui/pages/instance/InstanceSettingsPage.h | ||
@@ -73,6 +73,7 @@ class InstanceSettingsPage : public QWidget, public BasePage { | ||
|
||
void onUseNativeGLFWChanged(bool checked); | ||
void onUseNativeOpenALChanged(bool checked); | ||
+ void onUseNativeJemallocChanged(bool checked); | ||
|
||
void applySettings(); | ||
void loadSettings(); | ||
--- a/launcher/ui/pages/instance/InstanceSettingsPage.ui | ||
+++ b/launcher/ui/pages/instance/InstanceSettingsPage.ui | ||
@@ -499,6 +499,30 @@ | ||
</property> | ||
</widget> | ||
</item> | ||
+ <item row="5" column="0"> | ||
+ <widget class="QLabel" name="labelJemallocPath"> | ||
+ <property name="text"> | ||
+ <string>&Jemalloc library path</string> | ||
+ </property> | ||
+ <property name="buddy"> | ||
+ <cstring>lineEditJemallocPath</cstring> | ||
+ </property> | ||
+ </widget> | ||
+ </item> | ||
+ <item row="4" column="0"> | ||
+ <widget class="QCheckBox" name="useNativeJemallocCheck"> | ||
+ <property name="text"> | ||
+ <string>Use system installation of Jemalloc</string> | ||
+ </property> | ||
+ </widget> | ||
+ </item> | ||
+ <item row="5" column="1"> | ||
+ <widget class="QLineEdit" name="lineEditJemallocPath"> | ||
+ <property name="enabled"> | ||
+ <bool>false</bool> | ||
+ </property> | ||
+ </widget> | ||
+ </item> | ||
</layout> | ||
</widget> | ||
</item> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters