source: branches/reyalp-ptp-live/platform/sx200is/sub/100c/lib.c @ 1706

Revision 1706, 3.0 KB checked in by reyalp, 15 months ago (diff)

integrate ptp live view related functions from old chdkcam patch found at http://ewavr.nm.ru/chdk/for_test/ note all are untested, not all firmwares of every camera done. Address related comments are copied from the patch, may be wrong
also comments + warning fix for a540

  • Property svn:eol-style set to native
Line 
1#include "platform.h"
2
3/*
4*********************
5SX200IS
6**********************
7note sensor size for camera.h is from
8@ FFAC8D6C
90x11CA240 = 18653760
1018653760/12 * 8 - 12435840 ---
11                              |
12@ FFAC8A40                    |
130xFF0 and 0xBE8 =             |
144080  *  3048  = 12435840  ---
15*/
16
17char *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
28long hook_raw_size()
29{
30        //found at FFAC8D6C
31        //ROM:FFAC8D6C                 LDR     R1, =0x11CA240
32        //ROM:FFAC8D70                 ADR     R0, aCrawBuffSizeP ; "CRAW BUFF SIZE  %p"
33        //ROM:FFAC8D74                 BL      sub_FF9037E8
34
35        return 0x11CA240;
36}
37
38// Live picture buffer (shoot not pressed)
39void *vid_get_viewport_live_fb()
40{
41    void **fb=(void **)0x2180;                               // 0x2150 or 0x2180 (suggested by ADamb)
42    unsigned char buff = *((unsigned char*)0x1FD8);          // found at FF838090
43    if (buff == 0) buff = 2;  else buff--;   
44    return fb[buff];
45}
46
47// OSD buffer
48void *vid_get_bitmap_fb()
49{
50        return (void*)0x403F1000;                              // found at FF842AC4 and FFA2BED4
51}
52
53// Live picture buffer (shoot half-pressed)
54void *vid_get_viewport_fb()
55{
56        return (void*)0x415F9E20;                              // found by search for VRAM Address @FFAC67F0
57}
58
59// Histo etc. when in play mode maybe ?
60void *vid_get_viewport_fb_d()
61{
62//      return (void*)(*(int*)(0x2950+0x50));                  // found at FF858A84 and FF859398 (0x58 at FF8594F0)
63        return (void*)(*(int*)(0x2950+0x58));                  // suggested by ADamb
64}
65
66
67int vid_get_viewport_width()
68{
69    return 360;                                               // stays at 360 as IN SD990
70}
71
72long vid_get_viewport_height()
73{
74    return 240;
75}
76
77char *camera_jpeg_count_str()
78{
79 return (void*)0x5408C;                                      // found at FF9C1F28
80}
81
82// PTP display stuff, untested, adapted from ewavr chdkcam patch
83// reyalp - type probably wrong, chdkcam patch suggests opposite order from a540 (e.g. vuya)
84int vid_get_palette_type() { return 2; }
85int vid_get_palette_size() { return 16*4; }
86
87void *vid_get_bitmap_active_palette() {
88    return (void *)*(unsigned int*)(0x5744+0x28); // FF8E6230
89}
90void *vid_get_bitmap_active_buffer()
91{
92    return (void*)(*(int*)(0x5744+0x14)); //"Add: %p Width : %ld Hight : %ld", FF8E62DC
93}
94// TODO value of vid_getviewport_height_proper needs to be checked in play, rec, and the different video modes
95//int vid_get_viewport_max_height()               { return 240; }
96
97// values from chdkcam patch
98// commented for now, protocol changes needed to handle correctly
99// note, play mode may be 704, needs to be tested
100#if 0
101int vid_get_viewport_width_proper() {
102    return ((mode_get()&MODE_MASK) == MODE_PLAY)?720:*(int*)0x2150; // VRAM W DataSize
103}
104int vid_get_viewport_height_proper() {
105    return ((mode_get()&MODE_MASK) == MODE_PLAY)?240:*(int*)(0x2150+4); // VRAM H DataSize
106}
107#endif
108
Note: See TracBrowser for help on using the repository browser.