Skip to content

Commit

Permalink
Fix script for commands not being in /usr/bin, use protontricks if wi…
Browse files Browse the repository at this point in the history
…netricks is not found
  • Loading branch information
famfo committed Dec 29, 2023
1 parent d40cfea commit 23285bd
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 13 deletions.
49 changes: 37 additions & 12 deletions Arma3Helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
# Contributing: famfo (famfo#0227)
# Testing: G4rrus#3755
#
# Version 1v18-5
_SCRIPTVER="1v18-5"
# Version 1v18-6
_SCRIPTVER="1v18-6"

#####################################################################################
## Adjust below or use the external config file
#####################################################################################

## MAKE SURE YOU CHOOSE THE SAME PROTON VERSION AS FOR ARMA IN STEAM!!!
# Set this to the Proton Version you are using with Arma!
# Available versions: "7.0", "6.3", "5.13", "5.0", "4.11", "4.2", "3.16", "3.7", "Proton Experimental", "Experimental"
# Defaults to: 7.0
# Available versions: "8.0 7.0", "6.3", "5.13", "5.0", "4.11", "4.2", "3.16", "3.7", "Proton Experimental", "Experimental"
# Defaults to: 8.0
PROTON_OFFICIAL_VERSION=""

## Path to Arma's compatdata (wineprefix)
Expand Down Expand Up @@ -61,6 +61,13 @@ fi
## FUNCTIONS
# Installed check ($1 = path; $2 = name in error msg)
_checkinstall() {
if [[ ! $(command -v $1) ]]; then
echo -e "\e[31mError\e[0m: $1 is not installed!"
exit 1
fi
}
# Installed check by path ($1 = path; $2 = name in error msg)
_checkpath() {
if [[ ! -x "$1" ]]; then
echo -e "\e[31mError\e[0m: $2 is not installed!"
exit 1
Expand All @@ -75,6 +82,22 @@ _confirmation() {
exit 1
fi
}
# Get the command to modify the protonprefix
_get_wrappercmd() {
no_winetricks=$(_checkinstall "winetricks")
no_protontricks=$(_checkinstall "protontricks")
wrappercmd=""

if [[ $no_winetricks && $no_protontricks ]]; then
echo -e "$no_winetricks\n$no_protontricks"
exit 1
fi
if [[ $no_winetricks ]]; then
echo "protontricks 107410"
else
echo "winetricks"
fi
}

## ENVIROMENTAL VARAIBLES
if [[ -z "$COMPAT_DATA_PATH" ]]; then
Expand All @@ -97,7 +120,7 @@ if [[ $PROTON_OFFICIAL_VERSION == "Proton Experimental" || $PROTON_OFFICIAL_VERS
PROTON_OFFICIAL_VERSION="- Experimental"
IS_EXPERIMENTAL=true
elif [[ -z $PROTON_OFFICIAL_VERSION ]]; then
PROTON_OFFICIAL_VERSION="7.0"
PROTON_OFFICIAL_VERSION="8.0"
fi

# Executable paths
Expand All @@ -114,7 +137,7 @@ fi
# Start
if [[ -z $* ]]; then
# Check if TS is installed
_checkinstall "$TSPATH" "TeamSpeak"
_checkpath "$TSPATH" "TeamSpeak"
if ! pgrep -i arma3.exe && ! pgrep -i arma3_x64.exe ; then
echo -e "\e[31mArma should be started first!\e[0m \n"
exit 1
Expand Down Expand Up @@ -160,21 +183,23 @@ elif [[ $1 = "debug" ]]; then
# Winetricks wrapper for Arma's compatdata
elif [[ $1 = "winetricks" ]]; then
echo "Executing winetricks inside Arma's compatdata prefix..."
_checkinstall "/usr/bin/winetricks" "winetricks"
wrappercmd=$(_get_wrappercmd)
echo "Using \"$wrappercmd\""
export WINEPREFIX="$COMPAT_DATA_PATH/pfx"
if [[ $2 = "Arma" ]]; then
echo "Installing recommended features/DLLs for Arma"
winetricks d3dcompiler_43 d3dx10_43 d3dx11_43 xact_x64
$wrappercmd d3dcompiler_43 d3dx10_43 d3dx11_43 xact_x64
echo "done"
else
echo "Winetricks Arguments: ${*:2}"
winetricks "${*:2}"
echo "Arguments: ${*:2}"
$wrappercmd "${*:2}"
fi
elif [[ $1 = "winecfg" ]]; then
echo "Starting winecfg via winetricks for Arma's compatdata..."
_checkinstall "/usr/bin/winetricks" "winetricks"
wrappercmd=$(_get_wrappercmd)
echo "Running $wrappercmd winecfg"
export WINEPREFIX="$COMPAT_DATA_PATH/pfx"
winetricks winecfg
$wrappercmd winecfg
# Updater
elif [[ $1 = "update" ]]; then
echo -e "\e[31mUpdating the script will reset your changes in the script options!\e[0m"
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1v18-5
1v18-6

0 comments on commit 23285bd

Please sign in to comment.