#!/bin/sh


echo . "MENU ......F12"
echo . "ECRAN .....F11"
echo . "QUITTER ...CMD Q RETURN"
echo . "DISK ......CMD D"
echo . "CURS/JOY ..CMD J"
echo . "SAVE/LOAD..CMD K/L"
echo . "SOURIS ....CMD M"


mypath="`dirname "$0"`"
rsrcpath="`dirname "$mypath"`"/Resources
Appdir="`dirname "$mypath"`"
Appdir="`dirname "$Appdir"`"
Appdir="`dirname "$Appdir"`"
AtariST="$mypath/AtariST"


#FullScreen
# image adapte au plein ecran
#fond=hatarifondf.pdf
#if test -e "$rsrcpath/$fondf" ; then 
#open -a Preview "$rsrcpath/$fond"
#FullScreen
#/usr/bin/osascript -e 'tell application "System Events"' -e 'tell process "Preview"' -e 'set frontmost to true' -e 'keystroke "f" using {command down, shift down}' -e "end tell" -e "end tell"
#fi

#Fentre
# image adapte mode window
fond=hatarifondw.pdf
if test -e "$rsrcpath/$fond" ; then 
	open -a Preview "$rsrcpath/$fond"
	#WindowMax
	/usr/bin/osascript  -e 'tell application "Finder"' -e 'set deskSize to bounds of window of desktop' -e 'end tell' -e 'set maxW to item 3 of deskSize' -e 'set maxH to item 4 of deskSize'  -e 'tell application "System Events" to tell application process "Preview"' -e "tell window \"$fond\""  -e 'set {size, position} to {{maxW, maxH}, {0, 0}}' -e 'end tell' -e 'end tell'
	#Windowfixe
	#/usr/bin/osascript -e 'tell application "System Events" to tell application process "Preview"' -e "tell window \"$fond\"" -e 'set {size, position} to {{1432, 872}, {4, 0}}' -e 'end tell' -e 'end tell'
fi


cd "$AtariST"
if test -e "$rsrcpath/ScriptRelSav5.command" ; then 
	/bin/bash "$rsrcpath/ScriptRelSav5.command"
fi
"Hatari.app/Contents/MacOS/Hatari" -c CONFIGS/app.cfg 