Skip to content

Commit

Permalink
Merge pull request #1815 from Trial97/fix_mangohub
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrumplex committed Nov 23, 2023
2 parents 2b17a61 + e4fecd1 commit 7c9c3d2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions launcher/minecraft/MinecraftInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,11 +601,17 @@ QProcessEnvironment MinecraftInstance::createLaunchEnvironment()
auto mangoHudLibString = MangoHud::getLibraryString();
if (!mangoHudLibString.isEmpty()) {
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
preloadList << "libMangoHud_dlsym.so"
<< "libMangoHud_opengl.so" << mangoHudLib.fileName();
libPaths << mangoHudLib.absolutePath();
appendLib("libMangoHud_dlsym.so");
appendLib("libMangoHud_opengl.so");
appendLib(mangoHudLib.fileName());
libPaths << libPath;
}

env.insert("LD_PRELOAD", preloadList.join(QLatin1String(":")));
Expand Down

0 comments on commit 7c9c3d2

Please sign in to comment.