This source file includes following definitions.
- filewritetask
- sub_FFA520F0_my
- sub_FFA52730_my
- sub_FFA5225C_my
1
2
3
4 #include "lolevel.h"
5 #include "platform.h"
6
7 typedef struct {
8 unsigned int address;
9 unsigned int length;
10 } cam_ptp_data_chunk;
11
12 #define MAX_CHUNKS_FOR_FWT 7
13
14
15
16
17
18
19
20 typedef struct
21 {
22 int unkn1;
23 int file_offset;
24 int full_size;
25 int unkn2, unkn3, unkn4;
26 cam_ptp_data_chunk pdc[MAX_CHUNKS_FOR_FWT];
27 int seek_flag;
28 char name[32];
29 } fwt_data_struct;
30 #define FWT_MUSTSEEK 2
31 #define FWT_SEEKMASK 0xffffffff
32
33 #include "../../../generic/filewrite.c"
34
35
36
37 void __attribute__((naked,noinline)) filewritetask() {
38 asm volatile (
39 " STMFD SP!, {R1-R7,LR} \n"
40 " LDR R7, =0x96B0 \n"
41 " MOV R6, #0 \n"
42
43 "loc_FFA52400:\n"
44 " LDR R0, [R7, #0x14] \n"
45 " MOV R2, #0 \n"
46 " ADD R1, SP, #8 \n"
47 " MOV R5, R7 \n"
48 " BL sub_003F7218 \n"
49 " CMP R0, #0 \n"
50 " LDRNE R1, =0x38E \n"
51 " LDRNE R0, =0xFFA52538 \n"
52 " BLNE _DebugAssert \n"
53 " LDR R0, [SP, #8] \n"
54 " LDR R1, [R0] \n"
55 " CMP R1, #0xB \n"
56 " ADDCC PC, PC, R1, LSL#2 \n"
57 " B loc_FFA52400 \n"
58 " B loc_FFA52508 \n"
59 " B loc_FFA52508 \n"
60 " B loc_FFA52508 \n"
61 " B loc_FFA52508 \n"
62 " B loc_FFA52508 \n"
63 " B loc_FFA52508 \n"
64 " B loc_FFA52508 \n"
65 " B loc_FFA52510 \n"
66 " B loc_FFA52464 \n"
67 " B loc_FFA524D4 \n"
68 " B loc_FFA524CC \n"
69
70 "loc_FFA52464:\n"
71 " STR R6, [SP] \n"
72
73 "loc_FFA52468:\n"
74 " LDR R0, [R5, #0x14] \n"
75 " MOV R1, SP \n"
76 " BL sub_003F745C \n"
77 " LDR R0, [SP] \n"
78 " CMP R0, #0 \n"
79 " BEQ loc_FFA52494 \n"
80 " LDR R0, [R5, #0x14] \n"
81 " MOV R2, #0 \n"
82 " ADD R1, SP, #4 \n"
83 " BL sub_003F7218 \n"
84 " B loc_FFA52468 \n"
85
86 "loc_FFA52494:\n"
87 " LDR R0, [R5, #8] \n"
88 " CMN R0, #1 \n"
89 " BEQ loc_FFA524C0 \n"
90 " BL fwt_close \n"
91 " MVN R0, #0 \n"
92 " STR R0, [R5, #8] \n"
93 " LDR R0, =0x131D20 \n"
94 " STR R6, [R5, #4] \n"
95 " BL sub_FF86671C \n"
96 " MOV R1, #0 \n"
97 " BL sub_FF8647B8 \n"
98
99 "loc_FFA524C0:\n"
100 " LDR R0, [R5, #0x10] \n"
101 " BL _GiveSemaphore \n"
102 " B loc_FFA52400 \n"
103
104 "loc_FFA524CC:\n"
105 " BL sub_FFA520F0_my \n"
106 " B loc_FFA52400 \n"
107
108 "loc_FFA524D4:\n"
109 " LDR R1, [R0, #4] \n"
110 " MOV R4, R0 \n"
111 " LDR R0, [R5, #8] \n"
112 " MOV R2, #0 \n"
113 " BL fwt_lseek \n"
114 " CMN R0, #1 \n"
115 " LDREQ R0, =0x9200013 \n"
116 " MOV R1, R4 \n"
117 " STREQ R0, [R4, #0x14] \n"
118 " MOVNE R0, #0 \n"
119 " MOVEQ R0, #7 \n"
120 " BL sub_FFA52034 \n"
121 " B loc_FFA52400 \n"
122
123 "loc_FFA52508:\n"
124 " BL sub_FFA52730_my \n"
125 " B loc_FFA52400 \n"
126
127 "loc_FFA52510:\n"
128 " BL sub_FFA5225C_my \n"
129 " B loc_FFA52400 \n"
130 );
131 }
132
133
134
135 void __attribute__((naked,noinline)) sub_FFA520F0_my() {
136 asm volatile (
137 " STMFD SP!, {R4-R9,LR} \n"
138 " LDR R6, =0x96B0 \n"
139 " MOV R4, R0 \n"
140
141
142 " STMFD SP!, {R4-R12,LR}\n"
143 " BL filewrite_main_hook\n"
144 " LDMFD SP!, {R4-R12,LR}\n"
145
146 " LDR R0, [R6, #4] \n"
147 " SUB SP, SP, #0x3C \n"
148 " CMP R0, #0 \n"
149 " BNE loc_FFA5222C \n"
150 " ADD R0, R4, #0x54 \n"
151 " BL sub_FF86671C \n"
152 " MOV R1, #0 \n"
153 " BL sub_FF86472C \n"
154 " LDR R0, [R4, #0x10] \n"
155 " BL sub_FF8636F0 \n"
156 " LDR R0, [R4, #0x50] \n"
157 " LDR R9, =0x1B6 \n"
158 " CMP R0, #1 \n"
159 " LDREQ R0, [R4, #0xC] \n"
160 " ADD R7, R4, #0x54 \n"
161 " ORREQ R0, R0, #0x8000 \n"
162 " STREQ R0, [R4, #0xC] \n"
163 " LDR R8, [R4, #0xC] \n"
164 " LDR R5, [R4, #0x10] \n"
165 " MOV R2, R9 \n"
166 " MOV R1, R8 \n"
167 " MOV R0, R7 \n"
168 " BL fwt_open \n"
169 " CMN R0, #1 \n"
170 " BNE loc_FFA521BC \n"
171 " MOV R0, R7 \n"
172 " BL sub_FF83083C \n"
173 " MOV R2, #0xF \n"
174 " MOV R1, R7 \n"
175 " ADD R0, SP, #4 \n"
176 " BL sub_003FC17C \n"
177 " MOV R0, #0 \n"
178 " LDR R1, =0x41FF \n"
179 " STRB R0, [SP, #0x13] \n"
180 " STR R1, [SP, #0x24] \n"
181 " MOV R1, #0x10 \n"
182 " STR R0, [SP, #0x2C] \n"
183 " STR R1, [SP, #0x28] \n"
184 " ADD R1, SP, #0x24 \n"
185 " ADD R0, SP, #4 \n"
186 " STR R5, [SP, #0x30] \n"
187 " STR R5, [SP, #0x34] \n"
188 " STR R5, [SP, #0x38] \n"
189 " BL sub_FF863FF8 \n"
190 " MOV R2, R9 \n"
191 " MOV R1, R8 \n"
192 " MOV R0, R7 \n"
193 " BL sub_FF830154 \n"
194
195 "loc_FFA521BC:\n"
196 " CMN R0, #1 \n"
197 " MOV R5, R0 \n"
198 " STR R0, [R6, #8] \n"
199 " BNE loc_FFA521F8 \n"
200 " ADD R0, R4, #0x54 \n"
201 " BL sub_FF86671C \n"
202 " LDR R1, [R6, #0x1C] \n"
203 " BL sub_FF8647B8 \n"
204 " LDR R1, [R6, #0x18] \n"
205 " CMP R1, #0 \n"
206 " BEQ loc_FFA52254 \n"
207 " ADD SP, SP, #0x3C \n"
208 " LDMFD SP!, {R4-R9,LR} \n"
209 " LDR R0, =0x9200001 \n"
210 " BX R1 \n"
211
212 "loc_FFA521F8:\n"
213 " MOV R0, #1 \n"
214 " STR R0, [R6, #4] \n"
215 " LDR R0, =0x131D20 \n"
216 " MOV R2, #0x20 \n"
217 " ADD R1, R4, #0x54 \n"
218 " BL sub_003FC364 \n"
219
220 " LDR R3, =current_write_ignored\n"
221 " LDR R3, [R3]\n"
222 " CMP R3, #0\n"
223 " BNE loc_A\n"
224
225 " LDR R1, [R4, #8] \n"
226 " MOV R0, R5 \n"
227 " BL sub_FF830430 \n"
228 " CMP R0, #0 \n"
229 " MOVEQ R1, R4 \n"
230 " MOVEQ R0, #7 \n"
231 " BEQ loc_FFA52250 \n"
232
233 "loc_FFA5222C:\n"
234 "loc_A:\n"
235 " LDR R0, [R4, #0x50] \n"
236 " CMP R0, #2 \n"
237 " BEQ loc_FFA52248 \n"
238 " LDR R0, [R4, #4] \n"
239 " CMP R0, #0 \n"
240 " MOVEQ R1, R4 \n"
241 " BEQ loc_FFA52250 \n"
242
243 "loc_FFA52248:\n"
244 " MOV R1, R4 \n"
245 " MOV R0, #9 \n"
246
247 "loc_FFA52250:\n"
248 " BL sub_FFA52034 \n"
249
250 "loc_FFA52254:\n"
251 " ADD SP, SP, #0x3C \n"
252 " LDMFD SP!, {R4-R9,PC} \n"
253 );
254 }
255
256
257
258 void __attribute__((naked,noinline)) sub_FFA52730_my() {
259 asm volatile (
260 " STMFD SP!, {R4-R10,LR} \n"
261 " MOV R5, R0 \n"
262 " LDR R0, [R0] \n"
263 " CMP R0, #6 \n"
264 " BHI loc_FFA5275C \n"
265 " ADD R0, R5, R0, LSL#3 \n"
266 " LDR R8, [R0, #0x18]! \n"
267 " LDR R7, [R0, #4] \n"
268 " CMP R7, #0 \n"
269 " BNE loc_FFA52774 \n"
270 " B loc_FFA52768 \n"
271
272 "loc_FFA5275C:\n"
273 " LDR R1, =0x2DD \n"
274 " LDR R0, =0xFFA52538 \n"
275 " BL _DebugAssert \n"
276
277 "loc_FFA52768:\n"
278 " MOV R1, R5 \n"
279 " MOV R0, #7 \n"
280 " B loc_FFA52808 \n"
281
282 "loc_FFA52774:\n"
283 " LDR R9, =0x96B0 \n"
284 " MOV R4, R7 \n"
285
286 "loc_FFA5277C:\n"
287 " LDR R0, [R5, #4] \n"
288 " CMP R4, #0x1000000 \n"
289 " MOVLS R6, R4 \n"
290 " MOVHI R6, #0x1000000 \n"
291 " BIC R1, R0, #0xFF000000 \n"
292 " CMP R1, #0 \n"
293 " BICNE R0, R0, #0xFF000000 \n"
294 " RSBNE R0, R0, #0x1000000 \n"
295 " CMPNE R6, R0 \n"
296 " MOVHI R6, R0 \n"
297 " LDR R0, [R9, #8] \n"
298 " MOV R2, R6 \n"
299 " MOV R1, R8 \n"
300 " BL fwt_write \n"
301 " LDR R1, [R5, #4] \n"
302 " CMP R6, R0 \n"
303 " ADD R1, R1, R0 \n"
304 " STR R1, [R5, #4] \n"
305 " BEQ loc_FFA527DC \n"
306 " CMN R0, #1 \n"
307 " LDRNE R0, =0x9200015 \n"
308 " LDREQ R0, =0x9200005 \n"
309 " STR R0, [R5, #0x14] \n"
310 " B loc_FFA52768 \n"
311
312 "loc_FFA527DC:\n"
313 " SUB R4, R4, R0 \n"
314 " CMP R4, R7 \n"
315 " ADD R8, R8, R0 \n"
316 " MOVCS R1, #0x308 \n"
317 " LDRCS R0, =0xFFA52538 \n"
318 " BLCS _DebugAssert \n"
319 " CMP R4, #0 \n"
320 " BNE loc_FFA5277C \n"
321 " LDR R0, [R5] \n"
322 " MOV R1, R5 \n"
323 " ADD R0, R0, #1 \n"
324
325 "loc_FFA52808:\n"
326 " LDMFD SP!, {R4-R10,LR} \n"
327 " B sub_FFA52034 \n"
328 );
329 }
330
331
332
333 void __attribute__((naked,noinline)) sub_FFA5225C_my() {
334 asm volatile (
335 " STMFD SP!, {R4-R6,LR} \n"
336 " MOV R4, R0 \n"
337 " LDR R0, [R0, #0x50] \n"
338 " LDR R5, =0x96B0 \n"
339 " CMP R0, #3 \n"
340 " SUB SP, SP, #0x38 \n"
341 " BEQ loc_FFA523D4 \n"
342 " LDR R0, [R5, #8] \n"
343 " CMN R0, #1 \n"
344 " BEQ loc_FFA522B0 \n"
345 " LDR R1, [R4, #0xC] \n"
346 " LDR R6, =0x9200003 \n"
347 " TST R1, #0x8000 \n"
348 " BEQ loc_FFA5229C \n"
349
350 " LDR R3, =current_write_ignored\n"
351 " LDR R3, [R3]\n"
352 " CMP R3, #0\n"
353 " BNE loc_B\n"
354
355 " BL sub_FF83015C \n"
356 " B loc_FFA522A0 \n"
357
358 "loc_FFA5229C:\n"
359 "loc_B:\n"
360 " BL fwt_close \n"
361
362 "loc_FFA522A0:\n"
363 " CMP R0, #0 \n"
364 " MVN R0, #0 \n"
365 " STRNE R6, [R4, #0x14] \n"
366 " STR R0, [R5, #8] \n"
367
368 "loc_FFA522B0:\n"
369 " LDR R0, [R4, #0x14] \n"
370 " TST R0, #1 \n"
371 " BNE loc_FFA523B8 \n"
372 " LDR R0, [R4, #0xC] \n"
373 " TST R0, #8 \n"
374 " BNE loc_FFA522D4 \n"
375 " LDR R0, [R4, #0x50] \n"
376 " CMP R0, #3 \n"
377 " BNE loc_FFA52304 \n"
378
379 "loc_FFA522D4:\n"
380 " ADD R1, SP, #0x20 \n"
381 " ADD R0, R4, #0x54 \n"
382 " BL sub_FF863F40 \n"
383 " CMP R0, #0 \n"
384 " LDREQ R1, =0x346 \n"
385 " LDREQ R0, =0xFFA52538 \n"
386 " BLEQ _DebugAssert \n"
387 " LDR R0, [SP, #0x28] \n"
388 " LDR R1, [R4, #4] \n"
389 " ADD R0, R0, R1 \n"
390 " STR R0, [SP, #0x28] \n"
391 " B loc_FFA52334 \n"
392
393 "loc_FFA52304:\n"
394 " LDR R0, =0x81FF \n"
395 " STR R0, [SP, #0x20] \n"
396 " MOV R0, #0x20 \n"
397 " STR R0, [SP, #0x24] \n"
398 " LDR R0, [R4, #4] \n"
399 " STR R0, [SP, #0x28] \n"
400 " LDR R0, [R4, #0x10] \n"
401 " STR R0, [SP, #0x2C] \n"
402 " LDR R0, [R4, #0x10] \n"
403 " STR R0, [SP, #0x30] \n"
404 " LDR R0, [R4, #0x10] \n"
405 " STR R0, [SP, #0x34] \n"
406
407 "loc_FFA52334:\n"
408 " LDR R0, [R4, #0x50] \n"
409 " CMP R0, #2 \n"
410 " BEQ loc_FFA523B8 \n"
411 " ADD R1, SP, #0x20 \n"
412 " ADD R0, R4, #0x54 \n"
413 " BL sub_FF863FF8 \n"
414 " LDR R0, [R4, #0x50] \n"
415 " CMP R0, #1 \n"
416 " BNE loc_FFA523B8 \n"
417 " MOV R2, #0x20 \n"
418 " ADD R1, R4, #0x54 \n"
419 " MOV R0, SP \n"
420 " BL sub_003FC364 \n"
421 " MOV R0, SP \n"
422 " BL _strlen \n"
423 " MOV R2, #0x54 \n"
424 " ADD R0, R0, SP \n"
425 " MOV R1, #0x4D \n"
426 " STRB R2, [R0, #-3] \n"
427 " STRB R1, [R0, #-2] \n"
428 " MOV R1, #0x50 \n"
429 " STRB R1, [R0, #-1] \n"
430 " MOV R1, SP \n"
431 " ADD R0, R4, #0x54 \n"
432 " BL sub_FF863878 \n"
433 " CMP R0, #0 \n"
434 " MOVEQ R1, #0x164 \n"
435 " LDREQ R0, =0xFFA52538 \n"
436 " BLEQ _DebugAssert \n"
437 " MOV R0, SP \n"
438 " BL sub_FF864454 \n"
439 " ADD R0, R4, #0x54 \n"
440 " BL sub_FF864454 \n"
441
442 "loc_FFA523B8:\n"
443 " ADD R0, R4, #0x54 \n"
444 " BL sub_FF86671C \n"
445 " LDR R1, [R5, #0x1C] \n"
446 " BL sub_FF8647B8 \n"
447 " MOV R0, #0 \n"
448 " STR R0, [R5, #4] \n"
449 " B loc_FFA523DC \n"
450
451 "loc_FFA523D4:\n"
452 " LDR R0, [R5, #0x1C] \n"
453 " BLX R0 \n"
454
455 "loc_FFA523DC:\n"
456 " LDR R1, [R5, #0x18] \n"
457 " CMP R1, #0 \n"
458 " LDRNE R0, [R4, #0x14] \n"
459 " BLXNE R1 \n"
460 " ADD SP, SP, #0x38 \n"
461 " LDMFD SP!, {R4-R6,PC} \n"
462 );
463 }