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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
|
.set sp,1
.set rtoc,2
.text
.extern OSReport
.extern enableNonLoopAnim__Q23m2d13EmbedLayout_cFib
.global FSShowCD, FSHideCD
FSShowCD:
addi r3, r3, 0x74
li r4, 0x2A
b enableNonLoopAnim__Q23m2d13EmbedLayout_cFib
FSHideCD:
addi r3, r3, 0x74
li r4, 0x2B
b enableNonLoopAnim__Q23m2d13EmbedLayout_cFib
.global FSShowCD_OpenWait
FSShowCD_OpenWait:
addi r3, r31, 0x74
li r4, 0x2A
bl enableNonLoopAnim__Q23m2d13EmbedLayout_cFib
lwz r0, 0x14(r1)
lwz r31, 0xC(r1)
mtlr r0
addi r1, r1, 0x10
blr
#.global FSHideCD_IWOSAEW
#FSHideCD_IWOSAEW:
# addi r3, r31, 0x74
# li r4, 0x2B
# bl enableNonLoopAnim__Q23m2d13EmbedLayout_cFib
# lwz r0, 0x14(r1)
# lwz r31, 0xC(r1)
# mtlr r0
# addi r1, r1, 0x10
# blr
.global DFNiceTitle
DFNiceTitle:
mr r3, r4
lis r4, DFTitle@h
ori r4, r4, DFTitle@l
lwz r6, 0xE44(r30)
addi r6, r6, '1'
sth r6, 0xA(r4)
li r5, 0
li r6, 6
lwz r12, 0(r3)
lwz r12, 0x80(r12)
mtctr r12
bctr
.extern findTextBoxByName__Q23m2d17EmbedLayoutBase_cCFPCc
.extern findPictureByName__Q23m2d17EmbedLayoutBase_cCFPCc
.extern InsertIntIntoTextBox1
.global DFNiceWorldName
DFNiceWorldName:
stwu r1, -0x30(r1)
mflr r0
stw r0, 0x34(r1)
stw r20, 0x2C(r1)
stw r21, 0x28(r1)
stw r22, 0x24(r1)
# r1+0x20 is reserved for the stupid ints in textboxes
stw r23, 0x1C(r1)
stw r24, 0x18(r1)
stw r25, 0x14(r1)
mr r20, r4
# Savefile is in r31
# World Name field is in r20
lis r4, ConvertedWorldName@h
ori r4, r4, ConvertedWorldName@l
mr r3, r4
mr r5, r31
li r6, 36
mtctr r6
convWNameLoop:
lbz r6, 0x6FC(r5)
sth r6, 0(r3)
addi r3, r3, 2
addi r5, r5, 1
bdnz convWNameLoop
mr r3, r20
li r5, 0
lwz r12, 0(r3)
lwz r12, 0x7C(r12)
mtctr r12
bctrl
# now set the colours
# Text colours: 0x720, hint colours: 0x728
lwz r3, 0x720(r31)
stw r3, 0xDC(r20)
lwz r3, 0x724(r31)
stw r3, 0xE0(r20)
addi r3, r30, 0x74
lis r4, Picture_00@h
ori r4, r4, Picture_00@l
bl findPictureByName__Q23m2d17EmbedLayoutBase_cCFPCc
lwz r4, 0x728(r31)
stw r4, 0xD8(r3)
stw r4, 0xDC(r3)
lwz r4, 0x72C(r31)
stw r4, 0xE0(r3)
stw r4, 0xE4(r3)
# While we're at it, take care of some other things
# r21 shall hold our star coin count; r22 shall hold our exit count
# r23 shall hold the level pointer
# r24 shall hold the world number, and r25 the level number
li r21, 0
li r22, 0
addi r23, r31, 0x6C
li r24, 0
li r25, 0
# Loop through ALL levels
levelLoop:
lwz r4, 0(r23)
cmpwi r25, 38
beq ignoreStartPoint
clrlwi. r0, r4, 31
beq noCoin1
addi r21, r21, 1
noCoin1:
extrwi. r0, r4, 1,30
beq noCoin2
addi r21, r21, 1
noCoin2:
extrwi. r0, r4, 1,29
beq noCoin3
addi r21, r21, 1
noCoin3:
extrwi. r0, r4, 1,27
beq noNormalExit
addi r22, r22, 1
# lis r3, NormalExitStr@h
# ori r3, r3, NormalExitStr@l
# addi r4, r24, 1
# addi r5, r25, 1
# crclr 4*cr1+eq
# bl OSReport
noNormalExit:
lwz r4, 0(r23)
extrwi. r0, r4, 1,26
beq noSecretExit
addi r22, r22, 1
# lis r3, SecretExitStr@h
# ori r3, r3, SecretExitStr@l
# addi r4, r24, 1
# addi r5, r25, 1
# crclr 4*cr1+eq
# bl OSReport
noSecretExit:
ignoreStartPoint:
addi r23, r23, 4
addi r25, r25, 1
cmpwi r25, 42
blt levelLoop
# next world
addi r24, r24, 1
li r25, 0
cmpwi r24, 10
blt levelLoop
# Now, subtract the paid star coins
lhz r3, 0x66(r31)
sub r21, r21, r3
# And write everything ...
addi r3, r30, 0x74
lis r4, ExitCount@h
ori r4, r4, ExitCount@l
bl findTextBoxByName__Q23m2d17EmbedLayoutBase_cCFPCc
stw r22, 0x20(r1)
mr r4, r3
addi r3, r1, 0x20
li r5, 1
bl InsertIntIntoTextBox1
addi r3, r30, 0x74
lis r4, StarCoinCount@h
ori r4, r4, StarCoinCount@l
bl findTextBoxByName__Q23m2d17EmbedLayoutBase_cCFPCc
stw r21, 0x20(r1)
mr r4, r3
addi r3, r1, 0x20
li r5, 0
bl InsertIntIntoTextBox1
lwz r25, 0x14(r1)
lwz r24, 0x18(r1)
lwz r23, 0x1C(r1)
lwz r22, 0x24(r1)
lwz r21, 0x28(r1)
lwz r20, 0x2C(r1)
lwz r0, 0x34(r1)
mtlr r0
addi r1, r1, 0x30
blr
.global FSDebugStates
FSDebugStates:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xC(r1)
stw r30, 0x8(r1)
mr r31, r3
mr r30, r4
lis r3, FSStateDebugStr@h
ori r3, r3, FSStateDebugStr@l
crclr 4*cr1+eq
lwz r4, 4(r4)
bl OSReport
mr r3, r31
mr r4, r30
lwzu r12, 0x18(r3)
lwz r12, 0x18(r12)
mtctr r12
bctrl
lwz r31, 0xC(r1)
lwz r30, 0x8(r1)
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
.global DefaultSavefileInfo
DefaultSavefileInfo:
addi r4, r3, 0x6FC
lis r5, DefaultSavefileInfoData@h
ori r5, r5, DefaultSavefileInfoData@l
lis r6, DefaultSavefileInfoDataEnd@h
ori r6, r6, DefaultSavefileInfoDataEnd@l
DSFICopyLoop:
lwz r7, 0(r5)
stw r7, 0(r4)
addi r4, r4, 4
addi r5, r5, 4
cmpw r5, r6
blt DSFICopyLoop
blr
.align 4
.data
FSStateDebugStr: .string "State: %s\n"
.global FSDummyBrlanName, FSDummyGroup, FSDummyPane
FSDummyBrlanName: .string "fileSelectBase_18_DummyAnim.brlan"
FSDummyGroup: .string "DummyGroup"
FSDummyPane: .string "DummyPane"
.global A00_window
A00_window: .string "A00_window"
.global ShowEraseCopy, HideEraseCopy
ShowEraseCopy: .string "fileSelectBase_18_ShowEraseCopy.brlan"
HideEraseCopy: .string "fileSelectBase_18_HideEraseCopy.brlan"
.global N_posFile1_00
N_posFile1_00: .string "N_posFile1_00"
.global CDHolderGroup
CDHolderGroup: .string "CDHolderGroup"
NormalExitStr: .string "<Normal> %d-%d\n"
SecretExitStr: .string "<Secret> %d-%d\n"
StarCoinCount: .string "StarCoinCount"
ExitCount: .string "ExitCount"
Picture_00: .string "Picture_00"
.align 4
DFTitle:
.short 'F','i','l','e',' ','X',0
ConvertedWorldName:
.short 0,0,0,0,0,0,0,0,0,0,0,0 # 12
.short 0,0,0,0,0,0,0,0,0,0,0,0 # 12
.short 0,0,0,0,0,0,0,0,0,0,0,0 # 12
.align 4
DefaultSavefileInfoData:
.string "Yoshi's Island" #15
.byte 0,0,0,0,0,0,0,0,0,0,0 # 11
.byte 0,0,0,0,0,0,0,0,0,0 # 10
.long 0xFFFF99FF,0x1FB423FF
.long 0x173714FF,0x3C9135FF
.long 0xFFFF99FF,0x1FB423FF
.short 0x75,0x2E,0xB
.byte 0,0
DefaultSavefileInfoDataEnd:
.long 0
|