-
-
Save arho/3170820 to your computer and use it in GitHub Desktop.
Starcraft II Optirun [Crash Fix Included]
This file contains hidden or 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
#!/bin/bash | |
echo 0|sudo tee /proc/sys/kernel/yama/ptrace_scope #If you don't do this game crashes after login. | |
function msg { | |
# Description: | |
# This function echoes-with-colors the arguments passed in | |
# Usage: | |
# msg 'whatever you want to print :)' | |
echo -e '\033[33m\033[44m'$@'\033[0m' | |
} | |
function wait_until_pid_finishes { | |
# Description: | |
# This function will block and wait untill the process with <pid> terminates | |
# Usage: | |
# wait_until_pid_finishes <pid> | |
_PID=$1 | |
while [ "$(kill -0 $_PID ; echo $?)" == "0" ]; do | |
sleep 5 | |
done | |
} | |
if [ "$1" == "RECALLED_WITH_OPTIRUN" ]; then | |
#we are being run with optirun :) | |
msg "$0 starting" | |
msg "Starting up Starcraft II.exe through wine" | |
wine ~/.wine/dosdevices/c:/Starcraft\ II/StarCraft\ II.exe | |
# breathing to let SC2.exe start-up... | |
sleep 5 | |
SC2_PID=$(pidof SC2.exe) | |
msg "SC2.exe has PID=$SC2_PID" | |
#wait while SC2.exe is running, until it terminates | |
wait_until_pid_finishes $SC2_PID | |
msg "SC2.exe has terminated" | |
msg "$0 terminating" | |
exit 0 | |
else | |
#This scripts needs to be called through optirun. | |
#In order to garantee it, we re-execute using optirun | |
exec optirun $0 RECALLED_WITH_OPTIRUN | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Test Details:
Please don't forget to update your x-swat drivers or you will see how poorly it will run. Even when you install the drivers there will be a little change in the fps and it will not change even when you try to put the graphics settings on low.