root/platform/m3/sub/121a/movie_rec.c

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

DEFINITIONS

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

   1 // byte offset of bitrate constants inside the fw struct passed to set_quality()
   2 #define BR_LOW_OFS 0x2c
   3 #define BR_MID_OFS 0x30
   4 #define BR_HI_OFS  0x28
   5 
   6 // maximum allowed bitrate that doesn't crash the camera
   7 #define MAX_VIDEO_BITRATE 41000
   8 
   9 #define FW_SHORT_TIME_LIMIT 30      // unlocking fw time limits below this require user permission (seconds)
  10 #define SHORT_TIME_LIMIT 300        // raised time limit for movie modes that have more restricted fw time limits
  11 #define LONG_TIME_LIMIT (3*60*60)   // raised time limit for all other movie kinds
  12 
  13 #include "../../../generic/movie_rec.c"
  14 
  15 /*************************************************************/
  16 //** movie_record_task @ FC142BCC
  17 void __attribute__((naked,noinline)) movie_record_task() {
  18 asm volatile (
  19 // task_MovieRecord 0xFC142BCC
  20 "    push.w  {r2, r3, r4, r5, r6, r7, r8, sb, sl, fp, ip, lr}\n"
  21 "    ldr     r4, =0x0000b228\n"
  22 "    movs    r7, #0\n"
  23 "    ldr.w   sb, =0x00058ef0\n"
  24 "    mov.w   sl, #1\n"
  25 "    ldr.w   r8, =0x0000b128\n"
  26 "    sub.w   r5, r4, #0x80\n"
  27 "    sub.w   r6, r4, #0x180\n"
  28 "    movw    fp, #0x2710\n"
  29 "loc_fc142bec:\n"
  30 "    movs    r2, #0\n"
  31 "    add     r1, sp, #4\n"
  32 "    ldr     r0, [r6, #0x18]\n"
  33 "    blx     sub_fc302304\n" // j_ReceiveMessageQueue
  34 "    ldr     r0, [sp, #4]\n"
  35 "    ldr     r0, [r0]\n"
  36 "    cmp     r0, #0xb\n"
  37 "    bhs     loc_fc142c1c\n"
  38 "    tbb     [pc, r0]\n" // (jumptable r0 11 elements)
  39 "branchtable_fc142c02:\n"
  40 "    .byte((loc_fc142c0e - branchtable_fc142c02) / 2)\n" // (case 0)
  41 "    .byte((loc_fc142c34 - branchtable_fc142c02) / 2)\n" // (case 1)
  42 "    .byte((loc_fc142d84 - branchtable_fc142c02) / 2)\n" // (case 2)
  43 "    .byte((loc_fc142c9a - branchtable_fc142c02) / 2)\n" // (case 3)
  44 "    .byte((loc_fc142ca0 - branchtable_fc142c02) / 2)\n" // (case 4)
  45 "    .byte((loc_fc142cfa - branchtable_fc142c02) / 2)\n" // (case 5)
  46 "    .byte((loc_fc142d3e - branchtable_fc142c02) / 2)\n" // (case 6)
  47 "    .byte((loc_fc142da4 - branchtable_fc142c02) / 2)\n" // (case 7)
  48 "    .byte((loc_fc142d9c - branchtable_fc142c02) / 2)\n" // (case 8)
  49 "    .byte((loc_fc142d1c - branchtable_fc142c02) / 2)\n" // (case 9)
  50 "    .byte((loc_fc142d7e - branchtable_fc142c02) / 2)\n" // (case 10)
  51 ".align 1\n"
  52 "loc_fc142c0e:\n"
  53 "    ldr     r0, [r5, #0x60]\n"
  54 "    bl      sub_fc37a5e6\n"
  55 "    ldr     r0, [r5, #0x5c]\n"
  56 "    cbz     r0, loc_fc142c1e\n"
  57 "loc_fc142c18:\n"
  58 "    bl      sub_fc13fc44\n"
  59 "loc_fc142c1c:\n"
  60 "    b       loc_fc142da4\n"
  61 "loc_fc142c1e:\n"
  62 "    ldr.w   r0, [r8, #0x3c]\n"
  63 "    cbnz    r0, loc_fc142c28\n"
  64 "    bl      sub_fc13fbc0\n"
  65 "loc_fc142c28:\n"
  66 "    bl      sub_fc142944_my\n" // <----------------
  67 "loc_fc142c2c:\n"
  68 "    cmp     r0, #0\n"
  69 "    str     r0, [r5, #0x5c]\n"
  70 "    bne     loc_fc142c18\n"
  71 "    b       loc_fc142da4\n"
  72 "loc_fc142c34:\n"
  73 "    bl      sub_fc14264c\n"
  74 "    str     r0, [r5, #0x5c]\n"
  75 "    ldr.w   r0, [r8, #0x3c]\n"
  76 "    cbnz    r0, loc_fc142c8c\n"
  77 "    ldr     r1, [r6, #0x68]\n"
  78 "    add.w   r0, sb, r1, lsl #2\n"
  79 "    ldr     r0, [r0, #-0x4]\n"
  80 "    bl      sub_fc260d30\n" //  return
  81 "    ldr     r0, [r5, #0x5c]\n"
  82 "    lsls    r0, r0, #0x1f\n"
  83 "    bne     loc_fc142c5a\n"
  84 "    bl      sub_fc142424\n"
  85 "    str     r0, [r5, #0x5c]\n"
  86 "loc_fc142c5a:\n"
  87 "    movw    r0, #0x314e\n"
  88 "    bl      sub_fc13fcdc\n"
  89 "    b       loc_fc142c8e\n"
  90 //*** constants skiped
  91 "loc_fc142c8c:\n"
  92 "    b       loc_fc142c92\n"
  93 "loc_fc142c8e:\n"
  94 "    bl      sub_fc13fc00\n"
  95 "loc_fc142c92:\n"
  96 "    ldr     r0, [r5, #0x5c]\n"
  97 "    cmp     r0, #0\n"
  98 "    bne     loc_fc142c18\n"
  99 "    b       loc_fc142cf4\n"
 100 "loc_fc142c9a:\n"
 101 "    bl      sub_fc142370\n"
 102 "    b       loc_fc142c2c\n"
 103 "loc_fc142ca0:\n"
 104 "    ldr     r0, [r6, #0x4c]\n"
 105 "    cmp     r0, #6\n"
 106 "    beq     loc_fc142cf4\n"
 107 "    ldr.w   r0, [r8, #0x14]\n"
 108 "    cbnz    r0, loc_fc142cb8\n"
 109 "    movs    r1, #4\n"
 110 "    movs    r0, #0\n"
 111 "    bl      sub_fc13b9d8\n"
 112 "    str.w   sl, [r8, #0x14]\n"
 113 "loc_fc142cb8:\n"
 114 "    bl      sub_fc13fbc0\n"
 115 "    bl      sub_fc142214\n"
 116 "    str     r0, [r5, #0x5c]\n"
 117 "    cbz     r0, loc_fc142cca\n"
 118 "loc_fc142cc4:\n"
 119 "    bl      sub_fc13fc44\n"
 120 "    b       loc_fc142cf4\n"
 121 "loc_fc142cca:\n"
 122 "    ldr.w   r0, [r8, #0x54]\n"
 123 "    mov     r1, r8\n"
 124 "    cbnz    r0, loc_fc142ce6\n"
 125 "    ldr     r0, [r1, #0x64]\n"
 126 "    cbz     r0, loc_fc142ce6\n"
 127 "    bl      sub_fc141bb6\n"
 128 "    str     r0, [r5, #0x5c]\n"
 129 "    bl      sub_fc143862\n"
 130 "    ldr     r0, [r5, #0x5c]\n"
 131 "    cmp     r0, #0\n"
 132 "    bne     loc_fc142cc4\n"
 133 "loc_fc142ce6:\n"
 134 "    ldr     r1, [r6, #0x68]\n"
 135 "    add.w   r0, sb, r1, lsl #2\n"
 136 "    ldr     r0, [r0, #-0x4]\n"
 137 "    bl      sub_fc260d30\n" //  return
 138 "loc_fc142cf4:\n"
 139 "    ldr     r0, [r4, #0x1c]\n"
 140 "    ldr     r1, [r5, #0x78]\n"
 141 "    b       loc_fc142d98\n"
 142 "loc_fc142cfa:\n"
 143 "    ldr     r0, [r6, #0x4c]\n"
 144 "    cmp     r0, #6\n"
 145 "    beq     loc_fc142d16\n"
 146 "    bl      sub_fc141bb6\n"
 147 "    str     r0, [r5, #0x5c]\n"
 148 "    bl      sub_fc143862\n"
 149 "    ldr     r0, [r5, #0x5c]\n"
 150 "    cbz     r0, loc_fc142d14\n"
 151 "    bl      sub_fc13fc44\n"
 152 "    b       loc_fc142d16\n"
 153 "loc_fc142d14:\n"
 154 "    str     r7, [r6, #0x4c]\n"
 155 "loc_fc142d16:\n"
 156 "    ldr     r1, [r4, #4]\n"
 157 "    ldr     r0, [r4, #0x24]\n"
 158 "    b       loc_fc142d98\n"
 159 "loc_fc142d1c:\n"
 160 "    bl      sub_fc142ef8\n"
 161 "    lsls    r0, r0, #0x1f\n"
 162 "    beq     loc_fc142d28\n"
 163 "    mov     r0, sl\n"
 164 "    b       loc_fc142d2a\n"
 165 "loc_fc142d28:\n"
 166 "    mov     r0, r7\n"
 167 "loc_fc142d2a:\n"
 168 "    str     r0, [r5, #0x5c]\n"
 169 "    cbz     r0, loc_fc142d36\n"
 170 "    mov.w   r0, #0xa0000\n"
 171 "    bl      sub_fc36e016\n" // HardwareDefect_FW
 172 "loc_fc142d36:\n"
 173 "    ldr     r0, [r6, #0x30]\n"
 174 "    blx     sub_fc302364\n" // -> GiveSemaphore
 175 "    b       loc_fc142da4\n"
 176 "loc_fc142d3e:\n"
 177 "    ldr     r0, [r6, #0x4c]\n"
 178 "    cmp     r0, #6\n"
 179 "    bne     loc_fc142d4e\n"
 180 "    ldr     r1, [r4, #0xc]\n"
 181 "    cbz     r1, loc_fc142d9a\n"
 182 "    ldr     r0, [r4, #0x2c]\n"
 183 "    blx     r1\n"
 184 "    b       loc_fc142d78\n"
 185 "loc_fc142d4e:\n"
 186 "    bl      sub_fc142006\n"
 187 "    str     r0, [r5, #0x5c]\n"
 188 "    cbnz    r0, loc_fc142d6c\n"
 189 "    ldr.w   r0, [r8, #0x64]\n"
 190 "    cbz     r0, loc_fc142d66\n"
 191 "    bl      sub_fc141bb6\n"
 192 "    str     r0, [r5, #0x5c]\n"
 193 "    bl      sub_fc143862\n"
 194 "loc_fc142d66:\n"
 195 "    str     r7, [r6, #0x4c]\n"
 196 "    ldr     r0, [r5, #0x5c]\n"
 197 "    cbz     r0, loc_fc142d78\n"
 198 "loc_fc142d6c:\n"
 199 "    ldr     r1, [r4, #0xc]\n"
 200 "    cbz     r1, loc_fc142d74\n"
 201 "    ldr     r0, [r4, #0x2c]\n"
 202 "    blx     r1\n"
 203 "loc_fc142d74:\n"
 204 "    bl      sub_fc13fc44\n"
 205 "loc_fc142d78:\n"
 206 "    ldr     r1, [r4, #8]\n"
 207 "    ldr     r0, [r4, #0x28]\n"
 208 "    b       loc_fc142d98\n"
 209 "loc_fc142d7e:\n"
 210 "    bl      sub_fc1418e0\n"
 211 "    b       loc_fc142c2c\n"
 212 "loc_fc142d84:\n"
 213 "    movw    r3, #0x1959\n"
 214 "    ldr     r2, =0xfc13ffd4\n" //  **"MovieRecorder.c"
 215 "    ldr     r0, [r6, #0x74]\n"
 216 "    mov     r1, fp\n"
 217 "    blx     sub_fc3022ec\n" // j_TakeSemaphoreStrictly
 218 "    str     r7, [r5, #0x5c]\n"
 219 "    ldr     r1, [r4]\n"
 220 "    ldr     r0, [r4, #0x34]\n"
 221 "loc_fc142d98:\n"
 222 "    blx     r1\n"
 223 "loc_fc142d9a:\n"
 224 "    b       loc_fc142da4\n"
 225 "loc_fc142d9c:\n"
 226 "    bl      sub_fc1439f4\n"
 227 "    str     r0, [r5, #0x5c]\n"
 228 "    b       loc_fc142d36\n"
 229 "loc_fc142da4:\n"
 230 "    ldr     r1, [sp, #4]\n"
 231 "    movw    r3, #0x13be\n"
 232 "    mov     r2, fp\n"
 233 "    str     r7, [r1]\n"
 234 "    str     r3, [sp]\n"
 235 "    ldr     r3, =0xfc13ffd4\n" //  **"MovieRecorder.c"
 236 "    ldr     r0, [r6, #0x20]\n"
 237 "    blx     sub_fc302164\n" // j_PostMessageQueueStrictly
 238 "    b       loc_fc142bec\n"
 239 );
 240 }
 241 
 242 /*************************************************************/
 243 void __attribute__((naked,noinline)) sub_fc142944_my() {
 244 asm volatile (
 245 "loc_fc142944:\n"
 246 "    push.w  {r4, r5, r6, r7, r8, lr}\n"
 247 "    sub     sp, #0x128\n"
 248 "    ldr     r5, =0x0000b128\n"
 249 "    movs    r0, #0x1a\n"
 250 "    add     r1, sp, #0x48\n"
 251 "    str     r0, [sp, #4]\n"
 252 "    add     r0, sp, #0xbc\n"
 253 "    ldrd    r2, r3, [r5, #0x3c]\n"
 254 "    mov     r4, r1\n"
 255 "    bl      sub_fc13ff38\n"
 256 "    add     r0, sp, #0xbc\n"
 257 "    bl      sub_fc2fc8d8\n"
 258 "    add     r0, sp, #0x34\n"
 259 "    mov     r1, r4\n"
 260 "    bl      sub_fc140120_my\n" // <----------------------
 261 "    add     r0, sp, #0x34\n"
 262 "    bl      sub_fc2fc918\n"
 263 "    bl      sub_fc2faf2c\n"
 264 "    sub.w   r4, r5, #0x80\n"
 265 "    movw    r6, #0x2710\n"
 266 "    add     r1, sp, #0x124\n"
 267 "    mov     r2, r6\n"
 268 "    ldr     r0, [r4, #0x14]\n"
 269 "    blx     sub_fc302304\n" // j_ReceiveMessageQueue
 270 "    lsls    r0, r0, #0x1f\n"
 271 "loc_fc14298a:\n"
 272 "    bne     loc_fc142a70\n"
 273 "    ldr     r0, [sp, #0x124]\n"
 274 "    ldr     r0, [r0]\n"
 275 "    cmp     r0, #4\n"
 276 "    bne     loc_fc14298a\n"
 277 "    bl      sub_fc2fb456\n"
 278 "    ldr     r0, [r4, #0x14]\n"
 279 "    add     r1, sp, #0x124\n"
 280 "    mov     r8, r6\n"
 281 "    mov     r2, r6\n"
 282 "    blx     sub_fc302304\n" // j_ReceiveMessageQueue
 283 "    lsls    r0, r0, #0x1f\n"
 284 "    bne     loc_fc14298a\n"
 285 "    ldr     r0, [sp, #0x124]\n"
 286 "    ldr     r0, [r0]\n"
 287 "    cmp     r0, #0x10\n"
 288 "    bne     loc_fc14298a\n"
 289 "    ldr     r6, =0x00058ef0\n"
 290 "    add.w   r7, r4, #0x100\n"
 291 "    ldr     r0, [r5, #0x40]\n"
 292 "    cbz     r0, loc_fc142a20\n"
 293 "    ldr     r0, [r4, #0x68]\n"
 294 "    add.w   r0, r6, r0, lsl #2\n"
 295 "    ldr     r0, [r0, #-0x4]\n"
 296 "    bl      sub_fc380402\n"
 297 "    ldr     r1, [r4, #0x68]\n"
 298 "    adds    r2, r0, #1\n"
 299 "    add     r0, sp, #8\n"
 300 "    add.w   r1, r6, r1, lsl #2\n"
 301 "    ldr     r1, [r1, #-0x4]\n"
 302 "    blx     sub_fc30245c\n"
 303 "    movs    r1, #0x2e\n"
 304 "    add     r0, sp, #8\n"
 305 "    bl      sub_fc14c324\n"
 306 "    cbz     r0, loc_fc1429f6\n"
 307 "    movs    r1, #0x44\n"
 308 "    strb    r1, [r0, #1]\n"
 309 "    movs    r1, #0x41\n"
 310 "    strb    r1, [r0, #2]\n"
 311 "    movs    r1, #0x54\n"
 312 "    strb    r1, [r0, #3]\n"
 313 "    add     r0, sp, #8\n"
 314 "    bl      sub_fc37a962\n"
 315 "loc_fc1429f6:\n"
 316 "    ldr     r0, [r4, #0x68]\n"
 317 "    add.w   r0, r6, r0, lsl #2\n"
 318 "    ldr     r0, [r0, #-0x4]\n"
 319 "    bl      sub_fc37a962\n"
 320 "    ldr     r0, [r5, #0x40]\n"
 321 "    cbz     r0, loc_fc142a20\n"
 322 "    ldr     r1, =0x000590e0\n"
 323 "    movs    r0, #0\n"
 324 "    str     r0, [r7, #0x10]\n"
 325 "    subs    r1, #0x20\n"
 326 "    str     r0, [r7, #0xc]\n"
 327 "    str     r0, [r1]\n"
 328 "    ldr     r0, =0xfc141169\n"
 329 "    bl      sub_fc2fbc9e\n"
 330 "    movs    r0, #3\n"
 331 "    bl      sub_fc06bf20\n"
 332 "loc_fc142a20:\n"
 333 "    ldr     r0, [r5, #0x3c]\n"
 334 "    cbz     r0, loc_fc142a7a\n"
 335 "    ldr     r0, [r4, #0x68]\n"
 336 "    add.w   r0, r6, r0, lsl #2\n"
 337 "    ldr     r0, [r0, #-0x4]\n"
 338 "    cbz     r0, loc_fc142a42\n"
 339 "    bl      sub_fc13fbc0\n"
 340 "    ldr     r0, =0x0000b128\n"
 341 "    add     r1, sp, #0x30\n"
 342 "    adds    r0, #0x64\n"
 343 "    bl      sub_fc142760\n"
 344 "    lsls    r0, r0, #0x1f\n"
 345 "    bne     loc_fc14298a\n"
 346 "loc_fc142a42:\n"
 347 "    bl      sub_fc13fc00\n"
 348 "    movw    r6, #0x27f8\n"
 349 "    ldr     r0, [r5, #0x78]\n"
 350 "    mov     r1, r6\n"
 351 "    blx     sub_fc302424\n"
 352 "    ldr     r0, [r5, #0x64]\n"
 353 "    cbz     r0, loc_fc142a60\n"
 354 "    ldr     r1, [sp, #0x30]\n"
 355 "    mov     r2, r6\n"
 356 "    ldr     r0, [r5, #0x78]\n"
 357 "    blx     sub_fc30245c\n"
 358 "loc_fc142a60:\n"
 359 "    ldr     r1, [r5, #0x78]\n"
 360 "    adds    r0, r1, #2\n"
 361 "    bl      sub_fc2fd39e\n"
 362 "    ldr     r0, [r5, #0x64]\n"
 363 "    cbz     r0, loc_fc142a72\n"
 364 "    movs    r0, #3\n"
 365 "    b       loc_fc142a74\n"
 366 "loc_fc142a70:\n"
 367 "    b       loc_fc142b8c\n"
 368 "loc_fc142a72:\n"
 369 "    movs    r0, #1\n"
 370 "loc_fc142a74:\n"
 371 "    bl      sub_fc2fc958\n"
 372 "    b       loc_fc142afa\n"
 373 "loc_fc142a7a:\n"
 374 "    ldr     r6, =0x00058ef0\n"
 375 "    ldr     r0, [r4, #0x68]\n"
 376 "    adds    r6, #0x98\n"
 377 "    add.w   r0, r6, r0, lsl #2\n"
 378 "    ldr     r0, [r0, #-0x4]\n"
 379 "    str     r0, [sp, #0x114]\n"
 380 "    str     r0, [sp, #0x118]\n"
 381 "    str     r0, [sp, #0x11c]\n"
 382 "    movs    r0, #1\n"
 383 "    bl      sub_fc1ff976\n"
 384 "    rsb     r0, r0, r0, lsl #4\n"
 385 "    lsls    r0, r0, #2\n"
 386 "    str     r0, [sp, #0x120]\n"
 387 "    ldr     r0, [r5, #0x4c]\n"
 388 "    cbz     r0, loc_fc142aee\n"
 389 "    ldr     r0, [r5, #0x5c]\n"
 390 "    cbz     r0, loc_fc142ab6\n"
 391 "    ldr     r0, [r5, #0x50]\n"
 392 "    movw    r1, #0x2800\n"
 393 "    blx     sub_fc302424\n"
 394 "    ldr     r1, =0x0000b128\n"
 395 "    ldr     r0, [r5, #0x50]\n"
 396 "    subs    r1, #0x7c\n"
 397 "    b       loc_fc142aba\n"
 398 "loc_fc142ab6:\n"
 399 "    movs    r1, #0\n"
 400 "    mov     r0, r1\n"
 401 "loc_fc142aba:\n"
 402 "    bl      sub_fc2fd382\n"
 403 "    movs    r0, #0\n"
 404 "    bl      sub_fc2fd36c\n"
 405 "    movs    r0, #1\n"
 406 "    bl      sub_fc2fc958\n"
 407 "    add     r0, sp, #0x114\n"
 408 "    bl      sub_fc2fcbc4\n"
 409 "    ldr     r0, [r4, #0x68]\n"
 410 "    add     r2, sp, #4\n"
 411 "    ldr     r1, =0x000590e0\n"
 412 "    add.w   r0, r6, r0, lsl #2\n"
 413 "    subs    r0, r0, #4\n"
 414 "    adds    r1, #0x14\n"
 415 "    blx     sub_fc30218c\n"
 416 "    ldr     r1, =0x000590e0\n"
 417 "    movs    r0, #8\n"
 418 "    adds    r1, #0x1f\n"
 419 "    bl      sub_fc2fc9aa\n"
 420 "    b       loc_fc142afa\n"
 421 "loc_fc142aee:\n"
 422 "    movs    r0, #0\n"
 423 "    bl      sub_fc2fc958\n"
 424 "    add     r0, sp, #0x114\n"
 425 "    bl      sub_fc2fcbc4\n"
 426 "loc_fc142afa:\n"
 427 "    ldr     r6, =0x0000b228\n"
 428 "    ldr     r0, [r6, #0x44]\n"
 429 "    cmp     r0, #7\n"
 430 "    beq     loc_fc142b06\n"
 431 "    cmp     r0, #8\n"
 432 "    bne     loc_fc142b0a\n"
 433 "loc_fc142b06:\n"
 434 "    movs    r0, #2\n"
 435 "    b       loc_fc142b0c\n"
 436 "loc_fc142b0a:\n"
 437 "    movs    r0, #1\n"
 438 "loc_fc142b0c:\n"
 439 "    bl      sub_fc2fc994\n"
 440 "    ldr     r0, [r5, #0x4c]\n"
 441 "    cbz     r0, loc_fc142b34\n"
 442 "    ldr     r0, [r6, #0x44]\n"
 443 "    cmp     r0, #6\n"
 444 "    beq     loc_fc142b20\n"
 445 "    cmp     r0, #7\n"
 446 "    beq     loc_fc142b20\n"
 447 "    cbnz    r0, loc_fc142b28\n"
 448 "loc_fc142b20:\n"
 449 "    movs    r0, #0xf\n"
 450 "    bl      sub_fc2fc994\n"
 451 "    b       loc_fc142b34\n"
 452 "loc_fc142b28:\n"
 453 "    ldr     r1, =0xfc13ffd4\n" //  **"MovieRecorder.c"
 454 "    movs    r0, #0\n"
 455 "    movw    r2, #0xe9d\n"
 456 "    blx     sub_fc302464\n" // j_DebugAssert
 457 "loc_fc142b34:\n"
 458 "    ldr     r1, [r5, #0x44]\n"
 459 "    ldr     r0, [r5, #0x18]\n"
 460 "    orrs    r0, r1\n"
 461 "    beq     loc_fc142b40\n"
 462 "    movs    r0, #0\n"
 463 "    b       loc_fc142b42\n"
 464 "loc_fc142b40:\n"
 465 "    movs    r0, #1\n"
 466 "loc_fc142b42:\n"
 467 "    bl      sub_fc209e82\n"
 468 "    bl      sub_fc2fb24e\n"
 469 "    ldr     r0, [r4, #0x14]\n"
 470 "    add     r1, sp, #0x124\n"
 471 "    mov     r2, r8\n"
 472 "    blx     sub_fc302304\n" // j_ReceiveMessageQueue
 473 "    lsls    r0, r0, #0x1f\n"
 474 "    bne     loc_fc142ba8\n"
 475 "    ldr     r0, [sp, #0x124]\n"
 476 "    ldr     r0, [r0]\n"
 477 "    cmp     r0, #0x11\n"
 478 "    bne     loc_fc142ba8\n"
 479 "    movs    r0, #0\n"
 480 "    bl      sub_fc144a04\n"
 481 "    ldr     r0, [r5, #0x3c]\n"
 482 "    cbz     r0, loc_fc142b8e\n"
 483 "    ldr     r0, [r7, #4]\n"
 484 "    uxth    r0, r0\n"
 485 "    bl      sub_fc2fcbae\n"
 486 "    bl      sub_fc2fb46c\n"
 487 "    ldr     r0, [r4, #0x14]\n"
 488 "    add     r1, sp, #0x124\n"
 489 "    mov     r2, r8\n"
 490 "    blx     sub_fc302304\n" // j_ReceiveMessageQueue
 491 "    lsls    r0, r0, #0x1f\n"
 492 "    bne     loc_fc142ba8\n"
 493 "    ldr     r0, [sp, #0x124]\n"
 494 "    ldr     r0, [r0]\n"
 495 "    cmp     r0, #0x12\n"
 496 "    beq     loc_fc142bb0\n"
 497 "loc_fc142b8c:\n"
 498 "    b       loc_fc142ba8\n"
 499 "loc_fc142b8e:\n"
 500 "    bl      sub_fc2fb264\n"
 501 "    ldr     r0, [r4, #0x14]\n"
 502 "    add     r1, sp, #0x124\n"
 503 "    mov     r2, r8\n"
 504 "    blx     sub_fc302304\n" // j_ReceiveMessageQueue
 505 "    lsls    r0, r0, #0x1f\n"
 506 "    bne     loc_fc142ba8\n"
 507 "    ldr     r0, [sp, #0x124]\n"
 508 "    ldr     r0, [r0]\n"
 509 "    cmp     r0, #0x15\n"
 510 "    beq     loc_fc142bb0\n"
 511 "loc_fc142ba8:\n"
 512 "    movs    r0, #1\n"
 513 "loc_fc142baa:\n"
 514 "    add     sp, #0x128\n"
 515 "    pop.w   {r4, r5, r6, r7, r8, pc}\n"
 516 "loc_fc142bb0:\n"
 517 "    ldr     r0, [r5, #0x40]\n"
 518 "    cbnz    r0, loc_fc142bc8\n"
 519 "    movs    r5, #0\n"
 520 "loc_fc142bb6:\n"
 521 "    ldr     r0, [r4, #0x1c]\n"
 522 "    add     r1, sp, #0x2c\n"
 523 "    blx     sub_fc30217c\n" // j_TryReceiveMessageQueue
 524 "    adds    r5, r5, #1\n"
 525 "    cmp     r5, #2\n"
 526 "    blt     loc_fc142bb6\n"
 527 "    ldr     r0, =0xfc13fd3d\n"
 528 "    str     r0, [r6, #0x14]\n"
 529 "loc_fc142bc8:\n"
 530 "    movs    r0, #0\n"
 531 "    b       loc_fc142baa\n"
 532 );
 533 }
 534 
 535 /*************************************************************/
 536 void __attribute__((naked,noinline)) sub_fc140120_my() {
 537 asm volatile (
 538 "loc_fc140120:\n"
 539 "    push.w  {r4, r5, r6, r7, r8, sb, sl, fp, lr}\n"
 540 "    sub     sp, #0x1c\n"
 541 "    mov.w   sb, #0\n"
 542 "    ldr.w   fp, =0x0000b0a8\n"
 543 "    mov.w   r8, #1\n"
 544 "    mov     r5, r0\n"
 545 "    mov     r4, r1\n"
 546 "    strd    r8, sb, [sp, #0xc]\n"
 547 "    add.w   fp, fp, #0x80\n"
 548 "    str.w   sb, [sp, #8]\n"
 549 "    str.w   sb, [sp, #4]\n"
 550 "    add.w   r6, fp, #0x80\n"
 551 "    mov     sl, sb\n"
 552 "    str.w   sb, [fp, #0x34]\n"
 553 "    strb.w  r8, [r0]\n"
 554 "    strb.w  sb, [r0, #1]\n"
 555 "    ldr     r0, [r6, #0x60]\n"
 556 "    bl      sub_fc379e7e\n" //"    bl      _GetDrive_ClusterSize\n"
 557 "    ldr     r7, =0x0000b0a8\n"
 558 "    add.w   r4, r4, #0x1c\n"
 559 "    mov.w   r2, #0xc\n"
 560 "    movw    ip, #0x9c4\n"
 561 "    movw    lr, #0x61a8\n"
 562 "    movw    r1, #0x7530\n"
 563 "    str     r0, [r7, #0x54]\n"
 564 "    str     r0, [r5, #8]\n"
 565 "    movs    r0, #0x64\n"
 566 "    strb.w  sl, [r5, #4]\n"
 567 "    strb    r0, [r4, #3]\n"
 568 "    movw    r0, #0xbb80\n"
 569 "    strb.w  sl, [r4, #8]\n"
 570 "    strb.w  sl, [r4, #6]\n"
 571 "    strb.w  r8, [r4, #9]\n"
 572 "    strb.w  r8, [r4, #0xb]\n"
 573 "    str     sl, [r4, #-0x10]\n"
 574 "    strb.w  r8, [r4, #5]\n"
 575 "    strb.w  r8, [r4, #0x26]\n"
 576 "    strb.w  r8, [r4, #7]\n"
 577 "    strb.w  r8, [r4, #0x1c]\n"
 578 "    str     r0, [r4, #0x38]\n"
 579 "    mov.w   r0, #0x10\n"
 580 "    strh    r0, [r4, #0x3c]\n"
 581 "    mov.w   r0, #0x1f400\n"
 582 "    str     r0, [r4, #0x44]\n"
 583 "    add.w   r0, r6, #0x80\n"
 584 "    strb.w  sl, [r4, #0x40]\n"
 585 "    sub.w   r4, r4, #0x1c\n"
 586 "    movw    sl, #0xbb5\n"
 587 "    ldr     r3, [r0, #0x44]\n"
 588 "    mov.w   r0, #0xf\n"
 589 "    cmp     r3, #0x16\n"
 590 "    bhs     loc_fc1402ce\n"
 591 "    tbh     [pc, r3]\n" // (jumptable r3 22 elements)
 592 "branchtable_fc1401d4:\n"
 593 "    .short((loc_fc140378 - branchtable_fc1401d4) / 2)\n" // (case 0)
 594 "    .short((loc_fc14020a - branchtable_fc1401d4) / 2)\n" // (case 1)
 595 "    .short((loc_fc1402ce - branchtable_fc1401d4) / 2)\n" // (case 2)
 596 "    .short((loc_fc1401ea - branchtable_fc1401d4) / 2)\n" // (case 3)
 597 "    .short((loc_fc140366 - branchtable_fc1401d4) / 2)\n" // (case 4)
 598 "    .short((loc_fc140354 - branchtable_fc1401d4) / 2)\n" // (case 5)
 599 "    .short((loc_fc1402e6 - branchtable_fc1401d4) / 2)\n" // (case 6)
 600 "    .short((loc_fc1402a6 - branchtable_fc1401d4) / 2)\n" // (case 7)
 601 "    .short((loc_fc140284 - branchtable_fc1401d4) / 2)\n" // (case 8)
 602 "    .short((loc_fc1402ce - branchtable_fc1401d4) / 2)\n" // (case 9)
 603 "    .short((loc_fc1402ce - branchtable_fc1401d4) / 2)\n" // (case 10)
 604 "    .short((loc_fc1402ce - branchtable_fc1401d4) / 2)\n" // (case 11)
 605 "    .short((loc_fc140394 - branchtable_fc1401d4) / 2)\n" // (case 12)
 606 "    .short((loc_fc1403a8 - branchtable_fc1401d4) / 2)\n" // (case 13)
 607 "    .short((loc_fc1403cc - branchtable_fc1401d4) / 2)\n" // (case 14)
 608 "    .short((loc_fc140222 - branchtable_fc1401d4) / 2)\n" // (case 15)
 609 "    .short((loc_fc140240 - branchtable_fc1401d4) / 2)\n" // (case 16)
 610 "    .short((loc_fc14025c - branchtable_fc1401d4) / 2)\n" // (case 17)
 611 "    .short((loc_fc1402ce - branchtable_fc1401d4) / 2)\n" // (case 18)
 612 "    .short((loc_fc1402ce - branchtable_fc1401d4) / 2)\n" // (case 19)
 613 "    .short((loc_fc1402ce - branchtable_fc1401d4) / 2)\n" // (case 20)
 614 "    .short((loc_fc140316 - branchtable_fc1401d4) / 2)\n" // (case 21)
 615 ".align 1\n"
 616 "loc_fc1401ea:\n"
 617 "    movw    r0, #0x95d\n"
 618 "    strh    r0, [r4, #0x1c]\n"
 619 "    ldr     r0, =0x0001005a\n"
 620 "    movw    r1, #0x5dc0\n"
 621 "    strb    r2, [r4, #1]\n"
 622 "    subs    r0, #0x42\n"
 623 "    str     r0, [r4, #0x34]\n"
 624 "    movw    r0, #0x3e9\n"
 625 "    strb    r2, [r5, #5]\n"
 626 "    strd    r1, r0, [r6, #0x1c]\n"
 627 "    str     r1, [sp, #0x10]\n"
 628 "    b       loc_fc14021c\n"
 629 "loc_fc14020a:\n"
 630 "    strh.w  ip, [r4, #0x1c]\n"
 631 "    movs    r0, #0x19\n"
 632 "    strb    r2, [r4, #1]\n"
 633 "    str     r0, [r4, #0x34]\n"
 634 "    strb    r2, [r5, #5]\n"
 635 "    str.w   lr, [r6, #0x1c]\n"
 636 "    b       loc_fc140234\n"
 637 "loc_fc14021c:\n"
 638 "    str     r0, [sp, #0xc]\n"
 639 "loc_fc14021e:\n"
 640 "    strh    r2, [r7, #0xe]\n"
 641 "    b       loc_fc140316\n"
 642 "loc_fc140222:\n"
 643 "    strh.w  ip, [r4, #0x1c]\n"
 644 "    movs    r0, #5\n"
 645 "    strb    r2, [r4, #1]\n"
 646 "    str     r0, [r4, #0x34]\n"
 647 "    movw    r0, #0x1388\n"
 648 "    strb    r2, [r5, #5]\n"
 649 "    str     r0, [r6, #0x1c]\n"
 650 "loc_fc140234:\n"
 651 "    movw    r0, #0x3e8\n"
 652 "loc_fc140238:\n"
 653 "    str     r0, [r6, #0x20]\n"
 654 "    str.w   lr, [sp, #0x10]\n"
 655 "    b       loc_fc14021c\n"
 656 "loc_fc140240:\n"
 657 "    strh.w  ip, [r4, #0x1c]\n"
 658 "    movs    r0, #5\n"
 659 "    strb    r2, [r4, #1]\n"
 660 "    str     r0, [r4, #0x34]\n"
 661 "    movw    r0, #0x3e8\n"
 662 "    strb    r2, [r5, #5]\n"
 663 "    strd    ip, r0, [r6, #0x1c]\n"
 664 "    strd    r0, lr, [sp, #0xc]\n"
 665 "    mov     r0, r8\n"
 666 "    b       loc_fc14027a\n"
 667 "loc_fc14025c:\n"
 668 "    strh.w  ip, [r4, #0x1c]\n"
 669 "    movs    r0, #5\n"
 670 "    strb    r2, [r4, #1]\n"
 671 "    str     r0, [r4, #0x34]\n"
 672 "    movw    r0, #0x4e2\n"
 673 "    strb    r2, [r5, #5]\n"
 674 "    str     r0, [r6, #0x1c]\n"
 675 "    movw    r0, #0x3e8\n"
 676 "    str     r0, [r6, #0x20]\n"
 677 "    strd    r0, lr, [sp, #0xc]\n"
 678 "    movs    r0, #3\n"
 679 "loc_fc14027a:\n"
 680 "    str.w   r0, [fp, #0x70]\n"
 681 "    str.w   r0, [fp, #0x74]\n"
 682 "    b       loc_fc14021e\n"
 683 "loc_fc140284:\n"
 684 "    movw    r0, #0x1388\n"
 685 "    strh    r0, [r4, #0x1c]\n"
 686 "    movs    r0, #0x18\n"
 687 "    strb    r0, [r4, #1]\n"
 688 "    movs    r1, #0x32\n"
 689 "    str     r1, [r4, #0x34]\n"
 690 "    movw    r1, #0x3e8\n"
 691 "    movw    r2, #0xc350\n"
 692 "    strb    r0, [r5, #5]\n"
 693 "    strd    r2, r1, [r6, #0x1c]\n"
 694 "    strd    r1, r2, [sp, #0xc]\n"
 695 "    b       loc_fc140304\n"
 696 "loc_fc1402a6:\n"
 697 "    ldr     r3, =0x0001005a\n"
 698 "    movw    r2, #0x176a\n"
 699 "    strh    r2, [r4, #0x1c]\n"
 700 "    movs    r2, #0x1e\n"
 701 "    strb    r2, [r4, #1]\n"
 702 "    subs    r3, #0x1e\n"
 703 "    movw    ip, #0x3e9\n"
 704 "    str     r3, [r4, #0x34]\n"
 705 "    movw    r3, #0xea60\n"
 706 "    strb.w  r8, [r4, #0x22]\n"
 707 "    strb    r2, [r5, #5]\n"
 708 "    strd    r3, ip, [r6, #0x1c]\n"
 709 "    strd    ip, r3, [sp, #0xc]\n"
 710 "    b       loc_fc1402d0\n"
 711 "loc_fc1402ce:\n"
 712 "    b       loc_fc140460\n"
 713 "loc_fc1402d0:\n"
 714 "    strh    r2, [r7, #0xe]\n"
 715 "    ldr.w   r2, [fp, #0x48]\n"
 716 "    cbz     r2, loc_fc140316\n"
 717 "    strh.w  sl, [r4, #0x1c]\n"
 718 "    strb    r0, [r4, #1]\n"
 719 "    strb    r0, [r5, #5]\n"
 720 "    strd    ip, r1, [sp, #0xc]\n"
 721 "    b       loc_fc140304\n"
 722 "loc_fc1402e6:\n"
 723 "    ldr.w   r2, [fp, #0x48]\n"
 724 "    cbz     r2, loc_fc140308\n"
 725 "    strh.w  sl, [r4, #0x1c]\n"
 726 "    ldr     r2, =0x0001005a\n"
 727 "    strb    r0, [r4, #1]\n"
 728 "    str     r2, [r4, #0x34]\n"
 729 "    ldr     r2, =0x00015f90\n"
 730 "    strb    r0, [r5, #5]\n"
 731 "loc_fc1402fa:\n"
 732 "    str     r2, [r6, #0x1c]\n"
 733 "    movw    r2, #0x3e9\n"
 734 "    str     r2, [r6, #0x20]\n"
 735 "    b       loc_fc14038e\n"
 736 "loc_fc140304:\n"
 737 "    strh    r0, [r7, #0xe]\n"
 738 "    b       loc_fc140316\n"
 739 "loc_fc140308:\n"
 740 "    movw    r2, #0x57c\n"
 741 "loc_fc14030c:\n"
 742 "    ldr     r1, =0xfc13ffd4\n" //  *"MovieRecorder.c"
 743 "    movs    r0, #0\n"
 744 "    blx     sub_fc302464\n" // j_DebugAssert
 745 "loc_fc140316:\n"
 746 "    movs    r0, #2\n"
 747 "    strb    r0, [r4]\n"
 748 "    ldr     r0, =0x0000b0a8\n"
 749 "    mov.w   sl, #0\n"
 750 "    strb.w  sl, [r4, #0x26]\n"
 751 "    adds    r0, #0x80\n"
 752 "    strb.w  sl, [r4, #2]\n"
 753 "    ldr     r3, [r0, #0x30]\n"
 754 "    cmp     r3, #0\n"
 755 "    beq     loc_fc1403f6\n"
 756 "    add.w   r0, r0, #0x100\n"
 757 "    ldr     r0, [r0, #0x3c]\n"
 758 "    cmp.w   r0, #0x780\n"
 759 "    bne     loc_fc1403f8\n"
 760 "    ldr     r1, =0x0000b0a8\n"
 761 "    adds    r1, #0x80\n"
 762 "    str.w   r8, [r1, #0x34]\n"
 763 "    movs    r1, #3\n"
 764 "    strb.w  r8, [r4]\n"
 765 "    strb    r1, [r4, #1]\n"
 766 "    strb.w  r8, [r4, #2]\n"
 767 "    strh    r1, [r7, #0xe]\n"
 768 "    b       loc_fc140472\n"
 769 "loc_fc140354:\n"
 770 "    ldr     r2, =0x0001005a\n"
 771 "    strh.w  sl, [r4, #0x1c]\n"
 772 "    strb    r0, [r4, #1]\n"
 773 "    adds    r2, #0x1e\n"
 774 "    str     r2, [r4, #0x34]\n"
 775 "    ldr     r2, =0x0001d4c0\n"
 776 "    strb    r0, [r5, #5]\n"
 777 "    b       loc_fc1402fa\n"
 778 "loc_fc140366:\n"
 779 "    ldr     r2, =0x0001005a\n"
 780 "    strh.w  sl, [r4, #0x1c]\n"
 781 "    strb    r0, [r4, #1]\n"
 782 "    adds    r2, #0x96\n"
 783 "    str     r2, [r4, #0x34]\n"
 784 "    ldr     r2, =0x0003a980\n"
 785 "    strb    r0, [r5, #5]\n"
 786 "    b       loc_fc1402fa\n"
 787 "loc_fc140378:\n"
 788 "    movw    r2, #0x3e9\n"
 789 "    ldr     r3, =0x0001005a\n"
 790 "    subs    r3, #0x3c\n"
 791 "    strd    r1, r2, [r6, #0x1c]\n"
 792 "    strh.w  sl, [r4, #0x1c]\n"
 793 "    strb    r0, [r4, #1]\n"
 794 "    str     r3, [r4, #0x34]\n"
 795 "    strb    r0, [r5, #5]\n"
 796 "loc_fc14038e:\n"
 797 "    strd    r2, r1, [sp, #0xc]\n"
 798 "    b       loc_fc140304\n"
 799 "loc_fc140394:\n"
 800 "    ldr     r2, =0x0001005a\n"
 801 "    strh.w  sl, [r4, #0x1c]\n"
 802 "    strb    r0, [r4, #1]\n"
 803 "    subs    r2, #0x54\n"
 804 "    str     r2, [r4, #0x34]\n"
 805 "    movw    r2, #0x1770\n"
 806 "    strb    r0, [r5, #5]\n"
 807 "    b       loc_fc1402fa\n"
 808 "loc_fc1403a8:\n"
 809 "    ldr     r2, =0x0001005a\n"
 810 "    strh.w  sl, [r4, #0x1c]\n"
 811 "    strb    r0, [r4, #1]\n"
 812 "    subs    r2, #0x54\n"
 813 "    str     r2, [r4, #0x34]\n"
 814 "    movw    r2, #0xbb8\n"
 815 "    strb    r0, [r5, #5]\n"
 816 "    str     r2, [r6, #0x1c]\n"
 817 "    movw    r2, #0x3e9\n"
 818 "    str     r2, [r6, #0x20]\n"
 819 "    strd    r2, r1, [sp, #0xc]\n"
 820 "    mov     r1, r8\n"
 821 "    b       loc_fc1403ec\n"
 822 "    b       loc_fc1403cc\n"
 823 "loc_fc1403cc:\n"
 824 "    ldr     r2, =0x0001005a\n"
 825 "    strh.w  sl, [r4, #0x1c]\n"
 826 "    strb    r0, [r4, #1]\n"
 827 "    subs    r2, #0x54\n"
 828 "    str     r2, [r4, #0x34]\n"
 829 "    movw    r2, #0x5dc\n"
 830 "loc_fc1403dc:\n"
 831 "    strb    r0, [r5, #5]\n"
 832 "    str     r2, [r6, #0x1c]\n"
 833 "    movw    r2, #0x3e9\n"
 834 "    str     r2, [r6, #0x20]\n"
 835 "    strd    r2, r1, [sp, #0xc]\n"
 836 "    movs    r1, #3\n"
 837 "loc_fc1403ec:\n"
 838 "    str.w   r1, [fp, #0x70]\n"
 839 "    str.w   r1, [fp, #0x74]\n"
 840 "    b       loc_fc140304\n"
 841 "loc_fc1403f6:\n"
 842 "    b       loc_fc14050a\n"
 843 "loc_fc1403f8:\n"
 844 "    b       loc_fc140466\n"
 845 // constants skiped
 846 "loc_fc140460:\n"
 847 "    movw    r2, #0x5ef\n"
 848 "    b       loc_fc14030c\n"
 849 "loc_fc140466:\n"
 850 "    strb.w  sl, [r4]\n"
 851 "    strb.w  r8, [r4, #1]\n"
 852 "    strh.w  r8, [r7, #0xe]\n"
 853 "loc_fc140472:\n"
 854 "    strb.w  r8, [r4, #0x26]\n"
 855 "    strb.w  r8, [r4, #0x22]\n"
 856 "    ldr     r0, =0x0000b2c8\n"
 857 "loc_fc14047c:\n"
 858 "    movw    lr, #0x800\n"
 859 "    str     r0, [r6, #0x44]\n"
 860 "    movs    r2, #6\n"
 861 "    ldr     r0, =0x1f0e1e4c\n"
 862 "    movw    r1, #0x140\n"
 863 "    mov.w   fp, #0x8000000\n"
 864 "    strd    lr, r0, [r4, #0x44]\n"
 865 "    ldr     r0, =0x082600eb\n"
 866 "    str     r0, [r4, #0x4c]\n"
 867 "    ldr     r0, =0x009a0834\n"
 868 "    str     r0, [r4, #0x50]\n"
 869 "    ldr     r0, =0x0000b2c8\n"
 870 "    subs    r0, #0xa0\n"
 871 "    ldr     r0, [r0, #0x3c]\n"
 872 "    cmp     r0, r1\n"
 873 "    beq     loc_fc1405a0\n"
 874 "    cmp.w   r0, #0x280\n"
 875 "    beq     loc_fc1405a2\n"
 876 "    movw    ip, #0x500\n"
 877 "    movw    r1, #0x9c40\n"
 878 "    cmp     r0, ip\n"
 879 "    movw    r2, #0x9bdc\n"
 880 "    movw    lr, #0x9b78\n"
 881 "    mov.w   fp, #0x29\n"
 882 "    beq     loc_fc140554\n"
 883 "    movw    ip, #0x780\n"
 884 "    cmp     r0, ip\n"
 885 "    bne     loc_fc1405a4\n"
 886 "    mov     sb, ip\n"
 887 "    mov     r0, ip\n"
 888 "    strh.w  ip, [r4, #6]\n"
 889 "    movw    ip, #0x438\n"
 890 "    strh.w  ip, [r4, #4]\n"
 891 "    strh    r0, [r4, #0xa]\n"
 892 "    strh.w  ip, [r4, #8]\n"
 893 "    strb.w  r8, [r4, #0x20]\n"
 894 "    strb.w  r8, [r4, #0x39]\n"
 895 "    strb.w  r8, [r4, #0x3a]\n"
 896 "    strb.w  r8, [r4, #0x3b]\n"
 897 "    strh.w  r8, [r4, #0x3c]\n"
 898 "    strh.w  r8, [r4, #0x3e]\n"
 899 "    strh.w  r8, [r4, #0x40]\n"
 900 "    strh.w  r8, [r7, #0x12]\n"
 901 "    cbz     r3, loc_fc14050e\n"
 902 "    strd    lr, r2, [r4, #0x2c]\n"
 903 "    str     r1, [r4, #0x28]\n"
 904 "    b       loc_fc140550\n"
 905 "loc_fc14050a:\n"
 906 "    mov     r0, sl\n"
 907 "    b       loc_fc14047c\n"
 908 "loc_fc14050e:\n"
 909 "    ldr     r0, =0x0000b2c8\n"
 910 "    movw    r1, #0x5d5c\n"
 911 "    movw    r2, #0x5cf8\n"
 912 "    subs    r0, #0xa0\n"
 913 "    ldr     r0, [r0, #0x44]\n"
 914 "    cmp     r0, #1\n"
 915 "    beq     loc_fc140546\n"
 916 "    cmp     r0, #3\n"
 917 "    beq     loc_fc140546\n"
 918 "    cmp     r0, #7\n"
 919 "    bne     loc_fc140546\n"
 920 "    movw    r0, #0x88b8\n"
 921 "    str     r0, [r4, #0x28]\n"
 922 "    movw    r0, #0x8854\n"
 923 "    str     r0, [r4, #0x30]\n"
 924 "    movw    r0, #0x87f0\n"
 925 "    str     r0, [r4, #0x2c]\n"
 926 "    movs    r0, #0x2a\n"
 927 "loc_fc14053c:\n"
 928 "    strb    r0, [r4, #0x1e]\n"
 929 "    mov     r0, ip\n"
 930 "    str.w   sb, [r6, #0x24]\n"
 931 "    b       loc_fc140760\n"
 932 "loc_fc140546:\n"
 933 "    strd    r2, r1, [r4, #0x2c]\n"
 934 "    movw    r0, #0x5dc0\n"
 935 "    str     r0, [r4, #0x28]\n"
 936 "loc_fc140550:\n"
 937 "    mov     r0, fp\n"
 938 "    b       loc_fc14053c\n"
 939 "loc_fc140554:\n"
 940 "    mov     sb, ip\n"
 941 "    mov     r0, ip\n"
 942 "    strh.w  ip, [r4, #6]\n"
 943 "    movw    ip, #0x2d0\n"
 944 "    strh.w  ip, [r4, #4]\n"
 945 "    strh    r0, [r4, #0xa]\n"
 946 "    strh.w  ip, [r4, #8]\n"
 947 "    strb.w  r8, [r4, #0x20]\n"
 948 "    strb.w  r8, [r4, #0x39]\n"
 949 "    strb.w  r8, [r4, #0x3a]\n"
 950 "    ldr     r0, =0x0000b2c8\n"
 951 "    strb.w  r8, [r4, #0x3b]\n"
 952 "    strh.w  r8, [r4, #0x3c]\n"
 953 "    subs    r0, #0xa0\n"
 954 "    strh.w  r8, [r4, #0x3e]\n"
 955 "    strh.w  r8, [r4, #0x40]\n"
 956 "    strh.w  r8, [r7, #0x12]\n"
 957 "    ldr     r0, [r0, #0x44]\n"
 958 "    cbz     r3, loc_fc1405bc\n"
 959 "    cbz     r0, loc_fc140598\n"
 960 "    cmp     r0, #1\n"
 961 "    bne     loc_fc1405ac\n"
 962 "loc_fc140598:\n"
 963 "    strd    lr, r2, [r4, #0x2c]\n"
 964 "    str     r1, [r4, #0x28]\n"
 965 "    b       loc_fc1405a6\n"
 966 "loc_fc1405a0:\n"
 967 "    b       loc_fc140764\n"
 968 "loc_fc1405a2:\n"
 969 "    b       loc_fc140704\n"
 970 "loc_fc1405a4:\n"
 971 "    b       loc_fc1407c2\n"
 972 "loc_fc1405a6:\n"
 973 "    strb.w  fp, [r4, #0x1e]\n"
 974 "    b       loc_fc1405f0\n"
 975 "loc_fc1405ac:\n"
 976 "    movw    r2, #0x679\n"
 977 "    ldr     r1, =0xfc13ffd4\n" //  *"MovieRecorder.c"
 978 "    movs    r0, #0\n"
 979 "    blx     sub_fc302464\n" // j_DebugAssert
 980 "    b       loc_fc1405f0\n"
 981 "loc_fc1405bc:\n"
 982 "    movs    r1, #0x1f\n"
 983 "    movw    r2, #0x1f40\n"
 984 "    cmp     r0, #0xf\n"
 985 "    movw    ip, #0x1edc\n"
 986 "    movw    fp, #0x1e78\n"
 987 "    bge     loc_fc14063e\n"
 988 "    cmp     r0, #1\n"
 989 "    beq     loc_fc14063e\n"
 990 "    cmp     r0, #7\n"
 991 "    movw    lr, #0x3e80\n"
 992 "    movw    r3, #0x3e1c\n"
 993 "    beq     loc_fc1405e2\n"
 994 "    cmp     r0, #8\n"
 995 "    bne     loc_fc14063e\n"
 996 "loc_fc1405e2:\n"
 997 "    str.w   lr, [r4, #0x28]\n"
 998 "    movw    r0, #0x3db8\n"
 999 "    str     r3, [r4, #0x30]\n"
1000 "loc_fc1405ec:\n"
1001 "    str     r0, [r4, #0x2c]\n"
1002 "    strb    r1, [r4, #0x1e]\n"
1003 "loc_fc1405f0:\n"
1004 "    movw    r0, #0x2d0\n"
1005 "    strd    sb, r0, [r6, #0x24]\n"
1006 "    ldr.w   sb, =0x0000b128\n"
1007 "    ldr.w   r0, [sb, #0x18]\n"
1008 "    cmp     r0, #1\n"
1009 "    bne     loc_fc1406fe\n"
1010 "    ldr     r0, [r6, #0x64]\n"
1011 "    movs    r3, #2\n"
1012 "    sub.w   r2, sb, #0x7a\n"
1013 "    movw    r1, #0x1d2\n"
1014 "    bl      sub_fc373be0\n"
1015 "    str.w   sl, [r6, #0x3c]\n"
1016 "    str.w   sl, [r6, #0x40]\n"
1017 "    ldr.w   r0, [sb, #0x1c]\n"
1018 "    cmp     r0, #0\n"
1019 "    ldrh    r0, [r7, #6]\n"
1020 "    beq     loc_fc140648\n"
1021 "    cbz     r0, loc_fc14064a\n"
1022 "    bl      sub_fc17b3e4\n" // GetLatestHVPosition_FW
1023 "    cmp     r0, #1\n"
1024 "    beq     loc_fc140634\n"
1025 "    cmp     r0, #2\n"
1026 "    bne     loc_fc14064e\n"
1027 "loc_fc140634:\n"
1028 "    str.w   r8, [r6, #0x3c]\n"
1029 "    str.w   r8, [r6, #0x40]\n"
1030 "    b       loc_fc14064e\n"
1031 "loc_fc14063e:\n"
1032 "    str.w   ip, [r4, #0x30]\n"
1033 "    mov     r0, fp\n"
1034 "    str     r2, [r4, #0x28]\n"
1035 "    b       loc_fc1405ec\n"
1036 "loc_fc140648:\n"
1037 "    cbnz    r0, loc_fc14064e\n"
1038 "loc_fc14064a:\n"
1039 "    str.w   r8, [r6, #0x3c]\n"
1040 "loc_fc14064e:\n"
1041 "    movs    r3, #1\n"
1042 "    ldr     r0, [r6, #0x64]\n"
1043 "    add     r2, sp, #8\n"
1044 "    movw    r1, #0x1d5\n"
1045 "    bl      sub_fc373be0\n"
1046 "    ldr     r0, [r6, #0x64]\n"
1047 "    movs    r3, #1\n"
1048 "    add     r2, sp, #4\n"
1049 "    movw    r1, #0x1d6\n"
1050 "    bl      sub_fc373be0\n"
1051 "    ldr     r0, [r6, #0x4c]\n"
1052 "    ldr     r1, =0xfc5fd400\n"
1053 "    cmp     r0, #0x5a\n"
1054 "    beq     loc_fc1406b2\n"
1055 "    cmp.w   r0, #0x10e\n"
1056 "    beq     loc_fc1406d6\n"
1057 "    ldrb.w  r2, [sp, #4]\n"
1058 "    movs    r0, #0\n"
1059 "    ldrb.w  r1, [sp, #8]\n"
1060 "    bl      sub_fc25cc6c\n" //  return 0
1061 "    strh    r0, [r7, #8]\n"
1062 "    asrs    r0, r0, #0x10\n"
1063 "    subs    r0, #0x3c\n"
1064 "    movw    r2, #0x280\n"
1065 "    uxth    r1, r0\n"
1066 "    ldrh    r0, [r7, #8]\n"
1067 "    add.w   r0, r0, r0, lsl #2\n"
1068 "    lsls    r0, r0, #8\n"
1069 "    udiv    r0, r0, r2\n"
1070 "    strh    r0, [r7, #8]\n"
1071 "    movw    r0, #0x2d0\n"
1072 "    muls    r1, r0, r1\n"
1073 "    asrs    r0, r0, #1\n"
1074 "    udiv    r0, r1, r0\n"
1075 "    strh    r0, [r7, #0xa]\n"
1076 "    movs    r0, #4\n"
1077 "    b       loc_fc1406fc\n"
1078 "loc_fc1406b2:\n"
1079 "    ldrb.w  r0, [sp, #8]\n"
1080 "    add.w   r0, r0, r0, lsl #1\n"
1081 "    add.w   r0, r1, r0, lsl #2\n"
1082 "    ldrb.w  r1, [sp, #4]\n"
1083 "    add.w   r1, r0, r1, lsl #2\n"
1084 "    ldr     r0, [sp]\n"
1085 "    ldrh    r2, [r1]\n"
1086 "    ldrh    r1, [r1, #2]\n"
1087 "    bfi     r0, r2, #0, #0x10\n"
1088 "    bfi     r0, r1, #0x10, #0x10\n"
1089 "    b       loc_fc1406ec\n"
1090 "loc_fc1406d6:\n"
1091 "    ldrb.w  r0, [sp, #8]\n"
1092 "    add.w   r0, r0, r0, lsl #1\n"
1093 "    add.w   r0, r1, r0, lsl #2\n"
1094 "    ldrb.w  r1, [sp, #4]\n"
1095 "    add.w   r0, r0, r1, lsl #2\n"
1096 "    ldr     r0, [r0, #0x30]\n"
1097 "loc_fc1406ec:\n"
1098 "    movw    r2, #0xfffe\n"
1099 "    adds    r1, r0, #1\n"
1100 "    ands    r1, r2\n"
1101 "    strh    r1, [r7, #8]\n"
1102 "    lsrs    r0, r0, #0x10\n"
1103 "    strh    r0, [r7, #0xa]\n"
1104 "    movs    r0, #2\n"
1105 "loc_fc1406fc:\n"
1106 "    strh    r0, [r7, #0xc]\n"
1107 "loc_fc1406fe:\n"
1108 "    movw    sb, #0x707\n"
1109 "    b       loc_fc1407d0\n"
1110 "loc_fc140704:\n"
1111 "    movw    ip, #0x280\n"
1112 "    strh.w  ip, [r4, #6]\n"
1113 "    movw    r0, #0x1e0\n"
1114 "    strh    r0, [r4, #4]\n"
1115 "    strh.w  ip, [r4, #0xa]\n"
1116 "    movs    r3, #3\n"
1117 "    strh    r0, [r4, #8]\n"
1118 "    strb.w  r2, [r4, #0x20]\n"
1119 "    strb.w  r8, [r4, #0x39]\n"
1120 "    strb.w  r8, [r4, #0x3a]\n"
1121 "    strb.w  r3, [r4, #0x3b]\n"
1122 "    movw    r3, #0xaf0\n"
1123 "    strh.w  r8, [r4, #0x3c]\n"
1124 "    ldr     r1, =0x0000b2c8\n"
1125 "    strh.w  r8, [r4, #0x3e]\n"
1126 "    strh.w  r2, [r4, #0x40]\n"
1127 "    subs    r1, #0xa0\n"
1128 "    strh    r2, [r7, #0x12]\n"
1129 "    movw    r2, #0xb54\n"
1130 "    strd    fp, lr, [r4, #0x4c]\n"
1131 "    str.w   sl, [r4, #0x48]\n"
1132 "    ldr     r1, [r1, #0x44]\n"
1133 "    movw    r1, #0xbb8\n"
1134 "    strd    r3, r2, [r4, #0x2c]\n"
1135 "    str     r1, [r4, #0x28]\n"
1136 "    movs    r1, #0x1e\n"
1137 "    strb    r1, [r4, #0x1e]\n"
1138 "    str.w   ip, [r6, #0x24]\n"
1139 "loc_fc140760:\n"
1140 "    str     r0, [r6, #0x28]\n"
1141 "    b       loc_fc1406fe\n"
1142 "loc_fc140764:\n"
1143 "    add.w   r4, r4, #0x1c\n"
1144 "    mov.w   ip, #0xf0\n"
1145 "    mov.w   r3, #3\n"
1146 "    movw    r0, #0x3e8\n"
1147 "    strh    r1, [r4, #-0x16]\n"
1148 "    strh    ip, [r4, #-0x18]\n"
1149 "    strh    r1, [r4, #-0x12]\n"
1150 "    strh    ip, [r4, #-0x14]\n"
1151 "    strb    r2, [r4, #4]\n"
1152 "    strb.w  r8, [r4, #0x1d]\n"
1153 "    strb.w  r8, [r4, #0x1e]\n"
1154 "    strb    r3, [r4, #0x1f]\n"
1155 "    strh.w  r8, [r4, #0x20]\n"
1156 "    strh.w  r8, [r4, #0x22]\n"
1157 "    strh    r2, [r4, #0x24]\n"
1158 "    strh    r2, [r7, #0x12]\n"
1159 "    strd    fp, lr, [r4, #0x30]\n"
1160 "    str.w   sl, [r4, #0x2c]\n"
1161 "    str     r0, [r4, #0xc]\n"
1162 "    movw    r0, #0x384\n"
1163 "    str     r0, [r4, #0x14]\n"
1164 "    movw    r0, #0x320\n"
1165 "    str     r0, [r4, #0x10]\n"
1166 "    mov.w   r0, #0x14\n"
1167 "    strb    r0, [r4, #2]\n"
1168 "    sub.w   r4, r4, #0x1c\n"
1169 "    strd    r1, ip, [r6, #0x24]\n"
1170 "    b       loc_fc1406fe\n"
1171 "loc_fc1407c2:\n"
1172 "    movw    r2, #0x746\n"
1173 "    ldr     r1, =0xfc13ffd4\n" //  *"MovieRecorder.c"
1174 "    movs    r0, #0\n"
1175 "    blx     sub_fc302464\n" // j_DebugAssert
1176 "loc_fc1407d0:\n"
1177 "    ldr     r0, [r6, #0x60]\n"
1178 "    bl      sub_fc261bca\n"
1179 "    strb    r0, [r7]\n"
1180 "    uxtb    r0, r0\n"
1181 "    cmp     r0, #2\n"
1182 "    beq     loc_fc1407e2\n"
1183 "    mov     r0, r8\n"
1184 "    b       loc_fc1407e4\n"
1185 "loc_fc1407e2:\n"
1186 "    mov     r0, sl\n"
1187 "loc_fc1407e4:\n"
1188 "    strb    r0, [r5, #7]\n"
1189 "    ldr     r0, [r7, #0x54]\n"
1190 "    mov.w   r1, #0x300000\n"
1191 "    cmp     r0, r1\n"
1192 "    bls     loc_fc1407f6\n"
1193 "    strb.w  sl, [r5, #7]\n"
1194 "    b       loc_fc1407fa\n"
1195 "loc_fc1407f6:\n"
1196 "    ldrb    r2, [r5, #7]\n"
1197 "    cbnz    r2, loc_fc1407fe\n"
1198 "loc_fc1407fa:\n"
1199 "    strb.w  sl, [r7]\n"
1200 "loc_fc1407fe:\n"
1201 "    mov.w   r1, #0x300000\n"
1202 "    ldr     r2, =0x0000b128\n"
1203 "    subs    r2, #0x80\n"
1204 "    ldrb    r2, [r2]\n"
1205 "    strb    r2, [r5, #6]\n"
1206 "    str     r1, [r4, #0x14]\n"
1207 "    ldrb    r1, [r5, #7]\n"
1208 "    cmp     r1, #1\n"
1209 "    bne     loc_fc140820\n"
1210 "    add.w   r2, r5, #0x10\n"
1211 "    ldr     r0, [r6, #0x60]\n"
1212 "    subs    r1, r2, #4\n"
1213 "    bl      sub_fc37a488\n"
1214 "    b       loc_fc140824\n"
1215 "loc_fc140820:\n"
1216 "    str     r0, [r5, #0xc]\n"
1217 "    str     r0, [r5, #0x10]\n"
1218 "loc_fc140824:\n"
1219 
1220 // movie time limit modification, r0...r3 does not seem to carry anything useful here, so they are not backed up
1221 "    mov     r0, sb\n"                  // + original limit is in r9 (aka sb)
1222 "    bl      set_movie_time_limit\n"    // +
1223 "    mov     sb, r0\n"                  // +
1224 // bitrate mod
1225 "    mov     r0, r4\n"                  // + addr of struct with bitrates is in r4
1226 "    bl      set_quality\n"             // +
1227 
1228 "    mvn     r2, #9\n"
1229 "    ldr     r0, [r6, #0x1c]\n"
1230 "    mov     r7, sl\n"
1231 "    str     r0, [sp, #0x18]\n"
1232 "    mul     r1, sb, r0\n"
1233 "    ldr     r0, [r6, #0x20]\n"
1234 "    mov     fp, r0\n"
1235 "    udiv    r0, r1, r0\n"
1236 "    ldr     r1, =0x0000b2c8\n"
1237 "    subs    r1, #0xa0\n"
1238 "    str     r0, [r1, #0x58]\n"
1239 "    str     r0, [sp, #0x14]\n"
1240 "    adds.w  r0, sb, r2\n"
1241 "    ldr.w   sb, =0x0000b128\n"
1242 "    adc     r1, sl, #-1\n"
1243 "    ldr     r1, =0x0000b128\n"
1244 "    sub.w   sb, sb, #0x80\n"
1245 "    str.w   r0, [sb, #0x64]\n"
1246 "    ldr     r0, [r1, #0x6c]\n"
1247 "    cbnz    r0, loc_fc140868\n"
1248 "    ldr     r0, [sp, #0x18]\n"
1249 "    add     r0, fp\n"
1250 "    subs    r0, r0, #1\n"
1251 "    udiv    r0, r0, fp\n"
1252 "    str     r0, [r1, #0x6c]\n"
1253 "loc_fc140868:\n"
1254 "    ldr     r2, [r1, #0x4c]\n"
1255 "    ldr     r0, [r1, #0x3c]\n"
1256 "    orrs    r2, r0\n"
1257 "    beq     loc_fc140898\n"
1258 "    strb.w  r8, [r5, #2]\n"
1259 "    b       loc_fc140890\n"
1260 // constants skiped
1261 "loc_fc140890:\n"
1262 "    movw    r2, #0x780\n"
1263 "    str     r2, [r4, #0x18]\n"
1264 "    b       loc_fc14089c\n"
1265 "loc_fc140898:\n"
1266 "    strb    r7, [r5, #2]\n"
1267 "    str     r7, [r4, #0x18]\n"
1268 "loc_fc14089c:\n"
1269 "    cmp     r0, #0\n"
1270 "    mov     sl, r1\n"
1271 "    beq     loc_fc140912\n"
1272 "    strb    r7, [r5, #7]\n"
1273 "    ldr.w   r0, [sb, #0x54]\n"
1274 "    cmp.w   r0, #0x300000\n"
1275 "    bls     loc_fc1408b0\n"
1276 "    str     r0, [r4, #0x14]\n"
1277 "loc_fc1408b0:\n"
1278 "    mov.w   fp, #0x3c\n"
1279 "    ldr     r0, =0x0000b228\n"
1280 "    ldr     r0, [r0, #0x44]\n"
1281 "    cbnz    r0, loc_fc1408c4\n"
1282 "    movs    r0, #0x78\n"
1283 "    strd    fp, r0, [r6]\n"
1284 "    movs    r0, #0x1e\n"
1285 "    b       loc_fc1408d2\n"
1286 "loc_fc1408c4:\n"
1287 "    cmp     r0, #1\n"
1288 "    bne     loc_fc1408d6\n"
1289 "    movs    r0, #0x30\n"
1290 "    str     r0, [r6]\n"
1291 "    movs    r0, #0x60\n"
1292 "    str     r0, [r6, #4]\n"
1293 "    movs    r0, #0x18\n"
1294 "loc_fc1408d2:\n"
1295 "    str     r0, [r6, #8]\n"
1296 "    b       loc_fc1408e4\n"
1297 "loc_fc1408d6:\n"
1298 "    movw    r2, #0x7ee\n"
1299 "    ldr     r1, =0xfc13ffd4\n" //  *"MovieRecorder.c"
1300 "    movs    r0, #0\n"
1301 "    blx     sub_fc302464\n" // j_DebugAssert
1302 "loc_fc1408e4:\n"
1303 "    ldr.w   r1, [sl, #0x18]\n"
1304 "    mov     r0, sl\n"
1305 "    cbz     r1, loc_fc1408f0\n"
1306 "    mov     r0, fp\n"
1307 "    b       loc_fc1408f6\n"
1308 "loc_fc1408f0:\n"
1309 "    ldr     r0, [r0, #0x54]\n"
1310 "    cbz     r0, loc_fc1408fa\n"
1311 "    ldr     r0, [r6, #8]\n"
1312 "loc_fc1408f6:\n"
1313 "    str     r0, [r4, #0x10]\n"
1314 "    b       loc_fc1408fc\n"
1315 "loc_fc1408fa:\n"
1316 "    str     r7, [r4, #0x10]\n"
1317 "loc_fc1408fc:\n"
1318 "    movs    r0, #2\n"
1319 "    strh.w  r0, [r4, #0x5a]\n"
1320 "    strh.w  r0, [sb, #0x10]\n"
1321 "    ldr.w   r0, [sl, #0x5c]\n"
1322 "    cbz     r0, loc_fc140924\n"
1323 "    strb.w  r8, [r5, #3]\n"
1324 "    b       loc_fc140926\n"
1325 "loc_fc140912:\n"
1326 "    ldrh.w  r0, [sb, #0xe]\n"
1327 "    ldr     r1, [sp, #0x14]\n"
1328 "    add     r1, r0\n"
1329 "    subs    r1, r1, #1\n"
1330 "    udiv    r0, r1, r0\n"
1331 "    adds    r0, r0, #1\n"
1332 "    b       loc_fc1408f6\n"
1333 "loc_fc140924:\n"
1334 "    strb    r7, [r5, #3]\n"
1335 "loc_fc140926:\n"
1336 "    movs    r3, #2\n"
1337 "    ldr     r0, [r6, #0x64]\n"
1338 "    movs    r1, #0xaf\n"
1339 "    add     r2, sp, #0x10\n"
1340 "    bl      sub_fc373b62\n"
1341 "    ldr     r0, [r6, #0x64]\n"
1342 "    movs    r3, #2\n"
1343 "    movs    r1, #0xae\n"
1344 "    add     r2, sp, #0xc\n"
1345 "    bl      sub_fc373b62\n"
1346 "    ldr.w   r0, [sl, #0x48]\n"
1347 "    mov.w   r3, #4\n"
1348 "    cbz     r0, loc_fc140958\n"
1349 "    ldr     r0, [r6, #0x64]\n"
1350 "    movs    r1, #0xa8\n"
1351 "    add     r2, sp, #0x10\n"
1352 "    bl      sub_fc373b62\n"
1353 "    movs    r3, #4\n"
1354 "    add     r2, sp, #0xc\n"
1355 "    b       loc_fc14096a\n"
1356 "loc_fc140958:\n"
1357 "    ldr     r2, =0x0000b228\n"
1358 "    movs    r1, #0xa8\n"
1359 "    ldr     r0, [r6, #0x64]\n"
1360 "    subs    r2, #0x64\n"
1361 "    bl      sub_fc373b62\n"
1362 "    ldr     r2, =0x0000b228\n"
1363 "    movs    r3, #4\n"
1364 "    subs    r2, #0x60\n"
1365 "loc_fc14096a:\n"
1366 "    ldr     r0, [r6, #0x64]\n"
1367 "    movs    r1, #0xa9\n"
1368 "    bl      sub_fc373b62\n"
1369 "    ldrh.w  r0, [sp, #0x10]\n"
1370 "    ldr     r5, [r6, #0x1c]\n"
1371 "    mov     r8, r0\n"
1372 "    cmp     r5, r0\n"
1373 "    beq     loc_fc1409b4\n"
1374 "    ldr     r0, =0x0000b228\n"
1375 "    ldr     r0, [r0, #0x44]\n"
1376 "    cmp     r0, #0x15\n"
1377 "    beq     loc_fc1409bc\n"
1378 "    ldr     r0, [r4, #0x28]\n"
1379 "    mov     r3, r7\n"
1380 "    ldrh.w  r1, [sp, #0xc]\n"
1381 "    lsls    r0, r0, #7\n"
1382 "    umull   r0, r2, r1, r0\n"
1383 "    mla     r1, r1, r7, r2\n"
1384 "    umull   r0, r2, r5, r0\n"
1385 "    mla     r1, r5, r1, r2\n"
1386 "    mov     r2, r8\n"
1387 "    blx     sub_fc302384\n"
1388 "    ldr     r2, [r6, #0x20]\n"
1389 "    mov     r3, r7\n"
1390 "    blx     sub_fc302384\n"
1391 "    str.w   r0, [sb, #0x58]\n"
1392 "    b       loc_fc1409bc\n"
1393 "loc_fc1409b4:\n"
1394 "    ldr     r0, [r4, #0x28]\n"
1395 "    lsls    r1, r0, #7\n"
1396 "    str.w   r1, [sb, #0x58]\n"
1397 "loc_fc1409bc:\n"
1398 "    ldr.w   r0, [sb, #0x58]\n"
1399 "    movs    r2, #0xa\n"
1400 "    mov     r1, sb\n"
1401 "    umull   r2, r3, r0, r2\n"
1402 "    str.w   r2, [sb, #0x5c]\n"
1403 "    movs    r2, #3\n"
1404 "    cmp     r5, r8\n"
1405 "    umull   r0, r2, r0, r2\n"
1406 "    str.w   r0, [sb, #0x60]\n"
1407 "    bne     loc_fc1409de\n"
1408 "    ldr     r0, [r1, #0x58]\n"
1409 "    b       loc_fc1409e4\n"
1410 "loc_fc1409de:\n"
1411 "    ldr     r0, [r4, #0x28]\n"
1412 "    lsls    r0, r0, #7\n"
1413 "    str     r0, [r1, #0x58]\n"
1414 "loc_fc1409e4:\n"
1415 "    add.w   r2, r0, r0, lsl #1\n"
1416 "    ldr     r0, [r1, #0x54]\n"
1417 "    add     r2, r0\n"
1418 "    subs    r2, r2, #1\n"
1419 "    udiv    r2, r2, r0\n"
1420 "    muls    r2, r0, r2\n"
1421 "    ldr     r0, [r1, #0x68]\n"
1422 "    muls    r2, r0, r2\n"
1423 "    ldr     r0, =0x0000b228\n"
1424 "    adds    r0, #0x80\n"
1425 "    stm     r0!, {r2, r7}\n"
1426 "    ldr     r0, [r4, #0x28]\n"
1427 "    add.w   r1, r0, r0, lsl #1\n"
1428 "loc_fc140a04:\n"
1429 "    rsb     r0, r1, r0, lsl #7\n"
1430 "    ldr     r1, =0x0000b228\n"
1431 "    str     r0, [r1, #0x48]\n"
1432 "    add     sp, #0x1c\n"
1433 "loc_fc140a0e:\n"
1434 "    pop.w   {r4, r5, r6, r7, r8, sb, sl, fp, pc}\n"
1435 );
1436 }
1437 
1438 // below functions are for getting bitrate information during recording
1439 // filesystem info only updates after recording stops
1440 
1441 void getchunkinfo(int *r0) { // for each model, firmware struct needs to be verified
1442     int m;
1443     unsigned int lsum = 0;
1444     m = *r0; // num of chunks
1445     int *cl = (int*)(*(r0+1));
1446     while (m>0) {
1447         // chunk properties, 3 words: addr, size, unknown
1448         lsum += *(cl+1);
1449         cl+=3;
1450         m--;
1451     }
1452     bitrate_calc(lsum);
1453 }
1454 
1455 void __attribute__((naked,noinline)) apendstrm_my() { // when porting: check disassembly to verify
1456 asm volatile (
1457 "    push    {r0, lr}\n"
1458 "    ldr     r0, [r0, #8]\n"
1459 "    ldr     r0, [r0, #4]\n"
1460 "    bl      getchunkinfo\n"
1461 "    pop     {r0, lr}\n"
1462 "    ldr     pc, orig_apendstrm\n"  // call the original fw function
1463 "orig_apendstrm:\n"
1464 "    .long   0\n"                   // placeholder, populated below
1465 );
1466 }
1467 
1468 // cocoa's APENDSTRM func pointer is located in ROM, fw's TskCocoa0 task needs to be modified
1469 // cocoa fw struct is copied to RAM first, so that the APENDSTRM pointer can be replaced
1470 void __attribute__((naked,noinline)) task_cocoa0() {
1471     asm volatile (
1472 ".equ   COCOA_ARR_START,    0xFC6355A4\n"
1473 ".equ   COCOA_APENDSTR_LOC, 0xFC6355F8\n"
1474 ".equ   COCOA_ARR_END,      0xFC635A90\n"
1475 ".equ   COCOA_ARR_LEN,      (COCOA_ARR_END - COCOA_ARR_START)\n"
1476 ".equ   COCOA_APENDSTR_OFS, (COCOA_APENDSTR_LOC - COCOA_ARR_START)\n"
1477 // copy and modify fw struct
1478 "    push    {r0, lr}\n"            // +
1479 "    adr     r0, cocoa_struct\n"    // + destination
1480 "    ldr     r1, =COCOA_ARR_START\n"// + source
1481 "    movw    r2, #COCOA_ARR_LEN\n"  // + struct length in bytes
1482 "    bl      _memcpy\n"             // +
1483 "    movw    r0, #COCOA_APENDSTR_OFS\n" // + offset of APENDSTRM func pointer
1484 "    adr     r1, cocoa_struct\n"    // +
1485 "    ldr     r2, [r1, r0]\n"        // + get original APENDSTRM pointer
1486 "    adr     r3, orig_apendstrm\n"  // +
1487 "    str     r2, [r3]\n"            // + store original APENDSTRM pointer for use in apendstrm_my()
1488 "    adr     r2, apendstrm_my\n"    // + our replacement for APENDSTRM
1489 "    orr     r2, #1\n"              // +
1490 "    str     r2, [r1, r0]\n"        // + replace the original APENDSTRM
1491 // TODO: do we need to care about the data cache?
1492 "    pop     {r0, lr}\n"            // +
1493 
1494 // task_TskCocoa0 0xFC262420
1495 "    mov     r1, r0\n"
1496 "    movs    r0, #0\n"
1497 "loc_fc262190:\n"
1498 "    push.w  {r4, r5, r6, r7, r8, sb, sl, fp, lr}\n"
1499 "    cmp     r0, #2\n"
1500 "    mov     r4, r1\n"
1501 "    sub     sp, #0x15c\n"
1502 "    mov     r6, r0\n"
1503 "    blt     loc_fc2621b0\n"
1504 "    ldr     r1, =0xfc262320\n" //  *"CocoaTsk.c"
1505 "    movw    r2, #0x1c8\n"
1506 "    ldr     r0, =0xfc26232c\n" //  *"Cocoa MEDIA OVER"
1507 "    bl      sub_fc261ed8\n"
1508 "loc_fc2621aa:\n"
1509 "    add     sp, #0x15c\n"
1510 "    pop.w   {r4, r5, r6, r7, r8, sb, sl, fp, pc}\n"
1511 "loc_fc2621b0:\n"
1512 "    blx     sub_fc30227c\n"
1513 "    mov     r1, r4\n"
1514 "    mov     r0, r6\n"
1515 "    bl      sub_fc447f58\n"
1516 "    cbnz    r4, loc_fc2621ca\n"
1517 "    adds    r6, r6, #2\n"
1518 "    ldr     r1, =0xfc262340\n" //  *"Fatal error!!"
1519 "    uxtb    r0, r6\n"
1520 "    bl      sub_fc37475e\n"
1521 "    b       loc_fc2621aa\n"
1522 "loc_fc2621ca:\n"
1523 //"    ldr.w   sb, =0xfc6355a4\n"   // -
1524 "    adr     sb, cocoa_struct\n"    // +
1525 "    ldr     pc, =0xFC2621CF\n"     // + back to rom
1526 ".ltorg\n"
1527 
1528 "    .align 2\n"                        // +
1529 "cocoa_struct:\n"                       // +
1530 "    .space  COCOA_ARR_LEN\n"           // + make space for copied fw struct
1531 
1532     );
1533 }
1534 

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