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_width
- vid_get_viewport_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
24 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
25 static char led_table[2]={0,4};
26 if(state<=1) _LEDDrive(led_table[led%sizeof(led_table)], (!state)&1);
27 }
28
29
30 void *vid_get_viewport_fb() { return (void*)0x40846b80; }
31
32 char *camera_jpeg_count_str() { return (char*)0x000d5168; }
33
34 int get_flash_params_count(void) { return 0xa6; }
35
36 extern int active_bitmap_buffer;
37 extern char* bitmap_buffer[];
38
39 void *vid_get_bitmap_fb() {
40 return bitmap_buffer[0];
41 }
42
43 void *vid_get_bitmap_active_buffer() {
44 return bitmap_buffer[active_bitmap_buffer&1];
45 }
46
47
48 void *vid_get_bitmap_active_palette()
49 {
50 extern int active_palette_buffer;
51 extern int** palette_buffer_ptr;
52 int *p = palette_buffer_ptr[active_palette_buffer];
53 if(!p) {
54 p = palette_buffer_ptr[0];
55 }
56 return (p+1);
57 }
58
59 extern int _GetVRAMHPixelsSize();
60 extern int _GetVRAMVPixelsSize();
61
62
63 int vid_get_viewport_width()
64 {
65 if ((mode_get() & MODE_MASK) == MODE_PLAY)
66 {
67 return 360;
68 }
69 return _GetVRAMHPixelsSize() >> 1;
70 }
71
72 long vid_get_viewport_height()
73 {
74 if ((mode_get() & MODE_MASK) == MODE_PLAY)
75 {
76 return 240;
77 }
78 return _GetVRAMVPixelsSize();
79 }
80
81 void *vid_get_viewport_fb_d()
82 {
83 extern char *viewport_fb_d;
84 return viewport_fb_d;
85 }
86
87 void *vid_get_viewport_live_fb()
88 {
89 extern char active_viewport_buffer;
90 extern void* viewport_buffers[];
91
92
93
94 return viewport_buffers[(active_viewport_buffer-1)&3];
95 }
96
97 char *hook_raw_image_addr()
98 {
99 return (char*) 0x42f95130;
100 }
101
102 void vid_bitmap_refresh()
103 {
104 extern int full_screen_refresh;
105 extern void _ScreenLock();
106 extern void _ScreenUnlock();
107
108 full_screen_refresh |= 3;
109 _ScreenLock();
110 _ScreenUnlock();
111 }
112
113 int vid_get_palette_type() { return 5; }
114 int vid_get_palette_size() { return 256 * 4 ; }
115
116 #ifdef CAM_LOAD_CUSTOM_COLORS
117
118 void load_chdk_palette()
119 {
120 extern int active_palette_buffer;
121
122 if ((active_palette_buffer == 0) || (active_palette_buffer == 5))
123 {
124 int *pal = (int*)vid_get_bitmap_active_palette();
125
126
127 if (pal[CHDK_COLOR_BASE+0] != 0x3F3ADF62)
128 {
129 pal[CHDK_COLOR_BASE+0] = 0x3F3ADF62;
130 pal[CHDK_COLOR_BASE+1] = 0x3F26EA40;
131 pal[CHDK_COLOR_BASE+2] = 0x3F4CD57F;
132 pal[CHDK_COLOR_BASE+3] = 0x3F73BFAE;
133 pal[CHDK_COLOR_BASE+4] = 0x3F4BD6CA;
134 pal[CHDK_COLOR_BASE+5] = 0x3F95AB95;
135 pal[CHDK_COLOR_BASE+6] = 0x3F4766F0;
136 pal[CHDK_COLOR_BASE+7] = 0x3F1250F3;
137 pal[CHDK_COLOR_BASE+8] = 0x3F7F408F;
138 pal[CHDK_COLOR_BASE+9] = 0x3F512D5B;
139 pal[CHDK_COLOR_BASE+10] = 0x3FA9A917;
140 pal[CHDK_COLOR_BASE+11] = 0x3F819137;
141 pal[CHDK_COLOR_BASE+12] = 0x3FDED115;
142 pal[CHDK_COLOR_BASE+13] = 0x00090000;
143
144 extern char palette_control;
145 palette_control = 1;
146 vid_bitmap_refresh();
147 }
148 }
149 }
150 #endif