This source file includes following definitions.
- filewritetask
- sub_FF338FA0_my
- sub_FF339660_my
- sub_FF33912C_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
21
22 typedef struct
23 {
24 int unkn1;
25 int file_offset;
26 int full_size;
27 int unkn2, unkn3;
28 cam_ptp_data_chunk pdc[MAX_CHUNKS_FOR_FWT];
29 int seek_flag;
30 int unkn4, unkn5;
31 char name[32];
32 } fwt_data_struct;
33
34
35
36
37
38 #define FWT_MUSTSEEK 0x40
39 #define FWT_SEEKMASK 0x40
40
41 #include "../../../generic/filewrite.c"
42
43
44
45 void __attribute__((naked,noinline)) filewritetask() {
46 asm volatile (
47 " STMFD SP!, {R1-R7,LR} \n"
48 " LDR R5, =0xC724 \n"
49 " MOV R6, #0 \n"
50
51 "loc_FF3392C0:\n"
52 " LDR R0, [R5, #0x10] \n"
53 " MOV R2, #0 \n"
54 " ADD R1, SP, #8 \n"
55 " BL sub_00677418 /*_ReceiveMessageQueue*/ \n"
56 " CMP R0, #0 \n"
57 " LDRNE R1, =0x3EF \n"
58 " LDRNE R0, =0xFF339480 /*'dwFWrite.c'*/ \n"
59 " BLNE _DebugAssert \n"
60 " LDR R0, [SP, #8] \n"
61 " LDR R1, [R0] \n"
62 " CMP R1, #0xD \n"
63 " ADDCC PC, PC, R1, LSL#2 \n"
64 " B loc_FF3392C0 \n"
65 " B loc_FF339448 \n"
66 " B loc_FF339448 \n"
67 " B loc_FF339448 \n"
68 " B loc_FF339448 \n"
69 " B loc_FF339448 \n"
70 " B loc_FF339448 \n"
71 " B loc_FF339448 \n"
72 " B loc_FF339450 \n"
73 " B loc_FF339328 \n"
74 " B loc_FF3393C4 \n"
75 " B loc_FF3393F4 \n"
76 " B loc_FF339390 \n"
77 " B loc_FF3393BC \n"
78
79 "loc_FF339328:\n"
80 " MOV R4, R5 \n"
81 " STR R6, [SP] \n"
82
83 "loc_FF339330:\n"
84 " LDR R0, [R4, #0x10] \n"
85 " MOV R1, SP \n"
86 " BL sub_0067765C /*_GetNumberOfPostedMessages*/ \n"
87 " LDR R0, [SP] \n"
88 " CMP R0, #0 \n"
89 " BEQ loc_FF33935C \n"
90 " LDR R0, [R4, #0x10] \n"
91 " MOV R2, #0 \n"
92 " ADD R1, SP, #4 \n"
93 " BL sub_00677418 /*_ReceiveMessageQueue*/ \n"
94 " B loc_FF339330 \n"
95
96 "loc_FF33935C:\n"
97 " LDR R0, [R4, #4] \n"
98 " CMN R0, #1 \n"
99 " BEQ loc_FF339384 \n"
100 " BL fwt_close \n"
101 " MVN R0, #0 \n"
102 " STR R0, [R4, #4] \n"
103 " LDR R0, =0x1A5400 \n"
104 " BL sub_FF0A6164 \n"
105 " MOV R1, #0 \n"
106 " BL sub_FF0A4088 \n"
107
108 "loc_FF339384:\n"
109 " LDR R0, [R4, #0xC] \n"
110 " BL _GiveSemaphore \n"
111 " B loc_FF3392C0 \n"
112
113 "loc_FF339390:\n"
114 " MOV R4, R0 \n"
115 " ADD R0, R0, #0x58 \n"
116 " BL sub_FF0A6164 \n"
117 " MOV R1, #0 \n"
118 " BL sub_FF0A3F4C \n"
119 " LDR R0, [R4, #0xC] \n"
120 " BL sub_FF0A2E28 \n"
121 " ADD R0, R4, #0x58 \n"
122
123
124 " LDR R3, =ignore_current_write\n"
125 " LDR R3, [R3]\n"
126 " CMP R3, #0\n"
127 " BNE loc_A\n"
128
129 " BL sub_FF034868 \n"
130 " ADD R0, R4, #0x58 \n"
131 " B loc_FF339428 \n"
132
133 "loc_FF3393BC:\n"
134 " BL sub_FF338FA0_my \n"
135 " B loc_FF3392C0 \n"
136
137 "loc_FF3393C4:\n"
138 " LDR R1, [R0, #4] \n"
139 " MOV R4, R0 \n"
140 " LDR R0, [R5, #4] \n"
141 " MOV R2, #0 \n"
142 " BL fwt_lseek \n"
143 " CMN R0, #1 \n"
144 " LDREQ R0, =0x9200013 \n"
145 " MOVEQ R1, R4 \n"
146 " STREQ R0, [R4, #0x10] \n"
147 " MOVEQ R0, #7 \n"
148 " BLEQ sub_FF338EE0 \n"
149 " B loc_FF3392C0 \n"
150
151 "loc_FF3393F4:\n"
152 " MOV R4, R0 \n"
153 " LDRSB R0, [R0, #0x58] \n"
154 " CMP R0, #0 \n"
155 " BEQ loc_FF3392C0 \n"
156 " STRB R0, [SP, #4] \n"
157 " ADD R0, R4, #0x58 \n"
158 " STRB R6, [SP, #5] \n"
159 " BL sub_FF0A6164 \n"
160 " MOV R1, #0 \n"
161 " BL sub_FF0A3F4C \n"
162
163
164 " LDR R3, =ignore_current_write\n"
165 " LDR R3, [R3]\n"
166 " CMP R3, #0\n"
167 " BNE loc_B\n"
168
169
170 " ADD R0, SP, #4 \n"
171 " BL sub_FF0A2E40 \n"
172 "loc_B:\n"
173 " ADD R0, R4, #0x58 \n"
174
175 "loc_FF339428:\n"
176 "loc_A:\n"
177 " BL sub_FF0A6164 \n"
178 " LDR R1, [R5, #0x18] \n"
179 " BL sub_FF0A4088 \n"
180 " LDR R1, [R5, #0x14] \n"
181 " CMP R1, #0 \n"
182 " LDRNE R0, [R4, #0x10] \n"
183 " BLXNE R1 \n"
184 " B loc_FF3392C0 \n"
185
186 "loc_FF339448:\n"
187 " BL sub_FF339660_my \n"
188 " B loc_FF3392C0 \n"
189
190 "loc_FF339450:\n"
191 " BL sub_FF33912C_my \n"
192 " B loc_FF3392C0 \n"
193 );
194 }
195
196
197
198 void __attribute__((naked,noinline)) sub_FF338FA0_my() {
199 asm volatile (
200 " STMFD SP!, {R4-R8,LR} \n"
201 " MOV R4, R0 \n"
202
203
204 " BL filewrite_main_hook\n"
205 " MOV R0, R4\n"
206
207 " LDR R0, [R0, #0x4C] \n"
208 " SUB SP, SP, #0x38 \n"
209 " TST R0, #1 \n"
210 " BEQ loc_FF3390FC \n"
211 " ADD R0, R4, #0x58 \n"
212 " BL sub_FF0A6164 \n"
213 " MOV R1, #0 \n"
214 " BL sub_FF0A3F4C \n"
215 " LDR R0, [R4, #0xC] \n"
216 " BL sub_FF0A2E28 \n"
217 " LDR R0, [R4, #0x4C] \n"
218 " LDR R5, =0x301 \n"
219 " TST R0, #0x10 \n"
220 " MOVNE R5, #9 \n"
221 " BNE loc_FF338FEC \n"
222 " TST R0, #0x40 \n"
223 " MOVNE R5, #1 \n"
224
225 "loc_FF338FEC:\n"
226 " TST R0, #0x20 \n"
227 " BNE loc_FF339000 \n"
228 " LDR R0, [R4, #0x54] \n"
229 " CMP R0, #1 \n"
230 " BNE loc_FF339004 \n"
231
232 "loc_FF339000:\n"
233 " ORR R5, R5, #0x8000 \n"
234
235 "loc_FF339004:\n"
236 " LDR R8, =0x1B6 \n"
237 " ADD R7, R4, #0x58 \n"
238 " LDR R6, [R4, #0xC] \n"
239 " MOV R2, R8 \n"
240 " MOV R1, R5 \n"
241 " MOV R0, R7 \n"
242 " BL fwt_open \n"
243 " CMN R0, #1 \n"
244 " BNE loc_FF339084 \n"
245 " MOV R0, R7 \n"
246 " BL sub_FF034868 \n"
247 " MOV R2, #0xF \n"
248 " MOV R1, R7 \n"
249 " MOV R0, SP \n"
250 " BL sub_006950D8 \n"
251 " MOV R0, #0 \n"
252 " LDR R1, =0x41FF \n"
253 " STRB R0, [SP, #0xF] \n"
254 " STR R1, [SP, #0x20] \n"
255 " MOV R1, #0x10 \n"
256 " STR R0, [SP, #0x28] \n"
257 " STR R1, [SP, #0x24] \n"
258 " ADD R1, SP, #0x20 \n"
259 " MOV R0, SP \n"
260 " STR R6, [SP, #0x2C] \n"
261 " STR R6, [SP, #0x30] \n"
262 " STR R6, [SP, #0x34] \n"
263 " BL sub_FF0A38C8 \n"
264 " MOV R2, R8 \n"
265 " MOV R1, R5 \n"
266 " MOV R0, R7 \n"
267 " BL _Open \n"
268
269 "loc_FF339084:\n"
270 " LDR R6, =0xC724 \n"
271 " CMN R0, #1 \n"
272 " MOV R5, R0 \n"
273 " STR R0, [R6, #4] \n"
274 " BNE loc_FF3390C4 \n"
275 " ADD R0, R4, #0x58 \n"
276 " BL sub_FF0A6164 \n"
277 " LDR R1, [R6, #0x18] \n"
278 " BL sub_FF0A4088 \n"
279 " LDR R1, [R6, #0x14] \n"
280 " CMP R1, #0 \n"
281 " BEQ loc_FF339124 \n"
282 " ADD SP, SP, #0x38 \n"
283 " LDMFD SP!, {R4-R8,LR} \n"
284 " LDR R0, =0x9200001 \n"
285 " BX R1 \n"
286
287 "loc_FF3390C4:\n"
288 " LDR R0, =0x1A5400 \n"
289 " MOV R2, #0x20 \n"
290 " ADD R1, R4, #0x58 \n"
291 " BL sub_006952C0 \n"
292
293
294 " LDR R3, =current_write_ignored\n"
295 " LDR R3, [R3]\n"
296 " CMP R3, #0\n"
297 " BNE loc_C\n"
298
299
300 " LDR R0, [R4, #0x4C] \n"
301 " TST R0, #0x80 \n"
302 " BEQ loc_FF3390FC \n"
303 " LDR R1, [R4, #8] \n"
304 " MOV R0, R5 \n"
305 " BL sub_FF034538 \n"
306 " CMP R0, #0 \n"
307 " MOVEQ R1, R4 \n"
308 " MOVEQ R0, #7 \n"
309 " BEQ loc_FF339120 \n"
310
311 "loc_FF3390FC:\n"
312 "loc_C:\n"
313 " LDR R0, [R4, #0x4C] \n"
314 " TST R0, #0x40 \n"
315 " LDREQ R0, [R4, #4] \n"
316 " CMPEQ R0, #0 \n"
317 " MOVNE R1, R4 \n"
318 " MOVNE R0, #9 \n"
319 " BLNE sub_FF338EE0 \n"
320 " MOV R1, R4 \n"
321 " MOV R0, #0 \n"
322
323 "loc_FF339120:\n"
324 " BL sub_FF338EE0 \n"
325
326 "loc_FF339124:\n"
327 " ADD SP, SP, #0x38 \n"
328 " LDMFD SP!, {R4-R8,PC} \n"
329 );
330 }
331
332
333
334 void __attribute__((naked,noinline)) sub_FF339660_my() {
335 asm volatile (
336 " STMFD SP!, {R4-R10,LR} \n"
337 " MOV R5, R0 \n"
338 " LDR R0, [R0] \n"
339 " CMP R0, #6 \n"
340 " BHI loc_FF33968C \n"
341 " ADD R0, R5, R0, LSL#3 \n"
342 " LDR R8, [R0, #0x14]! \n"
343 " LDR R7, [R0, #4] \n"
344 " CMP R7, #0 \n"
345 " BNE loc_FF3396A4 \n"
346 " B loc_FF339698 \n"
347
348 "loc_FF33968C:\n"
349 " MOV R1, #0x344 \n"
350 " LDR R0, =0xFF339480 /*'dwFWrite.c'*/ \n"
351 " BL _DebugAssert \n"
352
353 "loc_FF339698:\n"
354 " MOV R1, R5 \n"
355 " MOV R0, #7 \n"
356 " B loc_FF339738 \n"
357
358 "loc_FF3396A4:\n"
359 " LDR R9, =0xC724 \n"
360 " MOV R4, R7 \n"
361
362 "loc_FF3396AC:\n"
363 " LDR R0, [R5, #4] \n"
364 " CMP R4, #0x1000000 \n"
365 " MOVLS R6, R4 \n"
366 " MOVHI R6, #0x1000000 \n"
367 " BIC R1, R0, #0xFF000000 \n"
368 " CMP R1, #0 \n"
369 " BICNE R0, R0, #0xFF000000 \n"
370 " RSBNE R0, R0, #0x1000000 \n"
371 " CMPNE R6, R0 \n"
372 " MOVHI R6, R0 \n"
373 " LDR R0, [R9, #4] \n"
374 " MOV R2, R6 \n"
375 " MOV R1, R8 \n"
376 " BL fwt_write \n"
377 " LDR R1, [R5, #4] \n"
378 " CMP R6, R0 \n"
379 " ADD R1, R1, R0 \n"
380 " STR R1, [R5, #4] \n"
381 " BEQ loc_FF33970C \n"
382 " CMN R0, #1 \n"
383 " LDRNE R0, =0x9200015 \n"
384 " LDREQ R0, =0x9200005 \n"
385 " STR R0, [R5, #0x10] \n"
386 " B loc_FF339698 \n"
387
388 "loc_FF33970C:\n"
389 " SUB R4, R4, R0 \n"
390 " CMP R4, R7 \n"
391 " LDRCS R1, =0x36F \n"
392 " ADD R8, R8, R0 \n"
393 " LDRCS R0, =0xFF339480 /*'dwFWrite.c'*/ \n"
394 " BLCS _DebugAssert \n"
395 " CMP R4, #0 \n"
396 " BNE loc_FF3396AC \n"
397 " LDR R0, [R5] \n"
398 " MOV R1, R5 \n"
399 " ADD R0, R0, #1 \n"
400
401 "loc_FF339738:\n"
402 " LDMFD SP!, {R4-R10,LR} \n"
403 " B sub_FF338EE0 \n"
404 " .ltorg\n"
405 );
406 }
407
408
409
410 void __attribute__((naked,noinline)) sub_FF33912C_my() {
411 asm volatile (
412 " STMFD SP!, {R4-R6,LR} \n"
413 " MOV R4, R0 \n"
414 " LDR R0, [R0, #0x4C] \n"
415 " LDR R5, =0xC724 \n"
416 " TST R0, #2 \n"
417 " SUB SP, SP, #0x38 \n"
418 " BEQ sub_FF339294 \n"
419 " LDR R0, [R5, #4] \n"
420 " CMN R0, #1 \n"
421 " BEQ sub_FF339180 \n"
422 " LDR R1, [R4, #0x54] \n"
423 " LDR R6, =0x9200003 \n"
424 " CMP R1, #1 \n"
425 " BNE loc_FF33916C \n"
426
427 " LDR R3, =current_write_ignored\n"
428 " LDR R3, [R3]\n"
429 " CMP R3, #0\n"
430 " BNE loc_D\n"
431
432
433 " BL sub_FF03428C \n"
434 " B sub_FF339170 \n"
435
436 "loc_FF33916C:\n"
437 "loc_D:\n"
438 " BL fwt_close \n"
439 " LDR PC, =0xFF339170 \n"
440 );
441 }