This source file includes following definitions.
- log_fwt_msg
- filewritetask
- sub_FFA46D80_my
- sub_FFA46E80_my
- sub_FFA46F8C_my
1
2
3
4 #include "lolevel.h"
5 #include "platform.h"
6
7
8
9 extern void _LogCameraEvent(int id,const char *fmt,...);
10
11 typedef struct {
12 unsigned int address;
13 unsigned int length;
14 } cam_ptp_data_chunk;
15
16 #define MAX_CHUNKS_FOR_FWT 4
17
18
19
20
21
22
23
24 typedef struct
25 {
26 int unkn1[5];
27 cam_ptp_data_chunk pdc[MAX_CHUNKS_FOR_FWT];
28 char name[32];
29 } fwt_data_struct;
30
31 #include "../../../generic/filewrite.c"
32
33 #ifdef FILEWRITE_DEBUG_LOG
34 void log_fwt_msg(fwt_data_struct *fwd)
35 {
36 int m=fwd->unkn1[0];
37 _LogCameraEvent(0x20,"fw m:%d",m);
38 _LogCameraEvent(0x20,"fw %s",fwd->name);
39 if(m >= 4 && m < (4+MAX_CHUNKS_FOR_FWT)) {
40 _LogCameraEvent(0x20,"fw chunk adr:0x%08x l:0x%08x",fwd->pdc[m-4].address,fwd->pdc[m-4].length);
41 }
42 _LogCameraEvent(0x20,"fw u %08x %08x %08x %08x",fwd->unkn1[1],fwd->unkn1[2],fwd->unkn1[3],fwd->unkn1[4]);
43 }
44 #endif
45
46
47
48
49 void __attribute__((naked,noinline)) filewritetask() {
50 asm volatile (
51 " STMFD SP!, {R1-R5,LR} \n"
52 " LDR R4, =0xC8F4 \n"
53
54 "loc_FFA46A30:\n"
55 " LDR R0, [R4, #0x10] \n"
56 " MOV R2, #0 \n"
57 " ADD R1, SP, #8 \n"
58 " BL sub_FF827D30 /*_ReceiveMessageQueue*/ \n"
59 " CMP R0, #0 \n"
60 " BNE loc_FFA46A60 \n"
61 #ifdef FILEWRITE_DEBUG_LOG
62 "ldr r0, [sp,#8]\n"
63 "bl log_fwt_msg\n"
64 #endif
65 " LDR R0, [SP, #8] \n"
66 " LDR R1, [R0] \n"
67 " CMP R1, #1 \n"
68 " BNE loc_FFA46A68 \n"
69 " LDR R0, [R4, #8] \n"
70 " BL _GiveSemaphore \n"
71
72 "loc_FFA46A60:\n"
73 " BL _ExitTask \n"
74 " LDMFD SP!, {R1-R5,PC} \n"
75
76 "loc_FFA46A68:\n"
77 " SUB R1, R1, #2 \n"
78 " CMP R1, #6 \n"
79 " ADDLS PC, PC, R1, LSL#2 \n"
80 " B loc_FFA46A30 \n"
81 " B loc_FFA46A94 \n"
82 " B loc_FFA46AF8 \n"
83 " B loc_FFA46B00 \n"
84 " B loc_FFA46B00 \n"
85 " B loc_FFA46B00 \n"
86 " B loc_FFA46B00 \n"
87 " B loc_FFA46B08 \n"
88
89 "loc_FFA46A94:\n"
90 " MOV R0, #0 \n"
91 " STR R0, [SP] \n"
92
93 "loc_FFA46A9C:\n"
94 " LDR R0, [R4, #0x10] \n"
95 " MOV R1, SP \n"
96 " BL sub_FF827F74 /*_GetNumberOfPostedMessages*/ \n"
97 " LDR R0, [SP] \n"
98 " CMP R0, #0 \n"
99 " BEQ loc_FFA46AC8 \n"
100 " LDR R0, [R4, #0x10] \n"
101 " MOV R2, #0 \n"
102 " ADD R1, SP, #4 \n"
103 " BL sub_FF827D30 /*_ReceiveMessageQueue*/ \n"
104 " B loc_FFA46A9C \n"
105
106 "loc_FFA46AC8:\n"
107 " LDR R0, [R4] \n"
108 " CMN R0, #1 \n"
109 " BEQ loc_FFA46AEC \n"
110 " BL fwt_close \n"
111 " MVN R0, #0 \n"
112 " STR R0, [R4] \n"
113 " LDR R0, =0xC03F0 \n"
114 " BL sub_FF85A094 \n"
115 " BL sub_FF85873C \n"
116
117 "loc_FFA46AEC:\n"
118 " LDR R0, [R4, #0xC] \n"
119 " BL _GiveSemaphore \n"
120 " B loc_FFA46A30 \n"
121
122 "loc_FFA46AF8:\n"
123 " BL sub_FFA46D80_my \n"
124 " B loc_FFA46A30 \n"
125
126 "loc_FFA46B00:\n"
127 " BL sub_FFA46E80_my \n"
128 " B loc_FFA46A30 \n"
129
130 "loc_FFA46B08:\n"
131 " BL sub_FFA46F8C_my \n"
132 " B loc_FFA46A30 \n"
133 );
134 }
135
136
137
138 void __attribute__((naked,noinline)) sub_FFA46D80_my() {
139 asm volatile (
140 " STMFD SP!, {R4-R8,LR} \n"
141 " MOV R4, R0 \n"
142 " ADD R0, R0, #0x34 \n"
143 " SUB SP, SP, #0x38 \n"
144 " BL sub_FF85A094 \n"
145 " MOV R1, #0 \n"
146 " BL sub_FF8586EC \n"
147 " LDR R0, [R4, #0xC] \n"
148 " BL sub_FF8569FC \n"
149 " LDR R7, [R4, #8] \n"
150 " LDR R8, =0x1B6 \n"
151 " ADD R6, R4, #0x34 \n"
152 " LDR R5, [R4, #0xC] \n"
153
154 " STMFD SP!, {R4-R12,LR}\n"
155 " MOV R0, R4\n"
156 " BL filewrite_main_hook\n"
157 " LDMFD SP!, {R4-R12,LR}\n"
158
159 " MOV R0, R6 \n"
160 " MOV R1, R7 \n"
161 " MOV R2, R8 \n"
162 " BL fwt_open \n"
163 " LDR PC, =0xFFA46DC4 \n"
164 );
165 }
166
167
168
169 void __attribute__((naked,noinline)) sub_FFA46E80_my() {
170 asm volatile (
171 " STMFD SP!, {R4-R10,LR} \n"
172 " MOV R4, R0 \n"
173 " LDR R0, [R0] \n"
174 " CMP R0, #4 \n"
175 " LDREQ R6, [R4, #0x18] \n"
176 " LDREQ R7, [R4, #0x14] \n"
177 " BEQ loc_FFA46ECC \n"
178 " CMP R0, #5 \n"
179 " LDREQ R6, [R4, #0x20] \n"
180 " LDREQ R7, [R4, #0x1C] \n"
181 " BEQ loc_FFA46ECC \n"
182 " CMP R0, #6 \n"
183 " LDREQ R6, [R4, #0x28] \n"
184 " LDREQ R7, [R4, #0x24] \n"
185 " BEQ loc_FFA46ECC \n"
186 " CMP R0, #7 \n"
187 " BNE loc_FFA46EE0 \n"
188 " LDR R6, [R4, #0x30] \n"
189 " LDR R7, [R4, #0x2C] \n"
190
191 "loc_FFA46ECC:\n"
192 " CMP R6, #0 \n"
193 " BNE loc_FFA46EF0 \n"
194
195 "loc_FFA46ED4:\n"
196 " MOV R1, R4 \n"
197 " MOV R0, #8 \n"
198 " B loc_FFA46F84 \n"
199
200 "loc_FFA46EE0:\n"
201 " LDR R1, =0x205 \n"
202 " LDR R0, =0xFFA46D6C /*'dwFWrite.c'*/ \n"
203 " BL _DebugAssert \n"
204 " B loc_FFA46ED4 \n"
205
206 "loc_FFA46EF0:\n"
207 " LDR R9, =0xC8F4 \n"
208 " MOV R5, R6 \n"
209
210 "loc_FFA46EF8:\n"
211 " LDR R0, [R4, #4] \n"
212 " CMP R5, #0x1000000 \n"
213 " MOVLS R8, R5 \n"
214 " MOVHI R8, #0x1000000 \n"
215 " BIC R1, R0, #0xFF000000 \n"
216 " CMP R1, #0 \n"
217 " BICNE R0, R0, #0xFF000000 \n"
218 " RSBNE R0, R0, #0x1000000 \n"
219 " CMPNE R8, R0 \n"
220 " MOVHI R8, R0 \n"
221 " LDR R0, [R9] \n"
222 " MOV R2, R8 \n"
223 " MOV R1, R7 \n"
224 " BL fwt_write \n"
225 " LDR R1, [R4, #4] \n"
226 " CMP R8, R0 \n"
227 " ADD R1, R1, R0 \n"
228 " STR R1, [R4, #4] \n"
229 " BEQ loc_FFA46F58 \n"
230 " LDR R0, =0x10B1 \n"
231 " BL sub_FF87EC08 /*_IsControlEventActive_FW*/ \n"
232 " LDR R1, =0x9200005 \n"
233 " STR R1, [R4, #0x10] \n"
234 " B loc_FFA46ED4 \n"
235
236 "loc_FFA46F58:\n"
237 " SUB R5, R5, R0 \n"
238 " CMP R5, R6 \n"
239 " ADD R7, R7, R0 \n"
240 " LDRCS R0, =0xFFA46D6C /*'dwFWrite.c'*/ \n"
241 " MOVCS R1, #0x234 \n"
242 " BLCS _DebugAssert \n"
243 " CMP R5, #0 \n"
244 " BNE loc_FFA46EF8 \n"
245 " LDR R0, [R4] \n"
246 " MOV R1, R4 \n"
247 " ADD R0, R0, #1 \n"
248
249 "loc_FFA46F84:\n"
250 " LDMFD SP!, {R4-R10,LR} \n"
251 " B sub_FFA46970 \n"
252 );
253 }
254
255
256
257 void __attribute__((naked,noinline)) sub_FFA46F8C_my() {
258 asm volatile (
259 " STMFD SP!, {R4,R5,LR} \n"
260 " LDR R5, =0xC8F4 \n"
261 " MOV R4, R0 \n"
262 " LDR R0, [R5] \n"
263 " SUB SP, SP, #0x1C \n"
264 " CMN R0, #1 \n"
265 " BEQ loc_FFA46FC0 \n"
266 " BL fwt_close \n"
267 " CMP R0, #0 \n"
268 " LDRNE R0, =0x9200003 \n"
269 " STRNE R0, [R4, #0x10] \n"
270 " MVN R0, #0 \n"
271 " STR R0, [R5] \n"
272
273 "loc_FFA46FC0:\n"
274 " LDR R0, [R4, #0x10] \n"
275 " TST R0, #1 \n"
276 " BNE loc_FFA47008 \n"
277 " LDR R0, =0x81FF \n"
278 " ADD R1, SP, #4 \n"
279 " STR R0, [SP, #4] \n"
280 " MOV R0, #0x20 \n"
281 " STR R0, [SP, #8] \n"
282 " LDR R0, [R4, #4] \n"
283 " STR R0, [SP, #0xC] \n"
284 " LDR R0, [R4, #0xC] \n"
285 " STR R0, [SP, #0x10] \n"
286 " LDR R0, [R4, #0xC] \n"
287 " STR R0, [SP, #0x14] \n"
288 " LDR R0, [R4, #0xC] \n"
289 " STR R0, [SP, #0x18] \n"
290 " ADD R0, R4, #0x34 \n"
291 " BL sub_FF858000 \n"
292
293 "loc_FFA47008:\n"
294 " ADD R0, R4, #0x34 \n"
295 " BL sub_FF85A094 \n"
296 " BL sub_FF85873C \n"
297 " LDR R1, [R5, #0x14] \n"
298 " CMP R1, #0 \n"
299 " LDRNE R0, [R4, #0x10] \n"
300 " BLXNE R1 \n"
301 " ADD SP, SP, #0x1C \n"
302 " LDMFD SP!, {R4,R5,PC} \n"
303 );
304 }