timing updates, added demo.sh (reg speed)

This commit is contained in:
Egan Ford 2017-06-03 12:56:07 -06:00
parent 3730953d66
commit 06a8fc715f
3 changed files with 112 additions and 9 deletions

89
demo.sh Executable file
View File

@ -0,0 +1,89 @@
#!/bin/bash
GAME="$1"
DEMO=0
BASENAME=$(basename $0)
if [ "$BASENAME" = "demo.sh" ]
then
DEMO=1
fi
RAND=0
if [ "$GAME" = "random" ]
then
GAME=""
RAND=1
fi
ITEMS=$(curl -sL http://asciiexpress.net/gameserver/links.html | awk -F\" '{print $4}' | sort | grep -i "$GAME" | wc -l)
if (( RAND == 0 ))
then
if (( ITEMS == 0 ))
then
echo "game $GAME not found" >&2
exit 1
fi
curl -sL http://asciiexpress.net/gameserver/links.html | awk -F\" '{print $4}' | sort | grep -i "$GAME" | nl -nln
ITEM=1
if (( ITEMS > 1 ))
then
echo
echo -n "pick one: "
read ITEM
test -z "$ITEM" && ITEM=1
fi
LINE=$(curl -sL http://asciiexpress.net/gameserver/links.html | awk -F\" '{print $4}' | sort | grep -ni "$GAME" | head -$ITEM | tail -1 | awk -F: '{print $1}')
else
LINE=$(( RANDOM % ITEMS + 1))
fi
GAME=$(curl -sL http://asciiexpress.net/gameserver/links.html | sort | head -$LINE | tail -1 | awk -F\" '{print $4 "," $6}' | sed 's/.html$/.qr.wav/')
DOWN=$((LINE - 1))
TITLE=$(echo $GAME | awk -F, '{print $1}')
GAME_URL=$(echo $GAME | awk -F, '{print "http://asciiexpress.net/gameserver/" $2}')
rm -f quick.aif
echo
echo -n "Downloading $GAME_URL"
echo
curl -sL $GAME_URL | sox - quick.aif
echo
AUDIOTIME=$(soxi -D quick.aif)
if ! OUTPUT=$(
osascript quick.scrp \
gameserverclient.dsk \
quick.aif \
c_gameserverdisk_splash.tiff $((5 + DEMO * 10)) \
c_gameserverdisk_mainscreen.tiff $((5 + DEMO * 10)) \
$DOWN \
$( dc <<< "$DEMO $AUDIOTIME * 1.5 + p" ) \
$DEMO
)
then
echo FAILED
exit 1
fi
if echo $OUTPUT | grep ERROR >/dev/null 2>&1
then
echo FAILED
echo $OUTPUT
echo
exit 1
fi
rm -f quick.aif
echo LAUNCHED
echo
#xdotool windowfocus $WINDOWID 2>/dev/null
#osascript -e 'activate application "XQuartz"'

View File

@ -1,5 +1,4 @@
on run argv
set my_path to (system attribute "PWD") & "/"
set my_disk to item 1 of argv
set my_audio to item 2 of argv
@ -8,6 +7,8 @@ on run argv
set my_screen2 to item 5 of argv
set my_timeout2 to item 6 of argv
set my_down to item 7 of argv
set my_tapedelay to item 8 of argv
set my_demo to item 9 of argv
tell application "Virtual ]["
activate
@ -36,7 +37,9 @@ on run argv
end try
-- full speed ahead
set speed to maximum
if (my_demo = "0") then
set speed to maximum
end if
-- main screen
try
@ -63,8 +66,10 @@ on run argv
play my_path & my_audio on device "cassette recorder"
delay 1.0
-- full speed ahead
set speed to maximum
delay 1.5
if (my_demo = "0") then
set speed to maximum
end if
delay my_tapedelay
-- normal speed
set speed to regular

View File

@ -1,6 +1,13 @@
#!/bin/bash
GAME="$1"
DEMO=0
BASENAME=$(basename $0)
if [ "$BASENAME" = "demo.sh" ]
then
DEMO=1
fi
RAND=0
if [ "$GAME" = "random" ]
@ -15,7 +22,7 @@ if (( RAND == 0 ))
then
if (( ITEMS == 0 ))
then
echo "no $GAME game found" >&2
echo "game $GAME not found" >&2
exit 1
fi
@ -48,15 +55,17 @@ echo
curl -sL $GAME_URL | sox - quick.aif
echo
echo -n Launching $TITLE...
AUDIOTIME=$(soxi -D quick.aif)
if ! OUTPUT=$(
osascript quick.scrp \
gameserverclient.dsk \
quick.aif \
c_gameserverdisk_splash.tiff 5 \
c_gameserverdisk_mainscreen.tiff 5 \
$DOWN
c_gameserverdisk_splash.tiff $((5 + DEMO * 10)) \
c_gameserverdisk_mainscreen.tiff $((5 + DEMO * 10)) \
$DOWN \
$( dc <<< "$DEMO $AUDIOTIME * 1.5 + p" ) \
$DEMO
)
then
echo FAILED