#!/bin/bash # figure out the absolute path to the script being run a bit # non-obvious, the ${0%/*} pulls the path out of $0, cd's into the # specified directory, then uses $PWD to figure out where that # directory lives - and all this in a subshell, so we don't affect # $PWD GAMEROOT=$(cd "${0%/*}" && echo $PWD) BINROOT="${GAMEROOT}/GarrysMod_Signed.app/Contents/MacOS" unset LD_PRELOAD GAMEEXE=gmod ulimit -n 2048 # enable nVidia threaded optimizations export __GL_THREADED_OPTIMIZATIONS=1 # and launch the game cd "$GAMEROOT" STATUS=42 while [ $STATUS -eq 42 ]; do if [ "${GAME_DEBUGGER}" == "lldb" ]; then ARGSFILE=$(mktemp $USER.hl2.lldb.XXXX) echo "b main" > "$ARGSFILE" echo "env DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH" > "$ARGSFILE" ${GAME_DEBUGGER} -s "$ARGSFILE" -- "${BINROOT}"/${GAMEEXE} "$@" rm $ARGSFILE else # Opening the app directly works, but we will stick with this for now exec ${GAME_DEBUGGER} "${BINROOT}"/${GAMEEXE} "$@" fi STATUS=$? done exit $STATUS