mirror of
https://github.com/datajerk/gameserverclient.git
synced 2024-06-09 05:29:29 +00:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
033761b6dc | ||
|
1189f9f131 | ||
|
da7d49824f | ||
|
3eff7c4e66 | ||
|
9164854f4c | ||
|
fc3fddec2f | ||
|
09e1e74cd4 | ||
|
5ab144f35d | ||
|
1ecafa4a7d | ||
|
257c3242d5 | ||
|
b217a0694a | ||
|
c1e133ec06 | ||
|
42224a48b3 | ||
|
b4639b0264 | ||
|
d3f15b9c5e | ||
|
92f183f045 | ||
|
b7b32ec993 | ||
|
1351d7ef60 | ||
|
06a8fc715f | ||
|
3730953d66 | ||
|
be216e45cc | ||
|
4bb916265b | ||
|
c78a4ce0e9 | ||
|
915c217b56 | ||
|
18dcf4247a |
13
Makefile
13
Makefile
|
@ -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
|
||||
|
||||
|
|
54
README.md
54
README.md
|
@ -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
BIN
c_ballblazer_game.tiff
Normal file
Binary file not shown.
BIN
c_ballblazer_loading.tiff
Normal file
BIN
c_ballblazer_loading.tiff
Normal file
Binary file not shown.
BIN
c_ballblazer_piratesplash.tiff
Normal file
BIN
c_ballblazer_piratesplash.tiff
Normal file
Binary file not shown.
BIN
c_ballblazer_qrcode.tiff
Normal file
BIN
c_ballblazer_qrcode.tiff
Normal file
Binary file not shown.
BIN
c_ballblazer_selected.tiff
Normal file
BIN
c_ballblazer_selected.tiff
Normal file
Binary file not shown.
BIN
c_gameserverdisk_mainscreen.tiff
Normal file
BIN
c_gameserverdisk_mainscreen.tiff
Normal file
Binary file not shown.
BIN
c_gameserverdisk_splash.tiff
Normal file
BIN
c_gameserverdisk_splash.tiff
Normal file
Binary file not shown.
18
decodeanddownload.sh
Executable file
18
decodeanddownload.sh
Executable 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
72
demo.sh
Executable 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"'
|
||||
|
|
@ -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
99
quick.scrp
Normal 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
72
quick.sh
Executable 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
141
test.scrp
Normal 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
37
test.sh
Executable 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
|
Loading…
Reference in New Issue
Block a user