This source file includes following definitions.
- vid_bitmap_refresh
- shutdown
- debug_led
- camera_set_led
- camera_jpeg_count_str
- get_flash_params_count
- hook_raw_image_addr
- vid_get_viewport_width
- vid_get_viewport_height
- vid_get_bitmap_fb
- vid_get_viewport_fb
- vid_get_viewport_fb_d
- vid_get_viewport_live_fb
- 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 {
7 extern int full_screen_refresh;
8 extern void _ScreenLock();
9 extern void _ScreenUnlock();
10
11 full_screen_refresh |= 3;
12 _ScreenLock();
13 _ScreenUnlock();
14 }
15
16
17 void shutdown()
18 {
19 extern void _TurnOffE1(void);
20 _TurnOffE1();
21 while(1);
22 }
23
24 #define LED_PR 0xC022D1FC
25 #define LED_AF 0xC022D200
26
27 void debug_led(int state)
28 {
29
30
31 *(int*)LED_PR=state ? 0x46 : 0x44;
32 }
33
34
35
36
37 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
38 static char led_table[2]={0,4};
39 _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
40 }
41
42 char *camera_jpeg_count_str()
43 {
44 extern char jpeg_count_str[];
45 return jpeg_count_str;
46 }
47
48 int get_flash_params_count(void) { return 0xa6; }
49 char *hook_raw_image_addr() {return (char*) 0x43717e20;}
50
51
52 extern int _GetVRAMHPixelsSize();
53 extern int _GetVRAMVPixelsSize();
54
55 int vid_get_viewport_width()
56 {
57 if (camera_info.state.mode_play)
58 {
59 return 360;
60 }
61 return _GetVRAMHPixelsSize() >> 1;
62 }
63
64 long vid_get_viewport_height()
65 {
66 extern int _GetVideoOutType(void);
67 int vot = _GetVideoOutType();
68 if (camera_info.state.mode_play)
69 {
70 if(vot == 2) {
71 return 288;
72 }
73 return 240;
74 }
75 return _GetVRAMVPixelsSize();
76 }
77
78
79
80
81
82
83
84 void *vid_get_bitmap_fb() { return (void*)0x406f1000; }
85
86
87
88
89 void *vid_get_viewport_fb() { return (void*)0x40846b80; }
90
91 void *vid_get_viewport_fb_d()
92 {
93 extern char *viewport_fb_d;
94 return viewport_fb_d;
95 }
96
97 void *vid_get_viewport_live_fb()
98 {
99 extern char active_viewport_buffer;
100 extern void* viewport_buffers[];
101
102
103 return viewport_buffers[(active_viewport_buffer-1)&3];
104 }
105
106 int vid_get_palette_type() { return 3; }
107 int vid_get_palette_size() { return 256 * 4; }
108
109 void *vid_get_bitmap_active_buffer()
110 {
111 return vid_get_bitmap_fb();
112 }
113
114 void *vid_get_bitmap_active_palette()
115 {
116 extern int active_palette_buffer;
117 extern int** palette_buffer_ptr;
118 int *p = palette_buffer_ptr[active_palette_buffer];
119
120
121 if(!p) {
122 p = palette_buffer_ptr[0];
123 if(!p) {
124 return (void *)0;
125 }
126 }
127 return (p+1);
128 }
129
130
131 void load_chdk_palette()
132 {
133 extern int active_palette_buffer;
134
135
136 if ((active_palette_buffer == 0) || (active_palette_buffer == 5))
137 {
138 int *pal = (int*)vid_get_bitmap_active_palette();
139 if (pal && pal[CHDK_COLOR_BASE+0] != 0x33ADF62)
140 {
141 pal[CHDK_COLOR_BASE+0] = 0x33ADF62;
142 pal[CHDK_COLOR_BASE+1] = 0x326EA40;
143 pal[CHDK_COLOR_BASE+2] = 0x34CD57F;
144 pal[CHDK_COLOR_BASE+3] = 0x373BFAE;
145 pal[CHDK_COLOR_BASE+4] = 0x34BD6CA;
146 pal[CHDK_COLOR_BASE+5] = 0x395AB95;
147 pal[CHDK_COLOR_BASE+6] = 0x34766F0;
148 pal[CHDK_COLOR_BASE+7] = 0x31250F3;
149 pal[CHDK_COLOR_BASE+8] = 0x37F408F;
150 pal[CHDK_COLOR_BASE+9] = 0x3512D5B;
151 pal[CHDK_COLOR_BASE+10] = 0x3A9A917;
152 pal[CHDK_COLOR_BASE+11] = 0x3819137;
153 pal[CHDK_COLOR_BASE+12] = 0x3DED115;
154 pal[CHDK_COLOR_BASE+13] = 0x1F0A0000;
155
156 extern char palette_control;
157 palette_control = 1;
158 vid_bitmap_refresh();
159 }
160 }
161 }
162