dmadisetti / steam-tui

Rust TUI client for steamcmd
MIT License
853 stars 17 forks source link

Most games are borked when launched through `steamcmd` or directly - consider launching games using `steam -silent -applaunch <id>` by default #51

Closed zeerooth closed 5 months ago

zeerooth commented 2 years ago

Hi! I've tried to use steam-tui for a fair while now and unfortunately it seems like most often than not games are borked and refuse to launch. For example, lately I've tried to make 4 linux native games work with different launch scripts, both on NixOS and Ubuntu and this is the result:

All in all, I don't know if it's only happening to me, but based on my experience and the discussions I've read online it seems like steamcmd is pretty ill-equipped for launching games beside simple servers, as it doesn't manage the libraries correctly and probably isn't even properly maintained (looking at the tiny documentation and non-existent support). To make user experience better, I'd simply offload the game launch phase straight to steam GUI and with -silent -nobrowser which seems to work, at least for me, 100% of the time (and this should also auto detect and start games with steam proton). However, that's just my opinion for now - I'd like to hear if anyone else encountered such errors and if you were able to solve it, if it's possible at all.

dmadisetti commented 2 years ago

so executing run-steam steam-tui works for some of my use-cases. I only really play a handful of games so this hasn't been a major sticking point for me.

I see 2 major ways to address this.

Let me know if you think this would address your issues

zeerooth commented 2 years ago

Yes, I think that'd work great!

I think that that steam -silent -applaunch <appid> or steam steam://rungameid/<appid> should be used by default if steam is running instead of currently used runscript in steamcmd.

It's because I found out why my games are stuck on the launching... phase - it seems that if app_launch fails in steamcmd it doesn't properly return any errors and simply exits with an error code 0, which means what steam-tui is unable to detect if an app was actually launched or not, see:

❯ steamcmd +@ShutdownOnFailedCommand 1 +@NoPromptForPassword 1 +@sStartupScript
Redirecting stderr to '/home/radek/.local/share/Steam/logs/stderr.txt'
Looks like steam didn't shutdown cleanly, scheduling immediate update check
[  0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation - version 1660762488
-- type 'quit' to exit --
Loading Steam API...OK
"@ShutdownOnFailedCommand" = "1"
"@NoPromptForPassword" = "1"
"@sStartupScript" = ""

Steam>runscript /home/radek/test.launch
Logging in user '####' to Steam Public...OK
Waiting for client config...OK
Waiting for user info...OK
app_update "105600" -validate
 Update state (0x3) reconfiguring, progress: 0.00 (0 / 0)
 Update state (0x5) verifying install, progress: 15.63 (109429880 / 700338209)
 Update state (0x5) verifying install, progress: 94.18 (659576994 / 700338209)
 Update state (0x5) verifying install, progress: 96.62 (676682291 / 700338209)
Success! App '105600' fully installed.
app_run 105600
Game process added : AppID 105600 "/home/radek/.local/share/Steam/linux32/reaper SteamLaunch AppId=105600 -- '/home/radek/.local/share/Steam/steamapps/common/Terraria/Terraria.exe'", ProcID 24583, IP 0.0.0.0:0
chdir /home/radek/.local/share/Steam/steamapps/common/Terraria
CHIDDeviceListSDL(): Couldn't load libSDL2-2.0.so.0, not enumerating devices
Game process removed: AppID 105600 "/home/radek/.local/share/Steam/linux32/reaper SteamLaunch AppId=105600 -- '/home/radek/.local/share/Steam/steamapps/common/Terraria/Terraria.exe'", ProcID 24583
quit
❯ echo $?
0

However, if there is an error reported by steamcmd itself, it'll correctly return an error exit code, see:

❯ steamcmd +@ShutdownOnFailedCommand 1 +@NoPromptForPassword 1 +@sStartupScript
Redirecting stderr to '/home/radek/.local/share/Steam/logs/stderr.txt'
[  0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation - version 1660762488
-- type 'quit' to exit --
Loading Steam API...OK
"@ShutdownOnFailedCommand" = "1"
"@NoPromptForPassword" = "1"
"@sStartupScript" = ""

Steam>runscript /home/radek/test.launch
Logging in user '#####' to Steam Public...OK
Waiting for client config...OK
Waiting for user info...OK
app_update "812810" -validate
 Update state (0x0) unknown, progress: 0.00 (0 / 0)
Success! App '812810' fully installed.
app_run 812810
ERROR! AppId 812810 launch failed (Missing executable)quit
❯ echo $?
13
purplebar0 commented 1 year ago

Dun dun duuuuuuun!

The LaunchOptionIndex argument of app_launch must be used to select the OS flavour of the game. (Source)

Maybe out of the question, but under app_info_print for the corresponding app, the "\<AppID>" > "config" > "launch" > "<#>" > "config" > "oslist" value determines which launch option is for which OS.

The final part is to link these two binaries used by Steam to launch games to the working directory of SteamCMD: ln -s ~/.local/share/Steam/ubuntu12_32/{reaper,steam-launch-wrapper} ~/.steam/steamcmd/linux32

As for games with other Steam dependencies, for all I know, it may be possible to make a clean Steam install and run SteamCMD in it. I would assume that many of them would have to be updated by the client rather often, so if you find where to run it or what else to link to its working directory, it may be possible to use Steam DRM (alongside a full client install) too. (edit: superseded by newer comment)

ghost commented 1 year ago

Copy steamconsole.so into your Steam install's ubuntu12_32 folder and run steam -textclient for a surprise.

This console seems to be able to open games in the proper Ubuntu environment, but the Steam auth service isn't running so most games will refuse to start. I think that to have proper control over things you end up needing to play the role of the steam executable (or steamclient.so???).

purplebar0 commented 1 year ago

Copy steamconsole.so into your Steam install's ubuntu12_32 folder and run steam -textclient for a surprise.

This console seems to be able to open games in the proper Ubuntu environment, but the Steam auth service isn't running so most games will refuse to start. I think that to have proper control over things you end up needing to play the role of the steam executable (or steamclient.so???).

Here's what I learned so far through my own research, testing and asking around.

Running SteamCMD (or, rather, Steam with -textclient) this way is no different than running SteamCMD without forcing the install directory, provided a full Steam installation is present. SteamCMD finds the existing Steam client installation, works in it and inherits all libraries and custom library folders, so don't force the install directory unless you absolutely have to.

steamclient.so is only responsible for VAC, to my knowledge (edit: confused it with steamservice.so). Basically, you need either the full Steam client, or a re-implementation like SteamLite (Windows-only) in order for games to communicate with Steam.


TL;DR: The original proposal in this issue is indeed the optimal solution.

dmadisetti commented 5 months ago

I have this as a fallback if the script doesn't work