This source file includes following definitions.
- filewritetask
- sub_e03af6a4_my
- sub_e03afc4c_my
- sub_e03af7dc_my
1 #include "lolevel.h"
2 #include "platform.h"
3
4 typedef struct {
5 unsigned int address;
6 unsigned int length;
7 } cam_ptp_data_chunk;
8
9 #define MAX_CHUNKS_FOR_FWT 7
10
11
12
13
14
15
16
17
18
19
20 typedef struct
21 {
22 int unkn1;
23 int file_offset;
24 int maybe_full_size;
25 int unkn2, unkn3;
26 int unkn4;
27 cam_ptp_data_chunk pdc[MAX_CHUNKS_FOR_FWT];
28 int maybe_seek_flag;
29 int unkn5, unkn6;
30 char name[32];
31 } fwt_data_struct;
32
33 #include "../../../generic/filewrite.c"
34
35
36
37 void __attribute__((naked,noinline))
38 filewritetask()
39 {
40 asm volatile (
41
42 " ldr r5, =0x00036344\n"
43 " push {r3, lr}\n"
44 "loc_e03af92e:\n"
45 " movs r2, #0\n"
46 " mov r1, sp\n"
47 " ldr r0, [r5, #0x14]\n"
48 " bl sub_dffc9de0\n"
49 " cbz r0, loc_e03af946\n"
50 " movs r0, #0\n"
51 " movw r2, #0x405\n"
52 " ldr r1, =0xe03af9f4\n"
53 " bl sub_dffc96f4\n"
54 "loc_e03af946:\n"
55 " ldr r0, [sp]\n"
56 " ldr r1, [r0]\n"
57 " cmp r1, #0xd\n"
58 " bhs loc_e03af92e\n"
59 " tbb [pc, r1]\n"
60 "branchtable_e03af952:\n"
61 " .byte((loc_e03af998 - branchtable_e03af952) / 2)\n"
62 " .byte((loc_e03af998 - branchtable_e03af952) / 2)\n"
63 " .byte((loc_e03af998 - branchtable_e03af952) / 2)\n"
64 " .byte((loc_e03af998 - branchtable_e03af952) / 2)\n"
65 " .byte((loc_e03af998 - branchtable_e03af952) / 2)\n"
66 " .byte((loc_e03af998 - branchtable_e03af952) / 2)\n"
67 " .byte((loc_e03af998 - branchtable_e03af952) / 2)\n"
68 " .byte((loc_e03af99e - branchtable_e03af952) / 2)\n"
69 " .byte((loc_e03af960 - branchtable_e03af952) / 2)\n"
70 " .byte((loc_e03af972 - branchtable_e03af952) / 2)\n"
71 " .byte((loc_e03af992 - branchtable_e03af952) / 2)\n"
72 " .byte((loc_e03af966 - branchtable_e03af952) / 2)\n"
73 " .byte((loc_e03af96c - branchtable_e03af952) / 2)\n"
74 ".align 1\n"
75 "loc_e03af960:\n"
76 " bl sub_e03afb30\n"
77 " b loc_e03af92e\n"
78 "loc_e03af966:\n"
79 " bl sub_e03afb7c\n"
80 " b loc_e03af92e\n"
81 "loc_e03af96c:\n"
82 " bl sub_e03af6a4_my\n"
83 " b loc_e03af92e\n"
84 "loc_e03af972:\n"
85 " ldr r1, [r0, #4]\n"
86 " mov r4, r0\n"
87 " ldr r0, [r5, #8]\n"
88 " movs r2, #0\n"
89 " bl sub_e0374088\n"
90 " adds r0, r0, #1\n"
91 " bne loc_e03af92e\n"
92 " mov r1, r4\n"
93 " ldr r0, =0x09200001\n"
94 " adds r0, #0x12\n"
95 " str r0, [r4, #0x14]\n"
96 " movs r0, #7\n"
97 " bl sub_e03af62a\n"
98 " b loc_e03af92e\n"
99 "loc_e03af992:\n"
100 " bl sub_e03afbda\n"
101 " b loc_e03af92e\n"
102 "loc_e03af998:\n"
103 " bl sub_e03afc4c_my\n"
104 " b loc_e03af92e\n"
105 "loc_e03af99e:\n"
106 " bl sub_e03af7dc_my\n"
107 " b loc_e03af92e\n"
108 );
109 }
110
111 void __attribute__((naked,noinline))
112 sub_e03af6a4_my() {
113 asm volatile (
114
115 " push.w {r4, r5, r6, r7, r8, sb, lr}\n"
116 " mov r4, r0\n"
117
118
119
120 " bl filewrite_main_hook\n"
121 " mov r0, r4\n"
122
123 " ldr r0, [r0, #0x50]\n"
124 " sub sp, #0x3c\n"
125 " lsls r1, r0, #0x1f\n"
126 " bne loc_e03af6b6\n"
127 " lsls r0, r0, #0x1d\n"
128 " bpl loc_e03af77a\n"
129 "loc_e03af6b6:\n"
130 " ldr r6, =0x00036344\n"
131 " ldr r0, [r6, #0x1c]\n"
132 " cbz r0, loc_e03af6be\n"
133 " blx r0\n"
134 "loc_e03af6be:\n"
135 " add.w r0, r4, #0x5c\n"
136 " mov r7, r0\n"
137 " bl sub_e03753e0\n"
138 " movs r1, #0\n"
139 " bl sub_e0036d66\n"
140 " movs r1, #0\n"
141 " movs r0, #0x47\n"
142 " bl sub_e03719e0\n"
143 " ldrb.w r0, [r4, #0x50]\n"
144 " lsls r0, r0, #0x1f\n"
145 " beq loc_e03af77a\n"
146 " ldr r0, [r4, #0x10]\n"
147 " bl sub_e045e5fe\n"
148 " ldr r1, [r4, #0x50]\n"
149 " movw r0, #0x301\n"
150 " lsls r2, r1, #0x1b\n"
151 " bpl loc_e03af6f2\n"
152 " movs r0, #9\n"
153 " b loc_e03af6f8\n"
154 "loc_e03af6f2:\n"
155 " lsls r2, r1, #0x19\n"
156 " bpl loc_e03af6f8\n"
157 " movs r0, #1\n"
158 "loc_e03af6f8:\n"
159 " lsls r1, r1, #0x1a\n"
160 " bmi loc_e03af702\n"
161 " ldr r1, [r4, #0x58]\n"
162 " cmp r1, #1\n"
163 " bne loc_e03af706\n"
164 "loc_e03af702:\n"
165 " orr r0, r0, #0x8000\n"
166 "loc_e03af706:\n"
167 " ldr r5, [r4, #0x10]\n"
168 " mov sb, r0\n"
169 " mov.w r2, #0x1b6\n"
170 " mov r1, r0\n"
171 " mov r8, r2\n"
172 " mov r0, r7\n"
173
174
175 " bl fwt_open\n"
176
177 " adds r1, r0, #1\n"
178 " bne loc_e03af756\n"
179 " mov r0, r7\n"
180 " bl sub_e0374354\n"
181 " movs r2, #0xf\n"
182 " mov r1, r7\n"
183 " mov r0, sp\n"
184 " blx sub_dffcc618\n"
185 " movs r0, #0\n"
186 " movw r1, #0x41ff\n"
187 " strb.w r0, [sp, #0xf]\n"
188 " str r1, [sp, #0x20]\n"
189 " movs r1, #0x10\n"
190 " strd r0, r5, [sp, #0x28]\n"
191 " mov r0, sp\n"
192 " str r1, [sp, #0x24]\n"
193 " add r1, sp, #0x20\n"
194 " str r5, [sp, #0x30]\n"
195 " str r5, [sp, #0x34]\n"
196 " bl sub_e040272c\n"
197 " mov r2, r8\n"
198 " mov r1, sb\n"
199 " mov r0, r7\n"
200 " bl sub_e0373e7a\n"
201 "loc_e03af756:\n"
202 " mov r5, r0\n"
203 " str r0, [r6, #8]\n"
204 " adds r0, r0, #1\n"
205 " beq loc_e03af79a\n"
206 " movs r2, #0x20\n"
207 " ldr r0, =0x00218988\n"
208 " mov r1, r7\n"
209 " blx sub_dffcc598\n"
210
211
212
213 " LDR r3, =current_write_ignored\n"
214 " LDR r3, [r3]\n"
215 " cbnz r3,loc_C\n"
216
217
218 " ldrb.w r0, [r4, #0x50]\n"
219 " lsls r0, r0, #0x18\n"
220 " bpl loc_e03af77a\n"
221 " ldr r1, [r4, #0xc]\n"
222 " mov r0, r5\n"
223 " bl sub_e037415c\n"
224 " cbz r0, loc_e03af7ca\n"
225 "loc_e03af77a:\n"
226 "loc_C:\n"
227 " ldrb.w r0, [r4, #0x50]\n"
228 " lsls r0, r0, #0x19\n"
229 " bmi loc_e03af786\n"
230 " ldr r0, [r4, #4]\n"
231 " cbz r0, loc_e03af78e\n"
232 "loc_e03af786:\n"
233 " movs r0, #9\n"
234 " mov r1, r4\n"
235 " bl sub_e03af62a\n"
236 "loc_e03af78e:\n"
237 " movs r0, #0\n"
238 " mov r1, r4\n"
239 "loc_e03af792:\n"
240 " add sp, #0x3c\n"
241 " pop.w {r4, r5, r6, r7, r8, sb, lr}\n"
242 " b sub_e03af62a\n"
243 "loc_e03af79a:\n"
244 " movs r1, #0\n"
245 " movs r0, #0x48\n"
246 " bl sub_e03719e0\n"
247 " mov r0, r7\n"
248 " bl sub_e03753e0\n"
249 " ldr r1, [r6, #0x20]\n"
250 " bl sub_e0036dc4\n"
251 " ldr r0, [r6, #0x18]\n"
252 " cmp r0, #0\n"
253 " beq loc_e03af7d6\n"
254 " mov r0, r4\n"
255 " ldr r5, =0x09200001\n"
256 " mov r1, r5\n"
257 " bl sub_e03af5f0\n"
258 " ldr r1, [r6, #0x18]\n"
259 " add sp, #0x3c\n"
260 " mov r0, r5\n"
261 " pop.w {r4, r5, r6, r7, r8, sb, lr}\n"
262 " bx r1\n"
263 "loc_e03af7ca:\n"
264 " ldr r0, =0x09200001\n"
265 " mov r1, r4\n"
266 " adds r0, #0x16\n"
267 " str r0, [r4, #0x14]\n"
268 " movs r0, #7\n"
269 " b loc_e03af792\n"
270 "loc_e03af7d6:\n"
271 " add sp, #0x3c\n"
272 " pop.w {r4, r5, r6, r7, r8, sb, pc}\n"
273 );
274 }
275
276 void __attribute__((naked,noinline))
277 sub_e03afc4c_my() {
278 asm volatile (
279
280 " push.w {r4, r5, r6, r7, r8, sb, sl, lr}\n"
281 " mov r5, r0\n"
282 " ldr r0, [r0]\n"
283 " cmp r0, #6\n"
284 " bhi loc_e03afcac\n"
285 " add.w r0, r5, r0, lsl #3\n"
286 " ldrd r7, r6, [r0, #0x18]\n"
287 " cbz r6, loc_e03afcaa\n"
288 " ldr.w sl, =0x00036344\n"
289 " mov r4, r6\n"
290 " mov.w sb, #0x1000000\n"
291 "loc_e03afc6c:\n"
292 " ldr r0, [r5, #4]\n"
293 " cmp r4, sb\n"
294 " mov r1, r4\n"
295 " bls loc_e03afc76\n"
296 " mov r1, sb\n"
297 "loc_e03afc76:\n"
298 " lsls r2, r0, #8\n"
299 " beq loc_e03afc88\n"
300 " bic r0, r0, #0xff000000\n"
301 " rsb.w r0, r0, #0x1000000\n"
302 " cmp r1, r0\n"
303 " bls loc_e03afc88\n"
304 " mov r1, r0\n"
305 "loc_e03afc88:\n"
306 " ldr.w r0, [sl, #8]\n"
307 " mov r8, r1\n"
308 " mov r2, r1\n"
309 " mov r1, r7\n"
310
311
312 " bl fwt_write\n"
313
314 " ldr r1, [r5, #4]\n"
315 " cmp r8, r0\n"
316 " add r1, r0\n"
317 " str r1, [r5, #4]\n"
318 " beq loc_e03afcc6\n"
319 " adds r0, r0, #1\n"
320 " beq loc_e03afcc0\n"
321 " ldr r0, =0x09200006\n"
322 " adds r0, #0xf\n"
323 "loc_e03afca8:\n"
324 " str r0, [r5, #0x14]\n"
325 "loc_e03afcaa:\n"
326 " b loc_e03afcba\n"
327 "loc_e03afcac:\n"
328 " mov.w r2, #0x348\n"
329 " ldr r1, =0xe03afa00\n"
330 " movs r0, #0\n"
331 " bl sub_dffc96f4\n"
332 "loc_e03afcba:\n"
333 " movs r0, #7\n"
334 " mov r1, r5\n"
335 " b loc_e03afce6\n"
336 "loc_e03afcc0:\n"
337 " ldr r0, =0x09200006\n"
338 " subs r0, r0, #1\n"
339 " b loc_e03afca8\n"
340 "loc_e03afcc6:\n"
341 " subs r4, r4, r0\n"
342 " add r7, r0\n"
343 " cmp r4, r6\n"
344 " blo loc_e03afcdc\n"
345 " movw r2, #0x372\n"
346 " ldr r1, =0xe03afa00\n"
347 " movs r0, #0\n"
348 " bl sub_dffc96f4\n"
349 "loc_e03afcdc:\n"
350 " cmp r4, #0\n"
351 " bne loc_e03afc6c\n"
352 " ldr r0, [r5]\n"
353 " mov r1, r5\n"
354 " adds r0, r0, #1\n"
355 "loc_e03afce6:\n"
356 " pop.w {r4, r5, r6, r7, r8, sb, sl, lr}\n"
357 " b sub_e03af62a\n"
358 );
359 }
360
361 void __attribute__((naked,noinline))
362 sub_e03af7dc_my() {
363 asm volatile (
364
365 " push {r4, r5, r6, r7, lr}\n"
366 " mov r4, r0\n"
367 " ldr r0, [r0, #0x50]\n"
368 " sub sp, #0x3c\n"
369 " ldr r5, =0x00036344\n"
370 " add.w r7, r4, #0x5c\n"
371 " lsls r1, r0, #0x1e\n"
372 " bmi loc_e03af7f4\n"
373 " lsls r0, r0, #0x1c\n"
374 " bmi loc_e03af844\n"
375 " b loc_e03af90e\n"
376 "loc_e03af7f4:\n"
377 " lsls r0, r0, #0x18\n"
378 " bpl loc_e03af826\n"
379 " ldrd r1, r0, [r4, #8]\n"
380 " cmp r1, r0\n"
381 " beq loc_e03af826\n"
382 " ldr r0, [r5, #8]\n"
383 " bl sub_e037415c\n"
384 " cbz r0, loc_e03af81a\n"
385 " ldr r0, [r4, #8]\n"
386 " add r1, sp, #0x20\n"
387 " str r0, [r4, #4]\n"
388 " mov r0, r7\n"
389 " bl sub_e04026b6\n"
390 " cmp r0, #1\n"
391 " beq loc_e03af822\n"
392 " b loc_e03af826\n"
393 "loc_e03af81a:\n"
394 " ldr r0, =0x09200001\n"
395 " adds r0, #0x16\n"
396 " str r0, [r4, #0x14]\n"
397 " b loc_e03af826\n"
398 "loc_e03af822:\n"
399 " ldr r0, [r4, #4]\n"
400 " str r0, [sp, #0x28]\n"
401 "loc_e03af826:\n"
402 " ldr r0, [r5, #8]\n"
403 " adds r1, r0, #1\n"
404 " beq loc_e03af844\n"
405 " ldr r1, [r4, #0x58]\n"
406 " ldr r6, =0x09200001\n"
407 " adds r6, r6, #2\n"
408 " cmp r1, #1\n"
409 " beq loc_e03af84c\n"
410
411 "loc_D:\n"
412
413 " bl fwt_close\n"
414
415 "loc_e03af83a:\n"
416 " cbz r0, loc_e03af83e\n"
417 " str r6, [r4, #0x14]\n"
418 "loc_e03af83e:\n"
419 " mov.w r0, #-1\n"
420 " str r0, [r5, #8]\n"
421 "loc_e03af844:\n"
422 " ldrb r0, [r4, #0x14]\n"
423 " lsls r0, r0, #0x1f\n"
424 " beq loc_e03af852\n"
425 " b loc_e03af8f8\n"
426 "loc_e03af84c:\n"
427
428
429 " LDR R3, =current_write_ignored\n"
430 " LDR R3, [R3]\n"
431 " cbz R3, loc_E\n"
432 " b loc_D\n"
433 "loc_E:\n"
434
435
436 " bl sub_e0373ee8\n"
437 " b loc_e03af83a\n"
438 "loc_e03af852:\n"
439 " ldr r0, [r4, #0x50]\n"
440 " lsls r1, r0, #0x1f\n"
441 " beq loc_e03af874\n"
442 " movw r0, #0x81ff\n"
443 " str r0, [sp, #0x20]\n"
444 " movs r0, #0x20\n"
445 " str r0, [sp, #0x24]\n"
446 " ldr r0, [r4, #4]\n"
447 " str r0, [sp, #0x28]\n"
448 " ldr r0, [r4, #0x10]\n"
449 " str r0, [sp, #0x2c]\n"
450 " ldr r0, [r4, #0x10]\n"
451 " str r0, [sp, #0x30]\n"
452 " ldr r0, [r4, #0x10]\n"
453 " str r0, [sp, #0x34]\n"
454 " b loc_e03af896\n"
455 "loc_e03af874:\n"
456 " lsls r0, r0, #0x1b\n"
457 " bpl loc_e03af896\n"
458 " add r1, sp, #0x20\n"
459 " mov r0, r7\n"
460 " bl sub_e04026b6\n"
461 " cbnz r0, loc_e03af88e\n"
462 " movs r0, #0\n"
463 " movw r2, #0x3ca\n"
464 " ldr r1, =0xe03af9f4\n"
465 " bl sub_dffc96f4\n"
466 "loc_e03af88e:\n"
467 " ldr r0, [sp, #0x28]\n"
468 " ldr r1, [r4, #4]\n"
469 " add r0, r1\n"
470 " str r0, [sp, #0x28]\n"
471 "loc_e03af896:\n"
472 " ldrb.w r0, [r4, #0x50]\n"
473 " mvns r0, r0\n"
474 " lsls r0, r0, #0x19\n"
475 " bpl loc_e03af8a8\n"
476 " add r1, sp, #0x20\n"
477 " mov r0, r7\n"
478 " bl sub_e040272c\n"
479 "loc_e03af8a8:\n"
480 " ldr r0, [r4, #0x50]\n"
481 " lsls r1, r0, #0x1e\n"
482 " bpl loc_e03af8f8\n"
483 " lsls r0, r0, #0x1a\n"
484 " bpl loc_e03af8f8\n"
485 " movs r2, #0x20\n"
486 " mov r1, r7\n"
487 " mov r0, sp\n"
488 " blx sub_dffcc598\n"
489 " mov r0, sp\n"
490 " bl sub_e037e6c6\n"
491 " add r0, sp, r0\n"
492 " movs r1, #0x54\n"
493 " strb r1, [r0, #-0x3]\n"
494 " movs r1, #0x4d\n"
495 " strb r1, [r0, #-0x2]\n"
496 " movs r1, #0x50\n"
497 " strb r1, [r0, #-0x1]\n"
498 " mov r1, sp\n"
499 " mov r0, r7\n"
500 " bl sub_e045e7d8\n"
501 " cbnz r0, loc_e03af8ec\n"
502 " movs r0, #0\n"
503 " mov.w r2, #0x1ae\n"
504 " ldr r1, =0xe03afa00\n"
505 " bl sub_dffc96f4\n"
506 "loc_e03af8ec:\n"
507 " mov r0, sp\n"
508 " bl sub_e0402a1a\n"
509 " mov r0, r7\n"
510 " bl sub_e0402a1a\n"
511 "loc_e03af8f8:\n"
512 " movs r1, #0\n"
513 " movs r0, #0x48\n"
514 " bl sub_e03719e0\n"
515 " mov r0, r7\n"
516 " bl sub_e03753e0\n"
517 " ldr r1, [r5, #0x20]\n"
518 " bl sub_e0036dc4\n"
519 " b loc_e03af912\n"
520 "loc_e03af90e:\n"
521 " ldr r0, [r5, #0x20]\n"
522 " blx r0\n"
523 "loc_e03af912:\n"
524 " ldr r0, [r5, #0x18]\n"
525 " cmp r0, #0\n"
526 " beq loc_e03af926\n"
527 " ldr r1, [r4, #0x14]\n"
528 " mov r0, r4\n"
529 " bl sub_e03af5f0\n"
530 " ldr r1, [r5, #0x18]\n"
531 " ldr r0, [r4, #0x14]\n"
532 " blx r1\n"
533 "loc_e03af926:\n"
534 " add sp, #0x3c\n"
535 " pop {r4, r5, r6, r7, pc}\n"
536 );
537 }