This source file includes following definitions.
- hook_raw_image_addr
- hook_alt_raw_image_addr
- camera_jpeg_count_str
- vid_bitmap_refresh
- shutdown
- debug_led
- camera_set_led
- get_flash_params_count
- vid_get_viewport_fb
- vid_get_viewport_fb_d
- vid_get_viewport_live_fb
- vid_get_viewport_yscale
- vid_get_viewport_width
- vid_get_viewport_width_proper
- vid_get_viewport_fulllscreen_width
- vid_get_viewport_height
- vid_get_viewport_height_proper
- vid_get_viewport_fullscreen_height
- vid_get_viewport_display_xoffset
- vid_get_viewport_display_xoffset_proper
- vid_get_viewport_display_yoffset_proper
- vid_get_palette_type
- vid_get_palette_size
- vid_get_bitmap_fb
- vid_get_bitmap_active_buffer
- vid_get_bitmap_active_palette
- load_chdk_palette
- camera_jpeg_current_filename
- camera_jpeg_current_gps
1 #include "platform.h"
2 #include "platform_palette.h"
3 #include "lolevel.h"
4
5 extern int active_raw_buffer;
6 extern char* raw_buffers[];
7
8 char *hook_raw_image_addr()
9 {
10 return raw_buffers[active_raw_buffer];
11 }
12
13 char *hook_alt_raw_image_addr()
14 {
15 return raw_buffers[active_raw_buffer^1];
16 }
17
18 char *camera_jpeg_count_str()
19 {
20 extern char jpeg_count_str[];
21 return jpeg_count_str;
22 }
23
24 void vid_bitmap_refresh()
25 {
26 extern int full_screen_refresh;
27 extern void _ScreenUnlock();
28 extern void _ScreenLock();
29
30 _ScreenLock();
31 full_screen_refresh |= 3;
32 _ScreenUnlock();
33 }
34
35 #define GREEN_LED 0xC0220130
36 #define AF_LED 0xC0223030
37 void shutdown()
38 {
39 extern void _TurnOffE1(void);
40 _TurnOffE1();
41 while(1);
42 }
43
44
45 void debug_led(int state) {
46
47
48
49 *(int*)GREEN_LED=state ? 0x46 : 0x44;
50 }
51
52
53
54
55
56 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
57 static char led_table[]={0,4};
58 _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
59 }
60
61 int get_flash_params_count(void) {
62 return 0xA6;
63 }
64
65
66
67
68
69 extern char active_viewport_buffer;
70 extern void* viewport_buffers[];
71
72 void *vid_get_viewport_fb()
73 {
74
75 return viewport_buffers[0];
76 }
77
78 void *vid_get_viewport_fb_d()
79 {
80 extern char *viewport_fb_d;
81 return viewport_fb_d;
82 }
83
84 void *vid_get_viewport_live_fb()
85 {
86 if (MODE_IS_VIDEO(mode_get()))
87 return viewport_buffers[0];
88
89
90 return viewport_buffers[(active_viewport_buffer-1)&3];
91 }
92
93
94 int vid_get_viewport_yscale() {
95 return 2;
96 }
97
98 extern int _GetVRAMHPixelsSize();
99 extern int _GetVRAMVPixelsSize();
100
101 int vid_get_viewport_width()
102 {
103 return 720;
104 }
105
106 int vid_get_viewport_width_proper() {
107 return ((mode_get()&MODE_MASK) == MODE_PLAY)?720:_GetVRAMHPixelsSize();
108 }
109
110 int vid_get_viewport_fulllscreen_width()
111 {
112 return 720;
113 }
114
115 long vid_get_viewport_height()
116 {
117 return 480;
118 }
119
120 int vid_get_viewport_height_proper()
121 {
122 int m = mode_get();
123 int aspect_ratio=shooting_get_prop(PROPCASE_ASPECT_RATIO);
124
125 if (MODE_IS_VIDEO(m) || is_video_recording())
126 return 240;
127
128 if ((m & MODE_MASK) != MODE_PLAY) {
129
130
131
132
133
134 if (aspect_ratio==1 || aspect_ratio==2)
135 return 480;
136 }
137 return ((m & MODE_MASK) == MODE_PLAY)?480:_GetVRAMVPixelsSize();
138 }
139
140 int vid_get_viewport_fullscreen_height()
141 {
142 return vid_get_viewport_height_proper();
143 }
144
145
146
147 static long vp_xo[4] = { 0, 0, 0, 44 };
148
149 int vid_get_viewport_display_xoffset()
150 {
151 int m = mode_get();
152 int aspect_ratio=shooting_get_prop(PROPCASE_ASPECT_RATIO);
153
154 if ((m & MODE_MASK) != MODE_PLAY) {
155 return (vp_xo[aspect_ratio]);
156 }
157 else
158 return 0;
159 }
160
161
162 int vid_get_viewport_display_xoffset_proper() { return vid_get_viewport_display_xoffset()<<1; }
163 int vid_get_viewport_display_yoffset_proper() { return vid_get_viewport_display_yoffset()<<1; }
164
165 int vid_get_palette_type() { return 3; }
166 int vid_get_palette_size() { return 256 * 4; }
167
168 extern int active_bitmap_buffer;
169 extern char* bitmap_buffer[];
170
171 void *vid_get_bitmap_fb() {
172
173 return bitmap_buffer[0];
174 }
175
176 void *vid_get_bitmap_active_buffer() {
177 return bitmap_buffer[active_bitmap_buffer];
178 }
179
180 #ifdef CAM_LOAD_CUSTOM_COLORS
181 void *vid_get_bitmap_active_palette() {
182 extern int active_palette_buffer;
183 extern char* palette_buffer[];
184 void* p = palette_buffer[active_palette_buffer];
185
186 if (p) p += 4;
187 return p;
188 }
189
190
191 void load_chdk_palette()
192 {
193 extern int active_palette_buffer;
194
195
196 if ((active_palette_buffer == 0) || (active_palette_buffer == 5))
197 {
198 int *pal = (int*)vid_get_bitmap_active_palette();
199 if (pal && pal[CHDK_COLOR_BASE+0] != 0x33ADF62)
200 {
201 pal[CHDK_COLOR_BASE+0] = 0x33ADF62;
202 pal[CHDK_COLOR_BASE+1] = 0x326EA40;
203 pal[CHDK_COLOR_BASE+2] = 0x34CD57F;
204 pal[CHDK_COLOR_BASE+3] = 0x373BFAE;
205 pal[CHDK_COLOR_BASE+4] = 0x34BD6CA;
206 pal[CHDK_COLOR_BASE+5] = 0x395AB95;
207 pal[CHDK_COLOR_BASE+6] = 0x34766F0;
208 pal[CHDK_COLOR_BASE+7] = 0x31250F3;
209 pal[CHDK_COLOR_BASE+8] = 0x37F408F;
210 pal[CHDK_COLOR_BASE+9] = 0x3512D5B;
211 pal[CHDK_COLOR_BASE+10] = 0x3A9A917;
212 pal[CHDK_COLOR_BASE+11] = 0x3819137;
213 pal[CHDK_COLOR_BASE+12] = 0x3DED115;
214
215 extern char palette_control;
216 palette_control = 1;
217 vid_bitmap_refresh();
218 }
219 }
220 }
221 #endif
222
223
224 char *camera_jpeg_current_filename() {
225 return (void*)0xBD06C;
226 }
227
228 char *camera_jpeg_current_gps() {
229 return (void*)0xBD0E0;
230 }