Last active
April 6, 2020 13:01
-
-
Save lboklin/c735c867a00fbb2d30bb89dbcd910c03 to your computer and use it in GitHub Desktop.
Bannerlord wine prefix creation for NixOS users (no deps management)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### WARNING: | |
### This will delete your prefix. Backup or move it or any settings before running. | |
### NOTE: | |
### This symlinks your game settings and saves into your ${HOME}/Documents directory | |
### to keep them safe. | |
# set -x | |
if [[ -z $@ ]] | |
then | |
echo "Usage: [STEAMAPPS=/path/to/steamapps] ./<this-script>.sh <verbs>" | |
echo "<verbs> can be any number of verbs (vcrun2015 vcrun2017 etc)." | |
echo "Passing dotnet472 makes for fast saves and good performance but crashes a lot." | |
echo "" | |
exit 1 | |
fi | |
##### Read Observations at the bottom before modifying anything other than these: | |
if [[ -z $STEAMAPPS ]] | |
then | |
STEAMAPPS=${HOME}/.steam/steam/steamapps | |
fi | |
export PROTON_VERSION=Proton-5.5-GE-1 | |
##### | |
# Windows dependencies as stated by TaleWorlds Entertainment: | |
# * vcrun2015 | |
# * vcrun2017 | |
# * dotnet472 | |
# If modified to use a proton wine for creating the prefix, run this with steam-run. | |
## Deps: | |
# * custom proton | |
# * Version: https://github.com/GloriousEggroll/proton-ge-custom/releases/tag/5.5-GE-1 | |
# * Set game to use it in Steam's game properties | |
# * nixpkgs.cabextract (maybe? I think I needed it at some point but maybe not for this ritual) | |
# * nixpkgs.protontricks | |
# * nixpkgs.wine-staging (untested - I used nixpkgs.wineWowPackages.staging) | |
# * staging required? | |
# * only if not using proton | |
# * I've had trouble in the past when using wine installed in user | |
# environment, so I recommend including it in nixos configuration. | |
# nixpkgs.winetricks | |
# * unless you need vcrun2019 which requires this revision or newer: | |
# https://github.com/Winetricks/winetricks/commit/94edaddc039c205a98c2a620399a741c7a70ce02 | |
# see https://github.com/ValveSoftware/Proton/issues/3706#issuecomment-609460039 for instructions. | |
# WINEBINDIR=${HOME}/.steam/root/compatibilitytools.d/${PROTON_VERSION}/dist/bin | |
WINEBINDIR=/run/current-system/sw/bin | |
export WINEPREFIX=${STEAMAPPS}/compatdata/261550/pfx | |
export PATH=$WINEBINDIR:$PATH | |
# Just to be sure | |
export WINE=$WINEBINDIR/wine64 | |
export WINESERVER=$WINEBINDIR/wineserver | |
# For custom (newer) winetricks - only needed for vcrun2019 afaik. | |
# Also only need to set this when using protontricks, but we'll use it generally. | |
# export WINETRICKS=${HOME}/.nix-profile/bin/winetricks | |
export WINETRICKS=/run/current-system/sw/bin/winetricks | |
DIRNAME="Mount and Blade II Bannerlord" | |
SRCCONFIGDIR="${HOME}/.local/share/TaleWorlds Interactive/$DIRNAME" | |
PFXCONFIGDIR="${WINEPREFIX}/drive_c/users/steamuser/My Documents/$DIRNAME" | |
if [[ -d "$PFXCONFIGDIR" && ! -d "$SRCCONFIGDIR" ]] | |
then | |
echo "Moving pre-existing game settings and saves to $SRCCONFIGDIR" | |
# echo "dry-run: mv -r \"$PFXCONFIGDIR\" \"$SRCCONFIGDIR\"" | |
mv -r "$PFXCONFIGDIR" "$SRCCONFIGDIR" | |
echo "" | |
fi | |
if [[ -d "$WINEPREFIX" ]] | |
then | |
echo "Purging wine prefix: $WINEPREFIX" | |
# echo "dry-run: rm -rf $WINEPREFIX" | |
rm -rf $WINEPREFIX | |
echo "" | |
fi | |
if [[ ! -z $@ ]] | |
then | |
echo "Creating prefix" | |
fi | |
for verb in "$@" | |
do | |
echo "Adding $verb to prefix" | |
# If using this, make sure to have steam create the prefix first by running the game once. | |
# protontricks 261550 $verb | |
# If using this, make sure prefix doesn't already exist. | |
# This is very interactive - have not tried -q in combination with this | |
# specific ritual and I'm afraid to ruin anything now. | |
# echo "dry-run: $WINETRICKS arch=64 prefix=$WINEPREFIX $verb" | |
$WINETRICKS arch=64 prefix=$WINEPREFIX $verb | |
done | |
echo "" | |
# Symlink your settings and local saves to outside prefix so you don't lose it | |
# upon wiping it. | |
if [[ ! -d "$SRCCONFIGDIR" ]] | |
then | |
echo "Creating $SRCCONFIGDIR" | |
mkdir -p "$SRCCONFIGDIR" | |
fi | |
if [[ ! -d "$PFXCONFIGDIR" ]] | |
then | |
echo "Creating $PFXCONFIGDIR" | |
mkdir -p "$PFXCONFIGDIR" # Create path | |
rmdir "$PFXCONFIGDIR" # This is to become a symlink | |
fi | |
echo "Symlinking your settings and save files:" | |
echo " \"$PFXCONFIGDIR\"" | |
echo " -> \"$SRCCONFIGDIR\"" | |
echo "" | |
# echo "dry-run: ln -sf \"$SRCCONFIGDIR\" \"$PFXCONFIGDIR\"" | |
ln -sf "$SRCCONFIGDIR" "$PFXCONFIGDIR" | |
echo "" | |
echo "Done. Make sure to set game to use $PROTON_VERSION in Steam before launching the game." | |
## Observations: | |
# * Using protontricks/steam to create prefix automatically includes vcrun2015 and vcrun2017 | |
# * It appears you can use any recent wine and winetricks vcrun2019) | |
# (unless you need vcrun2019) for creating the prefix and then run with some | |
# proton or patched wine. | |
# * Using system wine and winetricks I'm able to install .Net 4.6, but not when | |
# using proton's wine (or anything inside steam-run runtime) | |
# * Things tried to make .Net 4.6 install with proton/steam-run: | |
# * (in steam-run) <newer-winetricks> arch=64 prefix=$WINEPREFIX win7 vcrun2015 vcrun2017 dotnet472 | |
# * (in steam-run) <system-winetricks> arch=64 prefix=$WINEPREFIX winxp vcrun2015 vcrun2017 dotnet472 | |
# * protontricks 261550 dotnet472 | |
# * (in steam-run) protontricks 261550 dotnet472 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment