Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steam Compatibility Tool installer #99

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

rankynbass
Copy link
Contributor

@rankynbass rankynbass commented Nov 25, 2023

Adds a tab in the settings menu to install as a steam compatibility tool. The tab also provides some basic instructions. Once the tool is installed and configured in FFXIV in steam, xlcore can be launched directly from the FFXIV steam entry. It is not inside a flatpak, so FFXIV will properly close.

There are two downsides that I can't work around.

  1. When the flatpak is used the first time to install as a compatibility tool it will still cause problems with steam. That is, the tool in compatibility mode causes no problems, but the flatpak itself stll does. It may also cause issues if someone selects it as a compatibility tool for a different game.
  2. Whenever the tool is reinstalled or updated, it will cause a shader recompile on next launch (if shader pre-caching is enabled). This doesn't actually affect the game, and can be skipped, but unfortunately I don't know how to prevent it.

Tab when launched as a Flatpak:
SCT-installer

Tab when launched as a Steam compatibility tool:
SCT-installed

Entry in Steam compatibility list:
SCT-setup

@rankynbass rankynbass marked this pull request as ready for review November 25, 2023 06:21
Cleaned up Steam Tool Settings Tab
Added command line install options:
--deck-install, --deck-remove to install to default paths
--install=/path/to/Steam, --remove= to specify path
@philpax
Copy link

philpax commented Mar 23, 2024

Apologies for letting this languish, as well as your other PRs. Is this/the other PRs still good to go? Anything you'd like to change?

@rankynbass
Copy link
Contributor Author

rankynbass commented Mar 23, 2024

I need to test two changes before this can be merged. Should have it done in the next 24 hours.

Edit: At the moment, this will trigger the stuttering bug unless LD_PRELOAD= is set in the steam launch arguments. I am testing a fix which seems to work.

@KazWolfe
Copy link
Member

KazWolfe commented Mar 23, 2024

Assuming we want to move forward with this, I would like to advocate that we encourage the player install the game to wherever Steam wants to install it (that is, the game install should be next to the Steam-downloaded launcher files).

At least in my experience, all the normal issues that come with the launcher on SD card no longer exist when a compatibility tool is used. Users would be able to install FFXIV fully to the SD card and experience a normal play environment, and net us the added benefit of users being able to easily uninstall FFXIV to free up space without manually editing directories. I'm not sure how possible/valuable it would be to attempt to get XLCore to also use the "standard" paths for everything, but it would be nice if the user could swap back to standard Proton at will and keep their save files/game configurations.


Env vars on my test system:

# workaround flatpak being annoying (??)
export LD_LIBRARY_PATH=
export LD_PRELOAD=
export XL_SECRET_PROVIDER=FILE
export IgnoreChildProcesses=0

@rankynbass
Copy link
Contributor Author

What is the IgnoreChildProcess? Any documentation on that?

@KazWolfe
Copy link
Member

Unsure - I brought it in as a synced var from lsteamclient. I don't actually remember what it is...

@rankynbass
Copy link
Contributor Author

Alright, this should be ready to go. Problem I was troubleshooting turned out to be elsewhere.

@rankynbass
Copy link
Contributor Author

Here's an updated picture of the installer screen.
XLCore-sct

@KazWolfe
Copy link
Member

Is it possible to hide the non-Steam Deck buttons on the Steam Deck?

@rankynbass
Copy link
Contributor Author

rankynbass commented Mar 23, 2024

Absolutely. I've done that. Also, the flatpak install option will be hidden if flatpak steam settings folder is not detected. There's no quick and easy path to check to find out if flatpak steam is installed. The best I could figure is actually flatpak info com.valvesoftware.Steam, and then check if the first line starts with "error". If it does, flatpak steam isn't installed. I haven't actually done that, though. Just checking to see if the paths are available for install atm.

@rankynbass
Copy link
Contributor Author

@philpax
Copy link

philpax commented Mar 25, 2024

Code looks good to me. Can someone try that test build? If it's alright, I'll merge it

"\nuninstall button.");
return;
}
ImGui.Text("\nUse this tab to install XIVLauncher.Core as a Steam compatibility tool.");
Copy link
Contributor

@Blooym Blooym Mar 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be a good idea to have the opening explain quickly what a "steam tool" is and why a user might want to use it. (We could also do this in the FaQ or link to an explainer elsewhere?)

Copy link
Contributor

@Blooym Blooym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mostly just have some phrasing adjustments that I think make sense, feel free to not use my wording if you think it doesn't make sense though.

