This source file includes following definitions.
- filewritetask
- sub_fc4e8210_my
- sub_fc4e8796_my
- sub_fc4e8342_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 " push {r3, r4, r5, r6, r7, lr}\n"
43 " ldr r6, =0x09200001\n"
44 " movw r7, #0x476\n"
45 " ldr r5, =0x000264c0\n"
46 " adds r6, #0x12\n"
47 "loc_fc4e8498:\n"
48 " mov r1, sp\n"
49 " movs r2, #0\n"
50 " ldr r0, [r5, #0x14]\n"
51 " blx sub_fc34d07c\n"
52 " cbz r0, loc_fc4e84ae\n"
53 " movs r0, #0\n"
54 " mov r2, r7\n"
55 " ldr r1, =0xfc4e8558\n"
56 " blx sub_fc34d28c\n"
57 "loc_fc4e84ae:\n"
58 " ldr r0, [sp]\n"
59 " ldr r1, [r0]\n"
60 " cmp r1, #0xd\n"
61 " bhs loc_fc4e8498\n"
62 " tbb [pc, r1]\n"
63 "branchtable_fc4e84ba:\n"
64 " .byte((loc_fc4e84fc - branchtable_fc4e84ba) / 2)\n"
65 " .byte((loc_fc4e84fc - branchtable_fc4e84ba) / 2)\n"
66 " .byte((loc_fc4e84fc - branchtable_fc4e84ba) / 2)\n"
67 " .byte((loc_fc4e84fc - branchtable_fc4e84ba) / 2)\n"
68 " .byte((loc_fc4e84fc - branchtable_fc4e84ba) / 2)\n"
69 " .byte((loc_fc4e84fc - branchtable_fc4e84ba) / 2)\n"
70 " .byte((loc_fc4e84fc - branchtable_fc4e84ba) / 2)\n"
71 " .byte((loc_fc4e8502 - branchtable_fc4e84ba) / 2)\n"
72 " .byte((loc_fc4e84c8 - branchtable_fc4e84ba) / 2)\n"
73 " .byte((loc_fc4e84da - branchtable_fc4e84ba) / 2)\n"
74 " .byte((loc_fc4e84f6 - branchtable_fc4e84ba) / 2)\n"
75 " .byte((loc_fc4e84ce - branchtable_fc4e84ba) / 2)\n"
76 " .byte((loc_fc4e84d4 - branchtable_fc4e84ba) / 2)\n"
77 ".align 1\n"
78 "loc_fc4e84c8:\n"
79 " bl sub_fc4e867a\n"
80 " b loc_fc4e8498\n"
81 "loc_fc4e84ce:\n"
82 " bl sub_fc4e86c6\n"
83 " b loc_fc4e8498\n"
84 "loc_fc4e84d4:\n"
85 " bl sub_fc4e8210_my\n"
86 " b loc_fc4e8498\n"
87 "loc_fc4e84da:\n"
88 " ldr r1, [r0, #4]\n"
89 " movs r2, #0\n"
90 " mov r4, r0\n"
91 " ldr r0, [r5, #8]\n"
92 " bl sub_fc3b5e3e\n"
93 " adds r0, r0, #1\n"
94 " bne loc_fc4e8498\n"
95 " movs r0, #7\n"
96 " mov r1, r4\n"
97 " str r6, [r4, #0x14]\n"
98 " bl sub_fc4e8196\n"
99 " b loc_fc4e8498\n"
100 "loc_fc4e84f6:\n"
101 " bl sub_fc4e8724\n"
102 " b loc_fc4e8498\n"
103 "loc_fc4e84fc:\n"
104 " bl sub_fc4e8796_my\n"
105 " b loc_fc4e8498\n"
106 "loc_fc4e8502:\n"
107 " bl sub_fc4e8342_my\n"
108 " b loc_fc4e8498\n"
109 );
110 }
111
112 void __attribute__((naked,noinline))
113 sub_fc4e8210_my() {
114 asm volatile (
115
116 " push.w {r4, r5, r6, r7, r8, sb, lr}\n"
117 " mov r4, r0\n"
118
119
120
121 " bl filewrite_main_hook\n"
122 " mov r0, r4\n"
123
124 " ldr r0, [r0, #0x50]\n"
125 " sub sp, #0x3c\n"
126 " lsls r1, r0, #0x1f\n"
127 " bne loc_fc4e8222\n"
128 " lsls r0, r0, #0x1d\n"
129 " bpl loc_fc4e831e\n"
130 "loc_fc4e8222:\n"
131 " ldr r7, =0x000264c0\n"
132 " ldr r0, [r7, #0x1c]\n"
133 " cbz r0, loc_fc4e822a\n"
134 " blx r0\n"
135 "loc_fc4e822a:\n"
136 " add.w r0, r4, #0x5c\n"
137 " mov r8, r0\n"
138 " bl sub_fc3b766c\n"
139 " movs r1, #0\n"
140 " bl sub_fc07dd36\n"
141 " movs r1, #0\n"
142 " movs r0, #0x47\n"
143 " bl sub_fc3b5aac\n"
144 " ldr r0, [r4, #0x50]\n"
145 " lsls r0, r0, #0x1f\n"
146 " beq loc_fc4e831e\n"
147 " ldr r0, [r4, #0x10]\n"
148 " bl sub_fc1c898a\n"
149 " ldr r0, [r4, #0x50]\n"
150 " movw r5, #0x301\n"
151 " lsls r1, r0, #0x1b\n"
152 " bpl loc_fc4e825c\n"
153 " movs r5, #9\n"
154 " b loc_fc4e8262\n"
155 "loc_fc4e825c:\n"
156 " lsls r1, r0, #0x19\n"
157 " bpl loc_fc4e8262\n"
158 " movs r5, #1\n"
159 "loc_fc4e8262:\n"
160 " lsls r0, r0, #0x1a\n"
161 " bmi loc_fc4e826c\n"
162 " ldr r0, [r4, #0x58]\n"
163 " cmp r0, #1\n"
164 " bne loc_fc4e8270\n"
165 "loc_fc4e826c:\n"
166 " orr r5, r5, #0x8000\n"
167 "loc_fc4e8270:\n"
168 " movw sb, #0x1b6\n"
169 " ldr r6, [r4, #0x10]\n"
170 " mov r2, sb\n"
171 " mov r1, r5\n"
172 " mov r0, r8\n"
173
174
175 " bl fwt_open\n"
176
177 " adds r1, r0, #1\n"
178 " bne loc_fc4e82be\n"
179 " mov r0, r8\n"
180 " bl sub_fc3b610a\n"
181 " movs r2, #0xf\n"
182 " mov r1, r8\n"
183 " add r0, sp, #4\n"
184 " blx sub_fc34d244\n"
185 " movs r0, #0\n"
186 " strb.w r0, [sp, #0x13]\n"
187 " movw r1, #0x41ff\n"
188 " str r1, [sp, #0x24]\n"
189 " strd r0, r6, [sp, #0x2c]\n"
190 " movs r1, #0x10\n"
191 " str r6, [sp, #0x34]\n"
192 " add r0, sp, #4\n"
193 " str r6, [sp, #0x38]\n"
194 " str r1, [sp, #0x28]\n"
195 " add r1, sp, #0x24\n"
196 " bl sub_fc1c8ede\n"
197 " mov r2, sb\n"
198 " mov r1, r5\n"
199 " mov r0, r8\n"
200 " bl sub_fc3b5c26\n"
201 "loc_fc4e82be:\n"
202 " mov r5, r0\n"
203 " str r0, [r7, #8]\n"
204 " adds r0, r0, #1\n"
205 " bne loc_fc4e82f6\n"
206 " movs r1, #0\n"
207 " movs r0, #0x48\n"
208 " bl sub_fc3b5aac\n"
209 " mov r0, r8\n"
210 " bl sub_fc3b766c\n"
211 " ldr r1, [r7, #0x20]\n"
212 " bl sub_fc07dd94\n"
213 " ldr r0, [r7, #0x18]\n"
214 " cmp r0, #0\n"
215 " beq loc_fc4e833c\n"
216 " ldr r5, =0x09200001\n"
217 " mov r0, r4\n"
218 " mov r1, r5\n"
219 " bl sub_fc4e815c\n"
220 " ldr r1, [r7, #0x18]\n"
221 " add sp, #0x3c\n"
222 " mov r0, r5\n"
223 " pop.w {r4, r5, r6, r7, r8, sb, lr}\n"
224 " bx r1\n"
225 "loc_fc4e82f6:\n"
226 " ldr r0, =0x001d2ae4\n"
227 " movs r2, #0x20\n"
228 " mov r1, r8\n"
229 " blx sub_fc34d294\n"
230
231
232
233 " LDR r3, =current_write_ignored\n"
234 " LDR r3, [r3]\n"
235 " cbnz r3,loc_C\n"
236
237
238 " ldr r0, [r4, #0x50]\n"
239 " lsls r0, r0, #0x18\n"
240 " bpl loc_fc4e831e\n"
241 " ldr r1, [r4, #0xc]\n"
242 " mov r0, r5\n"
243 " bl sub_fc3b5f12\n"
244 " cbnz r0, loc_fc4e831c\n"
245 " ldr r0, =0x09200001\n"
246 " mov r1, r4\n"
247 " adds r0, #0x16\n"
248 " str r0, [r4, #0x14]\n"
249 " movs r0, #7\n"
250 " b loc_fc4e8334\n"
251 "loc_fc4e831c:\n"
252 " b loc_fc4e831e\n"
253 "loc_fc4e831e:\n"
254 "loc_C:\n"
255 " ldr r0, [r4, #0x50]\n"
256 " lsls r0, r0, #0x19\n"
257 " bmi loc_fc4e8328\n"
258 " ldr r0, [r4, #4]\n"
259 " cbz r0, loc_fc4e8330\n"
260 "loc_fc4e8328:\n"
261 " movs r0, #9\n"
262 " mov r1, r4\n"
263 " bl sub_fc4e8196\n"
264 "loc_fc4e8330:\n"
265 " movs r0, #0\n"
266 " mov r1, r4\n"
267 "loc_fc4e8334:\n"
268 " add sp, #0x3c\n"
269 " pop.w {r4, r5, r6, r7, r8, sb, lr}\n"
270 " b sub_fc4e8196\n"
271 "loc_fc4e833c:\n"
272 " add sp, #0x3c\n"
273 " pop.w {r4, r5, r6, r7, r8, sb, pc}\n"
274 );
275 }
276
277 void __attribute__((naked,noinline))
278 sub_fc4e8796_my() {
279 asm volatile (
280
281 " push.w {r4, r5, r6, r7, r8, sb, sl, lr}\n"
282 " mov r5, r0\n"
283 " ldr r0, [r0]\n"
284 " cmp r0, #6\n"
285 " bhi loc_fc4e87ae\n"
286 " add.w r0, r5, r0, lsl #3\n"
287 " ldrd r7, r6, [r0, #0x18]\n"
288 " cbnz r6, loc_fc4e87c2\n"
289 " b loc_fc4e87bc\n"
290 "loc_fc4e87ae:\n"
291 " movw r2, #0x3b5\n"
292 " ldr r1, =0xfc4e8558\n"
293 " movs r0, #0\n"
294 " blx sub_fc34d28c\n"
295 "loc_fc4e87bc:\n"
296 " movs r0, #7\n"
297 " mov r1, r5\n"
298 " b loc_fc4e8832\n"
299 "loc_fc4e87c2:\n"
300 " ldr.w sl, =0x000264c0\n"
301 " mov.w sb, #0x1000000\n"
302 " mov r4, r6\n"
303 "loc_fc4e87cc:\n"
304 " ldr r0, [r5, #4]\n"
305 " cmp r4, sb\n"
306 " mov r1, sb\n"
307 " bhi loc_fc4e87d6\n"
308 " mov r1, r4\n"
309 "loc_fc4e87d6:\n"
310 " lsls r2, r0, #8\n"
311 " beq loc_fc4e87e8\n"
312 " bic r0, r0, #0xff000000\n"
313 " rsb.w r0, r0, #0x1000000\n"
314 " cmp r1, r0\n"
315 " bls loc_fc4e87e8\n"
316 " mov r1, r0\n"
317 "loc_fc4e87e8:\n"
318 " ldr.w r0, [sl, #8]\n"
319 " mov r8, r1\n"
320 " mov r2, r1\n"
321 " mov r1, r7\n"
322
323
324 " bl fwt_write\n"
325
326 " ldr r1, [r5, #4]\n"
327 " cmp r8, r0\n"
328 " add r1, r0\n"
329 " str r1, [r5, #4]\n"
330 " beq loc_fc4e8812\n"
331 " adds r0, r0, #1\n"
332 " bne loc_fc4e880a\n"
333 " ldr r0, =0x09200006\n"
334 " subs r0, r0, #1\n"
335 " b loc_fc4e880e\n"
336 "loc_fc4e880a:\n"
337 " ldr r0, =0x09200006\n"
338 " adds r0, #0xf\n"
339 "loc_fc4e880e:\n"
340 " str r0, [r5, #0x14]\n"
341 " b loc_fc4e87bc\n"
342 "loc_fc4e8812:\n"
343 " subs r4, r4, r0\n"
344 " cmp r4, r6\n"
345 " add r7, r0\n"
346 " blo loc_fc4e8828\n"
347 " movw r2, #0x3df\n"
348 " ldr r1, =0xfc4e8558\n"
349 " movs r0, #0\n"
350 " blx sub_fc34d28c\n"
351 "loc_fc4e8828:\n"
352 " cmp r4, #0\n"
353 " bne loc_fc4e87cc\n"
354 " ldr r0, [r5]\n"
355 " mov r1, r5\n"
356 " adds r0, r0, #1\n"
357 "loc_fc4e8832:\n"
358 " pop.w {r4, r5, r6, r7, r8, sb, sl, lr}\n"
359 " b sub_fc4e8196\n"
360 );
361 }
362
363 void __attribute__((naked,noinline))
364 sub_fc4e8342_my() {
365 asm volatile (
366
367 " push {r4, r5, r6, r7, lr}\n"
368 " mov r4, r0\n"
369 " ldr r0, [r0, #0x50]\n"
370 " ldr r5, =0x000264c0\n"
371 " sub sp, #0x3c\n"
372 " add.w r7, r4, #0x5c\n"
373 " lsls r1, r0, #0x1e\n"
374 " bmi loc_fc4e835a\n"
375 " lsls r0, r0, #0x1c\n"
376 " bpl loc_fc4e8454\n"
377 " b loc_fc4e83ae\n"
378 "loc_fc4e835a:\n"
379 " lsls r0, r0, #0x18\n"
380 " bpl loc_fc4e838a\n"
381 " ldrd r1, r0, [r4, #8]\n"
382 " cmp r1, r0\n"
383 " beq loc_fc4e838a\n"
384 " ldr r0, [r5, #8]\n"
385 " bl sub_fc3b5f12\n"
386 " cbnz r0, loc_fc4e8376\n"
387 " ldr r0, =0x09200001\n"
388 " adds r0, #0x16\n"
389 " str r0, [r4, #0x14]\n"
390 " b loc_fc4e838a\n"
391 "loc_fc4e8376:\n"
392 " ldr r0, [r4, #8]\n"
393 " add r1, sp, #0x24\n"
394 " str r0, [r4, #4]\n"
395 " mov r0, r7\n"
396 " bl sub_fc1c8e68\n"
397 " cmp r0, #1\n"
398 " bne loc_fc4e838a\n"
399 " ldr r0, [r4, #4]\n"
400 " str r0, [sp, #0x2c]\n"
401 "loc_fc4e838a:\n"
402 " ldr r0, [r5, #8]\n"
403 " adds r1, r0, #1\n"
404 " beq loc_fc4e83ae\n"
405 " ldr r6, =0x09200001\n"
406 " ldr r1, [r4, #0x58]\n"
407 " adds r6, r6, #2\n"
408 " cmp r1, #1\n"
409 " bne loc_fc4e83a0\n"
410
411
412 " LDR R3, =current_write_ignored\n"
413 " LDR R3, [R3]\n"
414 " cbnz R3,loc_D\n"
415
416
417 " bl sub_fc3b5c94\n"
418 " b loc_fc4e83a4\n"
419 "loc_fc4e83a0:\n"
420
421 "loc_D:\n"
422
423 " bl fwt_close\n"
424
425 "loc_fc4e83a4:\n"
426 " cbz r0, loc_fc4e83a8\n"
427 " str r6, [r4, #0x14]\n"
428 "loc_fc4e83a8:\n"
429 " mov.w r0, #-1\n"
430 " str r0, [r5, #8]\n"
431 "loc_fc4e83ae:\n"
432 " ldr r0, [r4, #0x14]\n"
433 " lsls r0, r0, #0x1f\n"
434 " bne loc_fc4e845a\n"
435 " ldr r0, [r4, #0x50]\n"
436 " lsls r1, r0, #0x1f\n"
437 " beq loc_fc4e83d6\n"
438 " movw r0, #0x81ff\n"
439 " str r0, [sp, #0x24]\n"
440 " movs r0, #0x20\n"
441 " str r0, [sp, #0x28]\n"
442 " ldr r0, [r4, #4]\n"
443 " str r0, [sp, #0x2c]\n"
444 " ldr r0, [r4, #0x10]\n"
445 " str r0, [sp, #0x30]\n"
446 " ldr r0, [r4, #0x10]\n"
447 " str r0, [sp, #0x34]\n"
448 " ldr r0, [r4, #0x10]\n"
449 " str r0, [sp, #0x38]\n"
450 " b loc_fc4e83f8\n"
451 "loc_fc4e83d6:\n"
452 " lsls r0, r0, #0x1b\n"
453 " bpl loc_fc4e83f8\n"
454 " add r1, sp, #0x24\n"
455 " mov r0, r7\n"
456 " bl sub_fc1c8e68\n"
457 " cbnz r0, loc_fc4e83f0\n"
458 " movs r0, #0\n"
459 " movw r2, #0x43b\n"
460 " ldr r1, =0xfc4e8558\n"
461 " blx sub_fc34d28c\n"
462 "loc_fc4e83f0:\n"
463 " ldr r0, [sp, #0x2c]\n"
464 " ldr r1, [r4, #4]\n"
465 " add r0, r1\n"
466 " str r0, [sp, #0x2c]\n"
467 "loc_fc4e83f8:\n"
468 " ldr r0, [r4, #0x50]\n"
469 " mvns r0, r0\n"
470 " lsls r0, r0, #0x19\n"
471 " bpl loc_fc4e8408\n"
472 " add r1, sp, #0x24\n"
473 " mov r0, r7\n"
474 " bl sub_fc1c8ede\n"
475 "loc_fc4e8408:\n"
476 " ldr r0, [r4, #0x50]\n"
477 " lsls r1, r0, #0x1e\n"
478 " bpl loc_fc4e845a\n"
479 " lsls r0, r0, #0x1a\n"
480 " bpl loc_fc4e845a\n"
481 " movs r2, #0x20\n"
482 " mov r1, r7\n"
483 " add r0, sp, #4\n"
484 " blx sub_fc34d294\n"
485 " add r0, sp, #4\n"
486 " bl sub_fc3bf4c4\n"
487 " add r2, sp, #4\n"
488 " add r0, r2\n"
489 " movs r1, #0x54\n"
490 " strb r1, [r0, #-0x3]!\n"
491 " movs r1, #0x4d\n"
492 " strb r1, [r0, #1]\n"
493 " movs r1, #0x50\n"
494 " strb r1, [r0, #2]\n"
495 " add r1, sp, #4\n"
496 " mov r0, r7\n"
497 " bl sub_fc1c8b62\n"
498 " cbnz r0, loc_fc4e844a\n"
499 " movs r0, #0\n"
500 " movw r2, #0x1be\n"
501 " ldr r1, =0xfc4e8558\n"
502 " blx sub_fc34d28c\n"
503 "loc_fc4e844a:\n"
504 " add r0, sp, #4\n"
505 " bl sub_fc1c91d0\n"
506 " mov r0, r7\n"
507 " b loc_fc4e8456\n"
508 "loc_fc4e8454:\n"
509 " b loc_fc4e8470\n"
510 "loc_fc4e8456:\n"
511 " bl sub_fc1c91d0\n"
512 "loc_fc4e845a:\n"
513 " movs r1, #0\n"
514 " movs r0, #0x48\n"
515 " bl sub_fc3b5aac\n"
516 " mov r0, r7\n"
517 " bl sub_fc3b766c\n"
518 " ldr r1, [r5, #0x20]\n"
519 " bl sub_fc07dd94\n"
520 " b loc_fc4e8474\n"
521 "loc_fc4e8470:\n"
522 " ldr r0, [r5, #0x20]\n"
523 " blx r0\n"
524 "loc_fc4e8474:\n"
525 " ldr r0, [r5, #0x18]\n"
526 " cmp r0, #0\n"
527 " beq loc_fc4e8488\n"
528 " ldr r1, [r4, #0x14]\n"
529 " mov r0, r4\n"
530 " bl sub_fc4e815c\n"
531 " ldr r1, [r5, #0x18]\n"
532 " ldr r0, [r4, #0x14]\n"
533 " blx r1\n"
534 "loc_fc4e8488:\n"
535 " add sp, #0x3c\n"
536 " pop {r4, r5, r6, r7, pc}\n"
537 );
538 }