ensure reload of search index after exiting mini attract mode

fixes https://github.com/a2-4am/4cade/issues/430
This commit is contained in:
4am 2021-11-11 22:20:06 -05:00
parent ff3b536e1c
commit 535b5b39ce
3 changed files with 8 additions and 3 deletions

View File

@ -65,7 +65,7 @@ MegaAttractMode
; in: gGameToLaunch = index in gSearchStore (word)
; gSearchStore populated
; out: all flags and registers clobbered
; assume all of main memory has been clobbered
; assume all of main memory has been clobbered (including gSearchStore)
;------------------------------------------------------------------------------
MiniAttractMode
jsr GetGameToLaunch

View File

@ -96,6 +96,9 @@ OnBrowseCheat
OnBrowseTab
jsr MiniAttractMode
pha ; must reload search index before calling either
jsr ReloadSearchIndex ; PlayGame or LoadGameTitleOffscreen, because
pla ; mini attract mode may have clobbered all of main memory
cmp #$8D
beq OnBrowseLaunch
; execution falls through here
@ -104,6 +107,7 @@ ForceBrowseChanged
; execution falls through here
OnBrowseChanged
; in: gGameToLaunch = game index (word)
; gSearchStore populated
jsr SwitchToBank2
jsr EnableAcceleratorAndSwitchToBank1
jsr LoadGameTitleOffscreen

View File

@ -162,7 +162,8 @@ OnTab
jsr MiniAttractMode
cmp #$8D ; if we exited mini attract mode
bne .req_redraw ; by pressing Enter, launch the game
jsr ReloadSearchIndex ; must reload search index before calling PlayGame
; /!\ execution falls through here
OnLaunch
ldx gGameToLaunch+1
inx
@ -170,7 +171,7 @@ OnLaunch
jsr PlayGame
.req_redraw
sec ; tell caller to redraw UI
sec ; tell caller to reload search index and redraw UI from scratch
rts
OnCheat