root/platform/m10/sub/110d/movie_rec.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. movie_record_task
  2. sub_fc10099a_my
  3. sub_fc0fdf5c_my
  4. getchunkinfo
  5. apendstrm_my
  6. task_cocoa0

   1 
   2 // byte offset of bitrate constants inside the fw struct passed to set_quality()
   3 #define BR_LOW_OFS 0x2c
   4 #define BR_MID_OFS 0x30
   5 #define BR_HI_OFS  0x28
   6 
   7 // maximum allowed bitrate that doesn't crash the camera
   8 #define MAX_VIDEO_BITRATE 41000
   9 
  10 #define FW_SHORT_TIME_LIMIT 30      // unlocking fw time limits below this require user permission (seconds)
  11 #define SHORT_TIME_LIMIT 300        // raised time limit for movie modes that have more restricted fw time limits
  12 #define LONG_TIME_LIMIT (3*60*60)   // raised time limit for all other movie kinds
  13 
  14 #include "../../../generic/movie_rec.c"
  15 
  16 void __attribute__((naked,noinline)) movie_record_task() {
  17     asm volatile (
  18 // capdis -f=chdk -s=task_MovieRecord -c=191 -stubs PRIMARY.BIN 0xfc000000
  19 // task_MovieRecord 0xfc100c55
  20 "    push.w  {r2, r3, r4, r5, r6, r7, r8, sb, sl, fp, ip, lr}\n"
  21 "    ldr.w   sb, =0x0000af90\n"
  22 "    mov.w   fp, #1\n"
  23 "    ldr.w   sl, =0x0005cd30\n"
  24 "    mov.w   r8, #0\n"
  25 "    add.w   r5, sb, #0x100\n"
  26 "    sub.w   r7, r5, #0x80\n"
  27 "    sub.w   r6, r5, #0x180\n"
  28 "loc_fc100c74:\n"
  29 "    movs    r2, #0\n"
  30 "    add     r1, sp, #4\n"
  31 "    ldr     r0, [r6, #0x1c]\n"
  32 "    blx     sub_fc314c7c\n" // j_ReceiveMessageQueue
  33 "    ldr     r0, [sp, #4]\n"
  34 "    ldr     r0, [r0]\n"
  35 "    cmp     r0, #0xb\n"
  36 "    bhs     loc_fc100ca4\n"
  37 "    tbb     [pc, r0]\n" // (jumptable r0 11 elements)
  38 "branchtable_fc100c8a:\n"
  39 "    .byte((loc_fc100c96 - branchtable_fc100c8a) / 2)\n" // (case 0)
  40 "    .byte((loc_fc100cbc - branchtable_fc100c8a) / 2)\n" // (case 1)
  41 "    .byte((loc_fc100e10 - branchtable_fc100c8a) / 2)\n" // (case 2)
  42 "    .byte((loc_fc100d22 - branchtable_fc100c8a) / 2)\n" // (case 3)
  43 "    .byte((loc_fc100d28 - branchtable_fc100c8a) / 2)\n" // (case 4)
  44 "    .byte((loc_fc100d80 - branchtable_fc100c8a) / 2)\n" // (case 5)
  45 "    .byte((loc_fc100dc6 - branchtable_fc100c8a) / 2)\n" // (case 6)
  46 "    .byte((loc_fc100e48 - branchtable_fc100c8a) / 2)\n" // (case 7)
  47 "    .byte((loc_fc100e40 - branchtable_fc100c8a) / 2)\n" // (case 8)
  48 "    .byte((loc_fc100da4 - branchtable_fc100c8a) / 2)\n" // (case 9)
  49 "    .byte((loc_fc100e0a - branchtable_fc100c8a) / 2)\n" // (case 10)
  50 ".align 1\n"
  51 "loc_fc100c96:\n"
  52 "    ldr     r0, [r7, #0x78]\n"
  53 "    bl      sub_fc3895e2\n"
  54 "    ldr     r0, [r7, #0x74]\n"
  55 "    cbz     r0, loc_fc100ca6\n"
  56 "loc_fc100ca0:\n"
  57 "    bl      sub_fc0fda98\n"
  58 "loc_fc100ca4:\n"
  59 "    b       loc_fc100e48\n"
  60 "loc_fc100ca6:\n"
  61 "    ldr.w   r0, [sb, #0x44]\n"
  62 "    cbnz    r0, loc_fc100cb0\n"
  63 "    bl      sub_fc0fda14\n"
  64 "loc_fc100cb0:\n"
  65 "    bl      sub_fc10099a_my\n"     // ->
  66 "loc_fc100cb4:\n"
  67 "    cmp     r0, #0\n"
  68 "    str     r0, [r7, #0x74]\n"
  69 "    bne     loc_fc100ca0\n"
  70 "    b       loc_fc100e48\n"
  71 "loc_fc100cbc:\n"
  72 "    bl      sub_fc1006a4\n"
  73 "    str     r0, [r7, #0x74]\n"
  74 "    mov     r4, sb\n"
  75 "    ldr.w   r0, [sb, #0x44]\n"
  76 "    cbnz    r0, loc_fc100d1a\n"
  77 "    ldrb    r1, [r6]\n"
  78 "    add.w   r0, sl, r1, lsl #2\n"
  79 "    ldr     r0, [r0, #-0x4]\n"
  80 "    bl      sub_fc255604\n"
  81 "    ldr     r0, [r7, #0x74]\n"
  82 "    lsls    r0, r0, #0x1f\n"
  83 "    bne     loc_fc100ce4\n"
  84 "    bl      sub_fc100470\n"
  85 "    str     r0, [r7, #0x74]\n"
  86 "loc_fc100ce4:\n"
  87 "    ldr     r1, [r4, #0x48]\n"
  88 "    ldr     r0, [r4, #0x50]\n"
  89 "    orrs    r0, r1\n"
  90 "    bne     loc_fc100d00\n"
  91 "    movs    r4, #0\n"
  92 "    b       loc_fc100cfa\n"
  93 "loc_fc100cf0:\n"
  94 "    ldr.w   r0, [sl, r4, lsl #2]\n"
  95 "    bl      sub_fc10eafc\n"
  96 "    adds    r4, r4, #1\n"
  97 "loc_fc100cfa:\n"
  98 "    ldrb    r0, [r6]\n"
  99 "    cmp     r4, r0\n"
 100 "    blt     loc_fc100cf0\n"
 101 "loc_fc100d00:\n"
 102 "    ldr     r1, =0x0000af90\n"
 103 "    movs    r2, #1\n"
 104 "    movw    r0, #0x274\n"
 105 "    subs    r1, #0x80\n"
 106 "    bl      _SetPropertyCase\n"
 107 "    movw    r0, #0x314e\n"
 108 "    bl      sub_fc0fdb2c\n"
 109 "    bl      sub_fc0fda54\n"
 110 "loc_fc100d1a:\n"
 111 "    ldr     r0, [r7, #0x74]\n"
 112 "    cmp     r0, #0\n"
 113 "    bne     loc_fc100ca0\n"
 114 "    b       loc_fc100d7a\n"
 115 "loc_fc100d22:\n"
 116 "    bl      sub_fc1003e6\n"
 117 "    b       loc_fc100cb4\n"
 118 "loc_fc100d28:\n"
 119 "    ldr     r0, [r6, #0x50]\n"
 120 "    cmp     r0, #6\n"
 121 "    beq     loc_fc100d7a\n"
 122 "    ldr.w   r0, [sb, #0x1c]\n"
 123 "    mov     r4, sb\n"
 124 "    cbnz    r0, loc_fc100d42\n"
 125 "    movs    r1, #4\n"
 126 "    movs    r0, #0\n"
 127 "    bl      sub_fc131e30\n"
 128 "    str.w   fp, [r4, #0x1c]\n"
 129 "loc_fc100d42:\n"
 130 "    bl      sub_fc0fda14\n"
 131 "    bl      sub_fc10025c\n"
 132 "    str     r0, [r7, #0x74]\n"
 133 "    cbz     r0, loc_fc100d54\n"
 134 "loc_fc100d4e:\n"
 135 "    bl      sub_fc0fda98\n"
 136 "    b       loc_fc100d7a\n"
 137 "loc_fc100d54:\n"
 138 "    ldr     r0, [r4, #0x5c]\n"
 139 "    cbnz    r0, loc_fc100d6c\n"
 140 "    ldr     r0, [r4, #0x6c]\n"
 141 "    cbz     r0, loc_fc100d6c\n"
 142 "    bl      sub_fc0ffbce\n"
 143 "    str     r0, [r7, #0x74]\n"
 144 "    bl      sub_fc10194c\n"
 145 "    ldr     r0, [r7, #0x74]\n"
 146 "    cmp     r0, #0\n"
 147 "    bne     loc_fc100d4e\n"
 148 "loc_fc100d6c:\n"
 149 "    ldrb    r1, [r6]\n"
 150 "    add.w   r0, sl, r1, lsl #2\n"
 151 "    ldr     r0, [r0, #-0x4]\n"
 152 "    bl      sub_fc255604\n"
 153 "loc_fc100d7a:\n"
 154 "    ldr     r1, [r5, #0xc]\n"
 155 "    ldr     r0, [r5, #0x30]\n"
 156 "    b       loc_fc100e3c\n"
 157 "loc_fc100d80:\n"
 158 "    ldr     r0, [r6, #0x50]\n"
 159 "    cmp     r0, #6\n"
 160 "    beq     loc_fc100d9e\n"
 161 "    bl      sub_fc0ffbce\n"
 162 "    str     r0, [r7, #0x74]\n"
 163 "    bl      sub_fc10194c\n"
 164 "    ldr     r0, [r7, #0x74]\n"
 165 "    cbz     r0, loc_fc100d9a\n"
 166 "    bl      sub_fc0fda98\n"
 167 "    b       loc_fc100d9e\n"
 168 "loc_fc100d9a:\n"
 169 "    str.w   r8, [r6, #0x50]\n"
 170 "loc_fc100d9e:\n"
 171 "    ldr     r1, [r5, #0x18]\n"
 172 "    ldr     r0, [r5, #0x38]\n"
 173 "    b       loc_fc100e3c\n"
 174 "loc_fc100da4:\n"
 175 "    bl      sub_fc100fba\n"
 176 "    lsls    r0, r0, #0x1f\n"
 177 "    beq     loc_fc100db0\n"
 178 "    mov     r0, fp\n"
 179 "    b       loc_fc100db2\n"
 180 "loc_fc100db0:\n"
 181 "    mov     r0, r8\n"
 182 "loc_fc100db2:\n"
 183 "    str     r0, [r7, #0x74]\n"
 184 "    cbz     r0, loc_fc100dbe\n"
 185 "    mov.w   r0, #0xa0000\n"
 186 "    bl      sub_fc37253a\n" // HardwareDefect_FW
 187 "loc_fc100dbe:\n"
 188 "    ldr     r0, [r6, #0x34]\n"
 189 "    blx     sub_fc314cc4\n" // -> GiveSemaphore
 190 "    b       loc_fc100e48\n"
 191 "loc_fc100dc6:\n"
 192 "    ldr     r0, [r6, #0x50]\n"
 193 "    cmp     r0, #6\n"
 194 "    bne     loc_fc100dd8\n"
 195 "    ldr     r1, [r5, #0x20]\n"
 196 "    cmp     r1, #0\n"
 197 "    beq     loc_fc100e48\n"
 198 "    ldr     r0, [r5, #0x40]\n"
 199 "    blx     r1\n"
 200 "    b       loc_fc100e04\n"
 201 "loc_fc100dd8:\n"
 202 "    bl      sub_fc100040\n"
 203 "    str     r0, [r7, #0x74]\n"
 204 "    cbnz    r0, loc_fc100df8\n"
 205 "    ldr.w   r0, [sb, #0x6c]\n"
 206 "    cbz     r0, loc_fc100df0\n"
 207 "    bl      sub_fc0ffbce\n"
 208 "    str     r0, [r7, #0x74]\n"
 209 "    bl      sub_fc10194c\n"
 210 "loc_fc100df0:\n"
 211 "    str.w   r8, [r6, #0x50]\n"
 212 "    ldr     r0, [r7, #0x74]\n"
 213 "    cbz     r0, loc_fc100e04\n"
 214 "loc_fc100df8:\n"
 215 "    ldr     r1, [r5, #0x20]\n"
 216 "    cbz     r1, loc_fc100e00\n"
 217 "    ldr     r0, [r5, #0x40]\n"
 218 "    blx     r1\n"
 219 "loc_fc100e00:\n"
 220 "    bl      sub_fc0fda98\n"
 221 "loc_fc100e04:\n"
 222 "    ldr     r1, [r5, #0x1c]\n"
 223 "    ldr     r0, [r5, #0x3c]\n"
 224 "    b       loc_fc100e3c\n"
 225 "loc_fc100e0a:\n"
 226 "    bl      sub_fc0ff8fe\n"
 227 "    b       loc_fc100cb4\n"
 228 "loc_fc100e10:\n"
 229 "    movw    r4, #0x2710\n"
 230 "    ldr     r2, =0xfc0fde28\n" //  **"MovieRecorder.c"
 231 "    ldr     r0, [r6, #0x78]\n"
 232 "    movw    r3, #0x1b84\n"
 233 "    mov     r1, r4\n"
 234 "    blx     sub_fc314bfc\n" // j_TakeSemaphoreStrictly
 235 "    movs    r0, #3\n"
 236 "    str     r0, [r6, #0x6c]\n"
 237 "    ldr     r2, =0xfc0fde28\n" //  **"MovieRecorder.c"
 238 "    movw    r3, #0x1b88\n"
 239 "    ldr     r0, [r6, #0x74]\n"
 240 "    mov     r1, r4\n"
 241 "    blx     sub_fc314bfc\n" // j_TakeSemaphoreStrictly
 242 "    str.w   r8, [r7, #0x74]\n"
 243 "    ldr     r1, [r5, #0x14]\n"
 244 "    ldr     r0, [r5, #0x48]\n"
 245 "loc_fc100e3c:\n"
 246 "    blx     r1\n"
 247 "    b       loc_fc100e48\n"
 248 "loc_fc100e40:\n"
 249 "    bl      sub_fc101b4c\n"
 250 "    str     r0, [r7, #0x74]\n"
 251 "    b       loc_fc100dbe\n"
 252 "loc_fc100e48:\n"
 253 "    ldr     r1, [sp, #4]\n"
 254 "    movw    r3, #0x161b\n"
 255 "    movw    r2, #0x2710\n"
 256 "    str.w   r8, [r1]\n"
 257 "    str     r3, [sp]\n"
 258 "    ldr     r3, =0xfc0fde28\n" //  **"MovieRecorder.c"
 259 "    ldr     r0, [r6, #0x24]\n"
 260 "    blx     sub_fc314a9c\n" // j_PostMessageQueueStrictly
 261 "    b       loc_fc100c74\n"
 262 ".ltorg\n"
 263     );
 264 }
 265 
 266 void __attribute__((naked,noinline)) sub_fc10099a_my() {
 267     asm volatile (
 268 // capdis -f=chdk -s=0xfc10099b -c=16 -stubs PRIMARY.BIN 0xfc000000
 269 "    push.w  {r4, r5, r6, r7, r8, lr}\n"
 270 "    ldr     r5, =0x0000af10\n"
 271 "    sub     sp, #0x128\n"
 272 "    movs    r0, #0x1a\n"
 273 "    adds    r5, #0x80\n"
 274 "    str     r0, [sp, #4]\n"
 275 "    add     r1, sp, #0x48\n"
 276 "    add     r0, sp, #0xbc\n"
 277 "    mov     r4, r1\n"
 278 "    ldrd    r2, r3, [r5, #0x44]\n"
 279 "    bl      sub_fc0fdd52\n"
 280 "    add     r0, sp, #0xbc\n"
 281 "    bl      sub_fc30985c\n"
 282 "    add     r0, sp, #0x34\n"
 283 "    mov     r1, r4\n"
 284 "    bl      sub_fc0fdf5c_my\n"     // ->
 285 "    ldr     pc, =0xFC1009C5\n"     // + back to rom
 286 ".ltorg\n"
 287     );
 288 }
 289 
 290 void __attribute__((naked,noinline)) sub_fc0fdf5c_my() {
 291     asm volatile (
 292 // capdis -f=chdk -s=0xfc0fdf5d -c=837 -stubs PRIMARY.BIN 0xfc000000  
 293 "    push.w  {r4, r5, r6, r7, r8, sb, sl, fp, lr}\n"
 294 "    sub     sp, #0x24\n"
 295 "    ldr.w   fp, =0x0000af10\n"
 296 "    mov.w   sb, #0\n"
 297 "    mov.w   sl, #1\n"
 298 "    add.w   fp, fp, #0x80\n"
 299 "    mov     r5, r0\n"
 300 "    str.w   sb, [sp, #0xc]\n"
 301 "    add.w   r6, fp, #0x80\n"
 302 "    strd    sl, sb, [sp, #0x10]\n"
 303 "    str.w   sb, [sp, #8]\n"
 304 "    mov     r4, r1\n"
 305 "    str.w   sb, [fp, #0x3c]\n"
 306 "    mov     r8, sb\n"
 307 "    strb.w  sl, [r0]\n"
 308 "    strb.w  sb, [r0, #1]\n"
 309 "    ldr     r0, [r6, #0x78]\n"
 310 "    bl      _GetDrive_ClusterSize\n"
 311 "    ldr     r7, =0x0000af10\n"
 312 "    add.w   r4, r4, #0xc\n"
 313 "    str     r0, [r7, #0x58]\n"
 314 "    str     r0, [r5, #8]\n"
 315 "    movs    r0, #0x64\n"
 316 "    strb.w  r8, [r5, #4]\n"
 317 "    strb    r0, [r4, #0x13]\n"
 318 "    strb.w  r8, [r4, #0x18]\n"
 319 "    strb.w  r8, [r4, #0x16]\n"
 320 "    strb.w  sl, [r4, #0x19]\n"
 321 "    strb.w  sl, [r4, #0x1b]\n"
 322 "    str.w   r8, [r4]\n"
 323 "    strb.w  sl, [r4, #0x15]\n"
 324 "    strb.w  sl, [r4, #0x36]\n"
 325 "    sub.w   r4, r4, #0xc\n"
 326 "    ldr     r0, [r6, #0x14]\n"
 327 "    movs.w  sl, r0\n"
 328 "    beq     loc_fc0fdfd8\n"
 329 "    movs    r0, #2\n"
 330 "    b       loc_fc0fdfda\n"
 331 "loc_fc0fdfd8:\n"
 332 "    movs    r0, #1\n"
 333 "loc_fc0fdfda:\n"
 334 "    strb.w  r0, [r4, #0x23]\n"
 335 "    mov.w   r8, #1\n"
 336 "    strb.w  r8, [r4, #0x38]\n"
 337 "    movw    r0, #0xbb80\n"
 338 "    str     r0, [r4, #0x54]\n"
 339 "    movs    r0, #0x10\n"
 340 "    strh.w  r0, [r4, #0x58]\n"
 341 "    mov.w   r0, #0x1f400\n"
 342 "    str     r0, [r4, #0x60]\n"
 343 "    movs    r0, #0\n"
 344 "    str     r0, [r4, #0x5c]\n"
 345 "    ldr     r0, =0x0000b090\n"
 346 "    movs    r2, #0xf\n"
 347 "    movw    lr, #0x9c4\n"
 348 "    movw    r1, #0xbb5\n"
 349 "    mov.w   ip, #0xc\n"
 350 "    ldr     r3, [r0, #0x58]\n"
 351 "    movw    r0, #0x3e9\n"
 352 "    cmp     r3, #0x16\n"
 353 "    bhs     loc_fc0fe0fc\n"
 354 "    tbb     [pc, r3]\n" // (jumptable r3 22 elements)
 355 "branchtable_fc0fe01a:\n"
 356 "    .byte((loc_fc0fe216 - branchtable_fc0fe01a) / 2)\n" // (case 0)
 357 "    .byte((loc_fc0fe04c - branchtable_fc0fe01a) / 2)\n" // (case 1)
 358 "    .byte((loc_fc0fe0fc - branchtable_fc0fe01a) / 2)\n" // (case 2)
 359 "    .byte((loc_fc0fe030 - branchtable_fc0fe01a) / 2)\n" // (case 3)
 360 "    .byte((loc_fc0fe214 - branchtable_fc0fe01a) / 2)\n" // (case 4)
 361 "    .byte((loc_fc0fe212 - branchtable_fc0fe01a) / 2)\n" // (case 5)
 362 "    .byte((loc_fc0fe15a - branchtable_fc0fe01a) / 2)\n" // (case 6)
 363 "    .byte((loc_fc0fe122 - branchtable_fc0fe01a) / 2)\n" // (case 7)
 364 "    .byte((loc_fc0fe0fe - branchtable_fc0fe01a) / 2)\n" // (case 8)
 365 "    .byte((loc_fc0fe0fc - branchtable_fc0fe01a) / 2)\n" // (case 9)
 366 "    .byte((loc_fc0fe0fc - branchtable_fc0fe01a) / 2)\n" // (case 10)
 367 "    .byte((loc_fc0fe0fc - branchtable_fc0fe01a) / 2)\n" // (case 11)
 368 "    .byte((loc_fc0fe210 - branchtable_fc0fe01a) / 2)\n" // (case 12)
 369 "    .byte((loc_fc0fe20e - branchtable_fc0fe01a) / 2)\n" // (case 13)
 370 "    .byte((loc_fc0fe20c - branchtable_fc0fe01a) / 2)\n" // (case 14)
 371 "    .byte((loc_fc0fe080 - branchtable_fc0fe01a) / 2)\n" // (case 15)
 372 "    .byte((loc_fc0fe0a2 - branchtable_fc0fe01a) / 2)\n" // (case 16)
 373 "    .byte((loc_fc0fe0cc - branchtable_fc0fe01a) / 2)\n" // (case 17)
 374 "    .byte((loc_fc0fe0fc - branchtable_fc0fe01a) / 2)\n" // (case 18)
 375 "    .byte((loc_fc0fe0fc - branchtable_fc0fe01a) / 2)\n" // (case 19)
 376 "    .byte((loc_fc0fe0fc - branchtable_fc0fe01a) / 2)\n" // (case 20)
 377 "    .byte((loc_fc0fe188 - branchtable_fc0fe01a) / 2)\n" // (case 21)
 378 ".align 1\n"
 379 "loc_fc0fe030:\n"
 380 "    movw    r1, #0x95d\n"
 381 "    strh    r1, [r4, #0x1c]\n"
 382 "    ldr     r1, =0x0001005a\n"
 383 "    strb.w  ip, [r4, #1]\n"
 384 "    subs    r1, #0x42\n"
 385 "    str     r1, [r4, #0x34]\n"
 386 "    strb.w  ip, [r5, #5]\n"
 387 "    movw    r1, #0x5dc0\n"
 388 "    str     r1, [r6, #0x34]\n"
 389 "    b       loc_fc0fe074\n"
 390 "loc_fc0fe04c:\n"
 391 "    strh.w  lr, [r4, #0x1c]\n"
 392 "    cmp.w   sl, #0\n"
 393 "    strb.w  ip, [r4, #1]\n"
 394 "    strb.w  ip, [r5, #5]\n"
 395 "    beq     loc_fc0fe066\n"
 396 "    movs    r0, #0x32\n"
 397 "    str.w   r8, [r6, #0x18]\n"
 398 "    b       loc_fc0fe068\n"
 399 "loc_fc0fe066:\n"
 400 "    movs    r0, #0x19\n"
 401 "loc_fc0fe068:\n"
 402 "    str     r0, [r4, #0x34]\n"
 403 "    movw    r1, #0x61a8\n"
 404 "    movw    r0, #0x3e8\n"
 405 "    str     r1, [r6, #0x34]\n"
 406 "loc_fc0fe074:\n"
 407 "    str     r0, [r6, #0x38]\n"
 408 "loc_fc0fe076:\n"
 409 "    strd    r0, r1, [sp, #0x10]\n"
 410 "loc_fc0fe07a:\n"
 411 "    strh.w  ip, [r7, #0x10]\n"
 412 "    b       loc_fc0fe188\n"
 413 "loc_fc0fe080:\n"
 414 "    strh.w  lr, [r4, #0x1c]\n"
 415 "    movs    r0, #5\n"
 416 "    strb.w  ip, [r4, #1]\n"
 417 "    movw    r1, #0x61a8\n"
 418 "    str     r0, [r4, #0x34]\n"
 419 "    movw    r0, #0x1388\n"
 420 "    strb.w  ip, [r5, #5]\n"
 421 "    str     r0, [r6, #0x34]\n"
 422 "    movw    r0, #0x3e8\n"
 423 "    str     r0, [r6, #0x38]\n"
 424 "    b       loc_fc0fe076\n"
 425 "loc_fc0fe0a2:\n"
 426 "    strh.w  lr, [r4, #0x1c]\n"
 427 "    movs    r0, #5\n"
 428 "    strb.w  ip, [r4, #1]\n"
 429 "    movw    r1, #0x61a8\n"
 430 "    str     r0, [r4, #0x34]\n"
 431 "    movw    r0, #0x3e8\n"
 432 "    strb.w  ip, [r5, #5]\n"
 433 "    strd    lr, r0, [r6, #0x34]\n"
 434 "    strd    r0, r1, [sp, #0x10]\n"
 435 "    str.w   r8, [fp, #0x78]\n"
 436 "    str.w   r8, [fp, #0x7c]\n"
 437 "    b       loc_fc0fe07a\n"
 438 "loc_fc0fe0cc:\n"
 439 "    strh.w  lr, [r4, #0x1c]\n"
 440 "    movs    r0, #5\n"
 441 "    strb.w  ip, [r4, #1]\n"
 442 "    movw    r1, #0x61a8\n"
 443 "    str     r0, [r4, #0x34]\n"
 444 "    movw    r0, #0x4e2\n"
 445 "    strb.w  ip, [r5, #5]\n"
 446 "    str     r0, [r6, #0x34]\n"
 447 "    movw    r0, #0x3e8\n"
 448 "    str     r0, [r6, #0x38]\n"
 449 "    strd    r0, r1, [sp, #0x10]\n"
 450 "    movs    r0, #3\n"
 451 "    str.w   r0, [fp, #0x78]\n"
 452 "    str.w   r0, [fp, #0x7c]\n"
 453 "    b       loc_fc0fe07a\n"
 454 "loc_fc0fe0fc:\n"
 455 "    b       loc_fc0fe374\n"
 456 "loc_fc0fe0fe:\n"
 457 "    movw    r2, #0x3e8\n"
 458 "    movw    r1, #0xc350\n"
 459 "    movs    r0, #0x32\n"
 460 "    str     r0, [r4, #0x34]\n"
 461 "    movw    r0, #0x1388\n"
 462 "    strd    r1, r2, [r6, #0x34]\n"
 463 "    strh    r0, [r4, #0x1c]\n"
 464 "    movs    r0, #0x18\n"
 465 "    strb    r0, [r4, #1]\n"
 466 "    strb    r0, [r5, #5]\n"
 467 "    strd    r2, r1, [sp, #0x10]\n"
 468 "    strh    r0, [r7, #0x10]\n"
 469 "    b       loc_fc0fe188\n"
 470 "loc_fc0fe122:\n"
 471 "    ldr.w   ip, =0x0001005a\n"
 472 "    movw    r3, #0x176a\n"
 473 "    strh    r3, [r4, #0x1c]\n"
 474 "    movs    r3, #0x1e\n"
 475 "    strb    r3, [r4, #1]\n"
 476 "    sub.w   ip, ip, #0x1e\n"
 477 "    str.w   ip, [r4, #0x34]\n"
 478 "    movw    ip, #0xea60\n"
 479 "    strb.w  r8, [r4, #0x22]\n"
 480 "    strb    r3, [r5, #5]\n"
 481 "    strd    ip, r0, [r6, #0x34]\n"
 482 "    strd    r0, ip, [sp, #0x10]\n"
 483 "    strh    r3, [r7, #0x10]\n"
 484 "    ldr.w   r3, [fp, #0x50]\n"
 485 "    cbz     r3, loc_fc0fe188\n"
 486 "    strh    r1, [r4, #0x1c]\n"
 487 "    strb    r2, [r4, #1]\n"
 488 "    strb    r2, [r5, #5]\n"
 489 "    b       loc_fc0fe16e\n"
 490 "loc_fc0fe15a:\n"
 491 "    ldr.w   r3, [fp, #0x50]\n"
 492 "    cbz     r3, loc_fc0fe17a\n"
 493 "    strh    r1, [r4, #0x1c]\n"
 494 "    ldr     r1, =0x0001005a\n"
 495 "    strb    r2, [r4, #1]\n"
 496 "    str     r1, [r4, #0x34]\n"
 497 "    ldr     r1, =0x00015f90\n"
 498 "    strb    r2, [r5, #5]\n"
 499 "    b       loc_fc0fe2dc\n"
 500 "loc_fc0fe16e:\n"
 501 "    movw    r1, #0x7530\n"
 502 "    str     r1, [sp, #0x14]\n"
 503 "loc_fc0fe174:\n"
 504 "    str     r0, [sp, #0x10]\n"
 505 "loc_fc0fe176:\n"
 506 "    strh    r2, [r7, #0x10]\n"
 507 "    b       loc_fc0fe188\n"
 508 "loc_fc0fe17a:\n"
 509 "    movw    r2, #0x602\n"
 510 "loc_fc0fe17e:\n"
 511 "    ldr     r1, =0xfc0fde28\n" //  *"MovieRecorder.c"
 512 "    movs    r0, #0\n"
 513 "    blx     sub_fc314dec\n" // j_DebugAssert
 514 "loc_fc0fe188:\n"
 515 "    movs    r0, #2\n"
 516 "    strb    r0, [r4]\n"
 517 "    ldr     r0, =0x0000af10\n"
 518 "    mov.w   sl, #0\n"
 519 "    strb.w  sl, [r4, #0x26]\n"
 520 "    adds    r0, #0x80\n"
 521 "    strb.w  sl, [r4, #2]\n"
 522 "    ldr     r0, [r0, #0x38]\n"
 523 "    cmp     r0, #0\n"
 524 "    beq     loc_fc0fe26e\n"
 525 "    ldr     r1, =0x0000b090\n"
 526 "    ldr     r1, [r1, #0x50]\n"
 527 "    cmp.w   r1, #0x780\n"
 528 "    bne     loc_fc0fe1b4\n"
 529 "    ldr     r2, =0x0000af10\n"
 530 "    adds    r2, #0x80\n"
 531 "    str.w   r8, [r2, #0x3c]\n"
 532 "loc_fc0fe1b4:\n"
 533 "    movs    r2, #3\n"
 534 "    strb.w  r8, [r4]\n"
 535 "    strb    r2, [r4, #1]\n"
 536 "    strb.w  r8, [r4, #2]\n"
 537 "    ldr     r1, =0x0000b090\n"
 538 "    strh    r2, [r7, #0x10]\n"
 539 "    strb.w  r8, [r4, #0x26]\n"
 540 "    adds    r1, #0xb8\n"
 541 "    strb.w  r8, [r4, #0x22]\n"
 542 "loc_fc0fe1ce:\n"
 543 "    movw    ip, #0x140\n"
 544 "    ldr     r2, =0x1f0e1e4c\n"
 545 "    str     r1, [r6, #0x5c]\n"
 546 "    movw    r1, #0x800\n"
 547 "    ldr.w   fp, =0x0000b090\n"
 548 "    strd    r1, r2, [r4, #0x44]\n"
 549 "    ldr     r2, =0x082600eb\n"
 550 "    str     r2, [r4, #0x4c]\n"
 551 "    ldr     r2, =0x009a0834\n"
 552 "    str     r2, [r4, #0x50]\n"
 553 "    movs    r2, #6\n"
 554 "    ldr.w   r3, [fp, #0x50]\n"
 555 "    cmp     r3, ip\n"
 556 "    beq     loc_fc0fe2e2\n"
 557 "    cmp.w   r3, #0x280\n"
 558 "    beq     loc_fc0fe2e4\n"
 559 "    movs    r1, #0x29\n"
 560 "    movw    r2, #0x500\n"
 561 "    cmp     r3, r2\n"
 562 "    beq     loc_fc0fe2e6\n"
 563 "    movw    lr, #0x780\n"
 564 "    cmp     r3, lr\n"
 565 "    b       loc_fc0fe218\n"
 566 "loc_fc0fe20c:\n"
 567 "    b       loc_fc0fe34c\n"
 568 "loc_fc0fe20e:\n"
 569 "    b       loc_fc0fe324\n"
 570 "loc_fc0fe210:\n"
 571 "    b       loc_fc0fe312\n"
 572 "loc_fc0fe212:\n"
 573 "    b       loc_fc0fe2c0\n"
 574 "loc_fc0fe214:\n"
 575 "    b       loc_fc0fe2ce\n"
 576 "loc_fc0fe216:\n"
 577 "    b       loc_fc0fe2e8\n"
 578 "loc_fc0fe218:\n"
 579 "    bne     loc_fc0fe306\n"
 580 "    add.w   r4, r4, #0x1c\n"
 581 "    movw    r2, #0x438\n"
 582 "    cmp     r0, #0\n"
 583 "    strh    lr, [r4, #-0x16]\n"
 584 "    strh    r2, [r4, #-0x18]\n"
 585 "    strh    lr, [r4, #-0x12]\n"
 586 "    strh    r2, [r4, #-0x14]\n"
 587 "    strb.w  r8, [r4, #4]\n"
 588 "    strb.w  r8, [r4, #0x1d]\n"
 589 "    strb.w  r8, [r4, #0x1e]\n"
 590 "    strb.w  r8, [r4, #0x1f]\n"
 591 "    strh.w  r8, [r4, #0x20]\n"
 592 "    strh.w  r8, [r4, #0x22]\n"
 593 "    strh.w  r8, [r4, #0x24]\n"
 594 "    sub.w   r4, r4, #0x1c\n"
 595 "    strh.w  r8, [r7, #0x14]\n"
 596 "    beq     loc_fc0fe34a\n"
 597 "    movw    r0, #0x9c40\n"
 598 "    str     r0, [r4, #0x28]\n"
 599 "    movw    r0, #0x9bdc\n"
 600 "    str     r0, [r4, #0x30]\n"
 601 "    movw    r0, #0x9b78\n"
 602 "    str     r0, [r4, #0x2c]\n"
 603 "    b       loc_fc0fe3be\n"
 604 "loc_fc0fe26e:\n"
 605 "    b       loc_fc0fe37a\n"
 606 // literal pool removed
 607 ".ltorg\n"  // +
 608 "loc_fc0fe2c0:\n"
 609 "    strh    r1, [r4, #0x1c]\n"
 610 "    strb    r2, [r4, #1]\n"
 611 "    ldr     r1, =0x00010078\n"
 612 "    str     r1, [r4, #0x34]\n"
 613 "    ldr     r1, =0x0001d4c0\n"
 614 "    strb    r2, [r5, #5]\n"
 615 "    b       loc_fc0fe2dc\n"
 616 "loc_fc0fe2ce:\n"
 617 "    strh    r1, [r4, #0x1c]\n"
 618 "    ldr     r1, =0x00010078\n"
 619 "    strb    r2, [r4, #1]\n"
 620 "    adds    r1, #0x78\n"
 621 "    str     r1, [r4, #0x34]\n"
 622 "    ldr     r1, =0x0003a980\n"
 623 "    strb    r2, [r5, #5]\n"
 624 "loc_fc0fe2dc:\n"
 625 "    strd    r1, r0, [r6, #0x34]\n"
 626 "    b       loc_fc0fe16e\n"
 627 "loc_fc0fe2e2:\n"
 628 "    b       loc_fc0fe5ce\n"
 629 "loc_fc0fe2e4:\n"
 630 "    b       loc_fc0fe570\n"
 631 "loc_fc0fe2e6:\n"
 632 "    b       loc_fc0fe3ca\n"
 633 "loc_fc0fe2e8:\n"
 634 "    movw    r3, #0x7530\n"
 635 "    strd    r3, r0, [r6, #0x34]\n"
 636 "    strh    r1, [r4, #0x1c]\n"
 637 "    cmp.w   sl, #0\n"
 638 "    strb    r2, [r4, #1]\n"
 639 "    strb    r2, [r5, #5]\n"
 640 "    beq     loc_fc0fe308\n"
 641 "    ldr     r1, =0x00010078\n"
 642 "    str.w   r8, [r6, #0x18]\n"
 643 "    subs    r1, #0x3c\n"
 644 "    b       loc_fc0fe30c\n"
 645 "loc_fc0fe306:\n"
 646 "    b       loc_fc0fe62e\n"
 647 "loc_fc0fe308:\n"
 648 "    ldr     r1, =0x00010078\n"
 649 "    subs    r1, #0x5a\n"
 650 "loc_fc0fe30c:\n"
 651 "    str     r1, [r4, #0x34]\n"
 652 "    str     r3, [sp, #0x14]\n"
 653 "    b       loc_fc0fe174\n"
 654 "loc_fc0fe312:\n"
 655 "    strh    r1, [r4, #0x1c]\n"
 656 "    ldr     r1, =0x00010078\n"
 657 "    strb    r2, [r4, #1]\n"
 658 "    subs    r1, #0x72\n"
 659 "    str     r1, [r4, #0x34]\n"
 660 "    movw    r1, #0x1770\n"
 661 "    strb    r2, [r5, #5]\n"
 662 "    b       loc_fc0fe2dc\n"
 663 "loc_fc0fe324:\n"
 664 "    strh    r1, [r4, #0x1c]\n"
 665 "    ldr     r1, =0x00010078\n"
 666 "    strb    r2, [r4, #1]\n"
 667 "    subs    r1, #0x72\n"
 668 "    str     r1, [r4, #0x34]\n"
 669 "    movw    r1, #0xbb8\n"
 670 "    strb    r2, [r5, #5]\n"
 671 "    strd    r1, r0, [r6, #0x34]\n"
 672 "    movw    r1, #0x7530\n"
 673 "    strd    r0, r1, [sp, #0x10]\n"
 674 "    str.w   r8, [fp, #0x78]\n"
 675 "    str.w   r8, [fp, #0x7c]\n"
 676 "    b       loc_fc0fe176\n"
 677 "loc_fc0fe34a:\n"
 678 "    b       loc_fc0fe37e\n"
 679 "loc_fc0fe34c:\n"
 680 "    strh    r1, [r4, #0x1c]\n"
 681 "    ldr     r1, =0x00010078\n"
 682 "    strb    r2, [r4, #1]\n"
 683 "    subs    r1, #0x72\n"
 684 "    str     r1, [r4, #0x34]\n"
 685 "    movw    r1, #0x5dc\n"
 686 "    strb    r2, [r5, #5]\n"
 687 "    strd    r1, r0, [r6, #0x34]\n"
 688 "    movw    r1, #0x7530\n"
 689 "    strd    r0, r1, [sp, #0x10]\n"
 690 "    movs    r0, #3\n"
 691 "    str.w   r0, [fp, #0x78]\n"
 692 "    str.w   r0, [fp, #0x7c]\n"
 693 "    b       loc_fc0fe176\n"
 694 "loc_fc0fe374:\n"
 695 "    movw    r2, #0x67a\n"
 696 "    b       loc_fc0fe17e\n"
 697 "loc_fc0fe37a:\n"
 698 "    mov     r1, sl\n"
 699 "    b       loc_fc0fe1ce\n"
 700 "loc_fc0fe37e:\n"
 701 "    ldr.w   r0, [fp, #0x58]\n"
 702 "    movw    r2, #0x5d5c\n"
 703 "    movw    r3, #0x5cf8\n"
 704 "    cmp     r0, #1\n"
 705 "    beq     loc_fc0fe3b4\n"
 706 "    cmp     r0, #3\n"
 707 "    beq     loc_fc0fe3b4\n"
 708 "    cmp     r0, #7\n"
 709 "    movw    ip, #0x88b8\n"
 710 "    movw    sb, #0x8854\n"
 711 "    beq     loc_fc0fe3a2\n"
 712 "    cmp     r0, #8\n"
 713 "    bne     loc_fc0fe3b4\n"
 714 "loc_fc0fe3a2:\n"
 715 "    movw    r0, #0x87f0\n"
 716 "    strd    ip, r0, [r4, #0x28]\n"
 717 "    str.w   sb, [r4, #0x30]\n"
 718 "    movs    r0, #0x2a\n"
 719 "    strb    r0, [r4, #0x1e]\n"
 720 "    b       loc_fc0fe3c0\n"
 721 "loc_fc0fe3b4:\n"
 722 "    strd    r3, r2, [r4, #0x2c]\n"
 723 "    movw    r0, #0x5dc0\n"
 724 "    str     r0, [r4, #0x28]\n"
 725 "loc_fc0fe3be:\n"
 726 "    strb    r1, [r4, #0x1e]\n"
 727 "loc_fc0fe3c0:\n"
 728 "    movw    r0, #0x438\n"
 729 "    str.w   lr, [r6, #0x3c]\n"
 730 "    b       loc_fc0fe5ca\n"
 731 "loc_fc0fe3ca:\n"
 732 "    mov     sb, r2\n"
 733 "    mov     r3, r2\n"
 734 "    strh    r2, [r4, #6]\n"
 735 "    movw    r2, #0x2d0\n"
 736 "    strh    r2, [r4, #4]\n"
 737 "    cmp     r0, #0\n"
 738 "    strh    r3, [r4, #0xa]\n"
 739 "    strh    r2, [r4, #8]\n"
 740 "    strb.w  r8, [r4, #0x20]\n"
 741 "    strb.w  r8, [r4, #0x39]\n"
 742 "    strb.w  r8, [r4, #0x3a]\n"
 743 "    strb.w  r8, [r4, #0x3b]\n"
 744 "    strh.w  r8, [r4, #0x3c]\n"
 745 "    strh.w  r8, [r4, #0x3e]\n"
 746 "    strh.w  r8, [r4, #0x40]\n"
 747 "    strh.w  r8, [r7, #0x14]\n"
 748 "    ldr.w   r0, [fp, #0x58]\n"
 749 "    beq     loc_fc0fe42c\n"
 750 "    movw    r2, #0x74cc\n"
 751 "    movw    r3, #0x7468\n"
 752 "    cbz     r0, loc_fc0fe410\n"
 753 "    cmp     r0, #1\n"
 754 "    bne     loc_fc0fe41c\n"
 755 "loc_fc0fe410:\n"
 756 "    strd    r3, r2, [r4, #0x2c]\n"
 757 "    movw    r0, #0x7530\n"
 758 "    str     r0, [r4, #0x28]\n"
 759 "    b       loc_fc0fe458\n"
 760 "loc_fc0fe41c:\n"
 761 "    movw    r2, #0x708\n"
 762 "    ldr     r1, =0xfc0fde28\n" //  *"MovieRecorder.c"
 763 "    movs    r0, #0\n"
 764 "    blx     sub_fc314dec\n" // j_DebugAssert
 765 "    b       loc_fc0fe45a\n"
 766 "loc_fc0fe42c:\n"
 767 "    movs    r1, #0x1f\n"
 768 "    movw    r2, #0x1f40\n"
 769 "    cmp     r0, #0xf\n"
 770 "    movw    ip, #0x1edc\n"
 771 "    bge     loc_fc0fe4a8\n"
 772 "    cmp     r0, #1\n"
 773 "    beq     loc_fc0fe4a8\n"
 774 "    lsls    r3, r2, #1\n"
 775 "    movw    lr, #0x3e1c\n"
 776 "    cmp     r0, #7\n"
 777 "    beq     loc_fc0fe44c\n"
 778 "    cmp     r0, #8\n"
 779 "    bne     loc_fc0fe4a8\n"
 780 "loc_fc0fe44c:\n"
 781 "    str.w   lr, [r4, #0x30]\n"
 782 "    movw    r0, #0x3db8\n"
 783 "    str     r3, [r4, #0x28]\n"
 784 "loc_fc0fe456:\n"
 785 "    str     r0, [r4, #0x2c]\n"
 786 "loc_fc0fe458:\n"
 787 "    strb    r1, [r4, #0x1e]\n"
 788 "loc_fc0fe45a:\n"
 789 "    movw    r0, #0x2d0\n"
 790 "    strd    sb, r0, [r6, #0x3c]\n"
 791 "    ldr.w   sb, =0x0000af90\n"
 792 "    ldr.w   r0, [sb, #0x20]\n"
 793 "    cmp     r0, #1\n"
 794 "    bne     loc_fc0fe56a\n"
 795 "    ldr     r0, [r6, #0x7c]\n"
 796 "    movs    r3, #2\n"
 797 "    sub.w   r2, sb, #0x78\n"
 798 "    movw    r1, #0x1d4\n"
 799 "    bl      sub_fc3885c2\n"
 800 "    str.w   sl, [r6, #0x54]\n"
 801 "    str.w   sl, [r6, #0x58]\n"
 802 "    ldr.w   r0, [sb, #0x24]\n"
 803 "    cmp     r0, #0\n"
 804 "    ldrh    r0, [r7, #8]\n"
 805 "    beq     loc_fc0fe4b4\n"
 806 "    cbz     r0, loc_fc0fe4b6\n"
 807 "    bl      sub_fc17a068\n" // GetLatestHVPosition_FW
 808 "    cmp     r0, #1\n"
 809 "    beq     loc_fc0fe49e\n"
 810 "    cmp     r0, #2\n"
 811 "    bne     loc_fc0fe4ba\n"
 812 "loc_fc0fe49e:\n"
 813 "    str.w   r8, [r6, #0x54]\n"
 814 "    str.w   r8, [r6, #0x58]\n"
 815 "    b       loc_fc0fe4ba\n"
 816 "loc_fc0fe4a8:\n"
 817 "    str.w   ip, [r4, #0x30]\n"
 818 "    movw    r0, #0x1e78\n"
 819 "    str     r2, [r4, #0x28]\n"
 820 "    b       loc_fc0fe456\n"
 821 "loc_fc0fe4b4:\n"
 822 "    cbnz    r0, loc_fc0fe4ba\n"
 823 "loc_fc0fe4b6:\n"
 824 "    str.w   r8, [r6, #0x54]\n"
 825 "loc_fc0fe4ba:\n"
 826 "    movs    r3, #1\n"
 827 "    ldr     r0, [r6, #0x7c]\n"
 828 "    add     r2, sp, #0xc\n"
 829 "    movw    r1, #0x1d7\n"
 830 "    bl      sub_fc3885c2\n"
 831 "    ldr     r0, [r6, #0x7c]\n"
 832 "    movs    r3, #1\n"
 833 "    add     r2, sp, #8\n"
 834 "    movw    r1, #0x1d8\n"
 835 "    bl      sub_fc3885c2\n"
 836 "    ldr     r0, [r6, #0x64]\n"
 837 "    ldr     r1, =0xfc626f98\n"
 838 "    cmp     r0, #0x5a\n"
 839 "    beq     loc_fc0fe51e\n"
 840 "    cmp.w   r0, #0x10e\n"
 841 "    beq     loc_fc0fe542\n"
 842 "    ldrb.w  r2, [sp, #8]\n"
 843 "    movs    r0, #0\n"
 844 "    ldrb.w  r1, [sp, #0xc]\n"
 845 "    bl      sub_fc250f70\n"
 846 "    strh    r0, [r7, #0xa]\n"
 847 "    asrs    r0, r0, #0x10\n"
 848 "    subs    r0, #0x3c\n"
 849 "    uxth    r1, r0\n"
 850 "    ldrh    r0, [r7, #0xa]\n"
 851 "    add.w   r0, r0, r0, lsl #2\n"
 852 "    lsls    r2, r0, #8\n"
 853 "    movw    r0, #0x280\n"
 854 "    udiv    r0, r2, r0\n"
 855 "    strh    r0, [r7, #0xa]\n"
 856 "    movw    r0, #0x2d0\n"
 857 "    muls    r1, r0, r1\n"
 858 "    asrs    r0, r0, #1\n"
 859 "    udiv    r0, r1, r0\n"
 860 "    strh    r0, [r7, #0xc]\n"
 861 "    movs    r0, #4\n"
 862 "    b       loc_fc0fe568\n"
 863 "loc_fc0fe51e:\n"
 864 "    ldrb.w  r0, [sp, #0xc]\n"
 865 "    add.w   r0, r0, r0, lsl #1\n"
 866 "    add.w   r0, r1, r0, lsl #2\n"
 867 "    ldrb.w  r1, [sp, #8]\n"
 868 "    add.w   r1, r0, r1, lsl #2\n"
 869 "    ldr     r0, [sp, #4]\n"
 870 "    ldrh    r2, [r1]\n"
 871 "    ldrh    r1, [r1, #2]\n"
 872 "    bfi     r0, r2, #0, #0x10\n"
 873 "    bfi     r0, r1, #0x10, #0x10\n"
 874 "    b       loc_fc0fe558\n"
 875 "loc_fc0fe542:\n"
 876 "    ldrb.w  r0, [sp, #0xc]\n"
 877 "    add.w   r0, r0, r0, lsl #1\n"
 878 "    add.w   r0, r1, r0, lsl #2\n"
 879 "    ldrb.w  r1, [sp, #8]\n"
 880 "    add.w   r0, r0, r1, lsl #2\n"
 881 "    ldr     r0, [r0, #0x30]\n"
 882 "loc_fc0fe558:\n"
 883 "    movw    r2, #0xfffe\n"
 884 "    adds    r1, r0, #1\n"
 885 "    ands    r1, r2\n"
 886 "    strh    r1, [r7, #0xa]\n"
 887 "    lsrs    r0, r0, #0x10\n"
 888 "    strh    r0, [r7, #0xc]\n"
 889 "    movs    r0, #2\n"
 890 "loc_fc0fe568:\n"
 891 "    strh    r0, [r7, #0xe]\n"
 892 "loc_fc0fe56a:\n"
 893 "    movw    sb, #0x707\n"
 894 "    b       loc_fc0fe63c\n"
 895 "loc_fc0fe570:\n"
 896 "    movw    lr, #0x280\n"
 897 "    strh.w  lr, [r4, #6]\n"
 898 "    movw    r0, #0x1e0\n"
 899 "    strh    r0, [r4, #4]\n"
 900 "    strh.w  lr, [r4, #0xa]\n"
 901 "    mov.w   ip, #3\n"
 902 "    strh    r0, [r4, #8]\n"
 903 "    movw    r3, #0xaf0\n"
 904 "    strb.w  r2, [r4, #0x20]\n"
 905 "    strb.w  r8, [r4, #0x39]\n"
 906 "    strb.w  r8, [r4, #0x3a]\n"
 907 "    strb.w  ip, [r4, #0x3b]\n"
 908 "    strh.w  r8, [r4, #0x3c]\n"
 909 "    strh.w  r8, [r4, #0x3e]\n"
 910 "    strh.w  r2, [r4, #0x40]\n"
 911 "    strh    r2, [r7, #0x14]\n"
 912 "    mov.w   r2, #0x8000000\n"
 913 "    strd    sl, r2, [r4, #0x48]\n"
 914 "    movw    r2, #0xb54\n"
 915 "    str     r1, [r4, #0x50]\n"
 916 "    movw    r1, #0xbb8\n"
 917 "    strd    r3, r2, [r4, #0x2c]\n"
 918 "    str     r1, [r4, #0x28]\n"
 919 "    movs    r1, #0x1e\n"
 920 "    strb    r1, [r4, #0x1e]\n"
 921 "    str.w   lr, [r6, #0x3c]\n"
 922 "loc_fc0fe5ca:\n"
 923 "    str     r0, [r6, #0x40]\n"
 924 "    b       loc_fc0fe56a\n"
 925 "loc_fc0fe5ce:\n"
 926 "    add.w   r4, r4, #0x1c\n"
 927 "    mov.w   lr, #0xf0\n"
 928 "    mov.w   r3, #3\n"
 929 "    mov.w   r0, #0x8000000\n"
 930 "    strh    ip, [r4, #-0x16]\n"
 931 "    strh    lr, [r4, #-0x18]\n"
 932 "    strh    ip, [r4, #-0x12]\n"
 933 "    strh    lr, [r4, #-0x14]\n"
 934 "    strb    r2, [r4, #4]\n"
 935 "    strb.w  r8, [r4, #0x1d]\n"
 936 "    strb.w  r8, [r4, #0x1e]\n"
 937 "    strb    r3, [r4, #0x1f]\n"
 938 "    strh.w  r8, [r4, #0x20]\n"
 939 "    strh.w  r8, [r4, #0x22]\n"
 940 "    strh    r2, [r4, #0x24]\n"
 941 "    strh    r2, [r7, #0x14]\n"
 942 "    strd    sl, r0, [r4, #0x2c]\n"
 943 "    str     r1, [r4, #0x34]\n"
 944 "    movw    r0, #0x3e8\n"
 945 "    str     r0, [r4, #0xc]\n"
 946 "    movw    r0, #0x384\n"
 947 "    str     r0, [r4, #0x14]\n"
 948 "    movw    r0, #0x320\n"
 949 "    str     r0, [r4, #0x10]\n"
 950 "    mov.w   r0, #0x14\n"
 951 "    strb    r0, [r4, #2]\n"
 952 "    sub.w   r4, r4, #0x1c\n"
 953 "    strd    ip, lr, [r6, #0x3c]\n"
 954 "    b       loc_fc0fe56a\n"
 955 "loc_fc0fe62e:\n"
 956 "    movw    r2, #0x7e6\n"
 957 "    ldr     r1, =0xfc0fde28\n" //  *"MovieRecorder.c"
 958 "    movs    r0, #0\n"
 959 "    blx     sub_fc314dec\n" // j_DebugAssert
 960 "loc_fc0fe63c:\n"
 961 "    ldr     r0, [r6, #0x78]\n"
 962 "    bl      sub_fc25561e\n"
 963 "    strb    r0, [r7, #1]\n"
 964 "    uxtb    r0, r0\n"
 965 "    cmp     r0, #2\n"
 966 "    beq     loc_fc0fe64e\n"
 967 "    mov     r0, r8\n"
 968 "loc_fc0fe64c:\n"
 969 "    b       loc_fc0fe650\n"
 970 "loc_fc0fe64e:\n"
 971 "    mov     r0, sl\n"
 972 "loc_fc0fe650:\n"
 973 "    strb    r0, [r5, #7]\n"
 974 "    ldr     r0, [r7, #0x58]\n"
 975 "    mov.w   r1, #0x300000\n"
 976 "    cmp     r0, r1\n"
 977 "    bls     loc_fc0fe662\n"
 978 "    strb.w  sl, [r5, #7]\n"
 979 "    b       loc_fc0fe666\n"
 980 "loc_fc0fe662:\n"
 981 "    ldrb    r2, [r5, #7]\n"
 982 "    cbnz    r2, loc_fc0fe66a\n"
 983 "loc_fc0fe666:\n"
 984 "    strb.w  sl, [r7, #1]\n"
 985 "loc_fc0fe66a:\n"
 986 "    mov.w   r1, #0x300000\n"
 987 "    ldr     r2, =0x0000af90\n"
 988 "    subs    r2, #0x80\n"
 989 "    ldrb    r2, [r2, #1]\n"
 990 "    strb    r2, [r5, #6]\n"
 991 "    str     r1, [r4, #0x14]\n"
 992 "    ldrb    r1, [r5, #7]\n"
 993 "    cmp     r1, #1\n"
 994 "    bne     loc_fc0fe68c\n"
 995 "    add.w   r2, r5, #0x10\n"
 996 "    ldr     r0, [r6, #0x78]\n"
 997 "    subs    r1, r2, #4\n"
 998 "    bl      sub_fc389484\n"
 999 "    b       loc_fc0fe690\n"
1000 "loc_fc0fe68c:\n"
1001 "    str     r0, [r5, #0xc]\n"
1002 "    str     r0, [r5, #0x10]\n"
1003 "loc_fc0fe690:\n"
1004 
1005 // movie time limit modification, r0...r3 does not seem to carry anything useful here, so they are not backed up
1006 "    mov     r0, sb\n"                  // + original limit is in r9 (aka sb)
1007 "    bl      set_movie_time_limit\n"    // +
1008 "    mov     sb, r0\n"                  // +
1009 // bitrate mod
1010 "    mov     r0, r4\n"                  // + addr of struct with bitrates is in r4
1011 "    bl      set_quality\n"             // +
1012 
1013 "    mvn     r2, #9\n"
1014 "    ldr     r0, [r6, #0x34]\n"
1015 "    mov     r7, sl\n"
1016 "    str     r0, [sp, #0x20]\n"
1017 "    mul     r1, sb, r0\n"
1018 "    ldr     r0, [r6, #0x38]\n"
1019 "    str     r0, [sp, #0x1c]\n"
1020 "    udiv    r0, r1, r0\n"
1021 "    str.w   r0, [fp, #0x6c]\n"
1022 "    str     r0, [sp, #0x18]\n"
1023 "    adds.w  r0, sb, r2\n"
1024 "    ldr.w   sb, =0x0000af90\n"
1025 "    adc     r1, sl, #-1\n"
1026 "    ldr     r1, =0x0000af90\n"
1027 "    sub.w   sb, sb, #0x80\n"
1028 "    str.w   r0, [sb, #0x68]\n"
1029 "    b       loc_fc0fe6d8\n"
1030 ".ltorg\n"
1031 // literal pool removed
1032 "loc_fc0fe6d8:\n"
1033 "    ldr     r0, [r1, #0x74]\n" // instruction restored (capdis lost sync)
1034 "    cbnz    r0, loc_fc0fe6ec\n"
1035 "    ldrd    r0, r2, [sp, #0x1c]\n"
1036 "    add     r0, r2\n"
1037 "    ldr     r2, [sp, #0x1c]\n"
1038 "    subs    r0, r0, #1\n"
1039 "    udiv    r0, r0, r2\n"
1040 "    str     r0, [r1, #0x74]\n"
1041 "loc_fc0fe6ec:\n"
1042 "    ldr     r2, [r1, #0x54]\n"
1043 "    ldr     r0, [r1, #0x44]\n"
1044 "    orrs    r2, r0\n"
1045 "    beq     loc_fc0fe700\n"
1046 "    strb.w  r8, [r5, #2]\n"
1047 "    movw    r2, #0x780\n"
1048 "    str     r2, [r4, #0x18]\n"
1049 "    b       loc_fc0fe704\n"
1050 "loc_fc0fe700:\n"
1051 "    strb    r7, [r5, #2]\n"
1052 "    str     r7, [r4, #0x18]\n"
1053 "loc_fc0fe704:\n"
1054 "    cmp     r0, #0\n"
1055 "    mov     sl, r1\n"
1056 "    beq     loc_fc0fe796\n"
1057 "    strb    r7, [r5, #7]\n"
1058 "    ldr.w   r0, [sb, #0x58]\n"
1059 "    cmp.w   r0, #0x300000\n"
1060 "    bls     loc_fc0fe718\n"
1061 "    str     r0, [r4, #0x14]\n"
1062 "loc_fc0fe718:\n"
1063 "    ldr.w   r0, [fp, #0x58]\n"
1064 "    cbnz    r0, loc_fc0fe72a\n"
1065 "    movs    r0, #0x3c\n"
1066 "    str     r0, [r6, #8]\n"
1067 "    movs    r0, #0x78\n"
1068 "    str     r0, [r6, #0xc]\n"
1069 "    movs    r0, #0x1e\n"
1070 "    b       loc_fc0fe738\n"
1071 "loc_fc0fe72a:\n"
1072 "    cmp     r0, #1\n"
1073 "    bne     loc_fc0fe73c\n"
1074 "    movs    r0, #0x30\n"
1075 "    str     r0, [r6, #8]\n"
1076 "    movs    r0, #0x60\n"
1077 "    str     r0, [r6, #0xc]\n"
1078 "    movs    r0, #0x18\n"
1079 "loc_fc0fe738:\n"
1080 "    str     r0, [r6, #0x10]\n"
1081 "    b       loc_fc0fe74a\n"
1082 "loc_fc0fe73c:\n"
1083 "    movw    r2, #0x89f\n"
1084 "    ldr     r1, =0xfc0fde28\n" //  *"MovieRecorder.c"
1085 "    movs    r0, #0\n"
1086 "    blx     sub_fc314dec\n" // j_DebugAssert
1087 "loc_fc0fe74a:\n"
1088 "    ldr.w   r1, [sl, #0x20]\n"
1089 "    mov     r0, sl\n"
1090 "    cbz     r1, loc_fc0fe76c\n"
1091 "    ldr.w   r0, [fp, #0x58]\n"
1092 "    cbnz    r0, loc_fc0fe75c\n"
1093 "    movs    r0, #0x3c\n"
1094 "    b       loc_fc0fe77a\n"
1095 "loc_fc0fe75c:\n"
1096 "    movw    r2, #0x8a6\n"
1097 "    ldr     r1, =0xfc0fde28\n" //  *"MovieRecorder.c"
1098 "    movs    r0, #0\n"
1099 "    blx     sub_fc314dec\n" // j_DebugAssert
1100 "    b       loc_fc0fe780\n"
1101 "loc_fc0fe76c:\n"
1102 "    ldr     r0, [r0, #0x5c]\n"
1103 "    cbz     r0, loc_fc0fe77e\n"
1104 "    ldrh.w  r1, [sb, #0x10]\n"
1105 "    ldr     r0, [r6, #0x10]\n"
1106 "    udiv    r0, r0, r1\n"
1107 "loc_fc0fe77a:\n"
1108 "    str     r0, [r4, #0x10]\n"
1109 "    b       loc_fc0fe780\n"
1110 "loc_fc0fe77e:\n"
1111 "    str     r7, [r4, #0x10]\n"
1112 "loc_fc0fe780:\n"
1113 "    movs    r0, #2\n"
1114 "    strh.w  r0, [r4, #0x5a]\n"
1115 "    strh.w  r0, [sb, #0x12]\n"
1116 "    ldr.w   r0, [sl, #0x64]\n"
1117 "    cbz     r0, loc_fc0fe7a8\n"
1118 "    strb.w  r8, [r5, #3]\n"
1119 "    b       loc_fc0fe7aa\n"
1120 "loc_fc0fe796:\n"
1121 "    ldrh.w  r0, [sb, #0x10]\n"
1122 "    ldr     r1, [sp, #0x18]\n"
1123 "    add     r1, r0\n"
1124 "    subs    r1, r1, #1\n"
1125 "    udiv    r0, r1, r0\n"
1126 "    adds    r0, r0, #1\n"
1127 "    b       loc_fc0fe77a\n"
1128 "loc_fc0fe7a8:\n"
1129 "    strb    r7, [r5, #3]\n"
1130 "loc_fc0fe7aa:\n"
1131 "    movs    r3, #2\n"
1132 "    ldr     r0, [r6, #0x7c]\n"
1133 "    movs    r1, #0xb1\n"
1134 "    add     r2, sp, #0x14\n"
1135 "    bl      sub_fc388546\n"
1136 "    ldr     r0, [r6, #0x7c]\n"
1137 "    movs    r3, #2\n"
1138 "    movs    r1, #0xb0\n"
1139 "    add     r2, sp, #0x10\n"
1140 "    bl      sub_fc388546\n"
1141 "    ldr.w   r0, [sl, #0x50]\n"
1142 "    mov.w   r3, #4\n"
1143 "    cbz     r0, loc_fc0fe7dc\n"
1144 "    ldr     r0, [r6, #0x7c]\n"
1145 "    movs    r1, #0xaa\n"
1146 "    add     r2, sp, #0x14\n"
1147 "    bl      sub_fc388546\n"
1148 "    movs    r3, #4\n"
1149 "    add     r2, sp, #0x10\n"
1150 "    b       loc_fc0fe7ec\n"
1151 "loc_fc0fe7dc:\n"
1152 "    ldr     r2, =0x0000b044\n"
1153 "    movs    r1, #0xaa\n"
1154 "    ldr     r0, [r6, #0x7c]\n"
1155 "    bl      sub_fc388546\n"
1156 "    ldr     r2, =0x0000b044\n"
1157 "    movs    r3, #4\n"
1158 "    adds    r2, r2, #4\n"
1159 "loc_fc0fe7ec:\n"
1160 "    ldr     r0, [r6, #0x7c]\n"
1161 "    movs    r1, #0xab\n"
1162 "    bl      sub_fc388546\n"
1163 "    ldrh.w  r0, [sp, #0x14]\n"
1164 "    ldr     r5, [r6, #0x34]\n"
1165 "    mov     r8, r0\n"
1166 "    cmp     r5, r0\n"
1167 "    beq     loc_fc0fe836\n"
1168 "    ldr.w   r0, [fp, #0x58]\n"
1169 "    cmp     r0, #0x15\n"
1170 "    beq     loc_fc0fe83e\n"
1171 "    ldr     r0, [r4, #0x28]\n"
1172 "    mov     r3, r7\n"
1173 "    ldrh.w  r1, [sp, #0x10]\n"
1174 "    lsls    r0, r0, #7\n"
1175 "    umull   r0, r2, r1, r0\n"
1176 "    mla     r1, r1, r7, r2\n"
1177 "    umull   r0, r2, r5, r0\n"
1178 "    mla     r1, r5, r1, r2\n"
1179 "    mov     r2, r8\n"
1180 "    blx     sub_fc314d74\n"
1181 "    ldr     r2, [r6, #0x38]\n"
1182 "    mov     r3, r7\n"
1183 "    blx     sub_fc314d74\n"
1184 "    str.w   r0, [sb, #0x5c]\n"
1185 "    b       loc_fc0fe83e\n"
1186 "loc_fc0fe836:\n"
1187 "    ldr     r0, [r4, #0x28]\n"
1188 "    lsls    r1, r0, #7\n"
1189 "    str.w   r1, [sb, #0x5c]\n"
1190 "loc_fc0fe83e:\n"
1191 "    ldr.w   r0, [sb, #0x5c]\n"
1192 "    movs    r2, #0xa\n"
1193 "    mov     r1, sb\n"
1194 "    umull   r2, r3, r0, r2\n"
1195 "    str.w   r2, [sb, #0x60]\n"
1196 "    movs    r2, #3\n"
1197 "    cmp     r5, r8\n"
1198 "    umull   r0, r2, r0, r2\n"
1199 "    str.w   r0, [sb, #0x64]\n"
1200 "    bne     loc_fc0fe860\n"
1201 "    ldr     r0, [r1, #0x5c]\n"
1202 "    b       loc_fc0fe866\n"
1203 "loc_fc0fe860:\n"
1204 "    ldr     r0, [r4, #0x28]\n"
1205 "    lsls    r0, r0, #7\n"
1206 "    str     r0, [r1, #0x5c]\n"
1207 "loc_fc0fe866:\n"
1208 "    add.w   r2, r0, r0, lsl #1\n"
1209 "    ldr     r0, [r1, #0x58]\n"
1210 "    add     r2, r0\n"
1211 "    subs    r2, r2, #1\n"
1212 "    udiv    r2, r2, r0\n"
1213 "    muls    r2, r0, r2\n"
1214 "    ldrb    r0, [r1]\n"
1215 "    muls    r2, r0, r2\n"
1216 "    ldr     r0, =0x0000b044\n"
1217 "    adds    r0, #0xe4\n"
1218 "    stm     r0!, {r2, r7}\n"
1219 "    ldr     r0, [r4, #0x28]\n"
1220 "    add.w   r1, r0, r0, lsl #1\n"
1221 "    rsb     r1, r1, r0, lsl #7\n"
1222 "    str.w   r1, [fp, #0x5c]\n"
1223 "    add     sp, #0x24\n"
1224 "    pop.w   {r4, r5, r6, r7, r8, sb, sl, fp, pc}\n"
1225 ".ltorg\n"
1226     );
1227 }
1228 
1229 // below functions are for getting bitrate information during recording
1230 // filesystem info only updates after recording stops
1231 
1232 void getchunkinfo(int *r0) { // for each model, firmware struct needs to be verified
1233     int m;
1234     unsigned int lsum = 0;
1235     m = *r0; // num of chunks
1236     int *cl = (int*)(*(r0+1));
1237     while (m>0) {
1238         // chunk properties, 3 words: addr, size, unknown
1239         lsum += *(cl+1);
1240         cl+=3;
1241         m--;
1242     }
1243     bitrate_calc(lsum);
1244 }
1245 
1246 void __attribute__((naked,noinline)) apendstrm_my() { // when porting: check disassembly to verify
1247 asm volatile (
1248 "    push    {r0, lr}\n"
1249 "    ldr     r0, [r0, #8]\n"
1250 "    ldr     r0, [r0, #4]\n"
1251 "    bl      getchunkinfo\n"
1252 "    pop     {r0, lr}\n"
1253 "    ldr     pc, orig_apendstrm\n"  // call the original fw function
1254 "orig_apendstrm:\n"
1255 "    .long   0\n"                   // placeholder, populated below
1256 );
1257 }
1258 
1259 // cocoa's APENDSTRM func pointer is located in ROM, fw's TskCocoa0 task needs to be modified
1260 // cocoa fw struct is copied to RAM first, so that the APENDSTRM pointer can be replaced
1261 void __attribute__((naked,noinline)) task_cocoa0() {
1262     asm volatile (
1263 ".equ   COCOA_ARR_START,    0xFC65D440\n"
1264 ".equ   COCOA_APENDSTR_LOC, 0xFC65D494\n"
1265 ".equ   COCOA_ARR_END,      0xFC65D92C\n"
1266 ".equ   COCOA_ARR_LEN,      (COCOA_ARR_END - COCOA_ARR_START)\n"
1267 ".equ   COCOA_APENDSTR_OFS, (COCOA_APENDSTR_LOC - COCOA_ARR_START)\n"
1268 // copy and modify fw struct
1269 "    push    {r0, lr}\n"            // +
1270 "    adr     r0, cocoa_struct\n"    // + destination
1271 "    ldr     r1, =COCOA_ARR_START\n"// + source
1272 "    movw    r2, #COCOA_ARR_LEN\n"  // + struct length in bytes
1273 "    bl      _memcpy\n"             // +
1274 "    movw    r0, #COCOA_APENDSTR_OFS\n" // + offset of APENDSTRM func pointer
1275 "    adr     r1, cocoa_struct\n"    // +
1276 "    ldr     r2, [r1, r0]\n"        // + get original APENDSTRM pointer
1277 "    adr     r3, orig_apendstrm\n"  // +
1278 "    str     r2, [r3]\n"            // + store original APENDSTRM pointer for use in apendstrm_my()
1279 "    adr     r2, apendstrm_my\n"    // + our replacement for APENDSTRM
1280 "    orr     r2, #1\n"              // +
1281 "    str     r2, [r1, r0]\n"        // + replace the original APENDSTRM
1282 // TODO: do we need to care about the data cache?
1283 "    pop     {r0, lr}\n"            // +
1284 
1285 // capdis -f=chdk -s=0xFC255E7B -c=3 -stubs PRIMARY.BIN 0xfc000000
1286 // task_TskCocoa0 0xfc255e7b
1287 "    mov     r1, r0\n"
1288 "    movs    r0, #0\n"
1289 //"    b       loc_fc255be4\n" // -
1290 // capdis -f=chdk -s=0xfc255be5 -c=22 -stubs PRIMARY.BIN 0xfc000000
1291 "    push.w  {r4, r5, r6, r7, r8, sb, sl, fp, lr}\n"
1292 "    cmp     r0, #2\n"
1293 "    mov     r4, r1\n"
1294 "    sub     sp, #0x15c\n"
1295 "    mov     r6, r0\n"
1296 "    blt     loc_fc255c04\n"
1297 "    ldr     r1, =0xfc255d64\n" //  *"CocoaTsk.c"
1298 "    movw    r2, #0x1c7\n"
1299 "    ldr     r0, =0xfc255d70\n" //  *"Cocoa MEDIA OVER"
1300 "    bl      sub_fc25592c\n"
1301 "loc_fc255bfe:\n"
1302 "    add     sp, #0x15c\n"
1303 "    pop.w   {r4, r5, r6, r7, r8, sb, sl, fp, pc}\n"
1304 "loc_fc255c04:\n"
1305 "    mov     r1, r4\n"
1306 "    mov     r0, r6\n"
1307 "    bl      sub_fc525bdc\n"
1308 "    cbnz    r4, loc_fc255c1a\n"
1309 "    adds    r6, r6, #2\n"
1310 "    ldr     r1, =0xfc255d84\n" //  *"Fatal error!!"
1311 "    uxtb    r0, r6\n"
1312 "    bl      sub_fc37fab2\n"
1313 "    b       loc_fc255bfe\n"
1314 "loc_fc255c1a:\n"
1315 //"    ldr.w   sb, =0xfc65d440\n"   // -
1316 "    adr     sb, cocoa_struct\n"    // +
1317 "    ldr     pc, =0xFC255C1F\n"     // + back to rom
1318 ".ltorg\n"
1319 
1320 "    .align 2\n"                        // +
1321 "cocoa_struct:\n"                       // +
1322 "    .space  COCOA_ARR_LEN\n"           // + make space for copied fw struct
1323 
1324     );

/* [<][>][^][v][top][bottom][index][help] */