[BUG] - Linux native modding doesn't work
Describe the bug
I configured EtG launch parameters with what r2modman gave me "/home/damglador/.config/r2modmanPlus-local/ETG/linux_wrapper.sh" %command%, installed BepInEx_EtG and mod the gungeon API, but when I try to launch the game from the launcher as modded or just through Steam it just instantly closes
To Reproduce Steps to reproduce the behavior:
- Install native EtG
- Launch r2modman
- Select EtG
- Copy the command it gives and paste it in Steam launch arguments for EtG
- Try to launch EtG from Steam or r2modman
Expected behavior You know, working
Additional context I wasted some time playing with the bepinex script and was able to fix it.
The script didn't work at all for Enter The Gungeon, but after some rewriting, though also removing MacOS code, it launches the game and can successfully switch profiles. I just need to move the script in game directory and add ./doorstop %command% in launch parameters (doorstop being the script), after that Gale and r2modman can mod the game without an issue, and it doesn't have to use linux_wrapper.sh.
My script https://gist.github.com/Damglador/8063983f424a800531699cdc7e894462
Issues
List of general and per-game issues and how users can workaround them
General
- ~~Linux wrapper is broken https://github.com/ebkr/r2modmanPlus/pull/1843~~
- BepInEx run scripts are broken
- Spaces in path issue like in Linux wrapper
- The script expects game executable to be in the same directory as itself, but placed in the profile directory
- Script checks for SteamLaunch as the second argument, but right now it's the fourth argument
- Script tries to re-execute itself with
exec $cmd $@, but fails - It shifts 4 arguments on
shift 4, but the Steam right now gives ~12, it also doesn't account for the case of another wrapper or an argument placed after the script and before %command%, which will likely break the script. My script just discards all arguments between itself and the game executable, which is also not ideal, but at least reliable
- Changing game installation directory is not possible, because r2modman looks for exe files, and it gives wrong filter for file picker
Solution: use https://gist.github.com/Damglador/8063983f424a800531699cdc7e894462
Enter the Gungeon
- BepInEx requires mono installed on the system
Workaround: install mono, on Arch sudo pacman -S mono, on Ubuntu and alike sudo apt install libmono-2.0-dev
As a small note, you also need SDL2 on the system for the game to work, on Arch it's sdl2-compat, on Ubuntu it's libsdl2-2.0-0 or libsdl2-compat (I think).
Inscryption
- Can't run at all from r2modman, gives:
Error
An unhandled error occurred
ENOENT: no such file or directory, open '/home/Games/SteamLibrary/steamapps/compatdata/1092790/pfx/user.reg'
Workaround: move BepInEx, doorstop_libs and my doorstop.sh to the game directory and launching it from Steam with ./doorstop.sh %command%. You can symlink BepInEx directory if you don't want to copy over newly installed mods
Ultimate Chicken Horse
- r2modman doesn't even download bepinex run script and
doorstop_libs
Workaround: steal doorstop_libs a profile of another Linux-native game
Straftat
- r2modman doesn't download bepinex run script and
doorstop_libs
https://github.com/ebkr/r2modmanPlus/pull/1843 doesn't fix this, but does at least make some progress in fixing it
Essential issues:
First the BASEDIR line has to be replaced with
a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; BASEDIR=$(cd "$a" || exit; pwd -P)
Then
if [ "$4" = "SteamLaunch" ]; then
shift 12
fi
The relaunching seems to be redundant and just breaks the thing.
Then exec has to NOT be "$BASEDIR/EtG.$arch", because BASEDIR is where the script is, and that's the profile folder, so r2modman has to either pass another variable to define the executable or path to the game folder, and only if the passed variable is missing it should default to BASEDIR.
The script didn't work at all for Enter The Gungeon, but after some rewriting, though also removing MacOS code, it launches the game and can successfully switch profiles. I just need to move the script in game directory and add
./doorstop %command%in launch parameters (doorstop being the script), after that Gale and r2modman can mod the game without an issue, and it doesn't have to uselinux_wrapper.sh.
Curious if this routine would fix things for UCH (https://github.com/ebkr/r2modmanPlus/issues/1845), could you provide the modified script you used to get EtG working? If it fixes it it'd probably be better to fold #1845 in to this one as just another effected app.
EDIT:
Honestly, looking in to this further I'm rather confused how/when this even got broken.
EtG, the game you're originally reporting, is:
- linux native
- unity based
- mods using beepinex
- prompts for/requires the issue wrapper script
On the other hand, UCH, which has at least a similar issue:
- windows only (uses proton)
- unity based
- mods using beepinex
- prompts for/requires the issue wrapper script
But then there's PEAK:
- windows only (uses proton)
- unity based
- mods using beepinex
- doesn't prompt for or use any wrapper script, and mods fine with no intervention out of the box
Maybe I'm missing something, but shouldn't these all be sharing basically the same runtime?
Edit2 : Scratch everything I said above, didn't realize it but UCH is a linux native game, thus why its got issues as well.
Yeah sure, I'll fix (or rather test) UHC, I have it.
It got broken because Windows uses a completely different loading mechanism I suppose. So the Linux script isn't even needed and that's what broke
I am having the same problem as Damglador. Can you explain to me how i can fix it like i am five?
Get doorstop.sh from https://gist.github.com/Damglador/8063983f424a800531699cdc7e894462, put it in the game directory and in Steam edit launch arguments to ./doorstop.sh %command%. Also for now you have to edit a variable called executable to match your game's executable name. Basically replace EtG.$(uname -m) with, for example, valheim.x86_64. Oh and you also have to move folder called doorstop_libs from /home/damglador/.config/r2modmanPlus-local/$GAME/profiles/$PROFILE/ to the game directory near the script.
I'll try to make it more automated later.
After that you can either launch the game from Steam and it'll try to load BepInEx in game directory or you can launch it from r2modman or Gale and it'll load the profile you're launching
@raku-cat UCH problem is deeper. r2modman doesn't even download native doorstop libs for it, as well as the script that linux_wrapper.sh is supposed to use. Nothing unfixable though
Just dropped my doorstop.sh in profile directory, yoinked doorstop_libs folder from Enter The Gungeon and placed it near the script and replaced the launch arguments with /home/damglador/.config/r2modmanPlus-local/UltimateChickenHorse/profiles/Default/doorstop.sh %command%
Profile directory should look like that:
/home/damglador/.config/r2modmanPlus-local/UltimateChickenHorse/profiles/Default
├── BepInEx
├── doorstop_config.ini
├── doorstop_libs
│ ├── libdoorstop_x64.dylib
│ ├── libdoorstop_x64.so
│ └── libdoorstop_x86.so
├── doorstop.sh
├── mods.yml
├── _state
│ └── installation_state.yml
└── winhttp.dll
After should be able to use other profiles from r2modman/Gale without any modifications, just leave in place doorstop.sh and doorstop_libs
How do I put the doorstop.sh in the game directory?
Just create a file called doorstop.sh and copy-paste the script in it. Also make sure it's executable, either by setting a check file's properties through file manager or by doing chmod +x /path/to/doorstop.sh
In Dolphin I can make it executable with this checked
I selected launch as executable. When i click run program on doorstop.sh it opens the terminal for a split second, then the game opens and runs for a couple of seconds and then it crashes. I have the correct launch options in steam.
Yes, that's a thing if you try to launch it not from Steam if it's a Steam game.
You have to just add ./doorstop.sh %command% to launch arguments and launch it either through Steam or r2modman.
Just need to know is steam launch options different to launch arguments? If so how do i add the command to launch arguments. Sorry to bother you i am very new to this stuff.
I added it to the launch options on steam in properties (If that's what your talking about). The game dose not launch. It plays then stops playing.
@raku-cat UCH problem is deeper. r2modman doesn't even download native doorstop libs for it, as well as the script that linux_wrapper.sh is supposed to use. Nothing unfixable though
Just dropped my
doorstop.shin profile directory, yoinkeddoorstop_libsfolder from Enter The Gungeon and placed it near the script and replaced the launch arguments with/home/damglador/.config/r2modmanPlus-local/UltimateChickenHorse/profiles/Default/doorstop.sh %command%Profile directory should look like that:
/home/damglador/.config/r2modmanPlus-local/UltimateChickenHorse/profiles/Default ├── BepInEx ├── doorstop_config.ini ├── doorstop_libs │ ├── libdoorstop_x64.dylib │ ├── libdoorstop_x64.so │ └── libdoorstop_x86.so ├── doorstop.sh ├── mods.yml ├── _state │ └── installation_state.yml └── winhttp.dllAfter should be able to use other profiles from r2modman/Gale without any modifications, just leave in place
doorstop.shanddoorstop_libs
Followed this, working for me here:
I updated the script a bit, now it should be able to find the game executable by itself, so editing it shouldn't be a requirement anymore. Would also be nice to have some fallbacks for doorstop_libs, so they don't have to be near the script. I would even try making it MacOS compatible, but I don't have an environment to test it in, and since neither Gale nor r2modman target MacOS, for now that shouldn't matter.
Still not working. Thank you for helping me.
@Orlando189 message me on Discord (or Steam), link in my profile
Sent you a friend request on discord
Seems like BepInEx also requires mono installed on the system. This should be added to the disclaimer about Linux native modding
What's interesting is that seems to be exclusive to Enter the Gungeon. Valheim can run BepInEx without system installed mono
BepInEx run scripts are broken
- Spaces in path issue like in Linux wrapper
- The script expects game executable to be in the same directory as itself, but placed in the profile directory
- Script checks for SteamLaunch as the second argument, but right now it's the fourth argument
- Script tries to re-execute itself with exec $cmd $@, but fails
- It shifts 4 arguments on shift 4, but the Steam right now gives ~12, it also doesn't account for the case of another wrapper or an argument placed after the script and before %command%, which will likely break the script. My script just discards all arguments between itself and the game executable, which is also not ideal, but at least reliable
I fixed all of these in https://github.com/NeighTools/UnityDoorstop/pull/74. For the 2nd one it can be fixed by changing your equivalent of target_assembly="Doorstop.dll" to target_assembly="$BASEDIR/Doorstop.dll".
For the 2nd one it can be fixed by changing your equivalent of target_assembly="Doorstop.dll" to target_assembly="$BASEDIR/Doorstop.dll".
To be more clear on this, in my changes the game executable listed in the script is never run when its launched through steam, its only used to find which argument passed by steam contains the executable and then it runs that. But when working on this I found that with doorstop 4.4.0, DOORSTOP_TARGET_ASSEMBLY needed to be an absolute path to bepinex if it was installed to an r2modman profile instead of directly into the game dir.
The launch options still aren’t working. Is there a fix for this somewhere that I can try? Or like, an older version of something that isn’t broken?
Having to launch modded through the R2MM application sucks so much on Steam deck for a whole bunch of reasons I won’t get into.
I’m super frustrated. Every single guide (and the application itself) says to just copy those launch options into Steam and it should work, but it doesn’t. It won’t launch modded.
Please let me know if there’s like, a file I can download and put somewhere, or if I can downgrade the application or something. I’m losing it.
Having to launch modded through the R2MM application sucks so much on Steam deck for a whole bunch of reasons I won’t get into.
I’m super frustrated. Every single guide (and the application itself) says to just copy those launch options into Steam and it should work, but it doesn’t. It won’t launch modded.
This sounds like its working exactly as its supposed to be. By default with Native Linux games when you launch them from Steam it does not launch modded, you must launch them by clicking Launch Modded in R2MM. You can add a --r2profile to the launch args in steam to change the default from ummodded to modded but you must add --r2profile PROFILENAME before the %command%. This is not documented AFAIK but it works.
@correii assuming you have the custom script in the game directory, ./doorstop.sh %command% --doorstop-enable true --doorstop-target "/home/damglador/.config/r2modmanPlus-local/ETG/profiles/Default/BepInEx/core/BepInEx.Preloader.dll" --r2profile "Default" should work perfectly fine, everything after %command% is what r2modman gives you at the bottom of Help > General
