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