This source file includes following definitions.
- vid_bitmap_refresh
- vid_get_bitmap_fb
- vid_get_bitmap_active_buffer
- vid_get_opacity_active_buffer
- camera_jpeg_count_str
- shutdown
- _Restart
- debug_led
- camera_set_led
- shutdown_soft
- get_flash_params_count
- JogDial_CW
- JogDial_CCW
- hook_raw_image_addr
- vid_get_viewport_fb_d
- vid_get_viewport_fb
- vid_get_viewport_live_fb
- vid_get_viewport_width
- vid_get_viewport_height
- vid_get_viewport_byte_width
- vid_get_viewport_display_xoffset
- vid_get_viewport_display_yoffset
- vid_get_viewport_display_xoffset_proper
- vid_get_viewport_display_yoffset_proper
- vid_get_viewport_fullscreen_width
- vid_get_viewport_fullscreen_height
- vid_get_viewport_buffer_width_proper
- vid_get_viewport_type
- vid_get_aspect_ratio
- update_ui
1
2 #include "platform.h"
3 #include "lolevel.h"
4 #include "live_view.h"
5 #include "levent.h"
6
7
8 int zoom_status;
9
10 extern int active_bitmap_buffer;
11 extern char* bitmap_buffer[];
12
13 void vid_bitmap_refresh()
14 {
15 extern void _transfer_src_overlay(int);
16 extern void _VTMLock();
17 extern void _VTMUnlock();
18 _VTMLock();
19 int n = active_bitmap_buffer;
20 _transfer_src_overlay(n^1);
21 _transfer_src_overlay(n);
22 _VTMUnlock();
23 }
24
25 void *vid_get_bitmap_fb()
26 {
27
28 return bitmap_buffer[0];
29 }
30
31 void *vid_get_bitmap_active_buffer()
32 {
33
34 return bitmap_buffer[active_bitmap_buffer];
35 }
36
37
38 extern void *opacity_buffer[];
39
40 void *vid_get_opacity_active_buffer()
41 {
42 return opacity_buffer[active_bitmap_buffer];
43 }
44
45 char *camera_jpeg_count_str()
46 {
47 extern char jpeg_count_str[];
48 return jpeg_count_str;
49 }
50
51 void shutdown()
52 {
53 debug_led(1);
54 PostLogicalEventForNotPowerType(levent_id_for_name("PressPowerButton"),0);
55 while(1) msleep(100);
56 }
57
58 void _Restart(__attribute__ ((unused))unsigned option)
59 {
60
61 _reboot_fw_update("A/PS.FI2");
62 }
63
64 #define LED_PR 0xd20b0994
65
66 void debug_led(int state) {
67 volatile long *p = (void*) LED_PR;
68 *p = ((state) ? 0x4d0002 : 0x4c0003);
69 }
70
71
72
73 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
74 static char led_table[2] = { 0, 4 };
75 _LEDDrive(led_table[led % sizeof(led_table)], state <= 1 ? !state : state);
76 }
77
78
79 void shutdown_soft()
80 {
81 _PostLogicalEventForNotPowerType(0x1005, 0);
82 }
83
84
85 int get_flash_params_count(void)
86 {
87 return 241;
88 }
89
90
91 void JogDial_CW(void)
92 {
93 _PostLogicalEventToUI(0x872, 1);
94 }
95
96
97 void JogDial_CCW(void)
98 {
99 _PostLogicalEventToUI(0x873, 1);
100 }
101
102
103 extern char* current_raw_addr;
104
105 char *hook_raw_image_addr()
106 {
107
108
109
110
111 return current_raw_addr;
112 }
113
114
115
116
117
118
119 extern void* _GetActiveViewportBuffer();
120
121 void *vid_get_viewport_fb_d()
122 {
123 return _GetActiveViewportBuffer();
124 }
125
126 void *vid_get_viewport_fb()
127 {
128 return _GetActiveViewportBuffer();
129 }
130
131 void *vid_get_viewport_live_fb()
132 {
133 return _GetActiveViewportBuffer();
134 }
135
136 extern int displaytype;
137 #define evf_out (displaytype == 11)
138 #define hdmi_out ((displaytype == 6) || (displaytype == 7))
139
140 int vid_get_viewport_width()
141 {
142 if (camera_info.state.mode_play)
143 {
144 if (hdmi_out) return 1920;
145 if (evf_out) return 1024;
146 return 720;
147 }
148 extern int _GetVRAMHPixelsSize();
149 return _GetVRAMHPixelsSize();
150 }
151
152 long vid_get_viewport_height()
153 {
154 if (camera_info.state.mode_play)
155 {
156 if (hdmi_out) return 1080;
157 if (evf_out) return 768;
158 return 480;
159 }
160 extern int _GetVRAMVPixelsSize();
161 return _GetVRAMVPixelsSize();
162 }
163
164 int vid_get_viewport_byte_width()
165 {
166 return vid_get_viewport_buffer_width_proper()*2;
167 }
168
169 int vid_get_viewport_display_xoffset()
170 {
171
172
173 static long vp_xo[5] = { 40, 0, 0, 120};
174 static long vp_xo_hdmi[5] = { 240, 0, 150, 420};
175
176 if (camera_info.state.mode_play)
177 {
178 return 0;
179 }
180 else if (camera_info.state.mode_video)
181 {
182 if (shooting_get_prop(PROPCASE_VIDEO_RESOLUTION) == 2)
183 return 40;
184 return 0;
185 }
186 else
187 {
188 if (hdmi_out)
189 return vp_xo_hdmi[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
190 return vp_xo[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
191 }
192 }
193
194 int vid_get_viewport_display_yoffset()
195 {
196
197
198 static long vp_yo[5] = { 0, 38, 0, 0 };
199
200 if (camera_info.state.mode_play)
201 {
202 return 0;
203 }
204 else if (camera_info.state.mode_video)
205 {
206 if (shooting_get_prop(PROPCASE_VIDEO_RESOLUTION) == 2)
207 return 0;
208 return 38;
209 }
210 else
211 {
212 if (hdmi_out)
213 return 0;
214 return vp_yo[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
215 }
216 }
217
218
219 int vid_get_viewport_display_xoffset_proper() { return vid_get_viewport_display_xoffset(); }
220 int vid_get_viewport_display_yoffset_proper() { return vid_get_viewport_display_yoffset(); }
221 int vid_get_viewport_fullscreen_width()
222 {
223 if (hdmi_out) return 1920;
224 if (evf_out) return 1024;
225 return 720;
226 }
227 int vid_get_viewport_fullscreen_height()
228 {
229 if (hdmi_out) return 1080;
230 if (evf_out) return 768;
231 return 480;
232 }
233 int vid_get_viewport_buffer_width_proper()
234 {
235 if (hdmi_out) return 1920;
236 if (evf_out) return 1024;
237 return 736;
238 }
239 int vid_get_viewport_type() { return LV_FB_YUV8B; }
240 int vid_get_aspect_ratio()
241 {
242 if (hdmi_out) return LV_ASPECT_16_9;
243 if (evf_out) return LV_ASPECT_4_3;
244 return LV_ASPECT_3_2;
245 }
246
247 int display_needs_refresh = 0;
248
249
250 typedef struct {
251 unsigned short unk1[6];
252 unsigned short color_type;
253 unsigned short visibility;
254 unsigned short unk2;
255 unsigned short src_y;
256 unsigned short src_x;
257 unsigned short src_h;
258 unsigned short src_w;
259 unsigned short dst_y;
260 unsigned short dst_x;
261 unsigned short enabled;
262 unsigned int marv_sig;
263 unsigned int bitmap;
264 unsigned int opacity;
265 unsigned int color;
266 unsigned int width;
267 unsigned int height;
268 unsigned int unk3;
269 } ximr_layer;
270
271
272 typedef struct {
273 unsigned int unk1[14];
274 int buffer_width;
275 int buffer_height;
276 unsigned int unk2[2];
277 ximr_layer layers[8];
278 unsigned int unk3[26];
279 short width;
280 short height;
281 unsigned int unk4[27];
282 } ximr_context;
283
284
285
286
287
288
289
290
291
292
293
294 void update_ui(ximr_context* ximr)
295 {
296
297 extern unsigned char* hdmi_buffer_check_adr;
298 if ((ximr->layers[0].color_type == 0x0500) || (ximr->layers[0].bitmap == (unsigned int)&hdmi_buffer_check_adr))
299 {
300
301 if (camera_screen.buffer_width != ximr->buffer_width)
302 {
303 camera_screen.width = ximr->width;
304 camera_screen.height = ximr->height;
305 camera_screen.buffer_width = ximr->buffer_width;
306 camera_screen.buffer_height = ximr->buffer_height;
307
308
309 camera_screen.disp_right = camera_screen.width - 1;
310 camera_screen.disp_width = camera_screen.width;
311
312
313 camera_screen.physical_width = camera_screen.width;
314 camera_screen.size = camera_screen.width * camera_screen.height;
315 camera_screen.buffer_size = camera_screen.buffer_width * camera_screen.buffer_height;
316 }
317
318
319 display_needs_refresh = 1;
320 }
321 }