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
15 void shutdown()
16 {
17 extern void _TurnOffE1(void);
18 _TurnOffE1();
19 while(1);
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*)0x000d7868; }
30 int get_flash_params_count(void) { return 0xd4; }
31
32 extern int active_bitmap_buffer;
33 extern char* bitmap_buffer[];
34
35 void *vid_get_bitmap_fb() {
36 return bitmap_buffer[0];
37 }
38
39
40 void *vid_get_bitmap_active_buffer() {
41 return bitmap_buffer[active_bitmap_buffer];
42 }
43
44 void *vid_get_bitmap_active_palette()
45 {
46 extern int active_palette_buffer;
47 extern int** palette_buffer_ptr;
48 int *p = palette_buffer_ptr[active_palette_buffer];
49 if(!p) {
50 p = palette_buffer_ptr[0];
51 }
52 return (p+1);
53 }
54
55 extern int _GetVRAMHPixelsSize();
56 extern int _GetVRAMVPixelsSize();
57
58
59 int vid_get_viewport_width()
60 {
61 if ((mode_get() & MODE_MASK) == MODE_PLAY)
62 {
63 return 360;
64 }
65 return _GetVRAMHPixelsSize() >> 1;
66 }
67
68 long vid_get_viewport_height()
69 {
70 if ((mode_get() & MODE_MASK) == MODE_PLAY)
71 {
72 return 240;
73 }
74 return _GetVRAMVPixelsSize();
75 }
76
77 void *vid_get_viewport_fb_d()
78 {
79 extern char *viewport_fb_d;
80 return viewport_fb_d;
81 }
82
83 void *vid_get_viewport_live_fb()
84 {
85 return 0;
86 }
87
88 char *hook_raw_image_addr()
89 {
90 return (char*) 0x43737E20;
91 }
92
93 void vid_bitmap_refresh()
94 {
95 extern int full_screen_refresh;
96 extern void _ScreenLock();
97 extern void _ScreenUnlock();
98
99 full_screen_refresh |= 3;
100 _ScreenLock();
101 _ScreenUnlock();
102 }
103
104 int vid_get_palette_type() { return 5; }
105 int vid_get_palette_size() { return 256 * 4 ; }
106
107
108 void load_chdk_palette()
109 {
110 extern int active_palette_buffer;
111
112 if ((active_palette_buffer == 0) || (active_palette_buffer == 5))
113 {
114 int *pal = (int*)vid_get_bitmap_active_palette();
115
116
117 if (pal[CHDK_COLOR_BASE+0] != 0x3F3ADF62)
118 {
119 pal[CHDK_COLOR_BASE+0] = 0x3F3ADF62;
120 pal[CHDK_COLOR_BASE+1] = 0x3F26EA40;
121 pal[CHDK_COLOR_BASE+2] = 0x3F4CD57F;
122 pal[CHDK_COLOR_BASE+3] = 0x3F73BFAE;
123 pal[CHDK_COLOR_BASE+4] = 0x3F4BD6CA;
124 pal[CHDK_COLOR_BASE+5] = 0x3F95AB95;
125 pal[CHDK_COLOR_BASE+6] = 0x3F4766F0;
126 pal[CHDK_COLOR_BASE+7] = 0x3F1250F3;
127 pal[CHDK_COLOR_BASE+8] = 0x3F7F408F;
128 pal[CHDK_COLOR_BASE+9] = 0x3F512D5B;
129 pal[CHDK_COLOR_BASE+10] = 0x3FA9A917;
130 pal[CHDK_COLOR_BASE+11] = 0x3F819137;
131 pal[CHDK_COLOR_BASE+12] = 0x3FDED115;
132
133 extern char palette_control;
134 palette_control = 1;
135 vid_bitmap_refresh();
136 }
137 }
138 }
139