Compare commits

...

25 Commits
v1.1 ... master

Author SHA1 Message Date
Egan Ford
033761b6dc added beer run 2021-11-18 20:30:59 -07:00
Egan Ford
1189f9f131 minor bug in quick.sh title output 2020-04-21 17:31:37 -06:00
Egan Ford
da7d49824f new game updates 2020-04-17 00:18:50 -06:00
Egan Ford
3eff7c4e66 added games, fixed tests 2020-04-14 13:25:18 -06:00
Egan Ford
9164854f4c menu changes due to mroe games 2020-03-28 17:43:57 -06:00
Egan Ford
fc3fddec2f fixed test for added games 2020-03-24 14:57:42 -06:00
Egan Ford
09e1e74cd4 replaced zxing with zbarimg 2020-03-16 10:02:24 -06:00
Egan Ford
5ab144f35d added apple panic keyboard 2020-03-12 14:39:53 -06:00
Egan Ford
1ecafa4a7d sort bugs fixed 2020-03-12 14:12:38 -06:00
Egan Ford
257c3242d5 proper sorting, been a prob for a while 2020-03-12 09:53:46 -06:00
Egan Ford
b217a0694a README update 2017-06-03 15:25:50 -06:00
Egan Ford
c1e133ec06 README update 2017-06-03 15:24:38 -06:00
Egan Ford
42224a48b3 README update 2017-06-03 15:21:45 -06:00
Egan Ford
b4639b0264 minor refactoring 2017-06-03 15:20:36 -06:00
Egan Ford
d3f15b9c5e minor refactoring, timing 2017-06-03 15:09:28 -06:00
Egan Ford
92f183f045 minor refactoring, timing 2017-06-03 14:59:40 -06:00
Egan Ford
b7b32ec993 README updates 2017-06-03 14:36:12 -06:00
Egan Ford
1351d7ef60 quick and demo tests actually read qr code from screen 2017-06-03 14:34:37 -06:00
Egan Ford
06a8fc715f timing updates, added demo.sh (reg speed) 2017-06-03 12:56:07 -06:00
Egan Ford
3730953d66 ajusted volume and tape delay 2017-06-02 15:37:36 -06:00
Egan Ford
be216e45cc added automated quick tests 2017-06-01 17:20:54 -06:00
Egan Ford
4bb916265b added automated tests 2017-06-01 13:45:22 -06:00
Egan Ford
c78a4ce0e9 added automated tests 2017-06-01 13:43:15 -06:00
Egan Ford
915c217b56 changed instructions 2017-06-01 12:41:25 -06:00
Egan Ford
18dcf4247a (c) bump 2017-06-01 08:33:57 -06:00
16 changed files with 503 additions and 9 deletions

View File

