Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
geefr committed Sep 7, 2019
2 parents 5a9bd9c + b601906 commit d0fe68c
Show file tree
Hide file tree
Showing 5 changed files with 212 additions and 19 deletions.
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# Beat Saber Linux Goodies

# Recommended Install Method
- Install wine and ensure your default wine prefix supports .Net 4.6.1
- Install Beat Saber through Steam
- Run Beat Saber once/Play a round
- Take latest Linux alpha from [My BeatDrop Fork](https://github.com/geefr/BeatDrop/releases)
- Use BeatDrop to install BSIPA and other mods
- Run [The Fixup Script](https://github.com/geefr/beatsaber-linux-goodies/blob/master/scripts/bs-linux-modfix.sh) to patch the game - './bs-linux-modfix.sh <Beat Saber Install directory (SteamApps/common/Beat Saber)> <Path to Proton Installation (SteamApps/common/Proton 3.7)>'
- In steam right click Beat Saber -> Properties
- Check 'Force the use of a specific Steam Play compatibility tool
- Select the tool called 'Proton BeatSaber' (Might need to restart Steam)
- Go have fun

At the moment there's no fully integrated solution, but if you know how to run a shell script you'll be fine ;)

For downloading mods the recommended method is [My BeatDrop Fork](https://github.com/geefr/BeatDrop/releases). This is a native Linux port of BeatDrop with a few tweaks here and there.

In addition to mod downloads you'll need to ensure your system's wine installation is up to scratch, as a default install can't run BSIPA.

See the [scripts directory](scripts/README.md) for instructions/further detail.

# What
Mod installation scripts and other goodies for running Beat Saber on Linux.
Expand Down
46 changes: 46 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# BeatSaber Linux Scripts

## Wine Scripts
These scripts checks to see if your wine prefix is setup for running BSIPA, and if not will install what you need.
```
# Set the location of your wine prefix
# If not set the default of ~/.wine will be used
export WINEPREFIX=~/.wine/wineprefix=beatsaber-linux-goodies-ipa
# Check whether wine is setup correctly
./bs-linux-is-wine-valid.sh
# If this script returns non-zero, or shows an error you'll need to install
# For this just run the other script, and follow the prompts when the various setup wizards appear
./bs-linux-setup-wine.sh
# This script will double-check if the prefix is valid at the end, if it doesn't work please raise a github issue
```

## Beat Saber Mod Fix
This script needs to be run after you've downloaded mods through BeatDrop/similar.
(Work to integrate this into BeatDrop is in progress, these scripts will remain if you prefer using the terminal)

The main actions it performs are to:
- Run BSIPA to patch the game
- Apply various tweaks to Proton and the game's prefix so things work correctly
```
# Before running this script ensure you have:
# - Beat saber installed
# - Beat saber run at least once
# - Mods/BSIPA downloaded
#
# First ensure your wine prefix is set correctly
export WINEPREFIX=~/.wine/wineprefix=beatsaber-linux-goodies-ipa
# Run the script
# The proton installation here will be copied and modified to apply some fixes
./bs-linux-modfis.sh ~/.steam/steam/steamapps/common/Beat\ Saber ~/.steam/steam/steamapps/common/Proton\ 3.7
```

With any luck you should have a modded copy of Beat Saber now, only one this left to do
- Restart Steam
- Right click Beat Saber -> Properties
- Check 'Force the use of a specific Steam Play compatibility tool
- Select the tool called 'Proton BeatSaber'
- Go have fun
64 changes: 64 additions & 0 deletions scripts/bs-linux-is-wine-valid.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env bash

# Copyright (c) 2019, Gareth Francis ([email protected])
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#set -x

# This script validates whether the wine installation on the system is valid for use with BSIPA
# In order to be considered valid:
# - The wine installation requires .net 4.6.1 installed
# - TODO: This script may not be perfect. It may return true for other similar versions of .net
#
# Arguments: None
# Environment: WINEPREFIX should be set to the prefix to check
# Returns: 0 if the prefix seems valid

echo "USAGE: ${0} : Validates whether \$WINEPREFIX is setup for running BSIPA"

which wine > /dev/null
if [ $? -ne 0 ]; then
echo "ERROR: Wine doesn't appear to be installed on your system, please do so and ensure it's in your PATH"
exit 1
fi

if [ -z "${WINEPREFIX}" ]; then
echo "WARNING: WINEPREFIX not set, assuming ~/.wine"
WINEPREFIX="${HOME}/.wine"
fi

WINEPREFIX=$(realpath ${WINEPREFIX})

if [ ! -d "${WINEPREFIX}" ]; then
echo "ERROR: Wine prefix at ${WINEPREFIX} doesn't exist"
exit 1
fi

if [ ! -f "${WINEPREFIX}/drive_c/windows/Microsoft.NET/Framework/v4.0.30319/Microsoft.CSharp.dll" ]; then
echo "ERROR: Wine prefix at ${WINEPREFIX} doesn't contain the expected .Net installation"
exit 1
fi

echo "SUCCESS: Wine prefix at ${WINEPREFIX} should be able to run BSIPA"
exit 0
25 changes: 16 additions & 9 deletions scripts/bs-linux-modfix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@

#set -x

ipaWinePrefix="${HOME}/.wine/wineprefix/beatsaber-linux-goodies-ipa"
bsProtonName="Proton BeatSaber"
compatTools="${HOME}/.steam/root/compatibilitytools.d/"
bsProtonDir="${compatTools}/${bsProtonName}"
compatData="${bsInstall}/../../compatdata/620980"

echo "This script will setup beat saber mods on your system"
echo "Before running make sure the following have been done:"
echo " - Wine is installed on your system"
Expand All @@ -52,6 +58,11 @@ if [ $# -ne 2 ]; then
exit 1
fi

if ! ./bs-linux-is-wine-valid.sh > /dev/null; then
echo "ERROR: Your wine installation doesn't appear to be valid, please ensure you have wine installed, and .Net 4.6.1 is installed in \$WINEPREFIX"
exit 1
fi

read -n 1 -p "Are you sure you want to continue? [Y/n] " reply;
if [ "$reply" != "" ]; then echo; fi
if [ "$reply" != "${reply#[Nn]}" ]; then
Expand All @@ -61,10 +72,6 @@ fi

bsInstall=$(realpath "${1}")
protonInstall=$(realpath "${2}")
bsProtonName="Proton BeatSaber"
compatTools="${HOME}/.steam/root/compatibilitytools.d/"
bsProtonDir="${compatTools}/${bsProtonName}"
compatData="${bsInstall}/../../compatdata/620980"

echo "Creating custom Proton installation for Beat Saber use"
rm -rf "${bsProtonDir}" || true
Expand Down Expand Up @@ -93,17 +100,17 @@ cat <<EOM >"${bsProtonDir}/compatibilitytool.vdf"
}
EOM

mv "${bsProtonDir}/dist/lib64/wine/winhttp.dll.so" "${bsProtonDir}/dist/lib64/wine/winhttp_alt.dll.so" 2> /dev/null || true
mv "${compatData}/pfx/drive_c/windows/syswow64/winhttp.dll" "${compatData}/pfx/drive_c/windows/syswow64/winhttp_alt.dll" 2> /dev/null || true
mv "${bsProtonDir}/dist/lib64/wine/winhttp.dll.so" "${bsProtonDir}/dist/lib64/wine/winhttp_alt.dll.so" &> /dev/null || true
mv "${compatData}/pfx/drive_c/windows/syswow64/winhttp.dll" "${compatData}/pfx/drive_c/windows/syswow64/winhttp_alt.dll" &> /dev/null || true

# Patching BS with IPA.exe
pushd "${bsInstall}"
pushd "${bsInstall}" &> /dev/null

# TODO: Would be nice to exploit the Proton installation here, or otherwise not require the user to deal with winetricks
#WINEPATH="${bsProtonDir}/dist/bin/wine64" WINEPREFIX="${bsProtonDir}/dist/share/default_pfx" "${bsProtonDir}/dist/bin/wine64" IPA.exe
# TODO: Would be nice to be able to detect if .net 4.6.1 is supported by wine and quit otherwise
# For now system wine must be setup with at least dotnet461 installed
wine IPA.exe
wine IPA.exe -n 2> /dev/null

if [ $? -ne 0 ]; then
echo "WARNING: IPA.exe returned non-zero result"
Expand All @@ -112,7 +119,7 @@ fi
echo ""
echo "SUCCESS: Beat Saber has been modded successfully, have fun hitting block <3"

popd
popd &> /dev/null

# Configure wine registry to ensure winhttp.dll loads correctly
# TODO: If using geefr/beatdrop this isn't needed, maybe do it anyway?
Expand Down
78 changes: 78 additions & 0 deletions scripts/bs-linux-setup-wine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/usr/bin/env bash

# Copyright (c) 2019, Gareth Francis ([email protected])
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#set -x

# This script sets up a wine prefix such that it can run BSIPA
# That means installing:
# - dotnet461 through winetricks
#
# Arguments: None
# Environment: WINEPREFIX should be set to the prefix to check
# Returns: 0 if installation was successful

echo "USAGE: ${0} : Sets up \$WINEPREFIX for running BSIPA"

if [ -z "${WINEPREFIX}" ]; then
echo "WARNING: WINEPREFIX not set, assuming ~/.wine"
WINEPREFIX="${HOME}/.wine"
fi

export WINEPREFIX=$(realpath ${WINEPREFIX})

which wine > /dev/null
if [ $? -ne 0 ]; then
echo "ERROR: Wine doesn't appear to be installed on your system, please do so and ensure it's in your PATH"
exit 1
fi

which cabextract > /dev/null
if [ $? -ne 0 ]; then
echo "ERROR: cabextract is required to install dotnet 4.6.1, please ensure it's in your PATH"
exit 1
fi

mkdir -p ${WINEPREFIX} 2> /dev/null
pushd ${WINEPREFIX} > /dev/null
if ! wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks 2> /dev/null; then
echo "ERROR: Failed to download winetricks, please log this as a bug at https://github.com/geefr/beatsaber-linux-goodies"
exit 1
fi
chmod +x winetricks
popd > /dev/null

if ! ${WINEPREFIX}/winetricks dotnet461 2> /dev/null; then
echo "ERROR: Failed to install .Net 4.6.1"
exit 1
fi

if ! ./bs-linux-is-wine-valid.sh &> /dev/null; then
echo "ERROR: .Net installation succeeded but wine prefix doesn't appear valid"
exit 1
fi

echo "SUCCESS: Wine prefix at ${WINEPREFIX} setup to run BSIPA"
exit 0

0 comments on commit d0fe68c

Please sign in to comment.