From d06d2749d48913509e6b5ae8edcc9a3c38ad1d3a Mon Sep 17 00:00:00 2001 From: Baplar Date: Wed, 24 Sep 2025 23:10:29 +0200 Subject: [PATCH 1/5] Add mod loader auto-detection mechanism to LinuxBootstrap.sh --- Runtimes/NET/BepisLoader/LinuxBootstrap.sh | 50 +++++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/Runtimes/NET/BepisLoader/LinuxBootstrap.sh b/Runtimes/NET/BepisLoader/LinuxBootstrap.sh index 36fa5031..6ace5397 100644 --- a/Runtimes/NET/BepisLoader/LinuxBootstrap.sh +++ b/Runtimes/NET/BepisLoader/LinuxBootstrap.sh @@ -110,10 +110,56 @@ main() EOF fi + echo "Parsing hookfxr parameters" + HOOKFXR_STATUS="" + TARGET_ASSEMBLY="" + + # CLI arg takes priority + for arg in "$@" ; do + if [ "$arg" = "--hookfxr-enable" ] ; then + HOOKFXR_STATUS="ENABLED" + echo "hookfxr is enabled by CLI" + fi + if [ "$arg" = "--hookfxr-disable" ] ; then + HOOKFXR_STATUS="DISABLED" + echo "hookfxr is disabled by CLI" + fi + TARGET_ARG=${arg#"--hookfxr-target="} + if [ ! "$arg" = "$TARGET_ARG" ] ; then + TARGET_ASSEMBLY="$TARGET_ARG" + echo "hookfxr target forced to $TARGET_ASSEMBLY by CLI" + fi + done + + # If not specified in CLI args, check INI + if [ -z $HOOKFXR_STATUS ] ; then + if grep -q "enable=true" hookfxr.ini ; then + HOOKFXR_STATUS="ENABLED" + echo "hookfxr is enabled by INI" + fi + if grep -q "enable=false" hookfxr.ini ; then + HOOKFXR_STATUS="DISABLED" + echo "hookfxr is disabled by INI" + fi + fi + + ENTRY_POINT="Renderite.Host.dll" + + # If hookfxr is enabled, change the entry point + if [ "$HOOKFXR_STATUS" = "ENABLED" ] ; then + # Only read from INI if it was not already found in CLI + if [ -z $TARGET_ASSEMBLY ]; then + TARGET_ASSEMBLY=$(sed -n "s/^\s*target_assembly=\(.*\S\)\s*$/\1/p" hookfxr.ini) + fi + + if [ -n $TARGET_ASSEMBLY ]; then + ENTRY_POINT="$TARGET_ASSEMBLY" + fi + fi + echo "Entry point: $ENTRY_POINT" # ~ Launch Resonite! :) ~ - - dotnet BepisLoader.dll "$@" + exec "$DOTNET_EXECUTABLE" "$ENTRY_POINT" "$@" } main "$@" From 4fb0ceb388fe7e5c95097f090c870acc6af971f5 Mon Sep 17 00:00:00 2001 From: Baplar Date: Wed, 24 Sep 2025 23:46:46 +0200 Subject: [PATCH 2/5] Update readme to account for new Linux bootstrap script --- Runtimes/NET/BepisLoader/README.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Runtimes/NET/BepisLoader/README.md b/Runtimes/NET/BepisLoader/README.md index 9d736989..91827de2 100644 --- a/Runtimes/NET/BepisLoader/README.md +++ b/Runtimes/NET/BepisLoader/README.md @@ -5,15 +5,24 @@ A mod loader which allows using BepInEx with [Resonite](https://resonite.com/). ## Installation (Manual) -1. Download the latest release ZIP file (e.g., `ResoniteModding-BepisLoader-1.3.1.zip`) from [Thunderstore](https://thunderstore.io/c/resonite/p/ResoniteModding/BepisLoader/). +1. Download the latest release ZIP file (e.g., `ResoniteModding-BepisLoader-1.4.1.zip`) from [Thunderstore](https://thunderstore.io/c/resonite/p/ResoniteModding/BepisLoader/). 2. Extract the contents of the `BepInExPack` folder from the ZIP into your Resonite installation directory: - **Windows Default:** `C:\Program Files (x86)\Steam\steamapps\common\Resonite\` - **Linux Default:** `~/.steam/steam/steamapps/common/Resonite/` 3. **Linux Users Only:** The included `LinuxBootstrap.sh` file needs to be used instead of the default one: - The package includes a modified `LinuxBootstrap.sh` that launches `BepisLoader.dll` instead of `Renderite.Host.dll` - - **Important:** Resonite updates could replace this file, breaking the mod loader. If this happens, you'll need to manually replace `LinuxBootstrap.sh` with the one from the BepisLoader package -4. Start the game normally. -5. If you want to verify that the mod loader is working, check the `BepInEx\LogOutput.log` file after launching the game. + - Due to limitations of the ZIP format, the script will not be executable when you first setup the plugin. + You will need to run `chmod +x LinuxBootstrap.sh` in your Resonite profile folder in order to fix this manually. + - **Important:** Resonite updates could replace this file, breaking the mod loader. If this happens, you'll need to manually replace `LinuxBootstrap.sh` with the one from the BepisLoader package. +4. Enable the modded entry point by replacing `enable=false` with `enable=true` in the file `hookfxr.ini` + - Alternatively, add `--hookfxr-enable` to your launch arguments. +5. Start the game normally. +6. If you want to verify that the mod loader is working, check the `BepInEx\LogOutput.log` file after launching the game. + +### Disabling temporarily +1. Set `enable=false` in the file `hookfxr.ini` + - Alternatively, add `--hookfxr-disable` to your launch arguments. +2. If you had added `--hookfxr-enable` to your launch arguments before, you must remove it. ### Uninstallation @@ -24,15 +33,13 @@ A mod loader which allows using BepInEx with [Resonite](https://resonite.com/). - **Common Files:** - `hookfxr.ini` - All `BepisLoader*` files - - **Linux Only:** - - Restore the original `LinuxBootstrap.sh` (or verify game files through Steam) 2. Delete the `BepInEx` folder. ## Package Contents The BepisLoader package contains: - **Windows Entry Point:** `hostfxr.dll` and `hookfxr.ini` for hooking into the .NET runtime -- **Linux Entry Point:** Modified `LinuxBootstrap.sh` that launches BepisLoader +- **Linux Entry Point:** Modified `LinuxBootstrap.sh` that launches BepisLoader if hookfxr is enabled (in `hookfxr.ini` or with launch options) - **BepisLoader:** Core loader files (`BepisLoader.dll`, etc.) - **BepInEx:** The BepInEx framework and all required dependencies From fc813b651f426b938e207d87c172df6fba69ffc5 Mon Sep 17 00:00:00 2001 From: Baplar Date: Thu, 25 Sep 2025 00:18:48 +0200 Subject: [PATCH 3/5] Tweak README --- Runtimes/NET/BepisLoader/LinuxBootstrap.sh | 9 --------- Runtimes/NET/BepisLoader/README.md | 5 +++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Runtimes/NET/BepisLoader/LinuxBootstrap.sh b/Runtimes/NET/BepisLoader/LinuxBootstrap.sh index 6ace5397..569db132 100644 --- a/Runtimes/NET/BepisLoader/LinuxBootstrap.sh +++ b/Runtimes/NET/BepisLoader/LinuxBootstrap.sh @@ -58,15 +58,6 @@ RENDERER_SCRIPT="Renderer/Renderite.Renderer.sh" # # "$*" 2>/dev/null # } -# Overload the 'dotnet' command so that it calls the version which was -# downloaded by the script rather than potentially call (or fail to call) -# the system's main dotnet runtime. - -dotnet() -{ - "$DOTNET_EXECUTABLE" "$@" -} - main() { # Make sure the dotnet installer is executable, grab the .NET 9.0 runtime and diff --git a/Runtimes/NET/BepisLoader/README.md b/Runtimes/NET/BepisLoader/README.md index 91827de2..e7c113a0 100644 --- a/Runtimes/NET/BepisLoader/README.md +++ b/Runtimes/NET/BepisLoader/README.md @@ -11,9 +11,10 @@ A mod loader which allows using BepInEx with [Resonite](https://resonite.com/). - **Linux Default:** `~/.steam/steam/steamapps/common/Resonite/` 3. **Linux Users Only:** The included `LinuxBootstrap.sh` file needs to be used instead of the default one: - The package includes a modified `LinuxBootstrap.sh` that launches `BepisLoader.dll` instead of `Renderite.Host.dll` - - Due to limitations of the ZIP format, the script will not be executable when you first setup the plugin. - You will need to run `chmod +x LinuxBootstrap.sh` in your Resonite profile folder in order to fix this manually. + - Currently, the script might not be executable when you first setup the plugin. + If that is the case, you need to run `chmod +x LinuxBootstrap.sh` in your Resonite profile folder in order to fix this manually. - **Important:** Resonite updates could replace this file, breaking the mod loader. If this happens, you'll need to manually replace `LinuxBootstrap.sh` with the one from the BepisLoader package. + - Some mod managers - including Gale - will copy the script from their managed profile folder to the Resonite install directory on every game launch. In which case, you do not need to replace it manually. 4. Enable the modded entry point by replacing `enable=false` with `enable=true` in the file `hookfxr.ini` - Alternatively, add `--hookfxr-enable` to your launch arguments. 5. Start the game normally. From 601af087e5a20c296572d2d874b2a1faf748c6ba Mon Sep 17 00:00:00 2001 From: Baplar Date: Thu, 25 Sep 2025 00:19:45 +0200 Subject: [PATCH 4/5] Remove section about script executable permission --- Runtimes/NET/BepisLoader/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/Runtimes/NET/BepisLoader/README.md b/Runtimes/NET/BepisLoader/README.md index e7c113a0..58fa109f 100644 --- a/Runtimes/NET/BepisLoader/README.md +++ b/Runtimes/NET/BepisLoader/README.md @@ -11,8 +11,6 @@ A mod loader which allows using BepInEx with [Resonite](https://resonite.com/). - **Linux Default:** `~/.steam/steam/steamapps/common/Resonite/` 3. **Linux Users Only:** The included `LinuxBootstrap.sh` file needs to be used instead of the default one: - The package includes a modified `LinuxBootstrap.sh` that launches `BepisLoader.dll` instead of `Renderite.Host.dll` - - Currently, the script might not be executable when you first setup the plugin. - If that is the case, you need to run `chmod +x LinuxBootstrap.sh` in your Resonite profile folder in order to fix this manually. - **Important:** Resonite updates could replace this file, breaking the mod loader. If this happens, you'll need to manually replace `LinuxBootstrap.sh` with the one from the BepisLoader package. - Some mod managers - including Gale - will copy the script from their managed profile folder to the Resonite install directory on every game launch. In which case, you do not need to replace it manually. 4. Enable the modded entry point by replacing `enable=false` with `enable=true` in the file `hookfxr.ini` From 458ce0733ce73fe7e75346e140ff244657a9c43f Mon Sep 17 00:00:00 2001 From: Baplar Date: Thu, 25 Sep 2025 00:22:38 +0200 Subject: [PATCH 5/5] Add executable permission to Linux bootstrap script --- Runtimes/NET/BepisLoader/LinuxBootstrap.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 Runtimes/NET/BepisLoader/LinuxBootstrap.sh diff --git a/Runtimes/NET/BepisLoader/LinuxBootstrap.sh b/Runtimes/NET/BepisLoader/LinuxBootstrap.sh old mode 100644 new mode 100755