This source file includes following definitions.
- camera_jpeg_count_str
- get_flash_params_count
- hook_raw_image_addr
- hook_alt_raw_image_addr
- vid_bitmap_refresh
- shutdown
- debug_led
- camera_set_led
- vid_get_bitmap_fb
- 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_height_proper
- vid_get_viewport_height
- vid_get_viewport_display_xoffset
- vid_get_viewport_yoffset
- vid_get_palette_type
- vid_get_palette_size
- vid_get_viewport_display_yoffset_proper
- vid_get_viewport_fullscreen_height
- vid_get_bitmap_active_palette
- vid_get_bitmap_active_buffer
- load_chdk_palette
1
2
3 #include "platform.h"
4 #include "platform_palette.h"
5 #include "lolevel.h"
6
7 extern int active_raw_buffer;
8 extern char* raw_buffers[];
9
10 char *camera_jpeg_count_str() { return (char*)0x00220be0; }
11 int get_flash_params_count(void) { return 0x91; }
12
13 char *hook_raw_image_addr()
14 {
15 return raw_buffers[active_raw_buffer];
16 }
17
18 char *hook_alt_raw_image_addr()
19 {
20 return raw_buffers[(active_raw_buffer^1)];
21 }
22
23 void vid_bitmap_refresh()
24 {
25 extern int full_screen_refresh;
26 extern void _ScreenUnlock();
27 extern void _ScreenLock();
28
29 full_screen_refresh |= 3;
30 _ScreenLock();
31 _ScreenUnlock();
32 }
33
34 void shutdown()
35 {
36 extern void _TurnOffE1(void);
37 _TurnOffE1();
38 while(1);
39 }
40
41
42 void debug_led(int state)
43 {
44 if ( state == 1 ) *(int*)0xc022c30c = ( (*(int*)0xc022c30c) & 0xffffffcf ) | 0x20 ;
45 else *(int*)0xc022c30c = ( (*(int*)0xc022c30c) & 0xffffffcf ) ;
46 }
47
48
49 void camera_set_led(int led, int state, __attribute__ ((unused))int bright)
50 {
51 static char led_table[3]={0,6,11};
52 _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
53 }
54
55
56 void *vid_get_bitmap_fb() { return (void*)0x406c5000; }
57 void *vid_get_viewport_fb() { return (void*)0x4081ab80; }
58
59 void *vid_get_viewport_fb_d()
60 {
61 extern char *viewport_fb_d;
62 return viewport_fb_d;
63 }
64
65 void *vid_get_viewport_live_fb()
66 {
67 extern char active_viewport_buffer;
68 extern void* viewport_buffers[];
69
70 if (camera_info.state.mode_video || is_video_recording() || camera_info.state.mode_shooting == MODE_FISHEYE)
71 return viewport_buffers[(active_viewport_buffer-1)&3];
72
73
74
75 return viewport_buffers[(active_viewport_buffer-1)&7];
76 }
77
78
79
80
81 int vid_get_viewport_yscale() {
82 if (camera_info.state.mode_play) {
83 return 2;
84 }
85 if(camera_info.state.mode_shooting == MODE_FISHEYE && !is_video_recording()) {
86 return 1;
87 }
88 return 2;
89 }
90
91 int vid_get_viewport_width()
92 {
93 if (camera_info.state.mode_play)
94 {
95 return 360;
96 }
97 extern int _GetVRAMHPixelsSize();
98 return _GetVRAMHPixelsSize() >> 1;
99 }
100
101 int vid_get_viewport_height_proper()
102 {
103 if (camera_info.state.mode_play)
104 {
105 return 480;
106 }
107 extern int _GetVRAMVPixelsSize();
108 return _GetVRAMVPixelsSize();
109
110 }
111
112
113 long vid_get_viewport_height()
114 {
115 return vid_get_viewport_height_proper() >> (vid_get_viewport_yscale()-1);
116 }
117
118
119 static long vp_xo[5] = { 0, 0, 0, 44 };
120
121
122
123
124 int vid_get_viewport_display_xoffset()
125 {
126 if (camera_info.state.mode_play || camera_info.state.mode_video || is_video_recording())
127 {
128 return 0;
129 }
130 return vp_xo[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
131 }
132
133
134
135 static long vp_yo[5] = { 0, 30, 13, 0 };
136
137 int vid_get_viewport_yoffset()
138 {
139 if (camera_info.state.mode_play)
140 {
141 return 0;
142 }
143 else if (camera_info.state.mode_video || is_video_recording())
144 {
145 if(shooting_get_prop(PROPCASE_VIDEO_RESOLUTION) == 2) {
146 return 0;
147 } else {
148 return 30;
149 }
150 }
151 else
152 {
153 return vp_yo[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
154 }
155 }
156
157
158
159
160
161
162 extern int active_palette_buffer;
163 extern int** palette_buffer_ptr;
164 extern char palette_control;
165
166
167
168 int vid_get_palette_type() { return 3; }
169 int vid_get_palette_size() { return 256 * 4; }
170 int vid_get_viewport_display_yoffset_proper() { return vid_get_viewport_display_yoffset() <<(vid_get_viewport_yscale()-1); }
171
172
173
174 int vid_get_viewport_fullscreen_height()
175 {
176 return 240<<(vid_get_viewport_yscale()-1);
177 }
178
179 void *vid_get_bitmap_active_palette() {
180 unsigned char theme;
181 get_parameter_data(20, &theme, 1);
182 void *p = palette_buffer_ptr[active_palette_buffer+theme];
183 if(p) {
184 p += 4;
185 }
186 return p;
187 }
188
189 void * vid_get_bitmap_active_buffer()
190 {
191 return (void*)(*(int*)(0x7510+0x18));
192 }
193
194 #ifdef CAM_LOAD_CUSTOM_COLORS
195
196
197
198 void load_chdk_palette()
199 {
200
201
202
203 if ( (active_palette_buffer == 0x00)
204 || (active_palette_buffer == 0x10))
205 {
206 int *pal = vid_get_bitmap_active_palette();
207
208 if ( (pal!=0)
209 && (pal[CHDK_COLOR_BASE+0] != 0x3F3ADF62)
210 && (pal[0x00]==0x00FF0000)
211 && (pal[0xFF]==0x3F000000) )
212 {
213 pal[CHDK_COLOR_BASE+0] = 0x3F3ADF62;
214 pal[CHDK_COLOR_BASE+1] = 0x3F26EA40;
215 pal[CHDK_COLOR_BASE+2] = 0x3F4CD57F;
216 pal[CHDK_COLOR_BASE+3] = 0x3F73BFAE;
217 pal[CHDK_COLOR_BASE+4] = 0x3F4BD6CA;
218 pal[CHDK_COLOR_BASE+5] = 0x3F95AB95;
219 pal[CHDK_COLOR_BASE+6] = 0x3F4766F0;
220 pal[CHDK_COLOR_BASE+7] = 0x3F1250F3;
221 pal[CHDK_COLOR_BASE+8] = 0x3F7F408F;
222 pal[CHDK_COLOR_BASE+9] = 0x3F512D5B;
223 pal[CHDK_COLOR_BASE+10] = 0x3FA9A917;
224 pal[CHDK_COLOR_BASE+11] = 0x3F819137;
225 pal[CHDK_COLOR_BASE+12] = 0x3FDED115;
226 pal[CHDK_COLOR_BASE+13] = 0x1F0A0000;
227
228 vid_bitmap_refresh();
229 }
230 }
231 }
232 #endif