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