FFXIVQuickLauncher
FFXIVQuickLauncher copied to clipboard
Update the SettingsTabWine to add a Flatpak check for gamemode.
This allows GameMode to work with XIVLauncher inside of Flatpak. I'll rework the PR on the Flatpak manifest to account for this change, when a new version comes out that has this change.
Why repeat a block? Feels like it makes more sense to do something like
#if FLATPAK
var gamemodePath = "/app/lib/libgamemodeauto.so.0";
#else // or #elseif? idr lol
var gamemodePath = "/usr/lib/libgamemodeauto.so.0";
#endif
IMO.
I'm not all that familiar with C#, so I went the easiest route. I'll apply that way of checking, and see if it works.
Maybe something like this would be the best way of going about the check?
{
CheckVisibility = () => RuntimeInformation.IsOSPlatform(OSPlatform.Linux),
CheckValidity = b =>
{
if (b == true && (!File.Exists("/usr/lib/libgamemodeauto.so.0") && !File.Exists("/app/lib/libgamemodeauto.so.0")))
return "GameMode not detected.";
return null;
}
},
hm, it seems the way I would do it (what I just posted) has some issues, where if one of them doesn't exist, it doesn't work at all.
Alright, I think I figured something out:
if (b == true && !FLATPAK && !File.Exists("/usr/lib/libgamemodeauto.so.0"))
return "GameMode not detected.";
else if (b == true && FLATPAK && !File.Exists("/app/lib/libgamemodeauto.so.0"))
return "GameMode not detected.";
return null;
Alright, I made a change, removes any Flatpak checks, and instead checks both /app/lib and /usr/lib for the appropriate gamemode files. It seems to build without any issues, and the logic for the check seems sound: If on Linux, and no gamemode files exist, it returns null.
And verified to check that it works:
I'd say it's ready to merge now.