FFXIVQuickLauncher icon indicating copy to clipboard operation
FFXIVQuickLauncher copied to clipboard

Update the SettingsTabWine to add a Flatpak check for gamemode.

Open orowith2os opened this issue 1 year ago • 7 comments

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.

orowith2os avatar Aug 11 '22 17:08 orowith2os

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.

NotNite avatar Aug 11 '22 18:08 NotNite

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.

orowith2os avatar Aug 11 '22 18:08 orowith2os

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;
                }
            },

orowith2os avatar Aug 11 '22 18:08 orowith2os

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.

orowith2os avatar Aug 11 '22 18:08 orowith2os

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;
               

orowith2os avatar Aug 11 '22 18:08 orowith2os

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.

orowith2os avatar Aug 11 '22 18:08 orowith2os

And verified to check that it works: image I'd say it's ready to merge now.

orowith2os avatar Aug 11 '22 19:08 orowith2os