This source file includes following definitions.
- hook_raw_image_addr
- hook_alt_raw_image_addr
- camera_jpeg_count_str
- vid_bitmap_refresh
- shutdown
- vid_get_bitmap_fb
- get_flash_params_count
- debug_led
- camera_set_led
- 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_fulllscreen_width
- vid_get_viewport_height
- vid_get_viewport_display_xoffset
- vid_get_viewport_display_xoffset_proper
- vid_get_viewport_display_yoffset_proper
- vid_get_viewport_height_proper
- vid_get_viewport_fullscreen_height
- vid_get_palette_type
- vid_get_palette_size
- vid_get_bitmap_active_palette
- load_chdk_palette
- JogDial_CW
- JogDial_CCW
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 _ScreenLock();
28 extern void _ScreenUnlock();
29
30 full_screen_refresh |= 3;
31 _ScreenLock();
32 _ScreenUnlock();
33 }
34
35 #define LED_PR 0xC022302C
36 #define AF_LED 0xC0223030
37 void shutdown()
38 {
39 extern void _TurnOffE1(void);
40 _TurnOffE1();
41 while(1);
42 }
43
44 void *vid_get_bitmap_fb() { return (void*)0x406f1000; }
45 int get_flash_params_count(void) { return 0x99; }
46
47
48 void debug_led(int state)
49 {
50 volatile long *p=(void*)LED_PR;
51 if (state)
52 p[0]=0x46;
53 else
54 p[0]=0x44;
55 }
56
57 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
58 static char led_table[]={0,12};
59 _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
60 }
61
62 extern char active_viewport_buffer;
63 extern void* viewport_buffers[];
64
65 void *vid_get_viewport_fb()
66 {
67
68 return viewport_buffers[0];
69 }
70
71 void *vid_get_viewport_fb_d()
72 {
73 extern char *viewport_fb_d;
74 return viewport_fb_d;
75 }
76
77 void *vid_get_viewport_live_fb()
78 {
79 if (MODE_IS_VIDEO(mode_get()) || is_video_recording())
80 return viewport_buffers[0];
81
82
83
84 return viewport_buffers[(active_viewport_buffer-1)&3];
85 }
86
87
88 int vid_get_viewport_yscale() {
89 return 2;
90 }
91
92 int vid_get_viewport_width()
93 {
94 if (camera_info.state.mode_play)
95 {
96 return 360;
97 }
98 extern int _GetVRAMHPixelsSize();
99 return _GetVRAMHPixelsSize() >> 1;
100 }
101
102 int vid_get_viewport_fulllscreen_width()
103 {
104 return 720;
105 }
106
107 long vid_get_viewport_height()
108 {
109
110 int m = mode_get();
111 int aspect_ratio=shooting_get_prop(PROPCASE_ASPECT_RATIO);
112
113 if (MODE_IS_VIDEO(m) || is_video_recording())
114 return 240;
115
116 if ((m & MODE_MASK) != MODE_PLAY)
117 {
118
119 if (aspect_ratio==1 || aspect_ratio==2)
120 return 240;
121 }
122 extern int _GetVRAMVPixelsSize();
123 return ((m & MODE_MASK) == MODE_PLAY)?240:_GetVRAMVPixelsSize()>>1;
124 }
125
126
127
128 static long vp_xo[4] = { 0, 0, 0, 44 };
129
130 int vid_get_viewport_display_xoffset()
131 {
132 int m = mode_get();
133 int aspect_ratio=shooting_get_prop(PROPCASE_ASPECT_RATIO);
134
135 if ((m & MODE_MASK) != MODE_PLAY) {
136 return (vp_xo[aspect_ratio]);
137 }
138 else
139 return 0;
140 }
141
142 int vid_get_viewport_display_xoffset_proper() { return vid_get_viewport_display_xoffset()<<1; }
143 int vid_get_viewport_display_yoffset_proper() { return vid_get_viewport_display_yoffset()<<1; }
144 int vid_get_viewport_height_proper() { return vid_get_viewport_height() * 2; }
145 int vid_get_viewport_fullscreen_height() { return 480; }
146 int vid_get_palette_type() { return 3; }
147 int vid_get_palette_size() { return 256 * 4; }
148
149
150 #ifdef CAM_LOAD_CUSTOM_COLORS
151 void *vid_get_bitmap_active_palette()
152 {
153 extern int active_palette_buffer;
154 extern int** palette_buffer_ptr;
155 int *p = palette_buffer_ptr[active_palette_buffer];
156
157
158 if(!p) {
159 p = palette_buffer_ptr[0];
160 }
161 return (p+1);
162 }
163
164
165 void load_chdk_palette()
166 {
167 extern int active_palette_buffer;
168
169 if ((active_palette_buffer == 0) || (active_palette_buffer == 5))
170 {
171 int *pal = (int*)vid_get_bitmap_active_palette();
172 if (pal[CHDK_COLOR_BASE+0] != 0x3F3ADF62)
173 {
174 pal[CHDK_COLOR_BASE+0] = 0x3F3ADF62;
175 pal[CHDK_COLOR_BASE+1] = 0x3F26EA40;
176 pal[CHDK_COLOR_BASE+2] = 0x3F4CD57F;
177 pal[CHDK_COLOR_BASE+5] = 0x3F73BFAE;
178 pal[CHDK_COLOR_BASE+6] = 0x3F4BD6CA;
179 pal[CHDK_COLOR_BASE+7] = 0x3F95AB95;
180 pal[CHDK_COLOR_BASE+8] = 0x3F4766F0;
181 pal[CHDK_COLOR_BASE+9] = 0x3F1250F3;
182 pal[CHDK_COLOR_BASE+10] = 0x3F7F408F;
183 pal[CHDK_COLOR_BASE+11] = 0x3F512D5B;
184 pal[CHDK_COLOR_BASE+12] = 0x3FA9A917;
185 pal[CHDK_COLOR_BASE+13] = 0x3F819137;
186 pal[CHDK_COLOR_BASE+14] = 0x3FDED115;
187
188 extern char palette_control;
189 palette_control = 1;
190 vid_bitmap_refresh();
191 }
192 }
193 }
194 #endif
195
196 void JogDial_CW(void)
197 {
198 _PostLogicalEventToUI(0x872, 1);
199 }
200
201 void JogDial_CCW(void)
202 {
203 _PostLogicalEventToUI(0x873, 1);
204 }