Useful patches
This page describes code patches which can be applied to the disassembly to make various useful changes.
Both games
Remove Beginning Locks
When you begin a game, you cannot open the menu, and music does not play properly. This state doesn't get lifted until you view the intro cutscenes.
You probably don't want this. There is a simple way to disable this. Simply navigate to constants/common/version.s
and add the following line at the bottom:
.redefine HACK_DISABLE_INTRO_LOCKS 1
This will activate some code added to the hack-base branch which disables the intro events. If you'd like to learn how this works, read on.
How it works
A single flag named "GLOBALFLAG_INTRO_DONE" is responsible for these events. The uses of this flag can be easily found by running git grep GLOBALFLAG_INTRO_DONE
in the oracles-disasm
folder:
$ git grep GLOBALFLAG_INTRO_DONE
code/ages/roomSpecificTileChanges.s: ld a,GLOBALFLAG_INTRO_DONE
code/bank1.s: ld a, GLOBALFLAG_INTRO_DONE
code/bank2.s: ld a,(wGlobalFlags+GLOBALFLAG_INTRO_DONE/8)
code/bank2.s: bit GLOBALFLAG_INTRO_DONE&7,a
code/seasons/roomGfxChanges.s: ld a,GLOBALFLAG_INTRO_DONE
constants/globalFlags.s: GLOBALFLAG_INTRO_DONE db ; $0a: Once set, start/select are usable
[...etc...]
It is used a number of times, but we're going to focus on its occurrences in bank1.s
and bank2.s
.
See the following code in code/bank1.s:
checkPlayRoomMusic:
; HACK-BASE: This define allows music to play before finishing the intro
.ifndef HACK_DISABLE_INTRO_LOCKS
ld a, GLOBALFLAG_INTRO_DONE
call checkGlobalFlag
ret z
.endif
We can see that these 3 lines of code, which are responsible for disabling the music before completing the intro, are wrapped around .ifndef HACK_DISABLE_INTRO_LOCKS
. .ifndef
stands for "if not defined", meaning the code will only exist if HACK_DISABLE_INTRO_LOCKS
is never defined. Because we defined it in version.s
, the code becomes disabled.
Moving on, we can find the following code in code/bank2.s:
; HACK-BASE: This define allows opening the inventory without finishing the intro
.ifndef HACK_DISABLE_INTRO_LOCKS
ld a,(wKeysJustPressed)
and BTN_START | BTN_SELECT
jr z,+
; Return if you haven't seen the opening cutscene yet
ld a,(wGlobalFlags+GLOBALFLAG_INTRO_DONE/8)
bit GLOBALFLAG_INTRO_DONE&7,a
ld a, SND_ERROR
jp z,playSound
+
.endif
Similarly, this code does not allow you to open the inventory unless you've cleared the intro. Having HACK_DISABLE_INTRO_LOCKS
defined disables the code in question.