Steam no EAC launch + fix Epic launch#172
Conversation
Bump version to v5.0.0-rc.15.
Delete old launch log before reading and launch the game directly via its executable path instead of wrapping with cmd.exe.
NicEastvillage
left a comment
There was a problem hiding this comment.
Nice. Environment variables were the next avenue I was going to investigate. Happy to see it is so simple here.
I tested Steam launching on Windows, and it works, as long as Steam is already running. What launcher/OS combinations did you test?
| // Let Steamworks initialize by providing the AppId, | ||
| // so the game can authenticate with the running Steam client. | ||
| rocketLeague.StartInfo.Environment["SteamAppId"] = SteamGameId; | ||
| rocketLeague.StartInfo.Environment["SteamGameId"] = SteamGameId; | ||
|
|
||
| Logger.LogInformation($"Starting Rocket League without EAC: {gamePath} {args}"); | ||
| rocketLeague.Start(); |
There was a problem hiding this comment.
We are assuming Steam is running. We should start Steam if it isn't.
There was a problem hiding this comment.
Things work if Steam isn't launched, we just don't get logged in. But I'll look into detecting if steam is running or not.
| if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | ||
| throw new PlatformNotSupportedException( | ||
| "Getting Windows path on non-Windows platform" | ||
| ); |
There was a problem hiding this comment.
Useless. We are in an #if WINDOWS directive.
There was a problem hiding this comment.
Yes, but when I deleted it, I got like 5 warnings about the following code being Windows only. Very annoying. I guess I'll just ignore the warnings. (This function was copy+pasted from the old code.)
| if (IsRocketLeagueRunningWithArgs()) | ||
| return; | ||
|
|
||
| if (IsRocketLeagueRunning()) | ||
| { | ||
| Logger.LogError("Please close Rocket League so RLBot can start it in RLBot mode."); | ||
| return; | ||
| } |
There was a problem hiding this comment.
We do not have these two checks for the other launchers. Maybe we should? Check before doing any launching.
| } | ||
|
|
||
| // Start with a fresh Launch.log so we don't read stale data from a previous run. | ||
| WinReadLog logReader = new(); |
There was a problem hiding this comment.
WinReadLog should be a static class. It holds no state. You can also move it to the LaunchManager folder. Arguably, WinProcArgs.cs can go there too.
| private static void LaunchGameViaLegendary() | ||
| { | ||
| Process legendary = RunCommandInShell( | ||
| "legendary launch Sugar -rlbot RLBot_ControllerURL=127.0.0.1:23233 RLBot_PacketSendRate=240 -nomovie" | ||
| ); | ||
| legendary.Start(); | ||
| } | ||
|
|
||
| private static void LaunchGameViaHeroic() | ||
| { | ||
| Process heroic; | ||
|
|
||
| #if WINDOWS | ||
| heroic = RunCommandInShell( | ||
| "start \"\" \"heroic://launch?appName=Sugar&runner=legendary&arg=-rlbot&arg=RLBot_ControllerURL%3D127.0.0.1%3A23233&arg=RLBot_PacketSendRate%3D240&arg=-nomovie\"" | ||
| ); | ||
| #else | ||
| heroic = RunCommandInShell( | ||
| "xdg-open 'heroic://launch?appName=Sugar&runner=legendary&arg=-rlbot&arg=RLBot_ControllerURL%3D127.0.0.1%3A23233&arg=RLBot_PacketSendRate%3D240&arg=-nomovie'" | ||
| ); | ||
| #endif | ||
|
|
||
| heroic.Start(); | ||
| } |
There was a problem hiding this comment.
Legendary and Heroic are launching with EAC, from what I can see. Hopefully, these just need the -noeac flag.
There was a problem hiding this comment.
Can we save those platforms for a later PR?
| catch (IOException) | ||
| { | ||
| // Rocket League may still be writing to the log file. | ||
| // Return null so the caller retries. | ||
| return null; | ||
| } |
There was a problem hiding this comment.
If this doesn't fix the issue, then it is likely because we are blocking RocketLeague from writing in the first place. We could check the last edited time first in that case.
Alternatively, we dig around in Heroic or Legendary to see how they authenticate. Start here https://github.com/legendary-gl/legendary/blob/master/legendary/api/egs.py.
There was a problem hiding this comment.
we dig around in Heroic or Legendary to see how they authenticate
Yes, but this PR is mostly focused on Steam, can we defer that to a follow-up PR?
There was a problem hiding this comment.
I just wanted to quickly push a fix so people stop complaining about how Epic launch is completely broken on their system.
| string? gamePath = FindWindowsRocketLeaguePath(); | ||
| if (gamePath == null) | ||
| throw new FileNotFoundException( | ||
| "Could not find Rocket League installation. Ensure Rocket League is installed via Steam." | ||
| ); |
There was a problem hiding this comment.
I like that you are thoroughly searching for the installation path using Steam's library data. So this is just a fun fact: We could get the path from Launch.log also when using Steam. It would be less code, but it assumes that RL has been started at least once.
There was a problem hiding this comment.
I think we should test out this method because hopefully it's more reliable. Perhaps we can investigate this in the future? I am hoping this current method proves fast and reliable.
Steam – No EAC (Windows + Linux)
This version successfully loads my player settings and stuff unlike the Epic no EAC launch and has replaced the only-with-EAC launch we had previously.
Steam.Windows.cs): Replaces-applaunchwith direct executable launch. Discovers the Rocket League install path by reading Steam library folders from the registry andlibraryfolders.vdf. SetsSteamAppId/SteamGameIdenvironment variables so Steamworks logs us in.Steam.Linux.cs): New implementation that discovers Steam roots via symlinks, XDG paths, Flatpak/Snap, and PATH. Finds the installed Rocket League and the configured (or newest) Proton version, then launches the game viaproton runwith the necessarySTEAM_COMPAT_*environment variables.config.vdffor the configured compatibility tool, falls back to the numerically newest Proton installation, with special handling for Hotfix/Experimental builds.Epic – Launch fixes (Windows)
Still doesn't load player settings beyond the username, but should launch much more reliably. It should be noted that player settings ARE loaded when launching Epic RL without EAC from the launcher manually, so we're probably missing something.
Epic.Windows.cs: Refactored to delete the old launch log before starting, read both the executable path and auth arguments fromWinReadLog.GetGamePathAndAuth(), and launch the game executable directly instead of wrapping withcmd.exe /c.WinReadLog.cs: AddedDeleteLog(),FileShare.ReadWritefor concurrent access, andIOExceptionhandling to retry while the log is still being written.Both Steam and Epic now default to launching without EAC which is probably a good step towards #156
Bumped version to
v5.0.0-rc.15(change tov1.0.0-rc.15?)