aboutsummaryrefslogtreecommitdiff
path: root/launcher/Application.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-09-05 17:45:17 +0200
committerGitHub <noreply@github.com>2022-09-05 17:45:17 +0200
commit8e3356f11a81cba394f57567e7521c3ccc2c3afa (patch)
tree12c44b9a4eeb96a63e433dd88b8eba5d6c45ac8b /launcher/Application.cpp
parent2f167b1512dc0c3b80731ae412d55ee897da14fd (diff)
parentd82bb29919d1cc6a9ead4a4e4a18d7b02c5221eb (diff)
downloadPrismLauncher-8e3356f11a81cba394f57567e7521c3ccc2c3afa.tar.gz
PrismLauncher-8e3356f11a81cba394f57567e7521c3ccc2c3afa.tar.bz2
PrismLauncher-8e3356f11a81cba394f57567e7521c3ccc2c3afa.zip
Merge pull request #1034 from Scrumplex/detect-performance-features
Diffstat (limited to 'launcher/Application.cpp')
-rw-r--r--launcher/Application.cpp33
1 files changed, 28 insertions, 5 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index 553b3229..0c9f0487 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -113,6 +113,11 @@
#include <sys.h>
+#ifdef Q_OS_LINUX
+#include <dlfcn.h>
+#include "gamemode_client.h"
+#endif
+
#if defined Q_OS_WIN32
#ifndef WIN32_LEAN_AND_MEAN
@@ -920,6 +925,8 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
{
return;
}
+
+ updateCapabilities();
performMainStartupAction();
}
@@ -1568,14 +1575,30 @@ shared_qobject_ptr<Meta::Index> Application::metadataIndex()
return m_metadataIndex;
}
-Application::Capabilities Application::currentCapabilities()
+void Application::updateCapabilities()
{
- Capabilities c;
+ m_capabilities = None;
if (!getMSAClientID().isEmpty())
- c |= SupportsMSA;
+ m_capabilities |= SupportsMSA;
if (!getFlameAPIKey().isEmpty())
- c |= SupportsFlame;
- return c;
+ m_capabilities |= SupportsFlame;
+
+#ifdef Q_OS_LINUX
+ if (gamemode_query_status() >= 0)
+ m_capabilities |= SupportsGameMode;
+
+ {
+ void *dummy = dlopen("libMangoHud_dlsym.so", RTLD_LAZY);
+ // try normal variant as well
+ if (dummy == NULL)
+ dummy = dlopen("libMangoHud.so", RTLD_LAZY);
+
+ if (dummy != NULL) {
+ dlclose(dummy);
+ m_capabilities |= SupportsMangoHud;
+ }
+ }
+#endif
}
QString Application::getJarPath(QString jarFile)