mirror of
https://github.com/a2-4am/4cade.git
synced 2024-12-12 18:30:00 +00:00
move search indexes and caches to TOTAL.IDX
This commit is contained in:
parent
8db9675770
commit
31a37400c4
27
Makefile
27
Makefile
@ -53,14 +53,6 @@ dsk: index asmproboot asmlauncher
|
||||
build/PREFS.CONF \
|
||||
build/CREDITS \
|
||||
build/HELPTEXT \
|
||||
build/SEARCH00.IDX \
|
||||
build/SEARCH01.IDX \
|
||||
build/SEARCH10.IDX \
|
||||
build/SEARCH11.IDX \
|
||||
res/CACHE00.IDX \
|
||||
res/CACHE01.IDX \
|
||||
res/CACHE10.IDX \
|
||||
res/CACHE11.IDX \
|
||||
build/HGR0.IDX \
|
||||
build/HGR1.IDX \
|
||||
build/HGR2.IDX \
|
||||
@ -116,13 +108,14 @@ index: md asmfx asmprelaunch compress
|
||||
[ -f build/GAMEHELP/"$$(basename $$f)" ] || (bin/converthelp.sh "$$f" build/GAMEHELP/"$$(basename $$f)"); \
|
||||
done
|
||||
#
|
||||
# create search indexes: (game-requires-joystick) X (game-requires-128K)
|
||||
# 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
|
||||
#
|
||||
[ -f build/GAMES.CONF ] || (awk '!/^$$|^#/' < res/GAMES.CONF > build/GAMES.CONF)
|
||||
[ -f build/SEARCH00.IDX ] || (grep "^00" < build/GAMES.CONF | bin/buildsearch.sh > build/SEARCH00.IDX)
|
||||
[ -f build/SEARCH01.IDX ] || (grep "^0" < build/GAMES.CONF | bin/buildsearch.sh > build/SEARCH01.IDX)
|
||||
[ -f build/SEARCH10.IDX ] || (grep "^.0" < build/GAMES.CONF | bin/buildsearch.sh > build/SEARCH10.IDX)
|
||||
[ -f build/SEARCH11.IDX ] || (bin/buildsearch.sh < build/GAMES.CONF > build/SEARCH11.IDX)
|
||||
[ -f build/SEARCH00.IDX ] || (grep "^00" < build/GAMES.CONF | bin/buildsearch.sh src/index/count00.a > build/SEARCH00.IDX)
|
||||
[ -f build/SEARCH01.IDX ] || (grep "^0" < build/GAMES.CONF | bin/buildsearch.sh src/index/count01.a > build/SEARCH01.IDX)
|
||||
[ -f build/SEARCH10.IDX ] || (grep "^.0" < build/GAMES.CONF | bin/buildsearch.sh src/index/count10.a > build/SEARCH10.IDX)
|
||||
[ -f build/SEARCH11.IDX ] || (bin/buildsearch.sh src/index/count11.a < build/GAMES.CONF > build/SEARCH11.IDX)
|
||||
#
|
||||
# create a sorted list of game filenames, without metadata or display names
|
||||
#
|
||||
@ -183,6 +176,14 @@ index: md asmfx asmprelaunch compress
|
||||
# add IDX files to the combined index file and generate
|
||||
# the index records that callers use to reference them
|
||||
#
|
||||
bin/addfile.sh build/SEARCH00.IDX build/TOTAL.IDX > src/index/search00.idx.a
|
||||
bin/addfile.sh res/CACHE00.IDX build/TOTAL.IDX > src/index/cache00.idx.a
|
||||
bin/addfile.sh build/SEARCH01.IDX build/TOTAL.IDX > src/index/search01.idx.a
|
||||
bin/addfile.sh res/CACHE01.IDX build/TOTAL.IDX > src/index/cache01.idx.a
|
||||
bin/addfile.sh build/SEARCH10.IDX build/TOTAL.IDX > src/index/search10.idx.a
|
||||
bin/addfile.sh res/CACHE10.IDX build/TOTAL.IDX > src/index/cache10.idx.a
|
||||
bin/addfile.sh build/SEARCH11.IDX build/TOTAL.IDX > src/index/search11.idx.a
|
||||
bin/addfile.sh res/CACHE11.IDX build/TOTAL.IDX > src/index/cache11.idx.a
|
||||
bin/addfile.sh build/PRELAUNCH.IDX build/TOTAL.IDX > src/index/prelaunch.idx.a
|
||||
bin/addfile.sh build/ATTRACT.IDX build/TOTAL.IDX > src/index/attract.idx.a
|
||||
bin/addfile.sh build/FX.IDX build/TOTAL.IDX > src/index/fx.idx.a
|
||||
|
@ -4,6 +4,14 @@
|
||||
records=$(mktemp)
|
||||
awk '!/^$|^#|^\[/' > "$records"
|
||||
|
||||
# generate source file with game count
|
||||
(echo ";"
|
||||
echo "; Game count"
|
||||
echo ";"
|
||||
echo "; This file is automatically generated"
|
||||
echo ";"
|
||||
echo "!word $(wc -l < "$records")") > "$1"
|
||||
|
||||
# make temp assembly source file that represents the binary OKVS data structure
|
||||
source=$(mktemp)
|
||||
(echo "*=0" # dummy program counter for assembler
|
||||
|
110
src/4cade.init.a
110
src/4cade.init.a
@ -394,42 +394,40 @@ CopyDevs
|
||||
ora MachineStatus
|
||||
sta MachineStatus ; set bit 3 of MachineStatus
|
||||
|
||||
ldx #$30 ; Look at other bits of MachineStatus to build
|
||||
lda MachineStatus ; the filename of the search index to use.
|
||||
and #HAS_JOYSTICK ; There are 4 files on disk, named
|
||||
beq + ; SEARCH00.IDX, SEARCH01.IDX, SEARCH10.IDX, SEARCH11.IDX,
|
||||
inx ; which correspond to <games-requiring-a-joystick> X
|
||||
+ stx gSearchHasJoystick ; <games-requiring-128K>.
|
||||
stx gCacheHasJoystick
|
||||
ldx #$30 ; Once we construct the filename, we'll forever after
|
||||
lda MachineStatus ; load and reload the correct list of games that
|
||||
and #HAS_128K ; this machine can play.
|
||||
beq +
|
||||
inx
|
||||
+ stx gSearchHas128K
|
||||
stx gCacheHas128K
|
||||
rol
|
||||
rol
|
||||
rol
|
||||
rol
|
||||
and #%00000110
|
||||
tax ; X in (0,2,4,6)
|
||||
ldy kGameCounts, x
|
||||
sty GameCount ; store total game count based on based on (has-joystick) X (has-128K)
|
||||
sty SAVE
|
||||
ldy kGameCounts+1, x
|
||||
sty GameCount+1
|
||||
sty SAVE+1
|
||||
lsr
|
||||
tax ; X in (0,1,2,3)
|
||||
lda kSearchIndexLo, x
|
||||
sta @searchIndexSrc+1 ; set up search index record based on (has-joystick) X (has-128K)
|
||||
lda kSearchIndexHi, x
|
||||
sta @searchIndexSrc+2
|
||||
lda kSearchCacheLo, x
|
||||
sta @searchCacheSrc+1 ; set up search cache record based on (has-joystick) X (has-128K)
|
||||
lda kSearchCacheHi, x
|
||||
sta @searchCacheSrc+2
|
||||
ldy #5
|
||||
@searchIndexSrc
|
||||
lda $FDFD, y ; SMC
|
||||
sta kSearchIndexRecord, y
|
||||
@searchCacheSrc
|
||||
lda $FDFD, y
|
||||
sta kSearchCacheRecord, y
|
||||
dey
|
||||
bpl @searchIndexSrc
|
||||
|
||||
lda #0 ; Read just the first 2 bytes of the search index
|
||||
sta sizelo ; to get the size, which is the number of games.
|
||||
lda #2 ; (we will load the entire search index later.)
|
||||
sta sizehi
|
||||
jsr SwitchToBank2
|
||||
lda #$24 ; patch out code that calculates file size during load
|
||||
sta LoadFileInternal_SizePatch
|
||||
jsr SwitchToBank1
|
||||
jsr ReloadSearchIndex ; this will really only load the first 2 bytes
|
||||
jsr SwitchToBank2
|
||||
lda #$85 ; restore code that calculates file size during load
|
||||
sta LoadFileInternal_SizePatch
|
||||
jsr SwitchToBank1
|
||||
+LDADDR gSearchStore
|
||||
jsr okvs_len ; this works because it only looks at the first two bytes
|
||||
+LD16 WCOUNT
|
||||
+ST16 GameCount
|
||||
+ST16 SAVE
|
||||
|
||||
; calculate and update visible game count (3-digit decimal number as ASCII string)
|
||||
dey ; Y = 0
|
||||
; convert GameCount (word) to VisibleGameCount (3-digit decimal number as ASCII string)
|
||||
iny ; Y = 0
|
||||
@outer
|
||||
lda #0
|
||||
pha
|
||||
@ -464,3 +462,45 @@ CopyDevs
|
||||
!byte 100
|
||||
!byte 10
|
||||
!byte 1
|
||||
|
||||
kSearchIndexLo
|
||||
!byte <kSearchIndexRecord00
|
||||
!byte <kSearchIndexRecord01
|
||||
!byte <kSearchIndexRecord10
|
||||
!byte <kSearchIndexRecord11
|
||||
kSearchIndexHi
|
||||
!byte >kSearchIndexRecord00
|
||||
!byte >kSearchIndexRecord01
|
||||
!byte >kSearchIndexRecord10
|
||||
!byte >kSearchIndexRecord11
|
||||
kSearchCacheLo
|
||||
!byte <kSearchCacheRecord00
|
||||
!byte <kSearchCacheRecord01
|
||||
!byte <kSearchCacheRecord10
|
||||
!byte <kSearchCacheRecord11
|
||||
kSearchCacheHi
|
||||
!byte >kSearchCacheRecord00
|
||||
!byte >kSearchCacheRecord01
|
||||
!byte >kSearchCacheRecord10
|
||||
!byte >kSearchCacheRecord11
|
||||
kSearchIndexRecord00
|
||||
!source "src/index/search00.idx.a"
|
||||
kSearchIndexRecord01
|
||||
!source "src/index/search01.idx.a"
|
||||
kSearchIndexRecord10
|
||||
!source "src/index/search10.idx.a"
|
||||
kSearchIndexRecord11
|
||||
!source "src/index/search11.idx.a"
|
||||
kSearchCacheRecord00
|
||||
!source "src/index/cache00.idx.a"
|
||||
kSearchCacheRecord01
|
||||
!source "src/index/cache01.idx.a"
|
||||
kSearchCacheRecord10
|
||||
!source "src/index/cache10.idx.a"
|
||||
kSearchCacheRecord11
|
||||
!source "src/index/cache11.idx.a"
|
||||
kGameCounts
|
||||
!source "src/index/count00.a"
|
||||
!source "src/index/count01.a"
|
||||
!source "src/index/count10.a"
|
||||
!source "src/index/count11.a"
|
||||
|
@ -11,7 +11,7 @@
|
||||
; ...unused...
|
||||
; E000..E3FF - HGR font data
|
||||
; ...unused...
|
||||
; E984..FFEE - main program code
|
||||
; E8FF..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)
|
||||
@ -60,15 +60,14 @@
|
||||
; 2000..5FFF - hi-res screens cleared
|
||||
; A000.. - prelaunch index file
|
||||
;
|
||||
; MAIN MEMORY DURING CREDITS
|
||||
; MAIN MEMORY DURING CREDITS (preserves search index and cache)
|
||||
; 0800.. - credits text
|
||||
;
|
||||
; MAIN MEMORY DURING GLOBAL HELP
|
||||
; MAIN MEMORY DURING GLOBAL HELP (preserves search index and cache)
|
||||
; 0800.. - help text
|
||||
;
|
||||
; MAIN MEMORY DURING PER-GAME HELP
|
||||
; MAIN MEMORY DURING PER-GAME HELP (clobbers search cache)
|
||||
; 0800.. - help text
|
||||
; 6000..9FFF - search index
|
||||
; A000.. - game help index file
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
@ -202,7 +201,7 @@ PRELAUNCH_STANDARD_SIZE = 61 ; LoadStandardPrelaunch, eventually to be d
|
||||
iCurBlockLo = $D401 ; constant
|
||||
iCurBlockHi = $D403 ; constant
|
||||
launchpatch = $D662 ; glue.launch.a
|
||||
iAddToPath = $FEC7 ; Roger Rabbit, avoid, use Infiltrator 2 style instead
|
||||
iAddToPath = $FED4 ; Roger Rabbit, avoid, use Infiltrator 2 style instead
|
||||
itraverse = $D964 ; Roger Rabbit, avoid, use Infiltrator 2 style instead
|
||||
ldrlo = $55 ; constant
|
||||
ldrhi = $56 ; constant
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 33099
|
||||
!be24 82246
|
||||
!le16 4186
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 6132
|
||||
!be24 55279
|
||||
!le16 5157
|
||||
|
8
src/index/cache00.idx.a
Normal file
8
src/index/cache00.idx.a
Normal file
@ -0,0 +1,8 @@
|
||||
;
|
||||
; Index record for res/CACHE00.IDX
|
||||
;
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 6152
|
||||
!le16 3580
|
8
src/index/cache01.idx.a
Normal file
8
src/index/cache01.idx.a
Normal file
@ -0,0 +1,8 @@
|
||||
;
|
||||
; Index record for res/CACHE01.IDX
|
||||
;
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 16468
|
||||
!le16 3940
|
8
src/index/cache10.idx.a
Normal file
8
src/index/cache10.idx.a
Normal file
@ -0,0 +1,8 @@
|
||||
;
|
||||
; Index record for res/CACHE10.IDX
|
||||
;
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 29225
|
||||
!le16 4615
|
8
src/index/cache11.idx.a
Normal file
8
src/index/cache11.idx.a
Normal file
@ -0,0 +1,8 @@
|
||||
;
|
||||
; Index record for res/CACHE11.IDX
|
||||
;
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 43585
|
||||
!le16 5562
|
6
src/index/count00.a
Normal file
6
src/index/count00.a
Normal file
@ -0,0 +1,6 @@
|
||||
;
|
||||
; Game count
|
||||
;
|
||||
; This file is automatically generated
|
||||
;
|
||||
!word 264
|
6
src/index/count01.a
Normal file
6
src/index/count01.a
Normal file
@ -0,0 +1,6 @@
|
||||
;
|
||||
; Game count
|
||||
;
|
||||
; This file is automatically generated
|
||||
;
|
||||
!word 288
|
6
src/index/count10.a
Normal file
6
src/index/count10.a
Normal file
@ -0,0 +1,6 @@
|
||||
;
|
||||
; Game count
|
||||
;
|
||||
; This file is automatically generated
|
||||
;
|
||||
!word 372
|
6
src/index/count11.a
Normal file
6
src/index/count11.a
Normal file
@ -0,0 +1,6 @@
|
||||
;
|
||||
; Game count
|
||||
;
|
||||
; This file is automatically generated
|
||||
;
|
||||
!word 411
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 13435
|
||||
!be24 62582
|
||||
!le16 1242
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 31757
|
||||
!be24 80904
|
||||
!le16 1249
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 11289
|
||||
!be24 60436
|
||||
!le16 2146
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 14677
|
||||
!be24 63824
|
||||
!le16 6132
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 33006
|
||||
!be24 82153
|
||||
!le16 93
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 25625
|
||||
!be24 74772
|
||||
!le16 6132
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 0
|
||||
!be24 49147
|
||||
!le16 6132
|
||||
|
8
src/index/search00.idx.a
Normal file
8
src/index/search00.idx.a
Normal file
@ -0,0 +1,8 @@
|
||||
;
|
||||
; Index record for build/SEARCH00.IDX
|
||||
;
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 0
|
||||
!le16 6152
|
8
src/index/search01.idx.a
Normal file
8
src/index/search01.idx.a
Normal file
@ -0,0 +1,8 @@
|
||||
;
|
||||
; Index record for build/SEARCH01.IDX
|
||||
;
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9732
|
||||
!le16 6736
|
8
src/index/search10.idx.a
Normal file
8
src/index/search10.idx.a
Normal file
@ -0,0 +1,8 @@
|
||||
;
|
||||
; Index record for build/SEARCH10.IDX
|
||||
;
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 20408
|
||||
!le16 8817
|
8
src/index/search11.idx.a
Normal file
8
src/index/search11.idx.a
Normal file
@ -0,0 +1,8 @@
|
||||
;
|
||||
; Index record for build/SEARCH11.IDX
|
||||
;
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 33840
|
||||
!le16 9745
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 20809
|
||||
!be24 69956
|
||||
!le16 4816
|
||||
|
@ -53,6 +53,46 @@ AddToPath
|
||||
@done
|
||||
rts
|
||||
|
||||
kSearchIndexRecord
|
||||
!byte 0
|
||||
!be24 0 ; SMC in 4cade.init
|
||||
!le16 0 ; SMC in 4cade.init
|
||||
|
||||
kSearchCacheRecord
|
||||
!byte 0
|
||||
!be24 0 ; SMC in 4cade.init
|
||||
!le16 0 ; SMC in 4cade.init
|
||||
|
||||
kPrelaunchIndexRecord
|
||||
!source "src/index/prelaunch.idx.a"
|
||||
|
||||
kAttractModeIndexRecord
|
||||
!source "src/index/attract.idx.a"
|
||||
|
||||
kMiniAttractIndexRecord
|
||||
!source "src/index/miniattract.idx.a"
|
||||
|
||||
kAttractModeSlideshowIndexRecord
|
||||
!source "src/index/slideshow.idx.a"
|
||||
|
||||
kFXIndexRecord
|
||||
!source "src/index/fx.idx.a"
|
||||
|
||||
kDFXIndexRecord
|
||||
!source "src/index/dfx.idx.a"
|
||||
|
||||
kGameHelpIndexRecord
|
||||
!source "src/index/gamehelp.idx.a"
|
||||
|
||||
kSHRArtworkIndexRecord
|
||||
!source "src/index/artwork.idx.a"
|
||||
|
||||
kDHGRActionIndexRecord
|
||||
!source "src/index/dhgr.idx.a"
|
||||
|
||||
kGRActionIndexRecord
|
||||
!source "src/index/gr.idx.a"
|
||||
|
||||
kTotalDataFile
|
||||
!byte 10
|
||||
!raw "TOTAL.DATA"
|
||||
@ -80,12 +120,6 @@ gHGRActionIndexNumber
|
||||
!raw "_"
|
||||
!raw ".IDX"
|
||||
|
||||
kDHGRActionIndexRecord
|
||||
!source "src/index/dhgr.idx.a"
|
||||
|
||||
kGRActionIndexRecord
|
||||
!source "src/index/gr.idx.a"
|
||||
|
||||
kDemoDirectory
|
||||
!byte 5
|
||||
!raw "DEMO/"
|
||||
@ -99,34 +133,10 @@ kFXDirectory
|
||||
!byte 3
|
||||
!raw "FX/"
|
||||
|
||||
kPrelaunchIndexRecord
|
||||
!source "src/index/prelaunch.idx.a"
|
||||
|
||||
kGlobalPrefsFilename
|
||||
!byte 10
|
||||
!raw "PREFS.CONF"
|
||||
|
||||
kAttractModeIndexRecord
|
||||
!source "src/index/attract.idx.a"
|
||||
|
||||
kMiniAttractIndexRecord
|
||||
!source "src/index/miniattract.idx.a"
|
||||
|
||||
kAttractModeSlideshowIndexRecord
|
||||
!source "src/index/slideshow.idx.a"
|
||||
|
||||
kFXIndexRecord
|
||||
!source "src/index/fx.idx.a"
|
||||
|
||||
kDFXIndexRecord
|
||||
!source "src/index/dfx.idx.a"
|
||||
|
||||
kGameHelpIndexRecord
|
||||
!source "src/index/gamehelp.idx.a"
|
||||
|
||||
kSHRArtworkIndexRecord
|
||||
!source "src/index/artwork.idx.a"
|
||||
|
||||
kCreditsFile
|
||||
!byte 7
|
||||
!raw "CREDITS"
|
||||
@ -166,21 +176,3 @@ kDecrunchFile
|
||||
kJoystickFile
|
||||
!byte 8
|
||||
!raw "JOYSTICK"
|
||||
|
||||
kSearchIndexFile
|
||||
!byte 12
|
||||
!raw "SEARCH"
|
||||
gSearchHasJoystick
|
||||
!raw "_"
|
||||
gSearchHas128K
|
||||
!raw "_"
|
||||
!raw ".IDX"
|
||||
|
||||
kSearchCacheFile
|
||||
!byte 11
|
||||
!raw "CACHE"
|
||||
gCacheHasJoystick
|
||||
!raw "_"
|
||||
gCacheHas128K
|
||||
!raw "_"
|
||||
!raw ".IDX"
|
||||
|
@ -34,14 +34,14 @@ InputBuffer
|
||||
; out: gSearchStore populated
|
||||
;------------------------------------------------------------------------------
|
||||
ReloadSearchIndex
|
||||
jsr LoadFile ; load appropriate search index into $8200
|
||||
!word kRootDirectory
|
||||
!word kSearchIndexFile
|
||||
jsr LoadIndexedFile ; load appropriate search index into $8200
|
||||
!word kTotalIndexFile
|
||||
!word gSearchIndex
|
||||
jsr LoadFile ; load appropriate search cache into $B000
|
||||
!word kRootDirectory
|
||||
!word kSearchCacheFile
|
||||
!word kSearchIndexRecord
|
||||
jsr LoadIndexedFile ; load appropriate search cache into $B000
|
||||
!word kTotalIndexFile
|
||||
!word gSearchCache
|
||||
!word kSearchCacheRecord
|
||||
rts
|
||||
|
||||
FindTitleInCache
|
||||
|
Loading…
Reference in New Issue
Block a user