X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/04fed8e4657d28df3ca947ea34c2a5d8f9ccc02f..61d7dd11d4a450a64f2817ee4db0ec7fa5880b42:/bin/grimfandango?ds=sidebyside diff --git a/bin/grimfandango b/bin/grimfandango new file mode 100755 index 0000000..dd8e0bd --- /dev/null +++ b/bin/grimfandango @@ -0,0 +1,25 @@ +#!/bin/bash +WINEPREFIX=/mnt/sdd5/ramsi/wineprefixes/grim-fandango wine "C:\GRIM\GRIMFANDANGO.EXE" & + +# Get list of Grim Fandango threads. And don't forget to remove the grep ID from the list! +GRIM_THREADS=`ps -LFfea | grep GRIMFANDANGO.EXE | grep -Ev 'grep' | awk '{printf($4); printf(" ")}'` + +# Wait until the 5 threads are created +THREAD_COUNT=`echo $GRIM_THREADS | wc -w` +while [ $THREAD_COUNT -lt 5 ] +do +echo "Waiting for threads to be ready. Hit Ctrl-C if it hangs here after closing the game." +sleep 1 +GRIM_THREADS=`ps -LFfea | grep GRIMFANDANGO.EXE | grep -Ev 'grep' | awk '{printf($4); printf(" ")}'` +THREAD_COUNT=`echo $GRIM_THREADS | wc -w` +done + +# The 5 Grim Fandango threads are ready. Set affinity!!! +for CURRENT_THREAD in $GRIM_THREADS +do +# Set affinity to the first system processor +echo "Setting thread " $CURRENT_THREAD " affinity!" +taskset -pc 0 $CURRENT_THREAD +done + +echo "READY!!!"