Made sure mangoHub libs are present

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-11-08 11:55:38 +02:00
parent 403c4bad86
commit e4fecd1f97
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318

View File

@ -585,11 +585,17 @@ QProcessEnvironment MinecraftInstance::createLaunchEnvironment()
auto mangoHudLibString = MangoHud::getLibraryString(); auto mangoHudLibString = MangoHud::getLibraryString();
if (!mangoHudLibString.isEmpty()) { if (!mangoHudLibString.isEmpty()) {
QFileInfo mangoHudLib(mangoHudLibString); QFileInfo mangoHudLib(mangoHudLibString);
QString libPath = mangoHudLib.absolutePath();
auto appendLib = [libPath, &preloadList](QString fileName) {
if (QFileInfo(FS::PathCombine(libPath, fileName)).exists())
preloadList << fileName;
};
// dlsym variant is only needed for OpenGL and not included in the vulkan layer // dlsym variant is only needed for OpenGL and not included in the vulkan layer
preloadList << "libMangoHud_dlsym.so" appendLib("libMangoHud_dlsym.so");
<< "libMangoHud_opengl.so" << mangoHudLib.fileName(); appendLib("libMangoHud_opengl.so");
libPaths << mangoHudLib.absolutePath(); appendLib(mangoHudLib.fileName());
libPaths << libPath;
} }
env.insert("LD_PRELOAD", preloadList.join(QLatin1String(":"))); env.insert("LD_PRELOAD", preloadList.join(QLatin1String(":")));