I do however have reservations about how we implement this as having users to manually update the steam compat tool every time we update the flatpak feels like a recipe for having users just never update the launcher which is going to be a headache. If we can solve that problem I'm happy to continue.

I'd also like if the flatpak and native steam options were condensed into singular option with buttons underneath the path for the default locations of native steam and flatpak steam. Do people use both together?

}
if (!steamToolInstalled) ImGui.EndDisabled();

if (CoreEnvironmentSettings.IsDeck != true && steamFlatpakInstalled)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (CoreEnvironmentSettings.IsDeck != true && steamFlatpakInstalled)
if (!CoreEnvironmentSettings.IsDeck && steamFlatpakInstalled)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I made a mistake here. This should be !Program.IsSteamDeckHardware. CoreEnvironmentSettings is just checking environment variables.

{
Entries = new SettingsEntry[]
{
steamPath = new SettingsEntry<string>("Steam Path (native install)", "Path to the native steam config files. Only change this if you have your steam config stored somewhere else.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
steamPath = new SettingsEntry<string>("Steam Path (native install)", "Path to the native steam config files. Only change this if you have your steam config stored somewhere else.",
steamPath = new SettingsEntry<string>("Steam Path (native)", "Path to the native steam installation. Only change this if you have steam installed in a non-default location.",

{
steamPath = new SettingsEntry<string>("Steam Path (native install)", "Path to the native steam config files. Only change this if you have your steam config stored somewhere else.",
() => Program.Config.SteamPath ?? Path.Combine(CoreEnvironmentSettings.HOME, ".local", "share", "Steam"), s => Program.Config.SteamPath = s),
steamFlatpakPath = new SettingsEntry<string>("Steam Path (flatpak install)", "Path to the flatpak steam config files. Only change this if you have your steam config stored somewhere else.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
steamFlatpakPath = new SettingsEntry<string>("Steam Path (flatpak install)", "Path to the flatpak steam config files. Only change this if you have your steam config stored somewhere else.",
steamFlatpakPath = new SettingsEntry<string>("Steam Path (flatpak)", "Path to the flatpak steam installation. Only change this if you have your flatpak steam installed in a non-default location.",


public override SettingsEntry[] Entries { get; }

public override bool IsUnixExclusive => true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I'm aware steam compatibility tools are Linux exclusive and this property only hides this page from Windows users. We don't actually release on Mac at all right now but I still wanna point this out.

Comment on lines 52 to 55
ImGui.Text("If you are trying to upgrade, you must first update your local install of XIVLauncher.Core. Then launch the local" +
"\nversion, navigate back to this tab, and re-install as a Steam compatibility tool.");
ImGui.Text("\nIf you are trying to uninstall, you should likewise launch the native version of XIVLauncher, and click the appropriate" +
"\nuninstall button.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way for us to do these updates on behalf on the end user instead of having them update the tool manually every time XIVLauncher updates? If we know they want the steam tool installed via a config field like wantsSteamTool then we can transparently update it on their behalf on launch.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least in my experimental config on Steam Deck, XLCore launched through the flatpak command works just fine. I'm curious if we can generate the script accordingly. We can probably both check for XIVLauncher.Core in $PATH and try to launch via Flatpak if the binary does not exist where we expect it to.

I'm not immediately aware of downsides to allowing $PATH to resolve xlcore nor attempting a Flatpak run, but admittedly my own scope here is pretty narrow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only issue I see with calling the flatpak is that the flatpak version of steam is not able to do that easily unless it has flatpak-spawn --host privilege iirc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually possible to download a tar.gz file and overwrite the steam tool in place, although you have to restart both the launcher and steam for some changes to take effect. I've successfully done this when I explored steam tool possibility back around 1.0.4. That would leave the flatpak or native install un-updated, though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhals we could distribute a small installer script that installs XL as a compatibility tool and then having it auto update itself, skipping the Flatpak?

Comment on lines 59 to 61
ImGui.Text("\nAfter you have installed XIVLauncher as a Steam tool, close this program, and launch Steam. Select Final Fantasy XIV from the library,");
ImGui.Text("and go to Compatibility. Force the use of a specific Steam Play compatibility tool, and choose XIVLauncher.Core as Compatibility Tool.");
ImGui.Text("XIVLauncher.Core will now be used to launch Final Fantasy XIV.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to reword this to be a little more explicit for users that may get confused why it doesn't show up in the list, or cannot find the compatibility tab.

Suggested change
ImGui.Text("\nAfter you have installed XIVLauncher as a Steam tool, close this program, and launch Steam. Select Final Fantasy XIV from the library,");
ImGui.Text("and go to Compatibility. Force the use of a specific Steam Play compatibility tool, and choose XIVLauncher.Core as Compatibility Tool.");
ImGui.Text("XIVLauncher.Core will now be used to launch Final Fantasy XIV.");
ImGui.Text("\nAfter you have installed XIVLauncher as a Steam compatibility tool please close XIVLauncher and launch or restart Steam. Find 'Final Fantasy XIV Online' in your steam library");
ImGui.Text("and open the 'Properties' menu and navigate to the 'Compatibility' tab. Enable 'Force the use of a specific Steam Play compatibility tool' and from the dropdown menu select 'XIVLauncher.Core'. If this option does not show up then restart Steam and try again.");
ImGui.Text("After finishing these steps, XIVLauncher will now be used when launching FINAL FANTASY XIV from steam.");

ImGui.Text("XIVLauncher.Core will now be used to launch Final Fantasy XIV.");
if (CoreEnvironmentSettings.IsDeck != true && steamFlatpakInstalled)
{
ImGui.Text("\nIf you wish to install into Flatpak Steam, you must use Flatseal to give XIVLauncher access to Steam's flatpak path. This is probably something like:");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ImGui.Text("\nIf you wish to install into Flatpak Steam, you must use Flatseal to give XIVLauncher access to Steam's flatpak path. This is probably something like:");
ImGui.Text("\nIf you wish to install into Flatpak Steam, you must use Flatseal to give XIVLauncher access to Steam's flatpak path. This is commonly found at:");

if (CoreEnvironmentSettings.IsDeck != true && steamFlatpakInstalled)
{
ImGui.Text("\nIf you wish to install into Flatpak Steam, you must use Flatseal to give XIVLauncher access to Steam's flatpak path. This is probably something like:");
ImGui.Text($"{CoreEnvironmentSettings.HOME}/.var/app/com.valvesoftware.Steam. If you do not give this permission, installation will fail. You will probably also want to");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ImGui.Text($"{CoreEnvironmentSettings.HOME}/.var/app/com.valvesoftware.Steam. If you do not give this permission, installation will fail. You will probably also want to");
ImGui.Text($"{CoreEnvironmentSettings.HOME}/.var/app/com.valvesoftware.Steam. If you do not give this permission, installation will fail. You will also want to");

Comment on lines 57 to 58
// File.SetUnixFileMode() doesn't exist, for some reason, so just run chmod
var psi = new ProcessStartInfo("/bin/chmod");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very strange that SetUnixFileMode isn't available here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not available in dotnet 6. We can switch to it if we upgrade to 8. https://learn.microsoft.com/en-us/dotnet/api/system.io.file.setunixfilemode?view=net-8.0. You can see in the Applies To section that it's for 7 and later.

@rankynbass
Copy link
Contributor Author

Added the rewording suggestions, and fixed the deck check to use the correct variable.

@philpax philpax requested a review from Blooym March 27, 2024 20:04
@rankynbass
Copy link
Contributor Author

Okay, I think this is the best state I can get this in without building a newer version of Facepunch Steamworks with Floating Keyboard. Steam input works fine in Gaming Mode, and external keyboard entry works fine in desktop mode. Desktop with Big Picture Mode steam functions like Gaming Mode, but clunky.

External keyboard is (probably) needed to edit launcher text boxes in desktop mode, but I'm not 100% sure of that, since I'm using an AMD mini-pc with HoloIso instead of an actual steam deck. The steam deck may be able to bring up a software keyboard in places HoloIso can't.

@rankynbass
Copy link
Contributor Author

Tested Floating Keyboard after it was added to XL.Common, and unfortunately it doesn't really work in desktop mode. It's actually possible to get it to pop up, but only if using gamescope (why? who knows). Even then, it doesn't actually function. However, I was able to install CoreKeyboard from the Discover store, and it did work, so it should now be possible to use the compatibility tool in desktop mode as long as CoreKeyboard or some other software keyboard, or an external keyboard, is installed.

@4ndv
Copy link

4ndv commented May 24, 2024

Tested your Apr 13 sct-10 flatpak from here with flatpak-ed Steam, didn't noticed any obvious issues.

When game is closed Steam now correctly handles that, so probably that'll be a good fix for #39?

@rankynbass
Copy link
Contributor Author

There are two problems with this as it stands: aria2c won't work on slightly older linux versions and libsecret might have a similar problem. Most of this is because the flatpak now uses 23.08 instead of 22.08, with a newer version of glibc. I've started working on static compiled aria2 binaries here: https://github.com/rankynbass/aria2-static-build. I'm not sure if the libsecret problem actually matters; the vast majority of linux distros come with libsecret already installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants