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*) 0x42f95130;}
50
51 extern int _GetVRAMHPixelsSize();
52 extern int _GetVRAMVPixelsSize();
53
54 int vid_get_viewport_width()
55 {
56 if ((mode_get() & MODE_MASK) == MODE_PLAY)
57 {
58 return 360;
59 }
60 return _GetVRAMHPixelsSize() >> 1;
61 }
62
63 long vid_get_viewport_height()
64 {
65 if ((mode_get() & MODE_MASK) == MODE_PLAY)
66 {
67 return 240;
68 }
69 return _GetVRAMVPixelsSize();
70 }
71
72
73
74
75
76
77
78
79
80
81
82 void *vid_get_bitmap_fb() { return (void*)0x406f1000; }
83
84
85
86
87
88
89
90
91 void *vid_get_viewport_fb() { return (void*)0x40846b80; }
92
93 void *vid_get_viewport_fb_d()
94 {
95 extern char *viewport_fb_d;
96 return viewport_fb_d;
97 }
98
99 void *vid_get_viewport_live_fb()
100 {
101 extern char active_viewport_buffer;
102 extern void* viewport_buffers[];
103
104
105
106 return viewport_buffers[(active_viewport_buffer-1)&3];
107 }
108
109 int vid_get_palette_type() { return 3; }
110 int vid_get_palette_size() { return 256 * 4; }
111
112 void *vid_get_bitmap_active_buffer()
113 {
114 return vid_get_bitmap_fb();
115 }
116
117 void *vid_get_bitmap_active_palette()
118 {
119 extern int active_palette_buffer;
120 extern int** palette_buffer_ptr;
121 int *p = palette_buffer_ptr[active_palette_buffer];
122
123
124 if(!p) {
125 p = palette_buffer_ptr[0];
126 }
127 return (p+1);
128 }
129
130
131
132 void load_chdk_palette() {
133
134 extern int active_palette_buffer;
135
136 if ((active_palette_buffer == 0) || (active_palette_buffer == 5))
137 {
138 int *pal = (int*)vid_get_bitmap_active_palette();
139 if (pal[CHDK_COLOR_BASE+0] != 0x3F3ADF62)
140 {
141 pal[CHDK_COLOR_BASE+0] = 0x3F3ADF62;
142 pal[CHDK_COLOR_BASE+1] = 0x3F26EA40;
143 pal[CHDK_COLOR_BASE+2] = 0x3F4CD57F;
144 pal[CHDK_COLOR_BASE+3] = 0x3F73BFAE;
145 pal[CHDK_COLOR_BASE+4] = 0x3F4BD6CA;
146 pal[CHDK_COLOR_BASE+5] = 0x3F95AB95;
147 pal[CHDK_COLOR_BASE+6] = 0x3F4766F0;
148 pal[CHDK_COLOR_BASE+7] = 0x3F1250F3;
149 pal[CHDK_COLOR_BASE+8] = 0x3F7F408F;
150 pal[CHDK_COLOR_BASE+9] = 0x3F512D5B;
151 pal[CHDK_COLOR_BASE+10] = 0x3FA9A917;
152 pal[CHDK_COLOR_BASE+11] = 0x3F819137;
153 pal[CHDK_COLOR_BASE+12] = 0x3FDED115;
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