-
Notifications
You must be signed in to change notification settings - Fork 651
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
Fix argument count when launched with Steam on Linux #562
Conversation
Any update on this? Is anyone else seeing the same issue with Steam games? |
Yeah I also had this issue on Linux when launching the BepInEx via Steam. For completeness sake, arguments in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the user has an old version of Steam for whatever reason? Can it be made to work on both old and new version of the arguments? Also a comment explaining the arguments would be nice.
I don't think it will work with an older version of Steam. Since Steam is constantly being updated I don't know if you can go back to an older version. |
You can stay without updating in offline mode indefinitely as long as the game doesn't have network features or secondary DRM. Since you can also use BepInEx fully offline I think breaking backwards compatibility is not ideal. If you have an old physical release with the full game files if I recall correctly you can install the Steam build from the disc and the game and it will work fine until you connect to the internet. This is not really relevant in this case though since I don't think there's any Unity games released in this format that we could support. It looks like you could detect how many arguments you have gotten and branch based on that? |
I think that should be the case since the last argument |
Can confirm this PR allows native Linux games to start again |
@@ -32,7 +32,7 @@ export DOORSTOP_CORLIB_OVERRIDE_PATH="" | |||
# Special case: program is launched via Steam | |||
# In that case rerun the script via their bootstrapper to ensure Steam overlay works | |||
if [ "$2" = "SteamLaunch" ]; then | |||
"$1" "$2" "$3" "$4" "$0" "$5" | |||
"$1" "$2" "$3" "$4" "$5" "$6" "$0" "$7" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ManlyMarco I don’t have a Linux Steam to test this on, but if you just want to forward all arguments—that is, assuming that there aren’t additional arguments that Steam passes in but you want to drop—then this should be compatible with old and new versions alike:
count=0
until [ $((count+=1)) -ge $# ]; do
set -- "$@" "$1"
shift
done
set -- "$@" "$0" "$1"
shift
"$@"
(Thanks to https://stackoverflow.com/a/62227833/865331 for a cross-platform implementation.)
Also, rather than "$@"; exit
in this line and the line after it, you may want to exec "$@"
.
Want me to submit a pull request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Want me to submit a pull request?
Yes, please do, that would be great. It'll have to be applied to the master branch as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, the version on master passes the remaining arguments through, as though they can be non-empty. This originates in #391 without any apparent explanation. If extra arguments are really possible, then this should rather parse the command line, find the steam-launch-wrapper [--]
and insert BepInEx after that, and it probably needs to preserve the extra arguments in v5, too. Alternatively, I guess it can just count the same fixed 5 arguments but avoid counting any instances of --
.
Description
Resolves a recent change (I think) with how Steam on Linux launches applications. I believe the extra
--
arguments are messing up the argument counts for the relaunch. Using the following change I was able to get the game working. Basically added 2 extra arguments and shifted the last argument by 2.Motivation and Context
I had to resolve this issue locally in order to even launch the game on Steam. The changes I made to the game properties in Steam were following this link. This PR resolves issue #559.
How Has This Been Tested?
I tested this change using the game Ultimate Chicken Horse on Steam on a laptop running Fedora 37.
Types of changes
Checklist: