#!/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"

################# A COMPLETER AU CHOIX PAR ###################
#		Image-disquette adf insere dans le lecteur 1
#   --disk-a chemin   --disk-b chemin
#    -d chemin --harddive chemin
#	--memstate fichier  Charge une sauvegarde d'tat de l'Atari
################################################################

#FullScreen
# image adapte au plein ecran
#fond=hatarifondf.pdf
#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"

#Fentre
# image adapte mode window
fond=hatarifondw.pdf
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'


cd "$AtariST"
"Hatari.app/Contents/MacOS/Hatari" -c CONFIGS/app.cfg --memstate "$AtariST/SAUVEGARDES/hatari+" &  /usr/bin/osascript -e "delay 2" -e 'tell application "System Events"' -e 'tell process "Hatari"' -e 'set frontmost to true' -e "key code {36, 36, 111, 36}" -e "end tell" -e "end tell" 