-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.inc
executable file
·281 lines (257 loc) · 10.1 KB
/
constants.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
constant ROM_REGION_JP = 1
constant ROM_REGION_US = 2
constant ROM_REGION_FR = 3
constant ROM_REGION_DE = 4
// Default version is US 1.0
variable REGION = ROM_REGION_US
variable REVISION = 0
constant wEntitiesStatusTable = $C280
constant wSGBCommandBuffer = $C370
constant wCreditsSubscene = $D00E
constant wRequestedSFX = $D360
constant wActiveSFX = $D361
constant wOverworldRoomStatus = $D800
constant wShieldLevel = $DB44
constant wSwordLevel = $DB4E
constant wIsMarinFollowingLink = $DB73
constant wCurrentBank = $DBAF
constant wFarcallParams = $DE01
constant wRequestedMusicTrack = $D368
constant wActiveMusicTrack = $D369
constant wSaveFile1Name = $DB80
constant wSaveSlot = $DBA6
constant hRoomId = $FFF6
constant hMapId = $FFF7
constant hLinkRoomPosition = $FFFA
constant hLinkFinalRoomPosition = $FFFB
if !{defined MSU1BASE} {
define MSU1BASE = $1800
}
evaluate MSU1BASE = {MSU1BASE}
if !{defined DISABLE_COLOR_DUNGEON} {
define DISABLE_COLOR_DUNGEON = 1
}
evaluate DISABLE_COLOR_DUNGEON = {DISABLE_COLOR_DUNGEON}
if {defined ROM_VERSION_JP_1_0} {
REGION = ROM_REGION_JP
REVISION = 0
} else if {defined ROM_VERSION_JP_1_1} {
REGION = ROM_REGION_JP
REVISION = 1
} else if {defined ROM_VERSION_JP_1_2} {
REGION = ROM_REGION_JP
REVISION = 2
} else if {defined ROM_VERSION_US_1_0} {
REGION = ROM_REGION_US
REVISION = 0
} else if {defined ROM_VERSION_US_1_1} {
REGION = ROM_REGION_US
REVISION = 1
} else if {defined ROM_VERSION_US_1_2} {
REGION = ROM_REGION_US
REVISION = 2
} else if {defined ROM_VERSION_FR_1_0} {
REGION = ROM_REGION_FR
REVISION = 0
} else if {defined ROM_VERSION_FR_1_1} {
REGION = ROM_REGION_FR
REVISION = 1
} else if {defined ROM_VERSION_DE_1_0} {
REGION = ROM_REGION_DE
REVISION = 0
} else if {defined ROM_VERSION_DE_1_1} {
REGION = ROM_REGION_DE
REVISION = 1
}
inline OFFSET(name, addr) {
constant Offset_{name} = {addr}
}
// Common offsets for all revs
OFFSET(Hook_CheckNewGameSong, $008151)
OFFSET(FreeSpace_Bank02, $00BD00)
OFFSET(FlyingBookEntity, $058C92)
OFFSET(FreeSpace_Bank17, $05FFBB)
OFFSET(Hook_JumpToPlaySong, $06C032)
OFFSET(SFXPanFix_Bank1B, $06C2D5)
OFFSET(SFXCancel_Bank1B, $06CE57)
OFFSET(FreeSpace_Bank1B, $06CF00)
OFFSET(SFXPanFix_Bank1E, $078359)
OFFSET(ClearCurrentTrack, $07FB66)
OFFSET(NOPSlide, $07FC00)
OFFSET(Hook_Fade_Decrement, $07FF9A)
OFFSET(Hook_Fade_Increment, $07FFBA)
OFFSET(FreeSpace_Bank1F, $07FFEE)
OFFSET(MadBatterEntityHandlerPtr, $08025E)
OFFSET(ColorDungeonPuzzle, $0809A1)
OFFSET(Hook_SGBTransfer, $0F2A7C)
OFFSET(Hook_MSUInit, $0F2B27)
OFFSET(SendUploadCommand, $0F2B51)
OFFSET(WaitFor60ms, $0F2B86)
OFFSET(WaitForBCFrames, $0F2B92)
OFFSET(SendVRAMData, $0F2BA3)
OFFSET(FreeSpace_Bank3C, $0F2C00)
OFFSET(MSU1TrackCommandTable, $0F3F00)
if REGION == ROM_REGION_JP {
print "ROM Region: JP\n"
if REVISION == 0 {
// Rev 0 unique offsets
OFFSET(Farcall, $000BD7)
OFFSET(CheckEntityCountdownTimer, $000C05)
OFFSET(CopyData, $002919)
OFFSET(IncrementEntityState, $003B17)
OFFSET(DebugSaveData, $004671)
OFFSET(InitDebugSave, $0046CD)
OFFSET(Hook_CheckFilenames, $004AE3)
OFFSET(Hook_SetVolume_Half, $0056DB)
OFFSET(Hook_SetVolume_Full, $0058BA)
OFFSET(CommitSaveData, $005E35)
OFFSET(Hook_TheEndSave, $05CBDD)
OFFSET(MadBatterEntityHandler, $060EDD)
OFFSET(Hook_LilDevil_Start, $060F41)
OFFSET(Hook_LilDevil_Stop, $06107D)
OFFSET(WalrusTrack, $0615CB)
OFFSET(DeactivateCurrentEnity_18, $063F08)
OFFSET(FreeSpace_Bank18, $063FF0)
} else {
// Rev 1+2 common offets
OFFSET(Farcall, $000BD3)
OFFSET(CheckEntityCountdownTimer, $000C01)
OFFSET(CopyData, $002910)
OFFSET(IncrementEntityState, $003B0E)
OFFSET(DebugSaveData, $004674)
OFFSET(InitDebugSave, $0046D0)
OFFSET(Hook_CheckFilenames, $004AE6)
OFFSET(Hook_TheEndSave, $05CBD8)
OFFSET(MadBatterEntityHandler, $060EE1)
OFFSET(Hook_LilDevil_Start, $060F45)
OFFSET(Hook_LilDevil_Stop, $061061)
OFFSET(WalrusTrack, $0615D9)
OFFSET(DeactivateCurrentEnity_18, $063F29)
OFFSET(FreeSpace_Bank18, $063FF7)
if REVISION == 1 {
// Rev 1 unique offsets
OFFSET(Hook_SetVolume_Half, $0056DE)
OFFSET(Hook_SetVolume_Full, $0058A8)
OFFSET(CommitSaveData, $005E34)
} else if REVISION == 2 {
// Rev 2 unique offsets
OFFSET(Hook_SetVolume_Half, $005702)
OFFSET(Hook_SetVolume_Full, $0058CC)
OFFSET(CommitSaveData, $005E5B)
}
}
} else if REGION == ROM_REGION_US {
print "ROM Region: US\n"
if REVISION == 0 {
// Rev 0 unique offsets
OFFSET(Farcall, $000BD7)
OFFSET(CheckEntityCountdownTimer, $000C05)
OFFSET(CopyData, $002914)
OFFSET(IncrementEntityState, $003B12)
OFFSET(DebugSaveData, $004667)
OFFSET(InitDebugSave, $0046C3)
OFFSET(Hook_CheckFilenames, $004AD0)
OFFSET(Hook_SetVolume_Half, $00568C)
OFFSET(Hook_SetVolume_Full, $00586B)
OFFSET(CommitSaveData, $005DE6)
OFFSET(Hook_TheEndSave, $05CBDD)
OFFSET(MadBatterEntityHandler, $060EDD)
OFFSET(Hook_LilDevil_Start, $060F41)
OFFSET(Hook_LilDevil_Stop, $06107D)
OFFSET(WalrusTrack, $0615CB)
OFFSET(DeactivateCurrentEnity_18, $063F08)
OFFSET(FreeSpace_Bank18, $063FF7)
} else {
// Rev 1+2 common offets
OFFSET(Farcall, $000BD3)
OFFSET(CheckEntityCountdownTimer, $000C01)
OFFSET(CopyData, $00290B)
OFFSET(IncrementEntityState, $003B09)
OFFSET(DebugSaveData, $00466A)
OFFSET(InitDebugSave, $0046C6)
OFFSET(Hook_CheckFilenames, $004AD3)
OFFSET(Hook_TheEndSave, $05CBD8)
OFFSET(MadBatterEntityHandler, $060EE1)
OFFSET(Hook_LilDevil_Start, $060F45)
OFFSET(Hook_LilDevil_Stop, $061081)
OFFSET(WalrusTrack, $0615D9)
OFFSET(DeactivateCurrentEnity_18, $063F29)
OFFSET(FreeSpace_Bank18, $063FF7)
if REVISION == 1 {
// Rev 1 unique offsets
OFFSET(Hook_SetVolume_Half, $00568F)
OFFSET(Hook_SetVolume_Full, $00586E)
OFFSET(CommitSaveData, $005DFA)
} else if REVISION == 2 {
// Rev 2 unique offsets
OFFSET(Hook_SetVolume_Half, $0056B3)
OFFSET(Hook_SetVolume_Full, $005892)
OFFSET(CommitSaveData, $005E21)
} else {
error "Invalid ROM revision"
}
}
} else if REGION == ROM_REGION_FR {
print "ROM Region: FR\n"
// Common offsets for all revs
OFFSET(Farcall, $000BC7)
OFFSET(CheckEntityCountdownTimer, $000BF5)
OFFSET(CopyData, $0028F7)
OFFSET(IncrementEntityState, $003B0D)
OFFSET(DebugSaveData, $004667)
OFFSET(InitDebugSave, $0046C3)
OFFSET(Hook_CheckFilenames, $004AD4)
OFFSET(Hook_TheEndSave, $05CC27)
OFFSET(MadBatterEntityHandler, $060EE1)
OFFSET(Hook_LilDevil_Start, $060F45)
OFFSET(Hook_LilDevil_Stop, $061081)
OFFSET(WalrusTrack, $0615D9)
OFFSET(DeactivateCurrentEnity_18, $063F29)
OFFSET(FreeSpace_Bank18, $063FF7)
if REVISION == 0 {
// Rev 0 unique offsets
OFFSET(Hook_SetVolume_Half, $0052A6)
OFFSET(Hook_SetVolume_Full, $00586A)
OFFSET(CommitSaveData, $005DF6)
} else if REVISION == 1 {
// Rev 1 unique offsets
OFFSET(Hook_SetVolume_Half, $0056AF)
OFFSET(Hook_SetVolume_Full, $00588E)
OFFSET(CommitSaveData, $005E1D)
} else {
error "Invalid ROM revision"
}
} else if REGION == ROM_REGION_DE {
print "ROM Region: DE\n"
// Common offsets for all revs
OFFSET(Farcall, $000BC7)
OFFSET(CheckEntityCountdownTimer, $000BF5)
OFFSET(CopyData, $0028FA)
OFFSET(IncrementEntityState, $003B10)
OFFSET(DebugSaveData, $00465B)
OFFSET(InitDebugSave, $0046B7)
OFFSET(Hook_CheckFilenames, $004A9A)
OFFSET(Hook_TheEndSave, $05CBF4)
OFFSET(MadBatterEntityHandler, $060EE1)
OFFSET(Hook_LilDevil_Start, $060F45)
OFFSET(Hook_LilDevil_Stop, $061081)
OFFSET(WalrusTrack, $0615D9)
OFFSET(DeactivateCurrentEnity_18, $063F29)
OFFSET(FreeSpace_Bank18, $063FF7)
if REVISION == 0 {
// Rev 0 unique offsets
OFFSET(Hook_SetVolume_Half, $0056E8)
OFFSET(Hook_SetVolume_Full, $0058C7)
OFFSET(CommitSaveData, $005E53)
} else if REVISION == 1 {
// Rev 1 unique offsets
OFFSET(Hook_SetVolume_Half, $00570C)
OFFSET(Hook_SetVolume_Full, $0058EB)
OFFSET(CommitSaveData, $005E7A)
} else {
error "Invalid ROM revision"
}
}
print "ROM Revision: 1."
print REVISION
print "\n"