mangohud support: getLibraryString should return absolute path when possible

Some distros ship MangoHub vulkan layer json with bare shared object name
instead of an absolute path. This breaks environment config as
`MinecraftInstance::createLaunchEnvironment()` seems to require absolute
path of `libMangoHud.so`.

Since we already have `MangoHud::findLibrary()` lying around, use that to
figure out where `libMangoHud.so` really is. In case of a platform that
doesn't support `dlopen()`, fallback to old behavior and return the path
verbatim as it is recorded in vk layer json.

Signed-off-by: Tianhao Chai <cth451@gmail.com>
This commit is contained in:
Tianhao Chai
2024-08-09 14:11:44 -04:00
parent b41e730707
commit c2192cfa98
2 changed files with 23 additions and 9 deletions

View File

@ -608,7 +608,7 @@ QProcessEnvironment MinecraftInstance::createLaunchEnvironment()
// dlsym variant is only needed for OpenGL and not included in the vulkan layer
appendLib("libMangoHud_dlsym.so");
appendLib("libMangoHud_opengl.so");
appendLib(mangoHudLib.fileName());
preloadList << mangoHudLibString;
}
env.insert("LD_PRELOAD", preloadList.join(QLatin1String(":")));