This source file includes following definitions.
- vid_bitmap_refresh
- shutdown
- debug_led
- camera_set_led
- shutdown_soft
- get_flash_params_count
- JogDial_CW
- JogDial_CCW
- vid_get_viewport_fb
- vid_get_viewport_live_fb
- vid_get_viewport_width
- vid_get_viewport_height
- vid_get_viewport_yscale
- vid_get_viewport_yoffset
- vid_get_viewport_display_xoffset
- vid_get_viewport_display_yoffset
- vid_get_bitmap_fb
- 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
- load_chdk_palette
1 #include "platform.h"
2 #include "platform_palette.h"
3 #include "lolevel.h"
4
5 void vid_bitmap_refresh() {
6 extern int full_screen_refresh;
7 extern void _ScreenUnlock();
8 extern void _ScreenLock();
9
10 full_screen_refresh |= 3;
11 _ScreenLock();
12 _ScreenUnlock();
13 }
14
15 void shutdown() {
16 volatile long *p = (void*)0xC022001C;
17
18 asm(
19 "MRS R1, CPSR\n"
20 "AND R0, R1, #0x80\n"
21 "ORR R1, R1, #0x80\n"
22 "MSR CPSR_cf, R1\n"
23 :::"r1","r0"
24 );
25
26 *p = 0x44;
27
28 while(1);
29 }
30
31
32
33
34 void debug_led(__attribute__ ((unused))int state) {
35
36
37
38
39
40 }
41
42
43
44
45 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
46 static char led_table[2]={0,4};
47 _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
48 }
49
50 void shutdown_soft() {
51 _PostLogicalEventForNotPowerType(0x1005,0);
52 }
53
54 int get_flash_params_count(void) { return 0xa6; }
55
56
57
58
59 void JogDial_CW(void) {
60 _PostLogicalEventToUI(0x872, 1);
61 }
62
63 void JogDial_CCW(void) {
64 _PostLogicalEventToUI(0x873, 1);
65 }
66
67 extern char active_viewport_buffer;
68 extern void* viewport_buffers[];
69
70 void *vid_get_viewport_fb() {
71
72 return viewport_buffers[0];
73 }
74
75 void *vid_get_viewport_live_fb() {
76 if (MODE_IS_VIDEO(mode_get()) || is_video_recording())
77 return viewport_buffers[0];
78
79
80 return viewport_buffers[(active_viewport_buffer-1)&3];
81 }
82
83 int vid_get_viewport_width() {
84 if ((mode_get() & MODE_MASK) == MODE_PLAY) {
85 return 360;
86 }
87 extern int _GetVRAMHPixelsSize();
88 return _GetVRAMHPixelsSize() >> 1;
89 }
90
91 long vid_get_viewport_height() {
92 if ((mode_get() & MODE_MASK) == MODE_PLAY) {
93 return 240;
94 }
95 extern int _GetVRAMVPixelsSize();
96 return _GetVRAMVPixelsSize() >> 1;
97 }
98
99
100 int vid_get_viewport_yscale() {
101 return 2;
102 }
103
104 int vid_get_viewport_yoffset() {
105 if ((mode_get() & MODE_MASK) == MODE_PLAY) {
106 return 0;
107 } else if (shooting_get_prop(PROPCASE_SHOOTING_MODE) == 16909) {
108 return 0;
109 } else {
110
111
112 static long vp_h[4] = { 0, 30, 13, 0 };
113 return vp_h[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
114 }
115 }
116
117 int vid_get_viewport_display_xoffset() {
118 if ((mode_get() & MODE_MASK) == MODE_PLAY) {
119 return 0;
120 } else if (shooting_get_prop(PROPCASE_SHOOTING_MODE) == 16909) {
121 if (shooting_get_prop(PROPCASE_STITCH_DIRECTION) == 0)
122 if (shooting_get_prop(PROPCASE_STITCH_SEQUENCE) == 0)
123 return 40;
124 else
125 return 140;
126 else
127 if (shooting_get_prop(PROPCASE_STITCH_SEQUENCE) == 0)
128 return 140;
129 else
130 return 40;
131 } else {
132
133
134 static long vp_w[4] = { 0, 0, 0, 44 };
135 return vp_w[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
136 }
137 }
138
139 int vid_get_viewport_display_yoffset() {
140 if ((mode_get() & MODE_MASK) == MODE_PLAY) {
141 return 0;
142 } else if (shooting_get_prop(PROPCASE_SHOOTING_MODE) == 16909) {
143 return 72;
144 } else {
145
146
147 static long vp_h[4] = { 0, 30, 13, 0 };
148 return vp_h[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
149 }
150 }
151
152 extern int active_bitmap_buffer;
153 extern char* bitmap_buffer[];
154
155 void *vid_get_bitmap_fb() {
156
157 return bitmap_buffer[0];
158 }
159
160
161 int vid_get_viewport_display_xoffset_proper() { return vid_get_viewport_display_xoffset() * 2; }
162 int vid_get_viewport_display_yoffset_proper() { return vid_get_viewport_display_yoffset() * 2; }
163 int vid_get_viewport_height_proper() { return vid_get_viewport_height() * 2; }
164 int vid_get_viewport_fullscreen_height() { return 480; }
165 int vid_get_palette_type() { return 3; }
166 int vid_get_palette_size() { return 256 * 4; }
167
168 void *vid_get_bitmap_active_buffer() {
169 return bitmap_buffer[active_bitmap_buffer];
170 }
171
172 void *vid_get_bitmap_active_palette() {
173 extern int active_palette_buffer;
174 extern char* palette_buffer[];
175 void* p = palette_buffer[active_palette_buffer];
176
177 if (p) p += 4;
178 return p;
179 }
180
181
182 void load_chdk_palette()
183 {
184 extern int active_palette_buffer;
185
186
187 if ((active_palette_buffer == 0) || (active_palette_buffer == 5))
188 {
189 int *pal = (int*)vid_get_bitmap_active_palette();
190 if (pal && pal[CHDK_COLOR_BASE+0] != 0x33ADF62)
191 {
192 pal[CHDK_COLOR_BASE+0] = 0x33ADF62;
193 pal[CHDK_COLOR_BASE+1] = 0x326EA40;
194 pal[CHDK_COLOR_BASE+2] = 0x34CD57F;
195 pal[CHDK_COLOR_BASE+3] = 0x373BFAE;
196 pal[CHDK_COLOR_BASE+4] = 0x34BD6CA;
197 pal[CHDK_COLOR_BASE+5] = 0x395AB95;
198 pal[CHDK_COLOR_BASE+6] = 0x34766F0;
199 pal[CHDK_COLOR_BASE+7] = 0x31250F3;
200 pal[CHDK_COLOR_BASE+8] = 0x37F408F;
201 pal[CHDK_COLOR_BASE+9] = 0x3512D5B;
202 pal[CHDK_COLOR_BASE+10] = 0x3A9A917;
203 pal[CHDK_COLOR_BASE+11] = 0x3819137;
204 pal[CHDK_COLOR_BASE+12] = 0x3DED115;
205 pal[CHDK_COLOR_BASE+13] = 0x0090000;
206
207 extern char palette_control;
208 palette_control = 1;
209 vid_bitmap_refresh();
210 }
211 }
212 }