-
-
Save lachie/3731229 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
# | |
# The Stanley Parable Launcher | |
# | |
# adapted by @mungler to use an embedded copy of the stanley parable game data | |
# adapted by @lachie to work with black mesa | |
# if this is not defined (default), the script will attempt to guess it | |
STEAMUSERID="" | |
# if your Steam application is somewhere other than /Applications, edit below. | |
STEAMAPPLOCATION="/Applications" | |
BUNDLEDIR=`dirname "$0"` | |
#echo "CURRENT DIR: $BUNDLEDIR" | |
# Stanley setup | |
#GAME=thestanleyparable | |
#GAME_FILES="$BUNDLEDIR/../Resources/$GAME" | |
# Black Mesa setup | |
GAME=blackmesa | |
# this is where you downloaded and unzipped black mesa | |
GAME_FILES="$HOME/Downloads/blackmesa" | |
if [ -z $STEAMUSERID ]; then | |
#guess | |
cd ~/Library/Application\ Support/Steam/SteamApps | |
STEAMUSERID=`find . -type d -depth 1 | egrep -v '(common|sourcemods)' | cut -f2 -d/` | |
#check if more than 1 "extra" directory | |
LINECOUNT=`echo "$STEAMUSERID" | wc -l` | |
if [ "$LINECOUNT" -gt "1" ]; then | |
STEAMUSERID=`/usr/bin/osascript <<EOT | |
tell application "Finder" | |
activate | |
set myReply to text returned of (display dialog "What is your Steam User ID?" default answer "") | |
end tell | |
EOT` | |
fi | |
fi | |
echo "steam user id is now $STEAMUSERID" | |
#location of the binary | |
GAMEROOT="$HOME/Library/Application Support/Steam/SteamApps/$STEAMUSERID/half-life 2" | |
if [ ! -x "${GAMEROOT}"/hl2_osx ]; then | |
# echo "game binary not found" | |
osascript -e 'tell application "Dock" | |
activate | |
display dialog "Script cannot find the hl2_osx binary. Is HL2 installed?" buttons "OK" default button 1 with title "cannot find hl2_osx" with icon stop | |
end tell' | |
exit -1 | |
fi | |
echo "game located in $GAMEROOT" | |
# create symlinks from this .app bundle to the relevant locations in Steam | |
echo "(re)creating symlinks" | |
touch "$HOME/Library/Application Support/Steam/SteamApps/sourcemods/$GAME" | |
touch "$GAMEROOT/$GAME" | |
rm "$HOME/Library/Application Support/Steam/SteamApps/sourcemods/$GAME" | |
rm "$GAMEROOT/$GAME" | |
ln -s "$GAME_FILES" "$HOME/Library/Application Support/Steam/SteamApps/sourcemods/$GAME" | |
ln -s "$GAME_FILES" "$GAMEROOT/$GAME" | |
#set the dynamic library load path | |
if [ ! -d "${STEAMAPPLOCATION}"/Steam.app/Contents/MacOS/osx32 ]; then | |
#echo "Steam app not found" | |
osascript -e 'tell application "Dock" | |
activate | |
display dialog "Script cannot find the Steam Application Bundle.\n\nIf your Steam is somewhere other than /Applications, Please edit the run.sh script manually." buttons "OK" default button 1 with title "cannot find Steam" with icon stop | |
end tell' | |
exit -1 | |
fi | |
export DYLD_LIBRARY_PATH="${GAMEROOT}"/bin:"${STEAMAPPLOCATION}"/Steam.app/Contents/MacOS/osx32 | |
################################################ | |
#check that the "$GAME" folder exists | |
if [ ! -f "${GAMEROOT}"/$GAME/gameinfo.txt ]; then | |
echo "$GAME folder missing" | |
ERRMESG="Script cannot find the $GAME folder/symlink..." | |
osascript -e 'tell application "Dock"' \ | |
-e 'activate' \ | |
-e "display dialog \"$ERRMESG\" buttons \"OK\" default button 1 with title \"$GAME folder missing\" with icon stop" \ | |
-e 'end tell' | |
exit -1 | |
fi | |
# launch the game ############################# | |
#increase number of open files allowed (default 256) | |
ulimit -n 2048 | |
cd "${GAMEROOT}" | |
if [ -z `ps -A -o comm | grep Steam.app/Contents/MacOS/osx32/steam` ]; then | |
#Steam is NOT running, so start it first | |
# osascript -e 'tell application "Dock" | |
# activate | |
# display dialog "The Stanley Parable needs to have Steam running in the background first... Starting it now" buttons "OK" default button 1 with title "Steam not running" with icon caution | |
# end tell' | |
# "main" is whatever your favorite screen is set to | |
open steam://open/main | |
sleep 15 | |
fi | |
#echo "everything is ok, launch the game" | |
./hl2_osx -steam -game $GAME | |
Note that this loaded and played the Tram ride fine, but then I was stuck in the Tram once it stopped at sector C :( | |
I'm pretty sure you could adapt this to work with other Source games as the base, but I use half life 2 (in other words install that first) |
Just downloaded black mesa for windows and placed bms folder inside steam half life 2 folder.
Created bms.sh
It is trying to load and even show blurred main menu background but then crash.
With your script It cant even try to start at all stopping at
(re)creating symlinks
49:286: execution error: Dock got an error: No user interaction allowed. (-1713)...
`#!/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)
#determine platform
UNAME=uname
if [ "$UNAME" == "Darwin" ]; then
prepend our lib path to LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH="${GAMEROOT}"/bin:$DYLD_LIBRARY_PATH
elif [ "$UNAME" == "Linux" ]; then
prepend our lib path to LD_LIBRARY_PATH
export LD_LIBRARY_PATH="${GAMEROOT}"/bin:$LD_LIBRARY_PATH
fi
if [ -z $GAMEEXE ]; then
GAMEEXE=hl2_osx
fi
ulimit -n 2048
export __GL_THREADED_OPTIMIZATIONS=1
and launch the game
cd "$GAMEROOT"
exec "$GAMEROOT/$GAMEEXE" -steam -game bms &`
Well, it works. But like you said, scripted sequences mostly fail and most of the AI characters are missing. I tried other levels using
changelevel
.If we had the Source SDK Base 2007 on OS X it would probably run fine.
I also tried running the mod on top of other games (Episode One and Two, HL2:DM).