root/platform/a590/sub/100e/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_FFC4B6B8_my
  4. sub_FFD126CC_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[24]={0x2000, 0x38D, 0x788, 0x5800, 0x9C5, 0x14B8, 0x10000, 0x1C6A, 0x3C45, 0x8000, 0xE35, 0x1E23,
  10            0x1CCD, -0x2E1, -0x579, 0x4F33, -0x7EB, -0xF0C, 0xE666, -0x170A, -0x2BC6, 0x7333, -0xB85, -0x15E3};
  11 
  12 long table[24];
  13 
  14 void change_video_tables(int a, int b){
  15  int i;
  16  for (i=0;i<24;i++) table[i]=(def_table[i]*a)/b; 
  17 }
  18 
  19 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};
  20 
  21 /*************************************************************/
  22 //** movie_record_task @ 0xFFC4BBBC - 0xFFC4BCC0, length=66
  23 void __attribute__((naked,noinline)) movie_record_task() {
  24 asm volatile (
  25 "    STMFD   SP!, {R2-R8,LR} \n"
  26 "    LDR     R8, =0x32B \n"
  27 "    LDR     R7, =0x2710 \n"
  28 "    LDR     R4, =0x5390 \n"
  29 "    MOV     R6, #0 \n"
  30 "    MOV     R5, #1 \n"
  31 
  32 "loc_FFC4BBD4:\n"
  33 "    LDR     R0, [R4, #0x18] \n"
  34 "    MOV     R2, #0 \n"
  35 "    ADD     R1, SP, #4 \n"
  36 "    BL      sub_FFC17B08 /*_ReceiveMessageQueue*/ \n"
  37 "    LDR     R0, [R4, #0x20] \n"
  38 "    CMP     R0, #0 \n"
  39 "    BNE     loc_FFC4BCA4 \n"
  40 "    LDR     R0, [SP, #4] \n"
  41 "    LDR     R1, [R0] \n"
  42 "    SUB     R1, R1, #2 \n"
  43 "    CMP     R1, #9 \n"
  44 "    ADDLS   PC, PC, R1, LSL#2 \n"
  45 "    B       loc_FFC4BCA4 \n"
  46 "    B       loc_FFC4BC58 \n"
  47 "    B       loc_FFC4BC78 \n"
  48 "    B       loc_FFC4BC88 \n"
  49 "    B       loc_FFC4BC90 \n"
  50 "    B       loc_FFC4BC60 \n"
  51 "    B       loc_FFC4BC98 \n"
  52 "    B       loc_FFC4BC68 \n"
  53 "    B       loc_FFC4BCA4 \n"
  54 "    B       loc_FFC4BCA0 \n"
  55 "    B       loc_FFC4BC30 \n"
  56 
  57 "loc_FFC4BC30:\n"
  58 "    LDR     R0, =0xFFC4B8B8 \n"
  59 "    STR     R6, [R4, #0x34] \n"
  60 "    STR     R0, [R4, #0xA0] \n"
  61 "    LDR     R0, =0xFFC4B330 \n"
  62 "    LDR     R2, =0xFFC4B24C \n"
  63 "    LDR     R1, =0x185EC \n"
  64 "    STR     R6, [R4, #0x24] \n"
  65 "    BL      sub_FFC2A0FC \n"
  66 "    STR     R5, [R4, #0x38] \n"
  67 "    B       loc_FFC4BCA4 \n"
  68 
  69 "loc_FFC4BC58:\n"
  70 "    BL      unlock_optical_zoom\n"
  71 "    BL      sub_FFC4B9B0 \n"
  72 "    B       loc_FFC4BCA4 \n"
  73 
  74 "loc_FFC4BC60:\n"
  75 "    BL      sub_FFC4B6B8_my \n"  // --> Patched. Old value = 0xFFC4B6B8.
  76 "    B       loc_FFC4BCA4 \n"
  77 
  78 "loc_FFC4BC68:\n"
  79 "    LDR     R1, [R0, #0x10] \n"
  80 "    LDR     R0, [R0, #4] \n"
  81 "    BL      sub_FFD14324 \n"
  82 "    B       loc_FFC4BCA4 \n"
  83 
  84 "loc_FFC4BC78:\n"
  85 "    LDR     R0, [R4, #0x38] \n"
  86 "    CMP     R0, #5 \n"
  87 "    STRNE   R5, [R4, #0x28] \n"
  88 "    B       loc_FFC4BCA4 \n"
  89 
  90 "loc_FFC4BC88:\n"
  91 "    BL      sub_FFC4B4C0 \n"
  92 "    B       loc_FFC4BCA4 \n"
  93 
  94 "loc_FFC4BC90:\n"
  95 "    BL      sub_FFC4B37C \n"
  96 "    B       loc_FFC4BCA4 \n"
  97 
  98 "loc_FFC4BC98:\n"
  99 "    BL      sub_FFC4B1D8 \n"
 100 "    B       loc_FFC4BCA4 \n"
 101 
 102 "loc_FFC4BCA0:\n"
 103 "    BL      sub_FFC4BE0C \n"
 104 
 105 "loc_FFC4BCA4:\n"
 106 "    LDR     R1, [SP, #4] \n"
 107 "    LDR     R3, =0xFFC4B040 /*'MovieRecorder.c'*/ \n"
 108 "    STR     R6, [R1] \n"
 109 "    STR     R8, [SP] \n"
 110 "    LDR     R0, [R4, #0x1C] \n"
 111 "    MOV     R2, R7 \n"
 112 "    BL      sub_FFC0BCF8 /*_PostMessageQueueStrictly*/ \n"
 113 "    B       loc_FFC4BBD4 \n"
 114 );
 115 }
 116 
 117 /*************************************************************/
 118 //** sub_FFC4B6B8_my @ 0xFFC4B6B8 - 0xFFC4B8B4, length=128
 119 void __attribute__((naked,noinline)) sub_FFC4B6B8_my() {
 120 asm volatile (
 121 "    STMFD   SP!, {R4-R8,LR} \n"
 122 "    SUB     SP, SP, #0x40 \n"
 123 "    MOV     R6, #0 \n"
 124 "    LDR     R5, =0x5390 \n"
 125 "    MOV     R4, R0 \n"
 126 "    STR     R6, [SP, #0x30] \n"
 127 "    STR     R6, [SP, #0x28] \n"
 128 "    LDR     R0, [R5, #0x38] \n"
 129 "    MOV     R8, #4 \n"
 130 "    CMP     R0, #3 \n"
 131 "    STREQ   R8, [R5, #0x38] \n"
 132 "    LDR     R0, [R5, #0xA0] \n"
 133 "    BLX     R0 \n"
 134 "    LDR     R0, [R5, #0x38] \n"
 135 "    CMP     R0, #4 \n"
 136 "    BNE     loc_FFC4B790 \n"
 137 "    ADD     R3, SP, #0x28 \n"
 138 "    ADD     R2, SP, #0x2C \n"
 139 "    ADD     R1, SP, #0x30 \n"
 140 "    ADD     R0, SP, #0x34 \n"
 141 "    BL      sub_FFD144B8 \n"
 142 "    CMP     R0, #0 \n"
 143 "    MOV     R7, #1 \n"
 144 "    BNE     loc_FFC4B734 \n"
 145 "    LDR     R1, [R5, #0x28] \n"
 146 "    CMP     R1, #1 \n"
 147 "    BNE     loc_FFC4B798 \n"
 148 "    LDR     R1, [R5, #0x50] \n"
 149 "    LDR     R2, [R5, #0x3C] \n"
 150 "    CMP     R1, R2 \n"
 151 "    BCC     loc_FFC4B798 \n"
 152 
 153 "loc_FFC4B734:\n"
 154 "    CMP     R0, #0x80000001 \n"
 155 "    STREQ   R8, [R5, #0x54] \n"
 156 "    BEQ     loc_FFC4B76C \n"
 157 "    CMP     R0, #0x80000003 \n"
 158 "    STREQ   R7, [R5, #0x54] \n"
 159 "    BEQ     loc_FFC4B76C \n"
 160 "    CMP     R0, #0x80000005 \n"
 161 "    MOVEQ   R0, #2 \n"
 162 "    BEQ     loc_FFC4B768 \n"
 163 "    CMP     R0, #0x80000007 \n"
 164 "    STRNE   R6, [R5, #0x54] \n"
 165 "    BNE     loc_FFC4B76C \n"
 166 "    MOV     R0, #3 \n"
 167 
 168 "loc_FFC4B768:\n"
 169 "    STR     R0, [R5, #0x54] \n"
 170 
 171 "loc_FFC4B76C:\n"
 172 "    LDR     R0, =0x1861C \n"
 173 "    LDR     R0, [R0, #8] \n"
 174 "    CMP     R0, #0 \n"
 175 "    BEQ     loc_FFC4B784 \n"
 176 "    BL      sub_FFC36694 \n"
 177 "    B       loc_FFC4B788 \n"
 178 
 179 "loc_FFC4B784:\n"
 180 "    BL      sub_FFC4B1D8 \n"
 181 
 182 "loc_FFC4B788:\n"
 183 "    MOV     R0, #5 \n"
 184 "    STR     R0, [R5, #0x38] \n"
 185 
 186 "loc_FFC4B790:\n"
 187 "    ADD     SP, SP, #0x40 \n"
 188 "    LDMFD   SP!, {R4-R8,PC} \n"
 189 
 190 "loc_FFC4B798:\n"
 191 "    LDR     LR, [SP, #0x30] \n"
 192 "    CMP     LR, #0 \n"
 193 "    BEQ     loc_FFC4B860 \n"
 194 "    STR     R7, [R5, #0x2C] \n"
 195 "    LDR     R0, [R5, #0x6C] \n"
 196 "    LDR     R1, [R4, #0x14] \n"
 197 "    LDR     R2, [R4, #0x18] \n"
 198 "    LDR     R12, [R4, #0xC] \n"
 199 "    ADD     R3, SP, #0x38 \n"
 200 "    ADD     R8, SP, #0x14 \n"
 201 "    STMIA   R8, {R0-R3} \n"
 202 "    LDR     R3, [R5, #0x58] \n"
 203 "    ADD     R2, SP, #0x3C \n"
 204 "    ADD     R8, SP, #8 \n"
 205 "    LDRD    R0, [SP, #0x28] \n"
 206 "    STMIA   R8, {R0,R2,R3} \n"
 207 "    STR     R1, [SP, #4] \n"
 208 "    STR     LR, [SP] \n"
 209 "    LDMIB   R4, {R0,R1} \n"
 210 "    LDR     R3, [SP, #0x34] \n"
 211 "    MOV     R2, R12 \n"
 212 "    BL      sub_FFCD0014 \n"
 213 "    LDR     R0, [R5, #0x10] \n"
 214 "    MOV     R1, #0x3E8 \n"
 215 "    BL      _TakeSemaphore \n"
 216 "    CMP     R0, #9 \n"
 217 "    BNE     loc_FFC4B814 \n"
 218 "    BL      sub_FFD14A94 \n"
 219 "    MOV     R0, #0x90000 \n"
 220 "    STR     R7, [R5, #0x38] \n"
 221 "    B       loc_FFC4B82C \n"
 222 
 223 "loc_FFC4B814:\n"
 224 "    LDR     R0, [SP, #0x38] \n"
 225 "    CMP     R0, #0 \n"
 226 "    BEQ     loc_FFC4B834 \n"
 227 "    BL      sub_FFD14A94 \n"
 228 "    MOV     R0, #0xA0000 \n"
 229 "    STR     R7, [R5, #0x38] \n"
 230 
 231 "loc_FFC4B82C:\n"
 232 "    BL      sub_FFC623B8 /*_HardwareDefect_FW*/ \n"
 233 "    B       loc_FFC4B790 \n"
 234 
 235 "loc_FFC4B834:\n"
 236 "    BL      sub_FFCD00D8 \n"
 237 "    LDR     R0, [SP, #0x34] \n"
 238 "    LDR     R1, [SP, #0x3C] \n"
 239 "    BL      sub_FFD1483C \n"
 240 "    LDR     R0, [R5, #0x4C] \n"
 241 "    LDR     R1, =0x53FC \n"
 242 "    ADD     R0, R0, #1 \n"
 243 "    STR     R0, [R5, #0x4C] \n"
 244 "    LDR     R0, [SP, #0x3C] \n"
 245 "    MOV     R2, #0 \n"
 246 "    BL      sub_FFD126CC_my \n"  // --> Patched. Old value = 0xFFD126CC.
 247 
 248 "loc_FFC4B860:\n"
 249 "    LDR     R0, [R5, #0x50] \n"
 250 "    ADD     R0, R0, #1 \n"
 251 "    STR     R0, [R5, #0x50] \n"
 252 "    LDR     R1, [R5, #0x78] \n"
 253 "    MUL     R0, R1, R0 \n"
 254 "    LDR     R1, [R5, #0x74] \n"
 255 "    BL      sub_FFE683D0 /*__divmod_unsigned_int*/ \n"
 256 "    MOV     R4, R0 \n"
 257 "    BL      sub_FFD14ACC \n"
 258 "    LDR     R1, [R5, #0x70] \n"
 259 "    CMP     R1, R4 \n"
 260 "    BNE     loc_FFC4B89C \n"
 261 "    LDR     R0, [R5, #0x30] \n"
 262 "    CMP     R0, #1 \n"
 263 "    BNE     loc_FFC4B8B0 \n"
 264 
 265 "loc_FFC4B89C:\n"
 266 "    LDR     R1, [R5, #0x84] \n"
 267 "    MOV     R0, R4 \n"
 268 "    BLX     R1 \n"
 269 "    STR     R4, [R5, #0x70] \n"
 270 "    STR     R6, [R5, #0x30] \n"
 271 
 272 "loc_FFC4B8B0:\n"
 273 "    STR     R6, [R5, #0x2C] \n"
 274 "    B       loc_FFC4B790 \n"
 275 );
 276 }
 277 
 278 /*************************************************************/
 279 //** sub_FFD126CC_my @ 0xFFD126CC - 0xFFD127AC, length=57
 280 void __attribute__((naked,noinline)) sub_FFD126CC_my() {
 281 asm volatile (
 282 "    STMFD   SP!, {R4-R8,LR} \n"
 283 "    LDR     R4, =0x80EC \n"
 284 "    LDR     LR, [R4] \n"
 285 "    LDR     R2, [R4, #8] \n"
 286 "    CMP     LR, #0 \n"
 287 "    LDRNE   R3, [R4, #0xC] \n"
 288 "    MOV     R5, R2 \n"
 289 "    CMPNE   R3, #1 \n"
 290 "    MOVEQ   R2, #0 \n"
 291 "    STREQ   R0, [R4] \n"
 292 "    STREQ   R2, [R4, #0xC] \n"
 293 "    BEQ     loc_FFD12798 \n"
 294 "    LDR     R3, [R4, #4] \n"
 295 "    LDR     R7, =table\n"          // +
 296 "    LDR     R7, =0xFFE86C28 \n"
 297 "    ADD     R12, R3, R3, LSL#1 \n"
 298 "    LDR     R3, [R7, R12, LSL#2] \n"
 299 "    ADD     R6, R7, #0x30 \n"
 300 "    LDR     R8, [R6, R12, LSL#2] \n"
 301 "    SUB     R3, LR, R3 \n"
 302 "    CMP     R3, #0 \n"
 303 "    SUB     LR, LR, R8 \n"
 304 "    BLE     loc_FFD12754 \n"
 305 "    ADD     R12, R7, R12, LSL#2 \n"
 306 "    LDR     LR, [R12, #4] \n"
 307 "    CMP     LR, R3 \n"
 308 "    ADDGE   R2, R2, #1 \n"
 309 "    BGE     loc_FFD12748 \n"
 310 "    LDR     R12, [R12, #8] \n"
 311 "    CMP     R12, R3 \n"
 312 "    ADDLT   R2, R2, #3 \n"
 313 "    ADDGE   R2, R2, #2 \n"
 314 
 315 "loc_FFD12748:\n"
 316 "    CMP     R2, #0x1A \n"  // --> Patched. Old value = 0x17.
 317 "    MOVGE   R2, #0x19 \n"  // --> Patched. Old value = 0x16.
 318 "    B       loc_FFD12788 \n"
 319 
 320 "loc_FFD12754:\n"
 321 "    CMP     LR, #0 \n"
 322 "    BGE     loc_FFD12788 \n"
 323 "    ADD     R3, R6, R12, LSL#2 \n"
 324 "    LDR     R12, [R3, #4] \n"
 325 "    CMP     R12, LR \n"
 326 "    SUBLE   R2, R2, #1 \n"
 327 "    BLE     loc_FFD12780 \n"
 328 "    LDR     R3, [R3, #8] \n"
 329 "    CMP     R3, LR \n"
 330 "    SUBGT   R2, R2, #3 \n"
 331 "    SUBLE   R2, R2, #2 \n"
 332 
 333 "loc_FFD12780:\n"
 334 "    CMP     R2, #0 \n"
 335 "    MOVLT   R2, #0 \n"
 336 
 337 "loc_FFD12788:\n"
 338 "    CMP     R2, R5 \n"
 339 "    STRNE   R2, [R4, #8] \n"
 340 "    MOVNE   R2, #1 \n"
 341 "    STRNE   R2, [R4, #0xC] \n"
 342 
 343 "loc_FFD12798:\n"
 344 "    LDR     R2, =CompressionRateTable \n"  // --> Patched. Old value = 0xFFE86BCC.
 345 "    LDR     R3, [R4, #8] \n"
 346 "    LDR     R2, [R2, R3, LSL#2] \n"
 347 //mod start
 348 "    LDR     R3, =video_mode\n"         // +
 349 "    LDR     R3, [R3]\n"                // +
 350 "    LDR     R3, [R3]\n"                // +
 351 "    CMP     R3, #1\n"                  // +
 352 "    LDREQ   R3, =video_quality\n"      // +
 353 "    LDREQ   R3, [R3]\n"                // +
 354 "    LDREQ   R2, [R3]\n"                // +
 355 //mod end
 356 "    STR     R2, [R1] \n"
 357 "    STR     R0, [R4] \n"
 358 "    BL      mute_on_zoom\n"            // +
 359 "    LDMFD   SP!, {R4-R8,PC} \n"
 360 );
 361 }

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