root/platform/g9/sub/100d/movie_rec.c

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

DEFINITIONS

This source file includes following definitions.
  1. change_video_tables
  2. movie_record_task
  3. sub_FF85CF18_my
  4. sub_FF93EFD0_my

   1 /*
   2  * movie_rec.c - auto-generated by CHDK code_gen.
   3  */
   4 #include "conf.h"
   5 
   6 int *video_quality = &conf.video_quality;
   7 int *video_mode    = &conf.video_mode;
   8 
   9 long def_table[48]={
  10   0x2000,   0x38D,   0x788, 0x5800,  0x9C5,  0x14B8, 0x10000,  0x1C6A,  0x3C45, 0x20000,  0x387A,  0x7813,
  11  0x25800,  0x422F,  0x8CB6, 0x8000,  0xE35,  0x1E23, 0x10000,  0x1C6A,  0x3C45, 0x12C00,  0x2118,  0x465B,
  12   0x1CCD,  -0x2E1,  -0x579, 0x4F33, -0x7EB,  -0xF0C,  0xE666, -0x170A, -0x2BC6, 0x1CC39, -0x2F5B, -0x59F0,
  13  0x21B53, -0x377F, -0x6965, 0x7333, -0xB85, -0x15E3,  0xE666, -0x170A, -0x2BC6, 0x10DAA, -0x1BC0, -0x34B3};
  14 
  15 long table[48];
  16 
  17 void change_video_tables(int a, int b){
  18     int i;
  19     for (i=0;i<48;i++) table[i]=(def_table[i]*a)/b; 
  20 }
  21 
  22 long CompressionRateTable[]={0x60, 0x5D, 0x5A, 0x57, 0x54, 0x51, 0x4D, 0x48, 0x42, 0x3B, 0x32, 0x29, 0x22, 0x1D, 0x17, 0x14, 0x10, 0xE, 0xB, 9, 7, 6, 5, 4, 3, 2, 1};
  23 
  24 /*************************************************************/
  25 //** movie_record_task @ 0xFF85D4C0 - 0xFF85D5C4, length=66
  26 void __attribute__((naked,noinline)) movie_record_task() {
  27 asm volatile (
  28 "    STMFD   SP!, {R2-R8,LR} \n"
  29 "    LDR     R8, =0x32B \n"
  30 "    LDR     R7, =0x2710 \n"
  31 "    LDR     R4, =0x56D8 \n"
  32 "    MOV     R6, #0 \n"
  33 "    MOV     R5, #1 \n"
  34 
  35 "loc_FF85D4D8:\n"
  36 "    LDR     R0, [R4, #0x1C] \n"
  37 "    MOV     R2, #0 \n"
  38 "    ADD     R1, SP, #4 \n"
  39 "    BL      sub_FF829FB0 /*_ReceiveMessageQueue*/ \n"
  40 "    LDR     R0, [R4, #0x24] \n"
  41 "    CMP     R0, #0 \n"
  42 "    BNE     loc_FF85D5A8 \n"
  43 "    LDR     R0, [SP, #4] \n"
  44 "    LDR     R1, [R0] \n"
  45 "    SUB     R1, R1, #2 \n"
  46 "    CMP     R1, #9 \n"
  47 "    ADDLS   PC, PC, R1, LSL#2 \n"
  48 "    B       loc_FF85D5A8 \n"
  49 "    B       loc_FF85D55C \n"
  50 "    B       loc_FF85D57C \n"
  51 "    B       loc_FF85D58C \n"
  52 "    B       loc_FF85D594 \n"
  53 "    B       loc_FF85D564 \n"
  54 "    B       loc_FF85D59C \n"
  55 "    B       loc_FF85D56C \n"
  56 "    B       loc_FF85D5A8 \n"
  57 "    B       loc_FF85D5A4 \n"
  58 "    B       loc_FF85D534 \n"
  59 
  60 "loc_FF85D534:\n"
  61 "    LDR     R0, =0xFF85D180 \n"
  62 "    STR     R6, [R4, #0x38] \n"
  63 "    STR     R0, [R4, #0xA4] \n"
  64 "    LDR     R0, =0xFF85CABC \n"
  65 "    LDR     R2, =0xFF85C9D8 \n"
  66 "    LDR     R1, =0x1E080 \n"
  67 "    STR     R6, [R4, #0x28] \n"
  68 "    BL      sub_FF83D8B4 \n"
  69 "    STR     R5, [R4, #0x3C] \n"
  70 "    B       loc_FF85D5A8 \n"
  71 
  72 "loc_FF85D55C:\n"
  73 "    BL      unlock_optical_zoom\n"
  74 "    BL      sub_FF85D278 \n"
  75 "    B       loc_FF85D5A8 \n"
  76 
  77 "loc_FF85D564:\n"
  78 "    BL      sub_FF85CF18_my \n"  // --> Patched. Old value = 0xFF85CF18.
  79 "    B       loc_FF85D5A8 \n"
  80 
  81 "loc_FF85D56C:\n"
  82 "    LDR     R1, [R0, #0x10] \n"
  83 "    LDR     R0, [R0, #4] \n"
  84 "    BL      sub_FF940C98 \n"
  85 "    B       loc_FF85D5A8 \n"
  86 
  87 "loc_FF85D57C:\n"
  88 "    LDR     R0, [R4, #0x3C] \n"
  89 "    CMP     R0, #5 \n"
  90 "    STRNE   R5, [R4, #0x2C] \n"
  91 "    B       loc_FF85D5A8 \n"
  92 
  93 "loc_FF85D58C:\n"
  94 "    BL      sub_FF85CCA8 \n"
  95 "    B       loc_FF85D5A8 \n"
  96 
  97 "loc_FF85D594:\n"
  98 "    BL      sub_FF85CB08 \n"
  99 "    B       loc_FF85D5A8 \n"
 100 
 101 "loc_FF85D59C:\n"
 102 "    BL      sub_FF85C964 \n"
 103 "    B       loc_FF85D5A8 \n"
 104 
 105 "loc_FF85D5A4:\n"
 106 "    BL      sub_FF85D710 \n"
 107 
 108 "loc_FF85D5A8:\n"
 109 "    LDR     R1, [SP, #4] \n"
 110 "    STR     R6, [R1] \n"
 111 "    LDR     R3, =0xFF85C768 /*'MovieRecorder.c'*/ \n"
 112 "    MOV     R2, R7 \n"
 113 "    STR     R8, [SP] \n"
 114 "    LDR     R0, [R4, #0x20] \n"
 115 "    BL      sub_FF81BF08 /*_PostMessageQueueStrictly*/ \n"
 116 "    B       loc_FF85D4D8 \n"
 117 );
 118 }
 119 
 120 /*************************************************************/
 121 //** sub_FF85CF18_my @ 0xFF85CF18 - 0xFF85D17C, length=154
 122 void __attribute__((naked,noinline)) sub_FF85CF18_my() {
 123 asm volatile (
 124 "    STMFD   SP!, {R4-R9,LR} \n"
 125 "    SUB     SP, SP, #0x3C \n"
 126 "    MOV     R7, #0 \n"
 127 "    LDR     R5, =0x56D8 \n"
 128 "    MOV     R4, R0 \n"
 129 "    STR     R7, [SP, #0x2C] \n"
 130 "    STR     R7, [SP, #0x24] \n"
 131 "    LDR     R0, [R5, #0x3C] \n"
 132 "    MOV     R8, #4 \n"
 133 "    CMP     R0, #3 \n"
 134 "    STREQ   R8, [R5, #0x3C] \n"
 135 "    LDR     R0, [R5, #0xA4] \n"
 136 "    MOV     R6, #0 \n"
 137 "    BLX     R0 \n"
 138 "    LDR     R0, [R5, #0x3C] \n"
 139 "    CMP     R0, #4 \n"
 140 "    BNE     loc_FF85D028 \n"
 141 "    LDRH    R0, [R5, #2] \n"
 142 "    MOV     R9, #1 \n"
 143 "    CMP     R0, #1 \n"
 144 "    BNE     loc_FF85CF94 \n"
 145 "    LDRH    R1, [R5, #4] \n"
 146 "    LDR     R0, [R5, #0x4C] \n"
 147 "    MUL     R0, R1, R0 \n"
 148 "    MOV     R1, #0x3E8 \n"
 149 "    BL      sub_FFABEC38 /*__divmod_unsigned_int*/ \n"
 150 "    MOV     R1, R0 \n"
 151 "    LDR     R0, [R5, #0x54] \n"
 152 "    BL      sub_FFABEC38 /*__divmod_unsigned_int*/ \n"
 153 "    CMP     R1, #0 \n"
 154 "    BNE     loc_FF85CFB0 \n"
 155 
 156 "loc_FF85CF94:\n"
 157 "    ADD     R3, SP, #0x24 \n"
 158 "    ADD     R2, SP, #0x28 \n"
 159 "    ADD     R1, SP, #0x2C \n"
 160 "    ADD     R0, SP, #0x30 \n"
 161 "    BL      sub_FF940E2C \n"
 162 "    MOVS    R6, R0 \n"
 163 "    BNE     loc_FF85CFCC \n"
 164 
 165 "loc_FF85CFB0:\n"
 166 "    LDR     R0, [R5, #0x2C] \n"
 167 "    CMP     R0, #1 \n"
 168 "    BNE     loc_FF85D030 \n"
 169 "    LDR     R0, [R5, #0x54] \n"
 170 "    LDR     R1, [R5, #0x40] \n"
 171 "    CMP     R0, R1 \n"
 172 "    BCC     loc_FF85D030 \n"
 173 
 174 "loc_FF85CFCC:\n"
 175 "    CMP     R6, #0x80000001 \n"
 176 "    STREQ   R8, [R5, #0x58] \n"
 177 "    BEQ     loc_FF85D004 \n"
 178 "    CMP     R6, #0x80000003 \n"
 179 "    STREQ   R9, [R5, #0x58] \n"
 180 "    BEQ     loc_FF85D004 \n"
 181 "    CMP     R6, #0x80000005 \n"
 182 "    MOVEQ   R0, #2 \n"
 183 "    BEQ     loc_FF85D000 \n"
 184 "    CMP     R6, #0x80000007 \n"
 185 "    STRNE   R7, [R5, #0x58] \n"
 186 "    BNE     loc_FF85D004 \n"
 187 "    MOV     R0, #3 \n"
 188 
 189 "loc_FF85D000:\n"
 190 "    STR     R0, [R5, #0x58] \n"
 191 
 192 "loc_FF85D004:\n"
 193 "    LDR     R0, =0x1E0B0 \n"
 194 "    LDR     R0, [R0, #8] \n"
 195 "    CMP     R0, #0 \n"
 196 "    BEQ     loc_FF85D01C \n"
 197 "    BL      sub_FF84ACE4 \n"
 198 "    B       loc_FF85D020 \n"
 199 
 200 "loc_FF85D01C:\n"
 201 "    BL      sub_FF85C964 \n"
 202 
 203 "loc_FF85D020:\n"
 204 "    MOV     R0, #5 \n"
 205 "    STR     R0, [R5, #0x3C] \n"
 206 
 207 "loc_FF85D028:\n"
 208 "    ADD     SP, SP, #0x3C \n"
 209 "    LDMFD   SP!, {R4-R9,PC} \n"
 210 
 211 "loc_FF85D030:\n"
 212 "    LDR     R12, [SP, #0x2C] \n"
 213 "    CMP     R12, #0 \n"
 214 "    BEQ     loc_FF85D128 \n"
 215 "    STR     R9, [R5, #0x30] \n"
 216 "    LDR     R0, [R5, #0x48] \n"
 217 "    CMP     R0, #4 \n"
 218 "    LDRNE   LR, [R4, #0xC] \n"
 219 "    BNE     loc_FF85D070 \n"
 220 "    LDR     R0, [R4, #0xC] \n"
 221 "    LDR     R1, [R4, #8] \n"
 222 "    MOV     R2, R0, LSR#3 \n"
 223 "    MUL     R1, R2, R1 \n"
 224 "    LDR     R2, [R4, #4] \n"
 225 "    SUB     LR, R0, R0, LSR#2 \n"
 226 "    ADD     R1, R2, R1, LSL#1 \n"
 227 "    STR     R1, [R4, #4] \n"
 228 
 229 "loc_FF85D070:\n"
 230 "    LDR     R0, [R5, #0x70] \n"
 231 "    LDR     R1, [R4, #0x14] \n"
 232 "    LDR     R2, [R4, #0x18] \n"
 233 "    ADD     R3, SP, #0x34 \n"
 234 "    ADD     R6, SP, #0x14 \n"
 235 "    STMIA   R6, {R0-R3} \n"
 236 "    LDR     R0, [SP, #0x24] \n"
 237 "    LDR     R3, [R5, #0x5C] \n"
 238 "    LDR     R1, [SP, #0x28] \n"
 239 "    ADD     R2, SP, #0x38 \n"
 240 "    ADD     R6, SP, #8 \n"
 241 "    STMIA   R6, {R0,R2,R3} \n"
 242 "    STR     R1, [SP, #4] \n"
 243 "    STR     R12, [SP] \n"
 244 "    LDMIB   R4, {R0,R1} \n"
 245 "    LDR     R3, [SP, #0x30] \n"
 246 "    MOV     R2, LR \n"
 247 "    BL      sub_FF8FBD68 \n"
 248 "    LDR     R0, [R5, #0x14] \n"
 249 "    MOV     R1, #0x3E8 \n"
 250 "    BL      _TakeSemaphore \n"
 251 "    CMP     R0, #9 \n"
 252 "    BNE     loc_FF85D0DC \n"
 253 "    BL      sub_FF941408 \n"
 254 "    MOV     R0, #0x90000 \n"
 255 "    STR     R9, [R5, #0x3C] \n"
 256 "    B       loc_FF85D0F4 \n"
 257 
 258 "loc_FF85D0DC:\n"
 259 "    LDR     R0, [SP, #0x34] \n"
 260 "    CMP     R0, #0 \n"
 261 "    BEQ     loc_FF85D0FC \n"
 262 "    BL      sub_FF941408 \n"
 263 "    MOV     R0, #0xA0000 \n"
 264 "    STR     R9, [R5, #0x3C] \n"
 265 
 266 "loc_FF85D0F4:\n"
 267 "    BL      sub_FF87347C /*_HardwareDefect_FW*/ \n"
 268 "    B       loc_FF85D028 \n"
 269 
 270 "loc_FF85D0FC:\n"
 271 "    BL      sub_FF8FBE2C \n"
 272 "    LDR     R0, [SP, #0x30] \n"
 273 "    LDR     R1, [SP, #0x38] \n"
 274 "    BL      sub_FF9411B0 \n"
 275 "    LDR     R0, [R5, #0x50] \n"
 276 "    LDR     R1, =0x5748 \n"
 277 "    ADD     R0, R0, #1 \n"
 278 "    STR     R0, [R5, #0x50] \n"
 279 "    LDR     R0, [SP, #0x38] \n"
 280 "    MOV     R2, #0 \n"
 281 "    BL      sub_FF93EFD0_my \n"  // --> Patched. Old value = 0xFF93EFD0.
 282 
 283 "loc_FF85D128:\n"
 284 "    LDR     R0, [R5, #0x54] \n"
 285 "    ADD     R0, R0, #1 \n"
 286 "    STR     R0, [R5, #0x54] \n"
 287 "    LDR     R1, [R5, #0x7C] \n"
 288 "    MUL     R0, R1, R0 \n"
 289 "    LDR     R1, [R5, #0x78] \n"
 290 "    BL      sub_FFABEC38 /*__divmod_unsigned_int*/ \n"
 291 "    MOV     R4, R0 \n"
 292 "    BL      sub_FF941440 \n"
 293 "    LDR     R1, [R5, #0x74] \n"
 294 "    CMP     R1, R4 \n"
 295 "    BNE     loc_FF85D164 \n"
 296 "    LDR     R0, [R5, #0x34] \n"
 297 "    CMP     R0, #1 \n"
 298 "    BNE     loc_FF85D178 \n"
 299 
 300 "loc_FF85D164:\n"
 301 "    LDR     R1, [R5, #0x88] \n"
 302 "    MOV     R0, R4 \n"
 303 "    BLX     R1 \n"
 304 "    STR     R4, [R5, #0x74] \n"
 305 "    STR     R7, [R5, #0x34] \n"
 306 
 307 "loc_FF85D178:\n"
 308 "    STR     R7, [R5, #0x30] \n"
 309 "    B       loc_FF85D028 \n"
 310 );
 311 }
 312 
 313 /*************************************************************/
 314 //** sub_FF93EFD0_my @ 0xFF93EFD0 - 0xFF93F0B0, length=57
 315 void __attribute__((naked,noinline)) sub_FF93EFD0_my() {
 316 asm volatile (
 317 "    STMFD   SP!, {R4-R8,LR} \n"
 318 "    LDR     R4, =0xE400 \n"
 319 "    LDR     LR, [R4] \n"
 320 "    LDR     R2, [R4, #8] \n"
 321 "    CMP     LR, #0 \n"
 322 "    LDRNE   R3, [R4, #0xC] \n"
 323 "    MOV     R5, R2 \n"
 324 "    CMPNE   R3, #1 \n"
 325 "    MOVEQ   R2, #0 \n"
 326 "    STREQ   R0, [R4] \n"
 327 "    STREQ   R2, [R4, #0xC] \n"
 328 "    BEQ     loc_FF93F09C \n"
 329 "    LDR     R3, [R4, #4] \n"
 330 "    LDR     R7, =table\n"          // +
 331 "    LDR     R7, =0xFFADC878 \n"
 332 "    ADD     R12, R3, R3, LSL#1 \n"
 333 "    LDR     R3, [R7, R12, LSL#2] \n"
 334 "    ADD     R6, R7, #0x60 \n"
 335 "    LDR     R8, [R6, R12, LSL#2] \n"
 336 "    SUB     R3, LR, R3 \n"
 337 "    CMP     R3, #0 \n"
 338 "    SUB     LR, LR, R8 \n"
 339 "    BLE     loc_FF93F058 \n"
 340 "    ADD     R12, R7, R12, LSL#2 \n"
 341 "    LDR     LR, [R12, #4] \n"
 342 "    CMP     LR, R3 \n"
 343 "    ADDGE   R2, R2, #1 \n"
 344 "    BGE     loc_FF93F04C \n"
 345 "    LDR     R12, [R12, #8] \n"
 346 "    CMP     R12, R3 \n"
 347 "    ADDLT   R2, R2, #3 \n"
 348 "    ADDGE   R2, R2, #2 \n"
 349 
 350 "loc_FF93F04C:\n"
 351 "    CMP     R2, #0x1A \n"  // --> Patched. Old value = 0x17.
 352 "    MOVGE   R2, #0x19 \n"  // --> Patched. Old value = 0x16.
 353 "    B       loc_FF93F08C \n"
 354 
 355 "loc_FF93F058:\n"
 356 "    CMP     LR, #0 \n"
 357 "    BGE     loc_FF93F08C \n"
 358 "    ADD     R3, R6, R12, LSL#2 \n"
 359 "    LDR     R12, [R3, #4] \n"
 360 "    CMP     R12, LR \n"
 361 "    SUBLE   R2, R2, #1 \n"
 362 "    BLE     loc_FF93F084 \n"
 363 "    LDR     R3, [R3, #8] \n"
 364 "    CMP     R3, LR \n"
 365 "    SUBGT   R2, R2, #3 \n"
 366 "    SUBLE   R2, R2, #2 \n"
 367 
 368 "loc_FF93F084:\n"
 369 "    CMP     R2, #0 \n"
 370 "    MOVLT   R2, #0 \n"
 371 
 372 "loc_FF93F08C:\n"
 373 "    CMP     R2, R5 \n"
 374 "    STRNE   R2, [R4, #8] \n"
 375 "    MOVNE   R2, #1 \n"
 376 "    STRNE   R2, [R4, #0xC] \n"
 377 
 378 "loc_FF93F09C:\n"
 379 "    LDR     R2, =CompressionRateTable \n"  // --> Patched. Old value = 0xFFADC81C.
 380 "    LDR     R3, [R4, #8] \n"
 381 "    LDR     R2, [R2, R3, LSL#2] \n"
 382 //mod start
 383 "    LDR     R3, =video_mode\n"         // +
 384 "    LDR     R3, [R3]\n"                // +
 385 "    LDR     R3, [R3]\n"                // +
 386 "    CMP     R3, #1\n"                  // +
 387 "    LDREQ   R3, =video_quality\n"      // +
 388 "    LDREQ   R3, [R3]\n"                // +
 389 "    LDREQ   R2, [R3]\n"                // +
 390 //mod end
 391 "    STR     R2, [R1] \n"
 392 "    STR     R0, [R4] \n"
 393 "    BL      mute_on_zoom\n"            // +
 394 "    LDMFD   SP!, {R4-R8,PC} \n"
 395 );
 396 }

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