This source file includes following definitions.
- get_core
- CreateTask_spytask
- boot
- debug_logging_my
- patch_mzrm_sendmsg
- CreateTask_my
- sub_e00200f8_my
- sub_e0020398_my
- sub_e0020750_my
- sub_e005b418_my
- init_required_fw_features
- task_Startup_my
- sub_e005b33e_my
- init_file_modules_task
- kbd_p2_f_my
- sub_e004e5ee_my
- kbd_p1_f_cont_my
- sub_e005b13c_my
- task_TricInitTask_my
- check_fsio_skip
- task_FsIoNotifyTask_my
1
2 #include "lolevel.h"
3 #include "platform.h"
4 #include "core.h"
5 #include "dryos31.h"
6
7 #include "camera_info.h"
8
9 const char * const new_sa = &_end;
10
11
12 extern void task_CaptSeq();
13 extern void task_InitFileModules();
14
15 extern void task_ExpDrv();
16 extern void task_FsIoNotifyTask();
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80 void __attribute__((naked,noinline)) get_core() {
81 asm volatile (
82 " mrc p15, #0, r0, c0, c0, #5\n"
83 " ands r0, #0xf\n"
84 " bx lr\n"
85 );
86 }
87
88
89
90
91 void CreateTask_spytask()
92 {
93
94 _CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
95 }
96
97
98
99
100
101
102
103
104 void __attribute__((naked,noinline)) boot() {
105 asm volatile (
106 " mrc p15, #0, r0, c0, c0, #5\n"
107 " ands r0, #0xf\n"
108 " beq loc_boot\n"
109 " adr r0, loc_boot\n"
110 " orr r0, #1\n"
111 " bl sub_e0539e64\n"
112 "loc_boot:\n"
113
114
115 " ldr r0, =0xe0020200\n"
116 " mcr p15, #0, r0, c12, c0, #0\n"
117 " isb sy\n"
118 " movw r0, #0x2000\n"
119 " movt r0, #0\n"
120 " mov sp, r0\n"
121 " mrc p15, #0, r5, c0, c0, #5\n"
122 " ands r0, r5, #0xf\n"
123 " bne loc_e0020032\n"
124 " b.w loc_e002003c\n"
125 "loc_e0020032:\n"
126 " b.w sub_e00200f8_my\n"
127
128
129
130 "loc_e002003c:\n"
131 " ldr r0, =0xe0fd37b8\n"
132 " ldr r1, =0x00008000\n"
133 " ldr r3, =0x0004c610\n"
134 "loc_e0020042:\n"
135 " cmp r1, r3\n"
136 " itt lo\n"
137 " ldrlo r2, [r0], #4\n"
138 " strlo r2, [r1], #4\n"
139 " blo loc_e0020042\n"
140 " ldr r1, =0x002c460c\n"
141 " mov.w r2, #0\n"
142 "loc_e0020056:\n"
143 " cmp r3, r1\n"
144 " it lo\n"
145 " strlo r2, [r3], #4\n"
146 " blo loc_e0020056\n"
147 " ldr r0, =0xe1017dc8\n"
148 " ldr r1, =0x01900000\n"
149 " ldr r3, =0x0190139c\n"
150 "loc_e0020066:\n"
151 " cmp r1, r3\n"
152 " itt lo\n"
153 " ldrlo r2, [r0], #4\n"
154 " strlo r2, [r1], #4\n"
155 " blo loc_e0020066\n"
156 " ldr r0, =0x01900000\n"
157 " ldr r1, =0x0000139c\n"
158 " bl sub_e042eb74\n"
159 " ldr r0, =0x01900000\n"
160 " ldr r1, =0x0000139c\n"
161 " bl sub_e042ec4c\n"
162 " ldr r0, =0xe1019164\n"
163 " ldr r1, =0xdffc4900\n"
164 " ldr r3, =0xdffd0908\n"
165 "loc_e002008a:\n"
166 " cmp r1, r3\n"
167 " itt lo\n"
168 " ldrlo r2, [r0], #4\n"
169 " strlo r2, [r1], #4\n"
170 " blo loc_e002008a\n"
171 " ldr r1, =0xdffd0908\n"
172 " mov.w r2, #0\n"
173 "loc_e002009e:\n"
174 " cmp r3, r1\n"
175 " it lo\n"
176 " strlo r2, [r3], #4\n"
177 " blo loc_e002009e\n"
178
179 " blx patch_mzrm_sendmsg\n"
180
181
182
183 " adr r0, patch_CreateTask\n"
184 " ldr r1, =hook_CreateTask\n"
185 " add r2, r0, #8\n"
186 "patch_hook_loop:\n"
187 " ldrh r3, [r0],#2\n"
188 " strh r3, [r1],#2\n"
189 " cmp r0,r2\n"
190 " blo patch_hook_loop\n"
191
192 " ldr r0, =0xdffc4900\n"
193 " ldr r1, =0x0000c008\n"
194 " bl sub_e042eb74\n"
195 " ldr r0, =0xdffc4900\n"
196 " ldr r1, =0x0000c008\n"
197 " bl sub_e042ec4c\n"
198
199
200
201 " b loc_e0020032\n"
202
203
204 " .align 2\n"
205 " .short 0\n"
206 "patch_CreateTask:\n"
207 " ldr.w pc, _createtask_my\n"
208 "_createtask_my:\n"
209 " .long CreateTask_my + 1\n"
210 " .align 1\n"
211 );
212 }
213
214
215
216
217
218
219
220 void __attribute__((naked,noinline))
221 debug_logging_my(char* fmt, ...)
222 {
223 (void)fmt;
224 asm volatile (
225
226 " ldr r0, =mzrm_sendmsg_ret_adr\n"
227 " cmp r0, lr\n"
228 " beq do_ui_update\n"
229 "exit_debug_logging_my:\n"
230 " bx lr\n"
231
232 "do_ui_update:\n"
233 " ldr r0, [sp,#0x18]\n"
234 " ldr r1, [r0]\n"
235 " mov r2, #0x25\n"
236 " cmp r1, r2\n"
237 " bne exit_debug_logging_my\n"
238 " add r0, r0, #16\n"
239 " b update_ui\n"
240 );
241 }
242
243
244
245
246 void
247 patch_mzrm_sendmsg ()
248 {
249 extern int debug_logging_flag;
250 extern void (*debug_logging_ptr)(char* fmt, ...);
251
252
253 debug_logging_flag = 0x200;
254 debug_logging_ptr = debug_logging_my;
255 }
256
257
258 void __attribute__((naked,noinline)) CreateTask_my() {
259 asm volatile (
260 " push {r0}\n"
261
262
263 " ldr r0, =task_CaptSeq\n"
264 " cmp r0, r3\n"
265 " itt eq\n"
266 " ldreq r3, =capt_seq_task\n"
267 " beq exitHook\n"
268
269 " ldr r0, =task_ExpDrv\n"
270 " cmp r0, R3\n"
271 " itt eq\n"
272 " ldreq r3, =exp_drv_task\n"
273 " beq exitHook\n"
274
275
276
277
278
279
280
281 " ldr r0, =task_FileWrite\n"
282 " cmp r0, R3\n"
283 " itt eq\n"
284 " ldreq r3, =filewritetask\n"
285 " beq exitHook\n"
286
287
288
289
290
291
292
293 " ldr r0, =task_FsIoNotifyTask\n"
294 " cmp r0, r3\n"
295 " itt eq\n"
296 " ldreq r3, =task_FsIoNotifyTask_my\n"
297 " beq exitHook\n"
298
299 " ldr r0, =task_TricInitTask\n"
300 " cmp r0, r3\n"
301 " itt eq\n"
302 " ldreq r3, =task_TricInitTask_my\n"
303 " beq exitHook\n"
304
305 " ldr r0, =task_InitFileModules\n"
306 " cmp r0, r3\n"
307 " it eq\n"
308 " ldreq r3, =init_file_modules_task\n"
309
310 "exitHook:\n"
311
312 " pop {r0}\n"
313
314 " push {r1, r2, r3, r4, r5, r6, r7, lr}\n"
315 " mov r4, r3\n"
316 " mov.w r3, #0x1000\n"
317 " ldr.w pc, =0xDFFC93C3\n"
318 );
319 }
320
321
322 void __attribute__((naked,noinline)) sub_e00200f8_my() {
323
324 if (*(int*)(0xd2082000 + 0x168) & 0x10000) {
325
326
327 *(int*)(0x9914+0x8) = 0x100000;
328 }
329 else {
330
331 *(int*)(0x9914+0x8) = 0x80000;
332 }
333
334 asm volatile (
335
336 " push {r4, r5, r6, lr}\n"
337 #if defined(CHDK_NOT_IN_CANON_HEAP)
338 " ldr r0, =0x002c4613\n"
339 #else
340 " ldr r0, =new_sa\n"
341 " ldr r0, [r0]\n"
342 " add r0, #7\n"
343 #endif
344 " sub sp, #0x80\n"
345 " ldr r1, =0x000f264c\n"
346 " bic r5, r0, #7\n"
347 " ldr r0, =0x006cd400\n"
348 " subs r0, r0, r5\n"
349 " cmp r0, r1\n"
350 " bhs loc_e002010e\n"
351 "loc_e002010c:\n"
352 " b loc_e002010c\n"
353 "loc_e002010e:\n"
354 " mrc p15, #0, r0, c0, c0, #5\n"
355 " and r6, r0, #0xf\n"
356 " mov.w r0, #0x400\n"
357 " add.w r1, r5, #0x400\n"
358 " str r0, [sp]\n"
359 " lsls r2, r0, #1\n"
360 " mov r3, r5\n"
361 " mov r4, r1\n"
362 " mov r0, r6\n"
363 " bl sub_e002052c\n"
364 " cbz r6, loc_e0020136\n"
365 " bl sub_dffc570c\n"
366 "loc_e0020132:\n"
367 " add sp, #0x80\n"
368 " pop {r4, r5, r6, pc}\n"
369 "loc_e0020136:\n"
370 " ldr r0, =0x00008088\n"
371 " mov.w r1, #0x80000\n"
372 " str r1, [r0]\n"
373 " ldr r1, =0x0000808c\n"
374 " ldr r0, =0x42aaa000\n"
375 " str r0, [r1]\n"
376 " ldr r1, =0x00008090\n"
377 " ldr r0, =0x42aac000\n"
378 " str r0, [r1]\n"
379 " movs r1, #0x78\n"
380 " add r0, sp, #4\n"
381 " bl sub_dffcc544\n"
382 " ldr r1, =0x005ce000\n"
383 " mov.w r0, #0x100000\n"
384 " ldr r2, =0x005bedb4\n"
385 " strd r1, r0, [sp, #4]\n"
386 " subs r2, r2, r5\n"
387 " add.w r0, r5, #0xc00\n"
388 " strd r0, r2, [sp, #0xc]\n"
389 " ldr r2, =0x005bf9b4\n"
390 " strd r2, r1, [sp, #0x14]\n"
391 " movs r1, #0x22\n"
392 " str r1, [sp, #0x1c]\n"
393 " movs r1, #0xca\n"
394 " str r1, [sp, #0x20]\n"
395 " mov.w r1, #0x2b0\n"
396 " str r1, [sp, #0x24]\n"
397 " movs r1, #0xfa\n"
398 " str r1, [sp, #0x28]\n"
399 " mov.w r1, #0x11a\n"
400 " str r1, [sp, #0x2c]\n"
401 " movs r1, #0x85\n"
402 " str r1, [sp, #0x30]\n"
403 " movs r1, #0x40\n"
404 " str r1, [sp, #0x34]\n"
405 " movs r1, #4\n"
406 " str r1, [sp, #0x38]\n"
407 " movs r1, #0\n"
408 " str r1, [sp, #0x3c]\n"
409 " movs r1, #0x10\n"
410 " str r1, [sp, #0x60]\n"
411 " lsls r1, r1, #8\n"
412 " str r1, [sp, #0x64]\n"
413 " asrs r1, r1, #4\n"
414 " str r1, [sp, #0x68]\n"
415 " lsls r1, r1, #5\n"
416 " str r1, [sp, #0x6c]\n"
417 " mov.w r1, #-0x11111112\n"
418 " b loc_e00201ae\n"
419 "loc_e00201ac:\n"
420 " stm r4!, {r1}\n"
421 "loc_e00201ae:\n"
422 " cmp r0, r4\n"
423 " bhi loc_e00201ac\n"
424 " movs r2, #0\n"
425 " ldr r1, =sub_e0020398_my\n"
426 " add r0, sp, #4\n"
427 " bl sub_dffc49e0\n"
428 " b loc_e0020132\n"
429 );
430 }
431
432
433 void __attribute__((naked,noinline)) sub_e0020398_my() {
434 asm volatile (
435
436 " push {r4, lr}\n"
437 " ldr r4, =0xe0020474\n"
438 " bl sub_e00213fa\n"
439 " ldr r0, =0x00008154\n"
440 " ldr r1, [r0]\n"
441 " ldr r0, =0x00008088\n"
442 " ldr r0, [r0]\n"
443 " adds r0, #0x10\n"
444 " cmp r1, r0\n"
445 " bhs loc_e00203b4\n"
446 " ldr r0, =0xe0020484\n"
447 " bl sub_e0020418\n"
448 "loc_e00203b4:\n"
449 " bl sub_e0450d70\n"
450 " cmp r0, #0\n"
451 " bge loc_e00203c2\n"
452 " ldr r0, =0xe002049c\n"
453 " bl sub_e0020418\n"
454 "loc_e00203c2:\n"
455 " bl sub_e002210c\n"
456 " cmp r0, #0\n"
457 " bge loc_e00203d0\n"
458 " ldr r0, =0xe00204a4\n"
459 " bl sub_e0020418\n"
460 "loc_e00203d0:\n"
461 " mov r0, r4\n"
462 " bl sub_e00221b0\n"
463 " cmp r0, #0\n"
464 " bge loc_e00203e0\n"
465 " ldr r0, =0xe00204b4\n"
466 " bl sub_e0020418\n"
467 "loc_e00203e0:\n"
468 " mov r0, r4\n"
469 " bl sub_e002056c\n"
470 " cmp r0, #0\n"
471 " bge loc_e00203f0\n"
472 " ldr r0, =0xe00204c8\n"
473 " bl sub_e0020418\n"
474 "loc_e00203f0:\n"
475 " bl sub_e00206b0\n"
476 " cmp r0, #0\n"
477 " bge loc_e00203fe\n"
478 " ldr r0, =0xe00204d4\n"
479 " bl sub_e0020418\n"
480 "loc_e00203fe:\n"
481 " bl sub_e0029ae4\n"
482 " cmp r0, #0\n"
483 " bge loc_e002040c\n"
484 " ldr r0, =0xe00204e0\n"
485 " bl sub_e0020418\n"
486 "loc_e002040c:\n"
487 " bl sub_e002042e\n"
488 " pop.w {r4, lr}\n"
489 " b.w sub_e0020750_my\n"
490 );
491 }
492
493
494 void __attribute__((naked,noinline)) sub_e0020750_my() {
495 asm volatile (
496
497 " push {r3, lr}\n"
498 " bl sub_e002088c\n"
499 " bl sub_e0020848\n"
500
501 " mrc p15, #0, r0, c0, c0, #5\n"
502 " ands r0, r0, #0xf\n"
503 " bne skip\n"
504 " movs r0, #1\n"
505 " bl sub_e051e078\n"
506
507 " movs r0, #1\n"
508 " bl sub_e051e078\n"
509 "skip:\n"
510
511 " bl sub_e003e3bc\n"
512 " bl sub_e005b418_my\n"
513 " cbz r0, loc_e002078a\n"
514 " bl sub_dffc9094\n"
515 " ldr r1, =0x006ce000\n"
516 " movs r0, #0\n"
517 " bl sub_e037e5d0\n"
518 " ldr r3, =task_Startup_my\n"
519 " movs r0, #0\n"
520 " mov r2, r0\n"
521 " str r0, [sp]\n"
522 " movs r1, #0x19\n"
523 " ldr r0, =0xe00207a8\n"
524 " bl sub_dffc93ba\n"
525 " movs r0, #0\n"
526 " pop {r3, pc}\n"
527 "loc_e002078a:\n"
528 " bl sub_e002087c\n"
529 "loc_e002078e:\n"
530 " b loc_e002078e\n"
531 );
532 }
533
534
535 void __attribute__((naked,noinline)) sub_e005b418_my() {
536 asm volatile (
537
538 " push.w {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr}\n"
539 " movs r5, #0\n"
540 " mov sl, r0\n"
541 " mov r4, r5\n"
542 " bl sub_e004e4d2\n"
543 " mov.w r0, #0x168\n"
544 " bl sub_e004ed2a\n"
545 " movs r6, #1\n"
546 " bic.w r7, r6, r0\n"
547 " mov.w r0, #0x150\n"
548 " bl sub_e004ed2a\n"
549 " bic.w r8, r6, r0\n"
550 " movs r0, #0\n"
551 " bl sub_e004e4ce\n"
552 " cbz r0, loc_e005b454\n"
553 " mov.w r0, #0x16c\n"
554 " bl sub_e004ed2a\n"
555 " bic.w r5, r6, r0\n"
556 "loc_e005b454:\n"
557 " movs r0, #0x38\n"
558 " bl sub_e004ed2a\n"
559 " mov sb, r6\n"
560 " bics r6, r0\n"
561 " movs r0, #1\n"
562 " bl sub_e004e4ce\n"
563 " cbz r0, loc_e005b472\n"
564 " mov.w r0, #0x194\n"
565 " bl sub_e004ed2a\n"
566 " bic.w r4, sb, r0\n"
567 "loc_e005b472:\n"
568 " cmp.w sl, #0\n"
569 " beq loc_e005b486\n"
570 " orr.w r0, r7, r8\n"
571 " orr.w r1, r5, r6\n"
572 " orrs r0, r1\n"
573 " orrs r0, r4\n"
574
575 "loc_e005b486:\n"
576 " mov r3, r6\n"
577 " mov r2, r5\n"
578 " mov r1, r8\n"
579 " mov r0, r7\n"
580 " str r4, [sp]\n"
581
582
583 " movs r0, #1\n"
584 "loc_e005b49a:\n"
585 " pop.w {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}\n"
586 );
587 }
588
589
590
591
592
593 void init_required_fw_features(void)
594 {
595 extern void _init_focus_eventflag();
596 _init_focus_eventflag();
597 extern void _init_nd_eventflag();
598 _init_nd_eventflag();
599 extern int av_override_semaphore;
600 extern int _CreateBinarySemaphoreStrictly(int x, int y);
601 av_override_semaphore = _CreateBinarySemaphoreStrictly(0,0);
602 }
603
604
605 void __attribute__((naked,noinline)) task_Startup_my() {
606 asm volatile (
607
608 " push {r4, lr}\n"
609 " bl sub_e013a49a\n"
610 " ldr r0, =0x4194a000\n"
611 " mov.w r1, #0x20000\n"
612 " bl sub_e03ea27c\n"
613 " cbz r0, loc_e00206f0\n"
614 " movs r2, #0x7d\n"
615 " movs r0, #0\n"
616 " ldr r1, =0xe0020794\n"
617 " bl sub_dffc96f4\n"
618 "loc_e00206f0:\n"
619 " bl sub_e0020860\n"
620 " bl sub_e046e380\n"
621 " bl sub_e052fda8\n"
622
623 " bl sub_e04d9986\n"
624
625 " bl sub_e005a122\n"
626 " bl sub_e0425880\n"
627 " bl sub_e0020924\n"
628 " bl sub_e00208be\n"
629 " bl sub_e052fdde\n"
630 " bl sub_e0056650\n"
631 " bl sub_e0425886\n"
632 " bl sub_e005b33e_my\n"
633 " BL CreateTask_spytask\n"
634 " bl init_required_fw_features\n"
635 " bl sub_e0297df6\n"
636 " bl sub_e042589c\n"
637 " bl sub_e052fd40\n"
638 " bl sub_e04914c0\n"
639 " bl sub_e005b870\n"
640 " bl sub_e005a0d2\n"
641 " bl sub_e049147c\n"
642 " bl sub_e0020928\n"
643 " bl sub_e037bccc\n"
644 " bl sub_e049144e\n"
645 " pop.w {r4, lr}\n"
646 " b.w sub_e013a496\n"
647 );
648 }
649
650
651 void __attribute__((naked,noinline)) sub_e005b33e_my() {
652 asm volatile (
653
654 " push {r2, r3, r4, lr}\n"
655 " bl sub_e005744c\n"
656 " bl sub_e003e33c\n"
657 " cbnz r0, loc_e005b34e\n"
658 " bl sub_e00573f0\n"
659 "loc_e005b34e:\n"
660 " ldr r4, =0x00008370\n"
661 " ldr r0, [r4, #4]\n"
662 " cmp r0, #0\n"
663 " bne loc_e005b36a\n"
664 " movs r1, #1\n"
665
666
667 " ldr r3, =mykbd_task\n"
668 " mov r2, #0x2000\n"
669 " strd r0, r1, [sp]\n"
670 " movs r1, #0x17\n"
671 " ldr r0, =0xe005b6a4\n"
672 " bl sub_dffc95d8\n"
673 " str r0, [r4, #4]\n"
674 "loc_e005b36a:\n"
675 " pop {r2, r3, r4, pc}\n"
676 );
677 }
678
679
680 void __attribute__((naked,noinline)) init_file_modules_task() {
681 asm volatile (
682
683 " push {r4, r5, r6, lr}\n"
684 " movs r0, #6\n"
685 " bl sub_e037b34c\n"
686 " bl sub_e049683c\n"
687 " movs r4, r0\n"
688 " movw r5, #0x5006\n"
689 " beq loc_e04200cc\n"
690 " movs r1, #0\n"
691 " mov r0, r5\n"
692 " bl _PostLogicalEventToUI\n"
693 "loc_e04200cc:\n"
694 " bl sub_e0496864\n"
695 " BL core_spytask_can_start\n"
696 " cmp r4, #0\n"
697 " bne loc_e04200e0\n"
698 " mov r0, r5\n"
699 " pop.w {r4, r5, r6, lr}\n"
700 " movs r1, #1\n"
701 " b.w _PostLogicalEventToUI\n"
702 "loc_e04200e0:\n"
703 " pop {r4, r5, r6, pc}\n"
704 ".ltorg\n"
705 );
706 }
707
708
709 void __attribute__((naked,noinline)) kbd_p2_f_my() {
710 asm volatile(
711
712 " push.w {r4, r5, r6, r7, r8, lr}\n"
713 " ldr r6, =0x0004e464\n"
714 " sub sp, #0x18\n"
715 " mov r7, sp\n"
716 " subs r6, #0xc\n"
717 " b loc_e005b0ba\n"
718 "loc_e005b086:\n"
719 " ldrb.w r0, [sp, #0x10]\n"
720 " mov r3, sp\n"
721 " ldr r1, =0x0004e464\n"
722 " add r2, sp, #0xc\n"
723 " subs r1, #0x18\n"
724 " bl sub_e004eb64\n"
725 " cbnz r0, loc_e005b0a0\n"
726 " ldr r1, [sp, #0xc]\n"
727 " movs r0, #0\n"
728 " bl sub_e005afe6\n"
729 "loc_e005b0a0:\n"
730 " movs r0, #2\n"
731 "loc_e005b0a2:\n"
732 " ldr.w r1, [r7, r0, lsl #2]\n"
733 " cbz r1, loc_e005b0b2\n"
734 " ldr.w r2, [r6, r0, lsl #2]\n"
735 " bics r2, r1\n"
736 " str.w r2, [r6, r0, lsl #2]\n"
737 "loc_e005b0b2:\n"
738 " subs r0, r0, #1\n"
739 " sxtb r0, r0\n"
740 " cmp r0, #0\n"
741 " bge loc_e005b0a2\n"
742 "loc_e005b0ba:\n"
743 " add r1, sp, #0x10\n"
744 " ldr r0, =0x0004e464\n"
745 " subs r0, #0xc\n"
746 " bl sub_e004e820\n"
747 " cmp r0, #0\n"
748 " bne loc_e005b086\n"
749 " movs r4, #0\n"
750 " ldr.w r8, =0x0004e464\n"
751 "loc_e005b0ce:\n"
752 " movs r5, #0\n"
753 " ldr.w r0, [r6, r4, lsl #2]\n"
754 " ldr.w r1, [r8, r4, lsl #2]\n"
755 " ands r0, r1\n"
756 " str.w r0, [r6, r4, lsl #2]\n"
757 " b loc_e005b126\n"
758 "loc_e005b0e0:\n"
759 " lsrs r0, r5\n"
760 " lsls r0, r0, #0x1f\n"
761 " beq loc_e005b11e\n"
762 " add.w r0, r5, r4, lsl #5\n"
763 " ldr r1, =0x0004e464\n"
764 " mov r3, sp\n"
765 " uxtb r0, r0\n"
766 " subs r1, #0x18\n"
767 " add r2, sp, #0xc\n"
768 " bl sub_e004eb64\n"
769 " cbnz r0, loc_e005b102\n"
770 " ldr r1, [sp, #0xc]\n"
771 " movs r0, #1\n"
772 " bl sub_e005afe6\n"
773 "loc_e005b102:\n"
774 " mov r0, r4\n"
775 " b loc_e005b11a\n"
776 "loc_e005b106:\n"
777 " ldr.w r1, [r7, r0, lsl #2]\n"
778 " cbz r1, loc_e005b116\n"
779 " ldr.w r2, [r6, r0, lsl #2]\n"
780 " bics r2, r1\n"
781 " str.w r2, [r6, r0, lsl #2]\n"
782 "loc_e005b116:\n"
783 " adds r0, r0, #1\n"
784 " sxtb r0, r0\n"
785 "loc_e005b11a:\n"
786 " cmp r0, #3\n"
787 " blt loc_e005b106\n"
788 "loc_e005b11e:\n"
789 " adds r5, r5, #1\n"
790 " ldr.w r0, [r6, r4, lsl #2]\n"
791 " uxtb r5, r5\n"
792 "loc_e005b126:\n"
793 " cmp r0, #0\n"
794 " bne loc_e005b0e0\n"
795 " adds r4, r4, #1\n"
796 " sxtb r4, r4\n"
797 " cmp r4, #3\n"
798 " blt loc_e005b0ce\n"
799 " bl sub_e004e5ee_my\n"
800 " add sp, #0x18\n"
801 " pop.w {r4, r5, r6, r7, r8, pc}\n"
802 );
803 }
804
805
806 void __attribute__((naked,noinline)) sub_e004e5ee_my() {
807 asm volatile(
808
809 " push {r4, lr}\n"
810 " ldr r4, =0x00009914\n"
811 " ldr r0, [r4, #0xc]\n"
812 " bl sub_e0052e76\n"
813 " ldr r0, [r4, #0x18]\n"
814 " bl sub_e0052f00\n"
815 " bl sub_e0402302\n"
816 " ldr r0, [r4, #0x14]\n"
817 " bl sub_e0052da8\n"
818 " ldr r0, [r4, #0x10]\n"
819 " bl sub_e0052da8\n"
820
821 " bl handle_jogdial\n"
822 " cmp r0, #0\n"
823 " beq no_scroll\n"
824
825 " pop.w {r4, lr}\n"
826 " b.w sub_e0517000\n"
827
828 "no_scroll:\n"
829 " pop {r4, pc}\n"
830 );
831 }
832
833
834 void __attribute__((naked,noinline)) kbd_p1_f_cont_my ()
835 {
836 asm volatile(
837
838 " ldr r6, =0x0004e440\n"
839 " movs r1, #2\n"
840 " mov r5, sp\n"
841 " add.w r3, r6, #0x24\n"
842 "loc_e005b63c:\n"
843 " add.w r0, r3, r1, lsl #2\n"
844 " ldr.w r2, [r6, r1, lsl #2]\n"
845 " ldr r7, [r0, #0xc]\n"
846 " ldr r0, [r0, #0x18]\n"
847 " ands r2, r7\n"
848 " eors r2, r0\n"
849 " str.w r2, [r5, r1, lsl #2]\n"
850 " subs r1, r1, #1\n"
851 " bpl loc_e005b63c\n"
852 " mov r0, r5\n"
853 " ldr r2, =0x0004e440\n"
854 " adds r2, #0x18\n"
855 " sub.w r1, r2, #0xc\n"
856 " bl sub_e005b13c_my\n"
857 " ldr pc, =0xe005b663\n"
858 );
859 }
860
861 extern int physw0_override;
862
863
864 void __attribute__((naked,noinline)) sub_e005b13c_my ()
865 {
866 asm volatile(
867
868 " push.w {r0, r1, r2, r3, r4, r5, r6, r7, r8, sb, sl, fp, ip, lr}\n"
869 " mov r5, r0\n"
870 " ldr r4, =0x0004e464\n"
871 " ldr r0, =physw0_override\n"
872 " ldr.w r0, [r0]\n"
873
874 " ldr pc, =0xe005b149\n"
875 );
876 }
877
878
879 void __attribute__((naked,noinline)) task_TricInitTask_my() {
880 asm volatile(
881
882 " push.w {r0, r1, r2, r3, r4, r5, r6, r7, r8, sb, sl, fp, ip, lr}\n"
883 " movs r0, #8\n"
884 " ldr r1, =0xe025d7b4\n"
885 " bl sub_e033c7b2\n"
886 " ldr.w fp, =0x000256f0\n"
887 " mov.w sl, #0x1000\n"
888 " ldr r4, =0x000256ec\n"
889 " movs r2, #0\n"
890 " ldr r1, =0x0703870f\n"
891 " ldr r0, [r4]\n"
892 " bl sub_dffc9830\n"
893 " lsls r0, r0, #0x1f\n"
894 " bne sub_e025d54a\n"
895
896
897 " ldr r4, =0x000256ec\n"
898 " mov r1, sp\n"
899 " ldr r0, [r4]\n"
900 " bl sub_dffc9996\n"
901 " ldr r1, [sp]\n"
902 " ldr r0, [r4]\n"
903 " bl sub_dffc9966\n"
904 " ldr r0, =0x02000003\n"
905 " ldr r7, [sp]\n"
906 " tst r7, r0\n"
907 " beq sub_e025d652\n"
908 " lsls r0, r7, #0x1f\n"
909 " beq sub_e025d580\n"
910
911 " ldr r0, =0xd2050074\n"
912 " ldr r0, [r0]\n"
913 " subs r0, #0\n"
914 " beq tric1\n"
915 " ldr r0, [r4]\n"
916 " mov r1, #0x80\n"
917 " bl _SetEventFlag\n"
918 "tric1:\n"
919
920 " bl sub_e025da1a\n"
921 " b sub_e025d5c2\n"
922 );
923 }
924
925 int check_fsio_skip(char* msg)
926 {
927
928 char* name = msg + 4;
929
930 char* long_name = *((char**)(msg+0x5c));
931 if (long_name != 0) name = long_name;
932 int l = strlen(name);
933
934
935
936
937 int skip = ((strncmp(name,"A/DCIM",6) == 0) && (name[l-9] == '_') && (strncmp(name+l-4, ".JPG", 4) != 0) && (strncmp(name+l-4, ".CR2", 4) != 0));
938
939
940 if (skip && (long_name != 0))
941 free(long_name);
942
943 return skip;
944 }
945
946
947 void __attribute__((naked,noinline)) task_FsIoNotifyTask_my() {
948 asm volatile(
949
950 " ldr r4, =0x000111a8\n"
951 " push {r3, lr}\n"
952 " ldr r0, [r4, #8]\n"
953 " cbnz r0, loc_e00f2b6e\n"
954 " movs r2, #0xbf\n"
955 " movs r0, #0\n"
956 " ldr r1, =0xe00f2ed0\n"
957 " bl sub_dffc96f4\n"
958 "loc_e00f2b6e:\n"
959 " ldr r0, [r4, #8]\n"
960 " movs r2, #0\n"
961 " mov r1, sp\n"
962 " bl sub_dffc9de0\n"
963 " cbz r0, loc_e00f2b84\n"
964 " movs r2, #0xc3\n"
965 " movs r0, #0\n"
966 " ldr r1, =0xe00f2ed0\n"
967 " bl sub_dffc96f4\n"
968 "loc_e00f2b84:\n"
969 " ldr r0, [sp]\n"
970 " bl check_fsio_skip\n"
971 " cbnz r0, loc_skip\n"
972 " ldr r0, [sp]\n"
973 " bl sub_e00f2ac4\n"
974 "loc_skip:\n"
975 " b loc_e00f2b6e\n"
976 );
977 }