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