build improvements (binary changes synced)

This commit is contained in:
4am 2024-06-12 20:12:44 -04:00
parent be487abdc3
commit 72a0be59d7
16 changed files with 102 additions and 89 deletions

View File

@ -234,9 +234,10 @@ $(TOTAL.DATA): $(FX) $(PRELAUNCH) $(DEMO) $(SS) $(X) $(ATTRACT) $(ATTRACT.IDX) $
bin/padto.sh "$@"
bin/buildindexedfile.py "$@" res/TITLE.HGR "$(BUILDDIR)"/HGR.TITLES.LOG < "$(TITLE.HGR.LIST)" > "$(BUILDDIR)"/TITLE.IDX
bin/buildindexedfile.py "$@" res/TITLE.DHGR "$(BUILDDIR)"/DHGR.TITLES.LOG < "$(TITLE.DHGR.LIST)" > "$(BUILDDIR)"/DTITLE.IDX
bin/addfile.py "$(COVER)" "$@" > src/index/res.cover.idx.a
bin/addfile.py "$(TITLE)" "$@" > src/index/res.title.idx.a
bin/addfile.py "$(HELP)" "$@" > src/index/res.help.idx.a
bin/addfiles.py "$@" \
"$(COVER)" src/index/res.cover.idx.a \
"$(TITLE)" src/index/res.title.idx.a \
"$(HELP)" src/index/res.help.idx.a
#
# precompute indexed files for game help
# note: these can be padded because they're loaded into $800 at a time when $800..$1FFF is clobber-able
@ -290,14 +291,12 @@ $(TOTAL.DATA): $(FX) $(PRELAUNCH) $(DEMO) $(SS) $(X) $(ATTRACT) $(ATTRACT.IDX) $
# note: these can not be padded because some of them are loaded too close to $C000
#
bin/buildindexedfile.py "$@" "$(DEMO)" "" < "$(DEMO.LIST)" > "$(BUILDDIR)"/DEMO.IDX
bin/addfile.py "$(BUILDDIR)"/DEMO.IDX "$@" > src/index/demo.idx.a
#
# precompute indexed files for single-load game binaries
# note: these can be padded because they are loaded at a time when all of main memory is clobber-able
#
bin/buildindexedfile.py -p "$@" "$(BUILDDIR)"/X.INDEXED "" < "$(XSINGLE.LIST)" > "$(BUILDDIR)"/XSINGLE.IDX
bin/addfile.py "$(BUILDDIR)"/XSINGLE.IDX "$@" > src/index/xsingle.idx.a
#
# create search indexes for each variation of (game-requires-joystick) X (game-requires-128K)
# in the form of OKVS data structures, plus game counts in the form of source files
@ -309,50 +308,51 @@ $(TOTAL.DATA): $(FX) $(PRELAUNCH) $(DEMO) $(SS) $(X) $(ATTRACT) $(ATTRACT.IDX) $
'(bin/buildsearch.py src/index/count11.a "$(BUILDDIR)"/HGR.TITLES.LOG "$(BUILDDIR)"/DHGR.TITLES.LOG < "$(GAMES.CONF)" > "$(BUILDDIR)"/SEARCH11.IDX)'
#
# add IDX files to the combined index file and generate
# the index records that callers use to reference them
# the index records that callers use to reference them,
# plus additional miscellaneous files
#
bin/addfile.py "$(BUILDDIR)"/SEARCH00.IDX "$@" > src/index/search00.idx.a
bin/addfile.py res/CACHE00.IDX "$@" > src/index/cache00.idx.a
bin/addfile.py "$(BUILDDIR)"/SEARCH01.IDX "$@" > src/index/search01.idx.a
bin/addfile.py res/CACHE01.IDX "$@" > src/index/cache01.idx.a
bin/addfile.py "$(BUILDDIR)"/SEARCH10.IDX "$@" > src/index/search10.idx.a
bin/addfile.py res/CACHE10.IDX "$@" > src/index/cache10.idx.a
bin/addfile.py "$(BUILDDIR)"/SEARCH11.IDX "$@" > src/index/search11.idx.a
bin/addfile.py res/CACHE11.IDX "$@" > src/index/cache11.idx.a
bin/addfile.py "$(BUILDDIR)"/PRELAUNCH.IDX "$@" > src/index/prelaunch.idx.a
bin/addfile.py "$(ATTRACT.IDX)" "$@" > src/index/attract.idx.a
bin/addfile.py "$(BUILDDIR)"/FX.IDX "$@" > src/index/fx.idx.a
bin/addfile.py "$(BUILDDIR)"/DFX.IDX "$@" > src/index/dfx.idx.a
bin/addfile.py "$(BUILDDIR)"/SFX.IDX "$@" > src/index/sfx.idx.a
bin/addfile.py "$(BUILDDIR)"/FXCODE.IDX "$@" > src/index/fxcode.idx.a
bin/addfile.py "$(BUILDDIR)"/FXDATA.IDX "$@" > src/index/fxdata.idx.a
bin/addfile.py "$(BUILDDIR)"/GAMEHELP.IDX "$@" > src/index/gamehelp.idx.a
bin/addfile.py "$(BUILDDIR)"/SLIDESHOW.IDX "$@" > src/index/slideshow.idx.a
bin/addfile.py "$(BUILDDIR)"/MINIATTRACT0.IDX "$@" > src/index/miniattract0.idx.a
bin/addfile.py "$(BUILDDIR)"/MINIATTRACT1.IDX "$@" > src/index/miniattract1.idx.a
bin/addfile.py "$(BUILDDIR)"/TITLE.IDX "$@" > src/index/title.idx.a
bin/addfile.py "$(BUILDDIR)"/DTITLE.IDX "$@" > src/index/dtitle.idx.a
bin/addfile.py "$(BUILDDIR)"/HGR0.IDX "$@" > src/index/hgr0.idx.a
bin/addfile.py "$(BUILDDIR)"/HGR1.IDX "$@" > src/index/hgr1.idx.a
bin/addfile.py "$(BUILDDIR)"/HGR2.IDX "$@" > src/index/hgr2.idx.a
bin/addfile.py "$(BUILDDIR)"/HGR3.IDX "$@" > src/index/hgr3.idx.a
bin/addfile.py "$(BUILDDIR)"/HGR4.IDX "$@" > src/index/hgr4.idx.a
bin/addfile.py "$(BUILDDIR)"/HGR5.IDX "$@" > src/index/hgr5.idx.a
bin/addfile.py "$(BUILDDIR)"/HGR6.IDX "$@" > src/index/hgr6.idx.a
bin/addfile.py "$(BUILDDIR)"/DHGR.IDX "$@" > src/index/dhgr.idx.a
bin/addfile.py "$(BUILDDIR)"/GR.IDX "$@" > src/index/gr.idx.a
bin/addfile.py "$(BUILDDIR)"/DGR.IDX "$@" > src/index/dgr.idx.a
bin/addfile.py "$(BUILDDIR)"/ARTWORK.IDX "$@" > src/index/artwork.idx.a
#
# add additional miscellaneous files
#
bin/addfile.py "$(BUILDDIR)"/COVERFADE "$@" > src/index/coverfade.idx.a
bin/addfile.py "$(BUILDDIR)"/GR.FIZZLE "$@" > src/index/gr.fizzle.idx.a
bin/addfile.py "$(BUILDDIR)"/DGR.FIZZLE "$@" > src/index/dgr.fizzle.idx.a
bin/addfile.py "$(HELPTEXT)" "$@" > src/index/helptext.idx.a
bin/addfile.py "$(CREDITS)" "$@" > src/index/credits.idx.a
bin/addfile.py "$(DECRUNCH)" "$@" > src/index/decrunch.idx.a
bin/addfile.py "$(JOYSTICK)" "$@" > src/index/joystick.idx.a
bin/addfiles.py "$@" \
"$(BUILDDIR)"/SEARCH00.IDX src/index/search00.idx.a \
res/CACHE00.IDX src/index/cache00.idx.a \
"$(BUILDDIR)"/SEARCH01.IDX src/index/search01.idx.a \
res/CACHE01.IDX src/index/cache01.idx.a \
"$(BUILDDIR)"/SEARCH10.IDX src/index/search10.idx.a \
res/CACHE10.IDX src/index/cache10.idx.a \
"$(BUILDDIR)"/SEARCH11.IDX src/index/search11.idx.a \
res/CACHE11.IDX src/index/cache11.idx.a \
"$(BUILDDIR)"/PRELAUNCH.IDX src/index/prelaunch.idx.a \
"$(ATTRACT.IDX)" src/index/attract.idx.a \
"$(BUILDDIR)"/DEMO.IDX src/index/demo.idx.a \
"$(BUILDDIR)"/XSINGLE.IDX src/index/xsingle.idx.a \
"$(BUILDDIR)"/FX.IDX src/index/fx.idx.a \
"$(BUILDDIR)"/DFX.IDX src/index/dfx.idx.a \
"$(BUILDDIR)"/SFX.IDX src/index/sfx.idx.a \
"$(BUILDDIR)"/FXCODE.IDX src/index/fxcode.idx.a \
"$(BUILDDIR)"/FXDATA.IDX src/index/fxdata.idx.a \
"$(BUILDDIR)"/GAMEHELP.IDX src/index/gamehelp.idx.a \
"$(BUILDDIR)"/SLIDESHOW.IDX src/index/slideshow.idx.a \
"$(BUILDDIR)"/MINIATTRACT0.IDX src/index/miniattract0.idx.a \
"$(BUILDDIR)"/MINIATTRACT1.IDX src/index/miniattract1.idx.a \
"$(BUILDDIR)"/TITLE.IDX src/index/title.idx.a \
"$(BUILDDIR)"/DTITLE.IDX src/index/dtitle.idx.a \
"$(BUILDDIR)"/HGR0.IDX src/index/hgr0.idx.a \
"$(BUILDDIR)"/HGR1.IDX src/index/hgr1.idx.a \
"$(BUILDDIR)"/HGR2.IDX src/index/hgr2.idx.a \
"$(BUILDDIR)"/HGR3.IDX src/index/hgr3.idx.a \
"$(BUILDDIR)"/HGR4.IDX src/index/hgr4.idx.a \
"$(BUILDDIR)"/HGR5.IDX src/index/hgr5.idx.a \
"$(BUILDDIR)"/HGR6.IDX src/index/hgr6.idx.a \
"$(BUILDDIR)"/DHGR.IDX src/index/dhgr.idx.a \
"$(BUILDDIR)"/GR.IDX src/index/gr.idx.a \
"$(BUILDDIR)"/DGR.IDX src/index/dgr.idx.a \
"$(BUILDDIR)"/ARTWORK.IDX src/index/artwork.idx.a \
"$(BUILDDIR)"/COVERFADE src/index/coverfade.idx.a \
"$(BUILDDIR)"/GR.FIZZLE src/index/gr.fizzle.idx.a \
"$(BUILDDIR)"/DGR.FIZZLE src/index/dgr.fizzle.idx.a \
"$(HELPTEXT)" src/index/helptext.idx.a \
"$(CREDITS)" src/index/credits.idx.a \
"$(DECRUNCH)" src/index/decrunch.idx.a \
"$(JOYSTICK)" src/index/joystick.idx.a
@touch "$@"
# assemble main program

