root/platform/sx200is/sub/100c/lib.c

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

DEFINITIONS

This source file includes following definitions.
  1. hook_raw_image_addr
  2. vid_get_viewport_live_fb
  3. vid_get_bitmap_fb
  4. vid_get_viewport_fb
  5. vid_get_viewport_fb_d
  6. vid_get_viewport_width
  7. vid_get_viewport_height
  8. camera_jpeg_count_str
  9. vid_get_palette_type
  10. vid_get_palette_size
  11. vid_get_bitmap_active_buffer
  12. vid_get_viewport_fullscreen_width
  13. vid_get_viewport_fullscreen_height
  14. vid_get_viewport_display_xoffset_proper
  15. vid_get_viewport_display_yoffset_proper

   1 #include "platform.h"
   2 
   3 /*
   4 *********************
   5 SX200IS
   6 **********************
   7 note sensor size for camera.h is from 
   8 @ FFAC8D6C
   9 0x11CA240 = 18653760
  10 18653760/12 * 8 - 12435840 ---
  11                               |
  12 @ FFAC8A40                    |
  13 0xFF0 and 0xBE8 =             |
  14 4080  *  3048  = 12435840  ---
  15 */
  16 
  17 char *hook_raw_image_addr()
  18 {
  19         //found at FFAC8D10
  20         //ROM:FFAC8D10                 LDR     R6, =0x424B41C0
  21         //...
  22         //ROM:FFAC8D60                 MOV     R1, R6
  23         //ROM:FFAC8D64                 ADR     R0, aCrawBuffP  ; "CRAW BUFF       %p"
  24 
  25         return (char*)(0x424B41C0);
  26 }
  27 
  28 // Live picture buffer (shoot not pressed)
  29 void *vid_get_viewport_live_fb()
  30 {
  31     void **fb=(void **)0x2180;                               // 0x2150 or 0x2180 (suggested by ADamb)
  32     unsigned char buff = *((unsigned char*)0x1FD8);          // found at FF838090
  33     if (buff == 0) buff = 2;  else buff--;    
  34     return fb[buff];
  35 }
  36 
  37 // OSD buffer
  38 void *vid_get_bitmap_fb()
  39 {
  40         return (void*)0x403F1000;                              // found at FF842AC4 and FFA2BED4
  41 }
  42 
  43 // Live picture buffer (shoot half-pressed)
  44 void *vid_get_viewport_fb()
  45 {
  46         return (void*)0x415F9E20;                              // found by search for VRAM Address @FFAC67F0
  47 }
  48 
  49 // Histo etc. when in play mode maybe ?
  50 void *vid_get_viewport_fb_d() 
  51 {
  52 //      return (void*)(*(int*)(0x2950+0x50));                  // found at FF858A84 and FF859398 (0x58 at FF8594F0)
  53         return (void*)(*(int*)(0x2950+0x58));                  // suggested by ADamb
  54 }
  55 
  56 
  57 int vid_get_viewport_width()
  58 {
  59     return 360;                                               // stays at 360 as IN SD990
  60 }
  61 
  62 long vid_get_viewport_height()
  63 {
  64     return 240;
  65 }
  66 
  67 char *camera_jpeg_count_str()
  68 {
  69  return (void*)0x5408C;                                      // found at FF9C1F28
  70 }
  71 
  72 // PTP display stuff
  73 int vid_get_palette_type() { return 3; }
  74 int vid_get_palette_size() { return 256*4; }
  75 
  76 /*void *vid_get_bitmap_active_palette() // used from load_chdk_palette
  77 {
  78     return (void *)*(unsigned int*)(0x5744+0x28);  //FF8E6198, FF8E6230
  79 }*/
  80 
  81 void *vid_get_bitmap_active_buffer()
  82 {
  83     return (void*)(*(int*)(0x5744+0x14)); //"Add: %p Width : %ld Hight : %ld", FF8E62DC
  84 }
  85 
  86 extern int _GetVRAMHPixelsSize();
  87 extern int _GetVRAMVPixelsSize();
  88 
  89 int vid_get_viewport_fullscreen_width() {
  90     int mode = mode_get()&MODE_MASK;
  91     int mode_shoot = mode_get()&MODE_SHOOTING_MASK;
  92     return ((mode == MODE_PLAY) ||
  93         (mode != MODE_PLAY && mode_shoot == MODE_STITCH))?720:_GetVRAMHPixelsSize();
  94 }
  95 
  96 int vid_get_viewport_fullscreen_height() {
  97     int mode = mode_get()&MODE_MASK;
  98     int mode_shoot = mode_get()&MODE_SHOOTING_MASK;
  99     return ((mode == MODE_PLAY) ||
 100         (mode != MODE_PLAY && mode_shoot == MODE_STITCH))?240:_GetVRAMVPixelsSize();
 101 }
 102 
 103 int vid_get_viewport_display_xoffset_proper() {
 104     int val=0;
 105     int mode = mode_get()&MODE_MASK;
 106     int mode_shoot = mode_get()&MODE_SHOOTING_MASK;
 107     if(mode != MODE_PLAY && mode_shoot == MODE_STITCH) {
 108         short dir=0;
 109         short seq=0;
 110         get_property_case(PROPCASE_STITCH_DIRECTION,&dir,sizeof(dir));
 111         get_property_case(PROPCASE_STITCH_SEQUENCE,&seq,sizeof(seq));
 112         // overall stitch window is 3/4 screen width, centered
 113         // live part is 1/2, so margin is either 1/8th or 3/8th
 114         if(dir==0) {
 115             val = seq?270:90;
 116         } else {
 117             val = seq?90:270;
 118         }
 119     }
 120     return val;
 121 }
 122 
 123 int vid_get_viewport_display_yoffset_proper() {
 124     int mode = mode_get()&MODE_MASK;
 125     int mode_shoot = mode_get()&MODE_SHOOTING_MASK;
 126     return (mode != MODE_PLAY && mode_shoot == MODE_STITCH)?70:0; // window is 120, not centered
 127 }

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