@ -12,20 +12,17 @@ qrbytes: qrbytes.c
qrcodes.inc: qrcodes.pl qrbytes
curl -sL http://asciiexpress.net/gameserver/links.html | \
sort | \
sort -t\" -k 5 | \
./qrcodes.pl >$@
titles.inc: titles.pl
curl -sL http://asciiexpress.net/gameserver/links.html | \
sort | \
sort -t\" -k 5 | \
./titles.pl >$@
gameserverclient: gameserverclient.s titles.inc qrcodes.inc
$(CL) $(CL_FLAGS) $<
clean:
rm -f qrbytes *.o *.lst *.dsk *.inc *.textpage gameserverclient
gameserverclient.textpage: Makefile
( \
figlet -c -w 40 -f slant "Apple ][ Game Server Online!" | \
@ -39,3 +36,9 @@ gameserverclient.textpage: Makefile
gameserverclient.dsk: gameserverclient.textpage gameserverclient
$(C2D) -t gameserverclient.textpage gameserverclient,800 $@
test: c_ballblazer_game.tiff c_ballblazer_loading.tiff c_ballblazer_piratesplash.tiff c_ballblazer_qrcode.tiff c_ballblazer_selected.tiff c_gameserverdisk_mainscreen.tiff c_gameserverdisk_splash.tiff test.sh test.scrp all
./test.sh
clean:
rm -f qrbytes *.o *.lst *.dsk *.inc *.textpage gameserverclient *.aif

View File

@ -24,7 +24,6 @@ Download <https://github.com/datajerk/gameserverclient/archive/master.zip> and e
- `perl`
- `gcc`
- `figlet`
- `curl`
#### Build
@ -32,3 +31,56 @@ Download <https://github.com/datajerk/gameserverclient/archive/master.zip> and e
make
```
### Test
#### Prerequisites
- MacOS
- Virtual ][ 9.2
- `curl`
- `zbarimg` (Google for `zbar-0.10.tar.bz2`)
- `tifftopnm` and `pnmtojpeg` from Netpbm (<http://netpbm.sourceforge.net/>)
- `sox` and `soxi` from SoX (<http://sox.sourceforge.net/>)
```
make test
```
#### Ad Hoc Testing
```
./quick.sh [search string or "random"]
./demo.sh [search string or "random"]
```
Example Ad Hoc Session:
```
$ ./demo.sh alien
1 Alien Ambush
2 Alien Downpour
3 Alien Game
4 Alien Munchies
5 Alien Typhoon
pick one: 2
Alien Downpour...LAUNCHED
```
Ad hoc example session video output: <http://asciiexpress.net/files/gameserverclienttest.mp4>
### Appendix
#### Zbar MacOS Build
```
sudo port install imagemagick qrencode
tar zxvf zbar-0.10.tar.bz2
cd zbar-0.10
./configure --disable-video --without-python --without-gtk --without-qt --with-libiconv-prefix=/opt/local
make -j
sudo make install
```

BIN
c_ballblazer_game.tiff Normal file

Binary file not shown.

BIN
c_ballblazer_loading.tiff Normal file

Binary file not shown.

Binary file not shown.

BIN
c_ballblazer_qrcode.tiff Normal file

Binary file not shown.

BIN
c_ballblazer_selected.tiff Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

18
decodeanddownload.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
set -e
tifftopnm <$1 2>/dev/null | pnmtojpeg >decode.jpg
# zxing version
# needs better error handling, zxing returns true on fail, test with Stellar Invaders
#URL=$(zxing decode.jpg && rm -f decode.jpg)
# zbar version, better
URL=$(zbarimg -q decode.jpg && rm -f decode.jpg)
URL=$(echo $URL | sed 's/QR-Code://')
curl -sL $URL | sox - quick.aif
soxi -D quick.aif

72
demo.sh Executable file
View File

@ -0,0 +1,72 @@
#!/bin/bash
GAME="$1"
DEMO=0
BASENAME=$(basename $0)
if [ "$BASENAME" = "demo.sh" ]
then
DEMO=1
fi
if [ "$GAME" = "random" ]
then
ITEMS=$(curl -sL http://asciiexpress.net/gameserver/links.html | wc -l)
LINE=$(( RANDOM % ITEMS + 1))
else
ITEMS=$(curl -sL http://asciiexpress.net/gameserver/links.html | awk -F\" '{print $4}' | sort -f | grep -i "$GAME" | wc -l)
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 -f | 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 -f | grep -ni "$GAME" | head -$ITEM | tail -1 | awk -F: '{print $1}')
fi
DOWN=$((LINE - 1))
TITLE=$(curl -sL http://asciiexpress.net/gameserver/links.html | sort -f | head -$LINE | tail -1 | awk -F\" '{print $4}')
echo
echo -n "${TITLE}..."
if ! OUTPUT=$(
osascript quick.scrp \
gameserverclient.dsk \
c_gameserverdisk_splash.tiff $((5 + DEMO * 10)) \
c_gameserverdisk_mainscreen.tiff $((5 + DEMO * 10)) \
$DOWN \
$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,6 +1,6 @@
;;apple game server client
;; (c) 2012 Egan Ford (egan@sense.net)
;; (c) 2012, 2017 Egan Ford (egan@sense.net)
;; apple //e vectors
@ -659,9 +659,9 @@ rowhi: .byte $4,$4,$4,$4,$5,$5,$5,$5,$6,$6,$6,$6,$7,$7,$7,$7
title: .asciiz "Apple ][ Game Server Online! Client"
titleend:
ins1: .asciiz "Use the arrow keys to select then"
ins1: .asciiz "UP/DOWN to select, RETURN to launch"
ins1end:
ins2: .asciiz "[RETURN] to launch."
ins2: .asciiz "CTRL-RESET (or reboot) to return here"
ins2end:
ins3: .asciiz "Connect smartphone headphone jack to Apple //e cassette input jack (next to"
ins3end:

99
quick.scrp Normal file
View File

@ -0,0 +1,99 @@
on run argv
set my_path to (system attribute "PWD") & "/"
set my_disk to item 1 of argv
set my_screen1 to item 2 of argv
set my_timeout1 to item 3 of argv
set my_screen2 to item 4 of argv
set my_timeout2 to item 5 of argv
set my_down to item 6 of argv as number
set my_demo to item 7 of argv as number
-- tell application "/Applications/Virtual ][/7.6/Virtual ][.app"
tell application "Virtual ]["
activate
-- may need delay for this error: execution error: Virtual ][ got an error: Connection is invalid. (-609)
delay 1.5
-- Close all open machines
close every machine saving no
-- Create a new (AppleIIe)
set theMachine to (make new AppleIIe)
tell theMachine
-- Change to a color screen
set monochrome screen to false
set scanlines to true
set speaker volume to 0.50
-- load disk
insert my_path & my_disk into device "S6D1"
-- splash page
try
with timeout of my_timeout1 seconds
waiting until screen equals imagefile POSIX path of (my_path & my_screen1)
end timeout
on error
return "ERROR: TIMEOUT: Virtual ][ screen != " & my_screen1
end try
-- full speed ahead
if (my_demo = 0) then
set speed to maximum
end if
-- main screen
try
with timeout of my_timeout2 seconds
waiting until screen equals imagefile POSIX path of (my_path & my_screen2)
end timeout
on error
return "ERROR: TIMEOUT: Virtual ][ screen != " & my_screen2
end try
-- normal speed
set speed to regular
-- down arrow my_down times and return
repeat my_down times
type key down arrow
delay 0.03
end repeat
delay 0.5
type line ""
delay 1.0
-- get qr code
snap screen picture to POSIX path of (my_path & "quick.tiff") format tiff
-- get audio
do shell script "./decodeanddownload.sh quick.tiff"
set my_audiotime to the result as number
set my_audio to "quick.aif"
-- send audio
play my_path & my_audio on device "cassette recorder"
-- full speed ahead
if (my_demo = 0) then
-- delay to see post QR text loading screen
delay 1.0
set speed to maximum
-- will need to be ajusted based on speed of your mac
delay 1.5
-- normal speed
set speed to regular
end if
if (my_demo = 1) then
delay (my_audiotime + 1.0)
end if
-- eject tape
eject device "cassette recorder"
end tell
-- delay 0.5
-- close every machine saving no
-- quit
end tell
end run

72
quick.sh Executable file
View File

@ -0,0 +1,72 @@
#!/bin/bash
GAME="$1"
DEMO=0
BASENAME=$(basename $0)
if [ "$BASENAME" = "demo.sh" ]
then
DEMO=1
fi
if [ "$GAME" = "random" ]
then
ITEMS=$(curl -sL http://asciiexpress.net/gameserver/links.html | wc -l)
LINE=$(( RANDOM % ITEMS + 1))
else
ITEMS=$(curl -sL http://asciiexpress.net/gameserver/links.html | awk -F\" '{print $4}' | sort -f | grep -i "$GAME" | wc -l)
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 -f | 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 -f | grep -ni "$GAME" | head -$ITEM | tail -1 | awk -F: '{print $1}')
fi
DOWN=$((LINE - 1))
TITLE=$(curl -sL http://asciiexpress.net/gameserver/links.html | sort -f | head -$LINE | tail -1 | awk -F\" '{print $4}')
echo
echo -n "${TITLE}..."
if ! OUTPUT=$(
osascript quick.scrp \
gameserverclient.dsk \
c_gameserverdisk_splash.tiff $((5 + DEMO * 10)) \
c_gameserverdisk_mainscreen.tiff $((5 + DEMO * 10)) \
$DOWN \
$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"'

141
test.scrp Normal file
View File

@ -0,0 +1,141 @@
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
set my_screen1 to item 3 of argv
set my_timeout1 to item 4 of argv
set my_screen2 to item 5 of argv
set my_timeout2 to item 6 of argv
set my_screen3 to item 7 of argv
set my_timeout3 to item 8 of argv
set my_screen4 to item 9 of argv
set my_timeout4 to item 10 of argv
set my_screen5 to item 11 of argv
set my_timeout5 to item 12 of argv
set my_screen6 to item 13 of argv
set my_timeout6 to item 14 of argv
set my_screen7 to item 15 of argv
set my_timeout7 to item 16 of argv
tell application "Virtual ]["
activate
-- may need delay for this error: execution error: Virtual ][ got an error: Connection is invalid. (-609)
delay 1.5
-- Close all open machines
close every machine saving no
-- Create a new (AppleIIe)
set theMachine to (make new AppleIIe)
tell theMachine
-- Change to a color screen
set monochrome screen to false
set scanlines to true
set speaker volume to 0.25
-- load disk
insert my_path & my_disk into device "S6D1"
-- splash page
try
with timeout of my_timeout1 seconds
waiting until screen equals imagefile POSIX path of (my_path & my_screen1)
end timeout
on error
return "ERROR: TIMEOUT: Virtual ][ screen != " & my_screen1
end try
-- full speed ahead
set speed to maximum
-- main screen
try
with timeout of my_timeout2 seconds
waiting until screen equals imagefile POSIX path of (my_path & my_screen2)
end timeout
on error
return "ERROR: TIMEOUT: Virtual ][ screen != " & my_screen2
end try
delay 0.5
-- normal speed
set speed to regular
-- down arrow 23x and return
repeat 23 times
type key down arrow
delay 0.03
end repeat
-- ballblazer selected
try
with timeout of my_timeout3 seconds
waiting until screen equals imagefile POSIX path of (my_path & my_screen3)
end timeout
on error
return "ERROR: TIMEOUT: Virtual ][ screen != " & my_screen3
end try
delay 0.5
-- return on ballblazer
type line ""
-- qr code screen
try
with timeout of my_timeout4 seconds
waiting until screen equals imagefile POSIX path of (my_path & my_screen4)
end timeout
on error
return "ERROR: TIMEOUT: Virtual ][ screen != " & my_screen4
end try
delay 0.5
-- send audio
play my_path & my_audio on device "cassette recorder"
-- audio start screen
try
with timeout of my_timeout5 seconds
waiting until screen equals imagefile POSIX path of (my_path & my_screen5)
end timeout
on error
return "ERROR: TIMEOUT: Virtual ][ screen != " & my_screen5
end try
-- full speed ahead
set speed to maximum
-- pirate splash page
try
with timeout of my_timeout6 seconds
waiting until screen equals imagefile POSIX path of (my_path & my_screen6)
end timeout
on error
return "ERROR: TIMEOUT: Virtual ][ screen != " & my_screen6
end try
delay 1.0
-- normal speed
set speed to regular
-- eject tape
eject device "cassette recorder"
-- press return
type line ""
-- game screen
try
with timeout of my_timeout7 seconds
waiting until screen equals imagefile POSIX path of (my_path & my_screen7)
end timeout
on error
return "ERROR: TIMEOUT: Virtual ][ screen != " & my_screen7
end try
end tell
delay 0.5
close every machine saving no
quit
end tell
end run

37
test.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
GAME_URL=http://asciiexpress.net/gameserver/ballblazer.qr.wav
curl -sL $GAME_URL | sox - test.aif
echo
echo -n "Emulator Test..."
if ! OUTPUT=$(
osascript test.scrp \
gameserverclient.dsk \
test.aif \
c_gameserverdisk_splash.tiff 5 \
c_gameserverdisk_mainscreen.tiff 5 \
c_ballblazer_selected.tiff 5 \
c_ballblazer_qrcode.tiff 5 \
c_ballblazer_loading.tiff 5 \
c_ballblazer_piratesplash.tiff $((15 + $(soxi -D test.aif | awk -F. '{print $1}') )) \
c_ballblazer_game.tiff 10 \
)
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 test.aif
echo PASSED
echo