MangoHud: rename to LibraryUtils

It handles more than mangohud

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2026-01-14 20:02:03 +00:00
parent 248eb13ab9
commit 327a554d42
No known key found for this signature in database
GPG key ID: 5E39D70B4C93C38E
5 changed files with 20 additions and 20 deletions

View file

@ -130,7 +130,7 @@
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
#include <dlfcn.h> #include <dlfcn.h>
#include "MangoHud.h" #include "LibraryUtils.h"
#include "gamemode_client.h" #include "gamemode_client.h"
#endif #endif
@ -1855,7 +1855,7 @@ void Application::updateCapabilities()
if (gamemode_query_status() >= 0) if (gamemode_query_status() >= 0)
m_capabilities |= SupportsGameMode; m_capabilities |= SupportsGameMode;
if (!MangoHud::getLibraryString().isEmpty()) if (!LibraryUtils::findMangoHud().isEmpty())
m_capabilities |= SupportsMangoHud; m_capabilities |= SupportsMangoHud;
#endif #endif
} }
@ -1863,8 +1863,8 @@ void Application::updateCapabilities()
void Application::detectLibraries() void Application::detectLibraries()
{ {
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
m_detectedGLFWPath = MangoHud::findLibrary(BuildConfig.GLFW_LIBRARY_NAME); m_detectedGLFWPath = LibraryUtils::find(BuildConfig.GLFW_LIBRARY_NAME);
m_detectedOpenALPath = MangoHud::findLibrary(BuildConfig.OPENAL_LIBRARY_NAME); m_detectedOpenALPath = LibraryUtils::find(BuildConfig.OPENAL_LIBRARY_NAME);
qDebug() << "Detected native libraries:" << m_detectedGLFWPath << m_detectedOpenALPath; qDebug() << "Detected native libraries:" << m_detectedGLFWPath << m_detectedOpenALPath;
#endif #endif
} }

View file

@ -107,9 +107,9 @@ if (UNIX AND NOT CYGWIN AND NOT APPLE)
set(CORE_SOURCES set(CORE_SOURCES
${CORE_SOURCES} ${CORE_SOURCES}
# MangoHud # LibraryUtils
MangoHud.h LibraryUtils.h
MangoHud.cpp LibraryUtils.cpp
) )
endif() endif()

View file

@ -25,7 +25,7 @@
#include "FileSystem.h" #include "FileSystem.h"
#include "Json.h" #include "Json.h"
#include "MangoHud.h" #include "LibraryUtils.h"
#ifdef __GLIBC__ #ifdef __GLIBC__
#ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
@ -36,9 +36,9 @@
#include <linux/limits.h> #include <linux/limits.h>
#endif #endif
namespace MangoHud { namespace LibraryUtils {
QString getLibraryString() QString findMangoHud()
{ {
/** /**
* Guess MangoHud install location by searching for vulkan layers in this order: * Guess MangoHud install location by searching for vulkan layers in this order:
@ -123,7 +123,7 @@ QString getLibraryString()
#ifdef __GLIBC__ #ifdef __GLIBC__
// Check whether mangohud is usable on a glibc based system // Check whether mangohud is usable on a glibc based system
QString libraryPath = findLibrary(libraryName); QString libraryPath = find(libraryName);
if (!libraryPath.isEmpty()) { if (!libraryPath.isEmpty()) {
return libraryPath; return libraryPath;
} }
@ -138,7 +138,7 @@ QString getLibraryString()
return {}; return {};
} }
QString findLibrary(QString libName) QString find(QString libName)
{ {
#ifdef __GLIBC__ #ifdef __GLIBC__
const char* library = libName.toLocal8Bit().constData(); const char* library = libName.toLocal8Bit().constData();
@ -161,11 +161,11 @@ QString findLibrary(QString libName)
dlclose(handle); dlclose(handle);
return fullPath; return fullPath;
#else #else
qWarning() << "MangoHud::findLibrary is not implemented on this platform"; qWarning() << "LibraryUtils::find is not implemented on this platform";
return {}; return {};
#endif #endif
} }
} // namespace MangoHud } // namespace LibraryUtils
#ifdef UNDEF_GNU_SOURCE #ifdef UNDEF_GNU_SOURCE
#undef _GNU_SOURCE #undef _GNU_SOURCE

View file

@ -21,9 +21,9 @@
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
namespace MangoHud { namespace LibraryUtils {
QString getLibraryString(); QString findMangoHud();
QString findLibrary(QString libName); QString find(QString libName);
} // namespace MangoHud } // namespace LibraryUtils

View file

@ -97,7 +97,7 @@
#include <QWindow> #include <QWindow>
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
#include "MangoHud.h" #include "LibraryUtils.h"
#endif #endif
#ifdef WITH_QTDBUS #ifdef WITH_QTDBUS
@ -700,7 +700,7 @@ QProcessEnvironment MinecraftInstance::createLaunchEnvironment()
if (auto value = env.value("LD_PRELOAD"); !value.isEmpty()) if (auto value = env.value("LD_PRELOAD"); !value.isEmpty())
preloadList = value.split(QLatin1String(":")); preloadList = value.split(QLatin1String(":"));
auto mangoHudLibString = MangoHud::getLibraryString(); auto mangoHudLibString = LibraryUtils::findMangoHud();
if (!mangoHudLibString.isEmpty()) { if (!mangoHudLibString.isEmpty()) {
QFileInfo mangoHudLib(mangoHudLibString); QFileInfo mangoHudLib(mangoHudLibString);
QString libPath = mangoHudLib.absolutePath(); QString libPath = mangoHudLib.absolutePath();