View File

@ -1,27 +0,0 @@
#!/usr/bin/env python3
# parameters
# 1 - input file
# 2 - output filename for data file
# stdout - source code of index record
import argparse
import os.path
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Append file to TOTAL.DATA and calculate its index record")
parser.add_argument("input_file")
parser.add_argument("output_file")
args = parser.parse_args()
offset = os.path.getsize(args.output_file)
size = os.path.getsize(args.input_file)
with open(args.input_file, 'rb') as input_handle, open(args.output_file, 'ab') as output_handle:
output_handle.write(input_handle.read())
print(f""";
; Index record for {args.input_file}
;
; This file is automatically generated
;
!byte 0
!be24 {offset:>9}
!le16 {size:>8}""")

40
bin/addfiles.py Executable file
View File

@ -0,0 +1,40 @@
#!/usr/bin/env python3
# parameters
# 1 - output filename for combined data file
# 2,3 - input filename, output index record filename
# 4,5 - ""
# 6,7... in pairs
import os.path
import sys
if __name__ == "__main__":
output_file = sys.argv[1]
offset = os.path.getsize(output_file)
data = []
index_records = []
# read and aggregate all input files, and generate index records
for input_file in sys.argv[2::2]:
with open(input_file, 'rb') as input_handle:
data.append(input_handle.read())
size = len(data[-1])
index_records.append(f""";
; Index record for {input_file}
;
; This file is automatically generated
;
!byte 0
!be24 {offset:>9}
!le16 {size:>8}
""")
offset += size
# write out index records to specified files
for index_file, record in zip(sys.argv[3::2], index_records):
with open(index_file, 'w') as index_handle:
index_handle.write(record)
# write out combined data
with open(output_file, 'ab') as output_handle:
output_handle.write(b''.join(data))

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15820174
!be24 15814174
!le16 5732

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15751941
!be24 15745941
!le16 4194

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15766655
!be24 15760655
!le16 4652

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15785370
!be24 15779370
!le16 5621

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15806411
!be24 15800411
!le16 6199

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 12648156
!be24 15819906
!le16 1652

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15812610
!be24 15806610
!le16 7564

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15742358
!be24 15736358
!le16 9583

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15756135
!be24 15750135
!le16 10520

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15771307
!be24 15765307
!le16 14063

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15790991
!be24 15784991
!le16 15420

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15738010
!be24 15821558
!le16 4348

