diff --git a/README.md b/README.md index 2abb000..56dde37 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..4be4d8e --- /dev/null +++ b/scripts/README.md @@ -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 diff --git a/scripts/bs-linux-is-wine-valid.sh b/scripts/bs-linux-is-wine-valid.sh new file mode 100755 index 0000000..0474ee7 --- /dev/null +++ b/scripts/bs-linux-is-wine-valid.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +# Copyright (c) 2019, Gareth Francis (gfrancis.dev@gmail.com) +# 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 diff --git a/scripts/bs-linux-modfix.sh b/scripts/bs-linux-modfix.sh index 280e7d2..5d89926 100755 --- a/scripts/bs-linux-modfix.sh +++ b/scripts/bs-linux-modfix.sh @@ -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" @@ -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 @@ -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 @@ -93,17 +100,17 @@ cat <"${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" @@ -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? diff --git a/scripts/bs-linux-setup-wine.sh b/scripts/bs-linux-setup-wine.sh new file mode 100755 index 0000000..2111112 --- /dev/null +++ b/scripts/bs-linux-setup-wine.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash + +# Copyright (c) 2019, Gareth Francis (gfrancis.dev@gmail.com) +# 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