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

View file

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

View file

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

View file

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

View file

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