From 67f1ec0694e554f4159ea89b3198b775510339c9 Mon Sep 17 00:00:00 2001 From: 4am Date: Thu, 21 Oct 2021 13:04:01 -0400 Subject: [PATCH] one file to rule them all --- Makefile | 67 +++++++++++++++++++++------------------ bin/buildindexedfile.sh | 18 +++++++---- res/DEMO/ALIEN.DOWNPOUR | Bin 138 -> 140 bytes res/DEMO/CHOPLIFTER | Bin 102 -> 104 bytes res/DEMO/NIGHT.STALKER | Bin 283 -> 285 bytes res/DEMO/SNEAKERS | Bin 103 -> 105 bytes res/DEMO/SPACE.QUARKS | Bin 165 -> 167 bytes res/DEMO/TB | Bin 146 -> 148 bytes res/DEMO/WAVY.NAVY | Bin 104 -> 106 bytes res/_FileInformation.txt | 9 +----- src/constants.a | 8 ++--- src/glue.launch.a | 2 +- src/prodos.path.a | 32 +++++++------------ 13 files changed, 65 insertions(+), 71 deletions(-) diff --git a/Makefile b/Makefile index 2a15b8991..6fc206a36 100644 --- a/Makefile +++ b/Makefile @@ -34,43 +34,53 @@ dsk: asm cp res/PREFS.CONF build/PREFS.CONF >>build/log bin/padto.sh 512 build/PREFS.CONF >>build/log # -# precompute OKVS data structure for mega-attract mode configuration file +# precompute binary data structure for mega-attract mode configuration file # bin/buildokvs.sh "res/ATTRACT.CONF" "build/ATTRACT.IDX" >>build/log # -# precompute FX and DFX indexes and merged data files containing multiple -# graphic effects in a single file (loaded at runtime by LoadIndexedFile()) -# - bin/buildindexedfile.sh -p "res/FX.CONF" "build/FX.IDX" "build/FX.ALL" "build/FX.INDEXED" >>build/log - bin/buildindexedfile.sh -a -p "res/DFX.CONF" "build/DFX.IDX" "build/FX.ALL" "build/FX.INDEXED" >>build/log -# -# substitute special characters in help text and other pages that will be -# drawn with DrawPage() +# precompute binary data structure and substitute special characters +# in game help and other all-text pages # bin/converthelp.sh res/HELPTEXT build/HELPTEXT >>build/log bin/converthelp.sh res/CREDITS build/CREDITS >>build/log for f in res/GAMEHELP/*; do \ - bin/converthelp.sh "$$f" build/GAMEHELP/"$$(basename $$f)" >>build/log; \ + bin/converthelp.sh "$$f" build/GAMEHELP/"$$(basename $$f)" >>build/log; \ done # -# precompute indexed files for game help, slideshow configuration, -# mini-attract mode configuration, and prelaunch files +# create a sorted list of game filenames, without metadata or display names # awk -F "," '!/^#/ { print $$2 }' < res/GAMES.CONF | awk -F "=" '{ print $$1 }' | sort > build/GAMES.SORTED - bin/buildindexedfile.sh -p "build/GAMES.SORTED" "build/GAMEHELP.IDX" "build/GAMEHELP.ALL" "build/GAMEHELP" >>build/log +# +# precompute indexed files for prelaunch +# note: prelaunch must be first in TOTAL.DATA due to a hack in LoadStandardPrelaunch +# note 2: these can not be padded because they are loaded at $0106 and padding would clobber the stack +# + bin/buildindexedfile.sh "build/GAMES.SORTED" "build/PRELAUNCH.IDX" "build/TOTAL.DATA" "build/PRELAUNCH.INDEXED" >>build/log +# +# precompute indexed files for game help +# + bin/buildindexedfile.sh -p -a "build/GAMES.SORTED" "build/GAMEHELP.IDX" "build/TOTAL.DATA" "build/GAMEHELP" >>build/log +# +# precompute indexed files for slideshows +# (for f in res/SS/*; do \ bin/buildokvs.sh "$$f" "build/SS/$$(basename $$f)"; \ echo "$$(basename $$f)"; \ done) > build/SSDIR - bin/buildindexedfile.sh -p "build/SSDIR" "build/SLIDESHOW.IDX" "build/SLIDESHOW.ALL" "build/SS" >>build/log + bin/buildindexedfile.sh -p -a "build/SSDIR" "build/SLIDESHOW.IDX" "build/TOTAL.DATA" "build/SS" >>build/log (for f in res/ATTRACT/*; do \ bin/buildokvs.sh "$$f" "build/ATTRACT/$$(basename $$f)"; \ echo "$$(basename $$f)"; \ done) > build/ATTRACTDIR - bin/buildindexedfile.sh -p "build/ATTRACTDIR" "build/MINIATTRACT.IDX" "build/MINIATTRACT.ALL" "build/ATTRACT" >>build/log - bin/buildindexedfile.sh "build/GAMES.SORTED" "build/PRELAUNCH.IDX" "build/PRELAUNCH.ALL" "build/PRELAUNCH.INDEXED" >>build/log + bin/buildindexedfile.sh -p -a "build/ATTRACTDIR" "build/MINIATTRACT.IDX" "build/TOTAL.DATA" "build/ATTRACT" >>build/log +# +# precompute indexed files for graphic effects +# + bin/buildindexedfile.sh -p -a "res/FX.CONF" "build/FX.IDX" "build/TOTAL.DATA" "build/FX.INDEXED" >>build/log + bin/buildindexedfile.sh -p -a "res/DFX.CONF" "build/DFX.IDX" "build/TOTAL.DATA" "build/FX.INDEXED" >>build/log # # precompute indexed files for HGR action screenshots +# note: these can not be padded because they are compressed and the decompressor needs the exact size # (for f in res/ACTION.HGR/[ABCD]*; do echo "$$(basename $$f)"; done) > build/ACTIONHGR0 (for f in res/ACTION.HGR/[EFGH]*; do echo "$$(basename $$f)"; done) > build/ACTIONHGR1 @@ -79,20 +89,21 @@ dsk: asm (for f in res/ACTION.HGR/[QRST]*; do echo "$$(basename $$f)"; done) > build/ACTIONHGR4 (for f in res/ACTION.HGR/[UVWX]*; do echo "$$(basename $$f)"; done) > build/ACTIONHGR5 (for f in res/ACTION.HGR/[YZ]*; do echo "$$(basename $$f)"; done) > build/ACTIONHGR6 - bin/buildindexedfile.sh "build/ACTIONHGR0" "build/HGR0.IDX" "build/HGR.ALL" "res/ACTION.HGR" >>build/log - bin/buildindexedfile.sh -a "build/ACTIONHGR1" "build/HGR1.IDX" "build/HGR.ALL" "res/ACTION.HGR" >>build/log - bin/buildindexedfile.sh -a "build/ACTIONHGR2" "build/HGR2.IDX" "build/HGR.ALL" "res/ACTION.HGR" >>build/log - bin/buildindexedfile.sh -a "build/ACTIONHGR3" "build/HGR3.IDX" "build/HGR.ALL" "res/ACTION.HGR" >>build/log - bin/buildindexedfile.sh -a "build/ACTIONHGR4" "build/HGR4.IDX" "build/HGR.ALL" "res/ACTION.HGR" >>build/log - bin/buildindexedfile.sh -a "build/ACTIONHGR5" "build/HGR5.IDX" "build/HGR.ALL" "res/ACTION.HGR" >>build/log - bin/buildindexedfile.sh -a "build/ACTIONHGR6" "build/HGR6.IDX" "build/HGR.ALL" "res/ACTION.HGR" >>build/log + bin/buildindexedfile.sh -a "build/ACTIONHGR0" "build/HGR0.IDX" "build/TOTAL.DATA" "res/ACTION.HGR" >>build/log + bin/buildindexedfile.sh -a "build/ACTIONHGR1" "build/HGR1.IDX" "build/TOTAL.DATA" "res/ACTION.HGR" >>build/log + bin/buildindexedfile.sh -a "build/ACTIONHGR2" "build/HGR2.IDX" "build/TOTAL.DATA" "res/ACTION.HGR" >>build/log + bin/buildindexedfile.sh -a "build/ACTIONHGR3" "build/HGR3.IDX" "build/TOTAL.DATA" "res/ACTION.HGR" >>build/log + bin/buildindexedfile.sh -a "build/ACTIONHGR4" "build/HGR4.IDX" "build/TOTAL.DATA" "res/ACTION.HGR" >>build/log + bin/buildindexedfile.sh -a "build/ACTIONHGR5" "build/HGR5.IDX" "build/TOTAL.DATA" "res/ACTION.HGR" >>build/log + bin/buildindexedfile.sh -a "build/ACTIONHGR6" "build/HGR6.IDX" "build/TOTAL.DATA" "res/ACTION.HGR" >>build/log # # precompute indexed files for SHR artwork +# note: these can not be padded because they are compressed and the decompressor needs the exact size # (for f in res/ARTWORK.SHR/*; do \ echo "$$(basename $$f)"; \ done) > build/ARTWORKDIR - bin/buildindexedfile.sh "build/ARTWORKDIR" "build/ARTWORK.IDX" "build/ARTWORK.ALL" "res/ARTWORK.SHR" >>build/log + bin/buildindexedfile.sh -a "build/ARTWORKDIR" "build/ARTWORK.IDX" "build/TOTAL.DATA" "res/ARTWORK.SHR" >>build/log # # create _FileInformation.txt files for subdirectories # @@ -107,6 +118,7 @@ dsk: asm # add everything to the disk # for f in \ + build/TOTAL.DATA \ res/TITLE \ res/COVER \ res/HELP \ @@ -117,17 +129,11 @@ dsk: asm build/ATTRACT.IDX \ build/FX.IDX \ build/DFX.IDX \ - build/FX.ALL \ build/GAMEHELP.IDX \ - build/GAMEHELP.ALL \ build/SLIDESHOW.IDX \ - build/SLIDESHOW.ALL \ build/MINIATTRACT.IDX \ - build/MINIATTRACT.ALL \ build/PRELAUNCH.IDX \ - build/PRELAUNCH.ALL \ build/ARTWORK.IDX \ - build/ARTWORK.ALL \ build/HGR0.IDX \ build/HGR1.IDX \ build/HGR2.IDX \ @@ -135,7 +141,6 @@ dsk: asm build/HGR4.IDX \ build/HGR5.IDX \ build/HGR6.IDX \ - build/HGR.ALL \ res/DECRUNCH \ res/JOYSTICK \ res/Finder.Data \ diff --git a/bin/buildindexedfile.sh b/bin/buildindexedfile.sh index 1b963bc28..decba6ef7 100755 --- a/bin/buildindexedfile.sh +++ b/bin/buildindexedfile.sh @@ -12,6 +12,7 @@ pad=false append=false +standardoffset=0 standardsize=0 while getopts ":ap" opt; do case $opt in @@ -23,14 +24,19 @@ while getopts ":ap" opt; do done shift $((OPTIND-1)) -if [ -f "$4"/STANDARD ]; then - cp "$4"/STANDARD "$3" - standardsize=$(wc -c < "$3") -elif [ "$append" = false ]; then +if [ "$append" = false ]; then rm -f "$3" fi touch "$3" +# if there is a file called "STANDARD" in the input directory, add it now +# because we will reuse it for any files that don't exist +if [ -f "$4"/STANDARD ]; then + standardoffset=$(wc -c < "$3") + standardsize=$(wc -c < "$4/STANDARD") + cat "$4"/STANDARD >> "$3" +fi + # make temp file with list of lines that contain keys records=$(mktemp) awk '!/^$|^#|^\[/ { print }' < "$1" > "$records" @@ -63,8 +69,8 @@ source=$(mktemp) echo "$size" fi cat "$4/$key" >> "$3" # append this file to the end of the merged data file - else # if file does not exist, reuse placeholder at offset 0 - echo "!be24 0" + else # if file does not exist, reuse STANDARD file + echo "!be24 $standardoffset" echo "!le16 $standardsize" fi done < "$records") > "$source" diff --git a/res/DEMO/ALIEN.DOWNPOUR b/res/DEMO/ALIEN.DOWNPOUR index 39aee5b234abf8ac6c7c309da857d4a0213c0ce3..190a2d7bc801aafa0921c71cf8494f2086d3147a 100755 GIT binary patch delta 31 lcmeBT>|qqwX+8i%3fph5WxV3CmidauB8Ilml{phdO99At4FdoG delta 29 jcmeBS>|zwvX+8i%3fph5WxV3CmidauB8HV&6U9pbuB{9v diff --git a/res/DEMO/CHOPLIFTER b/res/DEMO/CHOPLIFTER index 57804456802e4cd0d3509a8374c7e095f9bfd655..c5d17cf327e89188c5f03a56cd91ef0280849680 100755 GIT binary patch delta 29 jcmYex5Z7rw07MGgZ?9#%;<1+bipL^`w$POU6Ga07z5@(- delta 27 hcmc~u6V+)x07MGgZ?9#%;<1+bipL^`m3|Y&0|BJV3!DG| diff --git a/res/DEMO/NIGHT.STALKER b/res/DEMO/NIGHT.STALKER index 518f264ce7643c911fe20756e54ed42851ca57ba..178eb0a3b9c4d7736d5a3ba31311dd8973bcf90c 100755 GIT binary patch delta 36 rcmbQuG?z(Sr}+R7DQv&JmhpcyBnF=00V7l#k0 delta 34 pcmbQsG@D6Or}+R7DQv&JmhpB8UH||9 diff --git a/res/DEMO/WAVY.NAVY b/res/DEMO/WAVY.NAVY index 3ef8cd2c4d6a2dcea76001a7e51212c4997bf653..25449f7e47a76af3147a456dca5b426e4d0e6eb5 100644 GIT binary patch delta 37 tcmd1EnjkLQ7P``J0kgvU{~5i^S2B7TudGbyjSWy>;8?`EH)W!c82}}W4%`3$ delta 35 rcmd1Gm>@2_(q{p)!u$Ujz06lKdKs^*Oz4dbP+;I##JV?WqKO#*2H6e$ diff --git a/res/_FileInformation.txt b/res/_FileInformation.txt index 80e6e977a..148f4017d 100644 --- a/res/_FileInformation.txt +++ b/res/_FileInformation.txt @@ -1,23 +1,17 @@ # This file is maintained by hand LAUNCHER.SYSTEM=Type(FF),AuxType(2000),Access(C3) +TOTAL.DATA=Type(06),AuxType(0000),Access(C3) PREFS.CONF=Type(04),AuxType(8000),Access(C3) GAMES.CONF=Type(04),AuxType(8000),Access(C3) ATTRACT.IDX=Type(06),AuxType(6000),Access(C3) MINIATTRACT.IDX=Type(06),AuxType(6000),Access(C3) -MINIATTRACT.ALL=Type(06),AuxType(6000),Access(C3) FX.IDX=Type(06),AuxType(6000),Access(C3) -FX.ALL=Type(06),AuxType(6000),Access(C3) DFX.IDX=Type(06),AuxType(6000),Access(C3) -DFX.ALL=Type(06),AuxType(6000),Access(C3) GAMEHELP.IDX=Type(06),AuxType(6000),Access(C3) -GAMEHELP.ALL=Type(06),AuxType(6000),Access(C3) SLIDESHOW.IDX=Type(06),AuxType(4000),Access(C3) -SLIDESHOW.ALL=Type(06),AuxType(0800),Access(C3) PRELAUNCH.IDX=Type(06),AuxType(6000),Access(C3) -PRELAUNCH.ALL=Type(06),AuxType(0106),Access(C3) ARTWORK.IDX=Type(06),AuxType(2000),Access(C3) -ARTWORK.ALL=Type(06),AuxType(1FF8),Access(C3) HGR0.IDX=Type(06),AuxType(4000),Access(C3) HGR1.IDX=Type(06),AuxType(4000),Access(C3) HGR2.IDX=Type(06),AuxType(4000),Access(C3) @@ -25,7 +19,6 @@ HGR3.IDX=Type(06),AuxType(4000),Access(C3) HGR4.IDX=Type(06),AuxType(4000),Access(C3) HGR5.IDX=Type(06),AuxType(4000),Access(C3) HGR6.IDX=Type(06),AuxType(4000),Access(C3) -HGR.ALL=Type(06),AuxType(3FF8),Access(C3) COVER=Type(06),AuxType(2000),Access(C3) TITLE=Type(06),AuxType(2000),Access(C3) HELP=Type(06),AuxType(2000),Access(C3) diff --git a/src/constants.a b/src/constants.a index 918f2bf4b..88321de9f 100644 --- a/src/constants.a +++ b/src/constants.a @@ -7,7 +7,7 @@ ; ; LC RAM BANK 1 ; D000..E789 - persistent data structures (gGlobalPrefsStore, gGamesListStore) -; E8E4..FFEE - main program code +; E92D..FFEE - main program code ; FFEF..FFF9 - API functions and global constants available for main program ; code, prelaunchers, transition effects, &c. ; (LoadFileDirect, Wait/UnwaitForVBL, MockingboardStuff, MachineStatus) @@ -16,8 +16,8 @@ ; LC RAM BANK 2 ; D000..D3FF - ProRWTS data ; D400..D6B8 - ProRWTS code -; D6B9..DB86 - HGR font code & ProRWTS glue code -; DB87..DB96 - backup of stack (during gameplay and self-running demos) +; D6B9..DB90 - HGR font code & ProRWTS glue code +; DB91..DBA0 - backup of stack (during gameplay and self-running demos) ; ...unused... ; DBB4..DBFF - (de)acceleration function ; DC00..DFFF - HGR font data @@ -149,7 +149,7 @@ CHEATS_ENABLED = %00001000 iCurBlockLo = $D401 ; constant iCurBlockHi = $D403 ; constant launchpatch = $D661 ; glue.launch.a -iAddToPath = $FE5C ; Roger Rabbit, avoid, use Infiltrator 2 style instead +iAddToPath = $FEA5 ; Roger Rabbit, avoid, use Infiltrator 2 style instead itraverse = $D958 ; Roger Rabbit, avoid, use Infiltrator 2 style instead ldrlo = $55 ; constant ldrhi = $56 ; constant diff --git a/src/glue.launch.a b/src/glue.launch.a index 85199b3b3..aa981e57a 100644 --- a/src/glue.launch.a +++ b/src/glue.launch.a @@ -291,4 +291,4 @@ LoadStandardPrelaunch rts + !byte 0 !be24 0 - !le16 71 + !le16 68 diff --git a/src/prodos.path.a b/src/prodos.path.a index 8f219a61b..4232b6c8d 100644 --- a/src/prodos.path.a +++ b/src/prodos.path.a @@ -72,9 +72,11 @@ gHGRActionIndexNumber !raw "_" !raw ".IDX" -kHGRActionDataFile - !byte 7 - !raw "HGR.ALL" +kTotalDataFile + !byte 10 + !raw "TOTAL.DATA" + +kHGRActionDataFile=kTotalDataFile kDHGRActionDirectory !byte 12 @@ -101,9 +103,7 @@ kPrelaunchIndexFile !byte 13 !raw "PRELAUNCH.IDX" -kPrelaunchFulFile - !byte 13 - !raw "PRELAUNCH.ALL" +kPrelaunchFulFile=kTotalDataFile kStandardPrelaunch !byte 8 @@ -121,25 +121,19 @@ kMiniAttractIndexFile !byte 15 !raw "MINIATTRACT.IDX" -kAttractModeFulFile - !byte 15 - !raw "MINIATTRACT.ALL" +kAttractModeFulFile=kTotalDataFile kAttractModeSlideshowIndexFile !byte 13 !raw "SLIDESHOW.IDX" -kAttractModeSlideshowFulFile - !byte 13 - !raw "SLIDESHOW.ALL" +kAttractModeSlideshowFulFile=kTotalDataFile kFXIndexFile !byte 6 !raw "FX.IDX" -kFXFile - !byte 6 - !raw "FX.ALL" +kFXFile=kTotalDataFile kDFXIndexFile !byte 7 @@ -149,17 +143,13 @@ kGameHelpIndexFile !byte 12 !raw "GAMEHELP.IDX" -kGameHelpFile - !byte 12 - !raw "GAMEHELP.ALL" +kGameHelpFile=kTotalDataFile kSHRArtworkIndexFile !byte 11 !raw "ARTWORK.IDX" -kSHRArtworkDataFile - !byte 11 - !raw "ARTWORK.ALL" +kSHRArtworkDataFile=kTotalDataFile kCreditsFile !byte 7