Skip to content

Commit

Permalink
modulare loose files mods! fuck yeah!
Browse files Browse the repository at this point in the history
  • Loading branch information
alterNERDtive committed Oct 27, 2023
1 parent 1df0d92 commit 75ec9b0
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ manage separate sets of mods in conjunction with a mod manager like
[BG3 Mod Manager](https://github.com/LaughingLeader/BG3ModManager) or
[Lamp](https://github.com/CHollingworth/Lamp).

Well OK, at this point it’s _kind of_ a mod-manager-like thing for loose files
mods. Read on :)

## Features

* Store an arbitrary amount of profiles. Each of them contains distinct
Expand All @@ -13,6 +16,8 @@ manage separate sets of mods in conjunction with a mod manager like
* Loose files mods
* Create and switch between your profiles via shell script.
* Mount loose files mods into your game folder at runtime via overlayfs
* Keep loose files mods separate! No more “which files did that add⁈” when you
want to uninstall one of them.

## Installation

Expand Down Expand Up @@ -45,6 +50,21 @@ the `override` subfolder of your profile. This not only means no accidental
mixups between profiles, but also that uninstalling / reinstalling / verifying
/ updating the game files does not affect your loose files mods in any way.

Alternatively, you can put loose files mods in their own subfolder of
`profiles/<name>/modular-override`:

```bash
> ls modular-override
'00-Visible Shields' 'Detailed Laezel' 'Karlach Vanilla Scars' 'Native Mod Loader' 'Shart Scars'
'Achievement Enabler' 'EA Loadscreens' 'Level 20' 'No Abs'
'Colorblind Spell Slots' 'Faster Rolls Quartered' 'More Detailed Halsin' OIO
'Contextual Dialogue Buttons' 'Highlight Prepared Spells' 'Native Camera Tweaks' 'Script Extender'
```

Priority will be the `override` folder, then the modular overrides in
alphabetical order. I use this e.g. to keep my “Native Camera Mod” configuration
file in `override` and not have it overwritten by mod updates.

Profiles are stored under `%AppData%/Local/Larian Studios` within the game’s
proton prefix. You can easily access it by running `bg3switch --cd`.

Expand Down
21 changes: 20 additions & 1 deletion bg3overlay
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,26 @@ mount_overlay() {
mv "${_folder}" bg3base
mkdir "${_folder}"
mkdir -p /tmp/bg3/{upper,work}
fuse-overlayfs -o lowerdir="${_current}/override":"${_common}/bg3base",upperdir=/tmp/bg3/upper,workdir=/tmp/bg3/work overlayfs "${_common}/${_folder}"

_current="${_library}/steamapps/compatdata/1086940/pfx/drive_c/users/steamuser/AppData/Local/Larian Studios/current"
if [ -d "${_current}/modular-override" ]; then
pushd "${_current}/modular-override"
declare -A _modulars=()
for _override in *
do
[ -d "${_override}" ] && _modulars["${_override}"]="${_current}/modular-override/${_override}"
done
popd
fi

if [[ ! "${#_modulars[*]}" -eq 0 ]]; then
# fugly, but I give up on doing this properly for now
_modular_overrides=$(printf "%s♫" ${_modulars[@]// /\\ })
_modular_overrides=${_modular_overrides//\\/\\ }
_modular_overrides=${_modular_overrides///:}
fi

fuse-overlayfs -o lowerdir="${_current}/override":"${_modular_overrides}""${_common}/bg3base",upperdir=/tmp/bg3/upper,workdir=/tmp/bg3/work overlayfs "${_common}/${_folder}"
}

unmount_overlay() {
Expand Down
1 change: 1 addition & 0 deletions bg3switch
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ create () {
touch "profiles/${1}/PlayerProfiles/Public/modsettings.lsx"
fi
mkdir "profiles/${1}/override"
mkdir "profiles/${1}/modular-override"
switch "${1}"
fi
}
Expand Down

0 comments on commit 75ec9b0

Please sign in to comment.