merge prelaunch into indexed file

This commit is contained in:
4am 2021-10-13 18:58:45 -04:00
parent e34993178d
commit 69aa12d9d7
7 changed files with 41 additions and 33 deletions

View File

@ -41,7 +41,8 @@ dsk: asm
rm -f build/ATTRACTDIR.CONF && touch build/ATTRACTDIR.CONF >>build/log
for f in res/ATTRACT/*; do bin/buildokvs.sh "$$f" "build/ATTRACT/$$(basename $$f)" && echo "$$(basename $$f)" >> build/ATTRACTDIR.CONF; done >>build/log
bin/buildfx.sh "build/ATTRACTDIR.CONF" "build/MINIATTRACT.IDX" "build/MINIATTRACT.ALL" "build/ATTRACT" >>build/log
for f in res/TITLE res/COVER res/HELP res/GAMES.CONF build/PREFS.CONF res/CREDITS res/HELPTEXT build/ATTRACT.IDX build/FX.IDX build/FX.ALL build/DFX.IDX build/DFX.ALL build/GAMEHELP.IDX build/GAMEHELP.ALL build/SLIDESHOW.IDX build/SLIDESHOW.ALL build/MINIATTRACT.IDX build/MINIATTRACT.ALL res/DECRUNCH res/JOYSTICK res/Finder.Data res/Finder.Root; do $(CADIUS) ADDFILE build/"$(DISK)" "/$(VOLUME)/" "$$f" >>build/log; done
bin/buildhelp.sh "res/GAMES.CONF" "build/PRELAUNCH.IDX" "build/PRELAUNCH.ALL" "build/PRELAUNCH" >>build/log
for f in res/TITLE res/COVER res/HELP res/GAMES.CONF build/PREFS.CONF res/CREDITS res/HELPTEXT build/ATTRACT.IDX build/FX.IDX build/FX.ALL build/DFX.IDX build/DFX.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 res/DECRUNCH res/JOYSTICK res/Finder.Data res/Finder.Root; do $(CADIUS) ADDFILE build/"$(DISK)" "/$(VOLUME)/" "$$f" >>build/log; done
bin/buildfileinfo.sh res/TITLE.HGR "06" "4000" >>build/log
bin/buildfileinfo.sh res/TITLE.DHGR "06" "4000" >>build/log
bin/buildfileinfo.sh res/ACTION.HGR "06" "3FF8" >>build/log
@ -57,8 +58,6 @@ dsk: asm
rm -f build/X/**/.DS_Store build/X/**/PRODOS* build/X/**/LOADER.SYSTEM*
$(CADIUS) CREATEFOLDER build/"$(DISK)" "/$(VOLUME)/X/" >>build/log
for f in build/X/*; do $(CADIUS) ADDFOLDER build/"$(DISK)" "/$(VOLUME)/X/$$(basename $$f)" "$$f"; done >>build/log
bin/buildfileinfo.sh build/PRELAUNCH "06" "0106" >>build/log
$(CADIUS) ADDFOLDER build/"$(DISK)" "/$(VOLUME)/PRELAUNCH" "build/PRELAUNCH" >>build/log
bin/changebootloader.sh build/"$(DISK)" build/proboothd
asm: asmlauncher asmfx asmprelaunch asmproboot
@ -73,7 +72,6 @@ asmfx: md
asmprelaunch: md
for f in src/prelaunch/*.a; do grep "^\!to" $${f} >/dev/null && $(ACME) $${f} >> build/log; done
for f in res/TITLE.HGR/* res/TITLE.DHGR/*; do rsync --ignore-existing build/PRELAUNCH/STANDARD build/PRELAUNCH/$$(basename $$f); done
asmproboot: md
$(ACME) -r build/proboothd.lst src/proboothd/proboothd.a >> build/log

View File

@ -25,19 +25,8 @@ source=$(mktemp)
echo "!byte ${#key}" # OKVS key length
echo "!text \"$key\"" # OKVS key (effect name)
if [ -f "$4/$key" ]; then
offset=$(wc -c < "$3")
echo "!be24 $offset" # offset into merged-gamehelp file (3-byte big-endian)
# If offset+size does not cross a block boundary, use the size.
# Otherwise, round up size to the next block boundary.
# This padding does not get added to the file; it is just an
# optimization to avoid a partial copy on the last block read.
echo -n "!le16 "
size=$(wc -c < "$4/$key")
if [ $(($offset / 512)) -eq $((($offset + $size) / 512)) ]; then
echo "$size"
else
echo "$(((($offset + $size + 511) & -512) - $offset))"
fi
echo "!be24 $(wc -c < "$3")" # offset into merged-gamehelp file (3-byte big-endian)
echo "!le16 $(wc -c < "$4/$key")" # size
cat "$4/$key" >> "$3" # add this gamehelp to the merged-gamehelp file
else
echo "!be24 0" # if game has no help, reuse placeholder at offset 0

View File

@ -14,6 +14,8 @@ GAMEHELP.IDX=Type(06),AuxType(6000),Access(C3)
GAMEHELP.ALL=Type(04),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)
COVER=Type(06),AuxType(2000),Access(C3)
TITLE=Type(06),AuxType(2000),Access(C3)
HELP=Type(06),AuxType(2000),Access(C3)

View File

@ -7,7 +7,7 @@
;
; LC RAM BANK 1
; D000..E789 - persistent data structures (gGlobalPrefsStore, gGamesListStore)
; E911..FFF1 - main program code
; E8E6..FFF1 - main program code
; FFF2..FFF9 - API functions and global constants available for main program
; code, prelaunchers, transition effects, &c.
; (Wait/UnwaitForVBL, MockingboardStuff, MachineStatus)
@ -151,7 +151,7 @@ iProDOS_enter = $D670
LoadFileDirect = $DAF9
iAuxReq = $DB1F
launchpatch = $D60E
iAddToPath = $FE78
iAddToPath = $FE67
itraverse = $D8D8
ldrhi = $56
namlo = $57

View File

@ -200,10 +200,21 @@ PlayGame
jsr ClearScreens ; avoid seeing code load into the HGR page
; (clobbers $106, must do now before loading prelaunch code)
jsr LoadFile ; load this game's prelaunch file at $106
!word kPrelaunchDirectory
@pfile !word $FDFD
jsr LoadFile ; load prelaunch index file into $6000
!word kRootDirectory
!word kPrelaunchIndexFile
- !word $6000
jsr okvs_find
!word -
@pfile !word $FDFD ; SMC
+ST16 @indexRecordPtr
jsr LoadIndexedFile
!word kPrelaunchFulFile
!word $0106
@indexRecordPtr
!word $FDFD ; SMC
; we start by placing the subdirectory name at gPathname+kGameDirectoryLen
; to leave room for the GameDirectory name as the parent
@ -264,10 +275,7 @@ Launch
jmp LaunchInternal
Joystick
jsr LoadFile
!word kPrelaunchDirectory
!word kStandardPrelaunch
!word $0106
jsr LoadStandardPrelaunch
jsr LoadFile
!word kRootDirectory
@ -275,3 +283,13 @@ Joystick
!word 0
jmp Launch
LoadStandardPrelaunch
jsr LoadIndexedFile ; load standard prelaunch code at $0106
!word kPrelaunchFulFile
!word $0106
!word +
rts
+ !byte 0
!be24 0
!le16 71

View File

@ -94,9 +94,13 @@ kFXDirectory
!byte 3
!raw "FX/"
kPrelaunchDirectory
!byte 10
!raw "PRELAUNCH/"
kPrelaunchIndexFile
!byte 13
!raw "PRELAUNCH.IDX"
kPrelaunchFulFile
!byte 13
!raw "PRELAUNCH.ALL"
kStandardPrelaunch
!byte 8

View File

@ -158,10 +158,7 @@ RunAttractModule
jsr ClearScreens ; avoid seeing code load into the HGR page
; (clobbers $106, must do now before loading prelaunch code)
jsr LoadFile ; load standard prelaunch code (|Launch| will call it)
!word kPrelaunchDirectory
!word kStandardPrelaunch
!word $0106
jsr LoadStandardPrelaunch ; load standard prelaunch code (|Launch| will call it)
jsr LoadFile ; load self-running demo into its default address (varies)
!word kDemoDirectory