resume background decompression of artwork on launch

This commit is contained in:
4am
2025-01-08 00:34:57 -05:00
parent cb4a68f7b5
commit 0551a864f3
10 changed files with 44 additions and 15 deletions

View File

@@ -146,6 +146,9 @@ ResetVector ; 6 bytes, copied to $100
!source "src/hw.vbl.a"
!source "src/ui.wait.a"
gPreloadStatus
!byte %00000000
gMegaAttractModeFilter ; module types to include in mega-attract mode
!byte %11111111
; |||||||+- bit 0 include self-running demos

View File

@@ -139,6 +139,9 @@ WCOUNT = $0C ; word
HTAB = $24 ; byte
VTAB = $25 ; byte
RNDSEED = $4E ; word
!src "src/decrunch/constants.a"
PrelaunchInit= $EA
HideLaunchArtwork = $1BA
HideLaunchArtworkLC2 = $DFAE

View File

@@ -8,6 +8,8 @@ zp_bits_hi = $a4
zp_bitbuf = $a5
zp_dest_lo = $a6 ; dest addr lo
zp_dest_hi = $a7 ; dest addr hi
exo_save_x = $a8
exo_save_y = $a9
_EXO_CONSTANTS_=*
}

View File

@@ -79,6 +79,8 @@ DecompressInternal
lda #$60
sta DECRUNCH_EXIT_ON_KEYPRESS
+ jsr DECRUNCH
- stx exo_save_x
sty exo_save_y
sta READMAINMEM
sta WRITEMAINMEM
jsr SwitchToBank2
@@ -86,6 +88,18 @@ DecompressInternal
sta auxreq
jmp DisableAcceleratorAndSwitchToBank1
ResumeAuxDecompress
jsr SwitchToBank2
jsr EnableAccelerator
sta READAUXMEM
sta WRITEAUXMEM
lda #$EA
sta DECRUNCH_EXIT_ON_KEYPRESS
ldx exo_save_x
ldy exo_save_y
jsr DECRUNCH_EXIT_ON_KEYPRESS+1
jmp -
;------------------------------------------------------------------------------
; DecompressDHGR
;

View File

@@ -150,7 +150,7 @@ PlayGameInAY
; since SHR video mode will be active instead of HGR
beq @postArtwork ; always branches because Z=1 coming out of ClearScreens
@loadLaunchArtwork
lda gLaunchArtworkPreloaded
lda gPreloadStatus
bmi @showLaunchArtwork128K
jsr Home
lda MachineStatus
@@ -164,9 +164,17 @@ PlayGameInAY
jsr ReloadSearchIndexOnly
jmp @postArtwork
@loadLaunchArtwork128K
jsr LoadAuxIndexedSHRFile
lda gPreloadStatus
bne @resumeBackgroundDecompression
+ jsr LoadAuxIndexedSHRFile
jsr PreSHRMode
jsr DecompressAuxSHR
jmp @showLaunchArtwork128K
@resumeBackgroundDecompression
jsr PreSHRMode
jsr ResumeAuxDecompress
lda #%11111111
sta gPreloadStatus
@showLaunchArtwork128K
jsr SHRMode
@postArtwork

View File

@@ -184,7 +184,7 @@ DHGRTitleCallback
+LD16 WINDEX ; save game index in case user hits RETURN
+ST16 gGameToLaunch ; while it's visible (we'll launch it)
lda #0
sta gLaunchArtworkPreloaded
sta gPreloadStatus
jsr LoadIndexedFile ; load index file into $4000
- !word $4000

View File

@@ -179,7 +179,7 @@ HGRTitleCallback
+LD16 WINDEX ; save game index in case user hits RETURN
+ST16 gGameToLaunch ; while it's visible (we'll launch it)
lda #0
sta gLaunchArtworkPreloaded
sta gPreloadStatus
jsr LoadIndexedFile ; load index file into $4000
- !word $4000

View File

@@ -13,9 +13,6 @@
; - LoadAuxIndexedSHRFile
;
gLaunchArtworkPreloaded
!byte 0
;------------------------------------------------------------------------------
; AllSHRSlideshow
; execute mega-attract mode of all super hi-res artwork (and nothing else)
@@ -268,7 +265,7 @@ LoadLaunchArtworkInBackground
lda MachineStatus
and #HAS_128K
beq @exit ; no 128K -> done (want to do this all in auxmem)
lda gLaunchArtworkPreloaded
lda gPreloadStatus
bmi @exit ; already preloaded -> done
jsr GetGameToLaunch
bcs @exit ; no game -> done (this should never happen but okay)
@@ -287,12 +284,14 @@ LoadLaunchArtworkInBackground
jsr LoadAuxIndexedSHRFile
lda KBD
bmi @exit
lda #%00000001
sta gPreloadStatus
jsr PreSHRMode
jsr DecompressAuxSHR
lda KBD
bmi @turnOffLinearizeAndExit
lda #$FF
sta gLaunchArtworkPreloaded
lda #%11111111
sta gPreloadStatus
@turnOffLinearizeAndExit
lda #%00000001
sta NEWVIDEO

View File

@@ -94,7 +94,7 @@ OnBrowseNext
notLastGame
+STX16 gGameToLaunch
lda #0
sta gLaunchArtworkPreloaded
sta gPreloadStatus
jmp OnBrowseChanged
OnBrowseRandom
@@ -107,7 +107,7 @@ GameCount
stx gGameToLaunch
sta gGameToLaunch+1
lda #0
sta gLaunchArtworkPreloaded
sta gPreloadStatus
jmp OnBrowseChanged
ReloadIndexAndLaunch

View File

@@ -119,7 +119,7 @@ SearchMode
stx gGameToLaunch+1
stx gMegaAttractModeFilter ; $FF = all module types
inx
stx gLaunchArtworkPreloaded
stx gPreloadStatus
stx OffscreenPage ; don't show text page 2 by accident
jsr ReloadSearchIndex
jsr Home ; clear screen (switches to text mode)
@@ -201,7 +201,7 @@ OnInputChanged
stx gGameToLaunch ; $FFFF = no game selected
stx gGameToLaunch+1
inx
stx gLaunchArtworkPreloaded
stx gPreloadStatus
jsr LoadTitleOffscreen
jmp DrawUIWithoutDots
@@ -268,7 +268,7 @@ SoftBell
+ST16 gGameToLaunch
jsr LoadGameTitleOffscreen
lda #0
sta gLaunchArtworkPreloaded
sta gPreloadStatus
@noload
sta gDrawingOnscreen ; will minimize flicker in case we're
jsr DrawUI ; drawing directly onscreen