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