fixhang on battlenet

This commit is contained in:
Roy 2023-06-05 11:15:24 -07:00 committed by GitHub
parent 7c5fec856a
commit 8c1da149c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1613,47 +1613,57 @@ if [[ $options == *"Battle.net"* ]]; then
# Check if Battlenet Launcher is installed # Check if Battlenet Launcher is installed
if [[ ! -f "$battlenet_path1" ]] && [[ ! -f "$battlenet_path2" ]]; then if [[ ! -f "$battlenet_path1" ]] && [[ ! -f "$battlenet_path2" ]]; then
# Set the appid for the Battlenet Launcher
if [ "$use_separate_appids" = true ]; then
appid=Battle.netLauncher
else
appid=NonSteamLaunchers
fi
# Create app id folder in compatdata folder if it doesn't exist
if [ ! -d "$HOME/.local/share/Steam/steamapps/compatdata/$appid" ]; then
mkdir -p "$HOME/.local/share/Steam/steamapps/compatdata/$appid"
fi
# Set the appid for the Battlenet Launcher # Change working directory to Proton's
if [ "$use_separate_appids" = true ]; then cd $proton_dir
appid=Battle.netLauncher
else
appid=NonSteamLaunchers
fi
# Create app id folder in compatdata folder if it doesn't exist # Set the STEAM_COMPAT_CLIENT_INSTALL_PATH environment variable
if [ ! -d "$HOME/.local/share/Steam/steamapps/compatdata/$appid" ]; then export STEAM_COMPAT_CLIENT_INSTALL_PATH="~/.local/share/Steam"
mkdir -p "$HOME/.local/share/Steam/steamapps/compatdata/$appid"
fi
# Change working directory to Proton's # Set the STEAM_COMPAT_DATA_PATH environment variable for Epic Games Launcher
cd $proton_dir export STEAM_COMPAT_DATA_PATH=~/.local/share/Steam/steamapps/compatdata/$appid
# Set the STEAM_COMPAT_CLIENT_INSTALL_PATH environment variable # Download BATTLE file
export STEAM_COMPAT_CLIENT_INSTALL_PATH="~/.local/share/Steam" if [ ! -f "$battle_file" ]; then
echo "Downloading BATTLE file"
wget $battle_url -O $battle_file
fi
# Set the STEAM_COMPAT_DATA_PATH environment variable for Epic Games Launcher # Run the BATTLE file using Proton with the /passive option
export STEAM_COMPAT_DATA_PATH=~/.local/share/Steam/steamapps/compatdata/$appid echo "Running BATTLE file using Proton with the /passive option"
"$STEAM_RUNTIME" "$proton_dir/proton" run "$battle_file" Battle.net-Setup.exe --lang=enUS --installpath="C:\Program Files (x86)\Battle.net" &
# Add a counter variable to track the number of times the loop runs
counter=0
# Download BATTLE file while true; do
if [ ! -f "$battle_file" ]; then if pgrep -f "Battle.net.exe" > /dev/null; then
echo "Downloading BATTLE file" pkill -f "Battle.net.exe"
wget $battle_url -O $battle_file break
fi fi
# Run the BATTLE file using Proton with the /passive option # Increment the counter variable each time the loop runs
echo "Running BATTLE file using Proton with the /passive option" ((counter++))
"$STEAM_RUNTIME" "$proton_dir/proton" run "$battle_file" Battle.net-Setup.exe --lang=enUS --installpath="C:\Program Files (x86)\Battle.net" &
while true; do # Check if the counter has reached a certain value and exit the loop if it has
if pgrep -f "Battle.net.exe" > /dev/null; then if [[ $counter -ge 60 ]]; then
pkill -f "Battle.net.exe" echo "Timeout: Battle.net.exe process not found after 60 seconds"
break break
fi fi
sleep 1
done sleep 1
done
fi fi
fi fi