-
Notifications
You must be signed in to change notification settings - Fork 54
Description
In key-sanity, vanilla small keys in chests do not immediately show up on the menu. They only appear after certain types of transitions like leaving the dungeon, or once a key is spent.
This is because small keys in their vanilla dungeons are converted to item 0x24 by code in Location.php. That code is desirable because it avoids the textbox.
However picking up of item 0x24 from a chest has not actually been hooked. The sprite version from pots and enemies is hooked, and the dungeon specific items are, but not the vanilla 0x24.
I'd recommend the following hook (perhaps needs a better name, I just went with the nearby label in the disassembly):
org $09873F ; <- 04873F - ancilla_init.asm : 960 (ADC [$00] : STA [$00] )
JSL.l AddToStock With an implementation in stats.asm nearby the existing IncrementSmallKey
AddToStock:
ADC [$00] : STA [$00] ; thing we wrote over
PHP : PHA
; if [$00] == $7EF36F (Small key count address)
LDA $00 : CMP #$6F : BNE + : LDA $01 : CMP #$F3 : BNE + : LDA $02 : CMP #$7E : BNE +
JSL.l UpdateKeys
+
PLA : PLP
RTLI am literally targeting the exact spot where $7EF36F is incremented, just like the existing IncrementSmallKey hook does.