View File

@ -231,7 +231,6 @@ rem note: these can not be padded because some of them are loaded too close to $
rem
echo|set/p="indexing demos..."
cscript /nologo bin\buildss.js build\DEMO build\DEMO.IDX nul build\TOTAL.DATA nul >>build\log
cscript /nologo bin\addfile.js build\DEMO.IDX src\index\demo.idx.a
echo done
rem
rem precompute indexed files for single-load game binaries
@ -242,7 +241,6 @@ for %%q in (res\dsk\*.po) do %CADIUS% EXTRACTVOLUME "%%q" build\X\ >>build\log
1>nul 2>nul del /s build\X\.DS_Store build\X\PRODOS* build\X\LOADER.SYSTEM* build\X\_FileInformation.txt
1>nul copy /y nul build\XSINGLE.IDX
cscript /nologo bin\buildsingle.js build\X.INDEXED build\XSINGLE.IDX build\TOTAL.DATA pad >>build\log
cscript /nologo bin\addfile.js build\XSINGLE.IDX src\index\xsingle.idx.a
cscript /nologo bin\flatten.js
echo done
rem
@ -270,6 +268,8 @@ cscript /nologo bin\addfile.js build\SEARCH11.IDX src\index\search11.idx.a
cscript /nologo bin\addfile.js res\CACHE11.IDX src\index\cache11.idx.a
cscript /nologo bin\addfile.js build\PRELAUNCH.IDX src\index\prelaunch.idx.a
cscript /nologo bin\addfile.js build\ATTRACT.IDX src\index\attract.idx.a
cscript /nologo bin\addfile.js build\DEMO.IDX src\index\demo.idx.a
cscript /nologo bin\addfile.js build\XSINGLE.IDX src\index\xsingle.idx.a
cscript /nologo bin\addfile.js build\FX.IDX src\index\fx.idx.a
cscript /nologo bin\addfile.js build\DFX.IDX src\index\dfx.idx.a
cscript /nologo bin\addfile.js build\SFX.IDX src\index\sfx.idx.a