Changeset 992
- Timestamp:
- 12/01/10 23:02:55 (2 years ago)
- Location:
- trunk/core
- Files:
-
- 5 edited
-
gui_batt.c (modified) (3 diffs)
-
gui_debug.c (modified) (7 diffs)
-
gui_space.c (modified) (7 diffs)
-
levent.c (modified) (1 diff)
-
main.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/gui_batt.c
r515 r992 49 49 draw_line(conf.batt_icon_pos.x+3-2, conf.batt_icon_pos.y+1+11, conf.batt_icon_pos.x+3+25+2, conf.batt_icon_pos.y+1+11, COLOR_BLACK); // b 50 50 draw_line(conf.batt_icon_pos.x+3+25+2, conf.batt_icon_pos.y+1-1, conf.batt_icon_pos.x+3+25+2, conf.batt_icon_pos.y+1+10, COLOR_BLACK); // r 51 51 52 52 // battery fill 53 53 x=conf.batt_icon_pos.x+3+1+25-(perc/4); … … 59 59 60 60 //------------------------------------------------------------------- 61 static void gui_batt_draw_charge() {61 static void gui_batt_draw_charge() { 62 62 int perc = get_batt_perc(); 63 63 color cl = (perc<=10)?conf.osd_color_warn:conf.osd_color; … … 84 84 gui_batt_draw_volts(); 85 85 } 86 86 87 87 if (conf.batt_icon_show) { 88 88 gui_batt_draw_icon(); -
trunk/core/gui_debug.c
r515 r992 18 18 19 19 //------------------------------------------------------------------- 20 #define SCREEN_COLOR 0xF720 #define SCREEN_COLOR 0xF7 21 21 22 22 //------------------------------------------------------------------- … … 44 44 draw_txt_string(10, y+2, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 45 45 46 //sprintf(buf, "0x%lf", *((double*)addr));47 //draw_txt_string(10, y+3, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));46 //sprintf(buf, "0x%lf", *((double*)addr)); 47 //draw_txt_string(10, y+3, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 48 48 49 49 for (i=0; i<30; ++i) { … … 90 90 gui_debug_draw_values(2, addr); 91 91 gui_debug_draw_values(8, *((void**)addr)); 92 93 92 conf.mem_view_addr_init = (long)addr; 94 93 … … 107 106 break; 108 107 case KEY_UP: 109 debug_cont_update = !debug_cont_update;110 debug_to_draw = 2;108 debug_cont_update = !debug_cont_update; 109 debug_to_draw = 2; 111 110 break; 112 111 case KEY_LEFT: … … 126 125 debug_to_draw = 2; 127 126 break; 128 case KEY_ZOOM_IN: // reduce step127 case KEY_ZOOM_IN: // reduce step 129 128 switch (step) { 130 129 case 0x00000010: step = 0x0000004; break; … … 132 131 default: step>>=4; break; 133 132 } 134 debug_to_draw = 2;135 break;136 case KEY_ZOOM_OUT:// increase step133 debug_to_draw = 2; 134 break; 135 case KEY_ZOOM_OUT: // increase step 137 136 switch (step) { 138 137 case 0x00000004: step = 0x00000010; break; … … 140 139 default: step<<=4; break; 141 140 } 142 debug_to_draw = 2;143 break;141 debug_to_draw = 2; 142 break; 144 143 } 145 144 } -
trunk/core/gui_space.c
r703 r992 18 18 } 19 19 20 static void gui_space_draw_spacebar_horizontal () {20 static void gui_space_draw_spacebar_horizontal() { 21 21 coord x; 22 22 color cl = conf.space_color; 23 23 int perc = get_space_perc(),height = 2; 24 24 float size = 0; 25 if (conf.space_warn_type == 0) {26 cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color);27 } 28 if (conf.space_warn_type == 1) {29 cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color);30 } 31 if (conf.space_warn_type == 2) {32 cl = conf.space_color;33 } 34 // space icon / bar25 if (conf.space_warn_type == 0) { 26 cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 27 } 28 if (conf.space_warn_type == 1) { 29 cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 30 } 31 if (conf.space_warn_type == 2) { 32 cl = conf.space_color; 33 } 34 // space icon / bar 35 35 height = conf.space_bar_width+1; 36 if (conf.space_bar_size == 0) {37 size = screen_width/4-4;38 if (conf.space_hor_pos.x>(screen_width-size)){36 if (conf.space_bar_size == 0) { 37 size = screen_width/4-4; 38 if (conf.space_hor_pos.x>(screen_width-size)) { 39 39 conf.space_hor_pos.x = screen_width-size; 40 } 41 } 42 if (conf.space_bar_size == 1) {43 size = screen_width/2-4;44 if (conf.space_hor_pos.x>(screen_width-size)){40 } 41 } 42 if (conf.space_bar_size == 1) { 43 size = screen_width/2-4; 44 if (conf.space_hor_pos.x>(screen_width-size)) { 45 45 conf.space_hor_pos.x = screen_width-size; 46 46 } 47 47 } 48 if (conf.space_bar_size == 2){49 size = screen_width-4;50 if (conf.space_hor_pos.x>(screen_width-size)) {48 if (conf.space_bar_size == 2) { 49 size = screen_width-4; 50 if (conf.space_hor_pos.x>(screen_width-size)) { 51 51 conf.space_hor_pos.x = 0; 52 52 } 53 53 } 54 if (conf.space_hor_pos.y > (screen_height-height-3)) {55 conf.space_hor_pos.y = screen_height-height-3;54 if (conf.space_hor_pos.y > (screen_height-height-3)) { 55 conf.space_hor_pos.y = screen_height-height-3; 56 56 } 57 57 draw_rect(conf.space_hor_pos.x+1, conf.space_hor_pos.y+1, conf.space_hor_pos.x+1+size+2, conf.space_hor_pos.y+1+height+1, cl); … … 60 60 draw_line(conf.space_hor_pos.x+1-1, conf.space_hor_pos.y+1+height+2, conf.space_hor_pos.x+1+size+3, conf.space_hor_pos.y+1+height+2, COLOR_BLACK); // b 61 61 draw_line(conf.space_hor_pos.x+1+size+3, conf.space_hor_pos.y+1-1, conf.space_hor_pos.x+1+size+3, conf.space_hor_pos.y+1+height+2, COLOR_BLACK); // r 62 62 63 63 // space bar fill 64 64 65 65 x=conf.space_hor_pos.x+size-(perc/(100/size)); 66 66 if (x<=conf.space_hor_pos.x+1) x=conf.space_hor_pos.x+1; … … 70 70 } 71 71 72 73 static void gui_space_draw_spacebar_vertical () { 72 static void gui_space_draw_spacebar_vertical() { 74 73 coord y; 75 74 color cl = conf.space_color; 76 75 int perc = get_space_perc(), width = 2; 77 76 float size = 0; 78 if (conf.space_warn_type == 0) {79 cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color);80 } 81 if (conf.space_warn_type == 1) {82 cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color);83 } 84 if (conf.space_warn_type == 2) {85 cl = conf.space_color;86 } 87 88 // space icon / bar77 if (conf.space_warn_type == 0) { 78 cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 79 } 80 if (conf.space_warn_type == 1) { 81 cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 82 } 83 if (conf.space_warn_type == 2) { 84 cl = conf.space_color; 85 } 86 87 // space icon / bar 89 88 width = conf.space_bar_width+1; 90 if (conf.space_bar_size == 0) {91 size = screen_height/4-4;92 if (conf.space_ver_pos.y>(screen_height-size)){89 if (conf.space_bar_size == 0) { 90 size = screen_height/4-4; 91 if (conf.space_ver_pos.y>(screen_height-size)) { 93 92 conf.space_ver_pos.y = screen_height-size; 94 93 } 95 94 } 96 if (conf.space_bar_size == 1) {97 size = screen_height/2-4;98 if (conf.space_ver_pos.y>(screen_height-size)){95 if (conf.space_bar_size == 1) { 96 size = screen_height/2-4; 97 if (conf.space_ver_pos.y>(screen_height-size)) { 99 98 conf.space_ver_pos.y = screen_height-size; 100 99 } 101 100 } 102 if (conf.space_bar_size == 2){103 size = screen_height-4;104 if (conf.space_ver_pos.y>(screen_height-size)) {101 if (conf.space_bar_size == 2) { 102 size = screen_height-4; 103 if (conf.space_ver_pos.y>(screen_height-size)) { 105 104 conf.space_ver_pos.y = 0; 106 105 } 107 106 } 108 if (conf.space_ver_pos.x > (screen_width-width-3)) {109 conf.space_ver_pos.x = screen_width-width-3;107 if (conf.space_ver_pos.x > (screen_width-width-3)) { 108 conf.space_ver_pos.x = screen_width-width-3; 110 109 } 111 110 draw_rect(conf.space_ver_pos.x+1, conf.space_ver_pos.y+1, conf.space_ver_pos.x+1+width+1, conf.space_ver_pos.y+1+size+2, cl); 112 draw_line(conf.space_ver_pos.x+1-1, conf.space_ver_pos.y+1-1, conf.space_ver_pos.x+1-1, conf.space_ver_pos.y+1+5, COLOR_BLACK); // l113 114 draw_line(conf.space_ver_pos.x+1-1, conf.space_ver_pos.y+1-1, conf.space_ver_pos.x+1+width+2, conf.space_ver_pos.y+1-1, COLOR_BLACK); // t111 draw_line(conf.space_ver_pos.x+1-1, conf.space_ver_pos.y+1-1, conf.space_ver_pos.x+1-1, conf.space_ver_pos.y+1+5, COLOR_BLACK); // l 112 113 draw_line(conf.space_ver_pos.x+1-1, conf.space_ver_pos.y+1-1, conf.space_ver_pos.x+1+width+2, conf.space_ver_pos.y+1-1, COLOR_BLACK); // t 115 114 draw_line(conf.space_ver_pos.x+1-1, conf.space_ver_pos.y+1+size+3, conf.space_ver_pos.x+1+width+2, conf.space_ver_pos.y+1+size+3, COLOR_BLACK); // b 116 117 draw_line(conf.space_ver_pos.x+1+width+2, conf.space_ver_pos.y+1-1, conf.space_ver_pos.x+1+width+2, conf.space_ver_pos.y+1+size+3, COLOR_BLACK); // r118 115 116 draw_line(conf.space_ver_pos.x+1+width+2, conf.space_ver_pos.y+1-1, conf.space_ver_pos.x+1+width+2, conf.space_ver_pos.y+1+size+3, COLOR_BLACK); // r 117 119 118 // space bar fill 120 121 119 y=conf.space_ver_pos.y+size-(perc/(100/size)); 122 120 if (y<=conf.space_ver_pos.y+1) y=conf.space_ver_pos.y+1; … … 126 124 } 127 125 128 static void gui_space_draw_icon () {126 static void gui_space_draw_icon() { 129 127 coord x; 130 128 color cl = conf.space_color; 131 129 int perc = get_space_perc(); 132 if (conf.space_warn_type == 0) {133 cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color);134 } 135 if (conf.space_warn_type == 1) {136 cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color);137 } 138 if (conf.space_warn_type == 2) {139 cl = conf.space_color;130 if (conf.space_warn_type == 0) { 131 cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 132 } 133 if (conf.space_warn_type == 1) { 134 cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 135 } 136 if (conf.space_warn_type == 2) { 137 cl = conf.space_color; 140 138 } 141 139 int i; 142 int le = 23; //length143 int wi = 15; //width144 145 draw_line(conf.space_icon_pos.x+5, conf.space_icon_pos.y, conf.space_icon_pos.x+le, conf.space_icon_pos.y, COLOR_BLACK); // outer top146 draw_line(conf.space_icon_pos.x+6, conf.space_icon_pos.y+1, conf.space_icon_pos.x+le-1, conf.space_icon_pos.y+1, MAKE_COLOR(cl, cl)); // inner top147 draw_line(conf.space_icon_pos.x, conf.space_icon_pos.y+5, conf.space_icon_pos.x, conf.space_icon_pos.y+wi, COLOR_BLACK); // outer left148 draw_line(conf.space_icon_pos.x+1, conf.space_icon_pos.y+6, conf.space_icon_pos.x+1, conf.space_icon_pos.y+wi-1, MAKE_COLOR(cl, cl)); // inner left149 draw_line(conf.space_icon_pos.x, conf.space_icon_pos.y+wi, conf.space_icon_pos.x+le, conf.space_icon_pos.y+wi, COLOR_BLACK); // outer bottom150 draw_line(conf.space_icon_pos.x+1, conf.space_icon_pos.y+wi-1, conf.space_icon_pos.x+le-1, conf.space_icon_pos.y+wi-1, MAKE_COLOR(cl, cl)); // inner bottom151 draw_line(conf.space_icon_pos.x+le, conf.space_icon_pos.y, conf.space_icon_pos.x+le, conf.space_icon_pos.y+wi, COLOR_BLACK); // outer right152 draw_line(conf.space_icon_pos.x+le-1, conf.space_icon_pos.y+1, conf.space_icon_pos.x+le-1, conf.space_icon_pos.y+wi-1, MAKE_COLOR(cl, cl)); // inner right153 draw_line(conf.space_icon_pos.x+5, conf.space_icon_pos.y, conf.space_icon_pos.x, conf.space_icon_pos.y+5, COLOR_BLACK); // edge154 draw_line(conf.space_icon_pos.x+5, conf.space_icon_pos.y+1, conf.space_icon_pos.x+1, conf.space_icon_pos.y+5, MAKE_COLOR(cl, cl)); // edge155 draw_line(conf.space_icon_pos.x+6, conf.space_icon_pos.y+1, conf.space_icon_pos.x+1, conf.space_icon_pos.y+6, MAKE_COLOR(cl, cl)); // edge156 140 int le = 23; // length 141 int wi = 15; // width 142 143 draw_line(conf.space_icon_pos.x+5, conf.space_icon_pos.y, conf.space_icon_pos.x+le, conf.space_icon_pos.y, COLOR_BLACK); // outer top 144 draw_line(conf.space_icon_pos.x+6, conf.space_icon_pos.y+1, conf.space_icon_pos.x+le-1, conf.space_icon_pos.y+1, MAKE_COLOR(cl, cl)); // inner top 145 draw_line(conf.space_icon_pos.x, conf.space_icon_pos.y+5, conf.space_icon_pos.x, conf.space_icon_pos.y+wi, COLOR_BLACK); // outer left 146 draw_line(conf.space_icon_pos.x+1, conf.space_icon_pos.y+6, conf.space_icon_pos.x+1, conf.space_icon_pos.y+wi-1, MAKE_COLOR(cl, cl)); // inner left 147 draw_line(conf.space_icon_pos.x, conf.space_icon_pos.y+wi, conf.space_icon_pos.x+le, conf.space_icon_pos.y+wi, COLOR_BLACK); // outer bottom 148 draw_line(conf.space_icon_pos.x+1, conf.space_icon_pos.y+wi-1, conf.space_icon_pos.x+le-1, conf.space_icon_pos.y+wi-1, MAKE_COLOR(cl, cl)); // inner bottom 149 draw_line(conf.space_icon_pos.x+le, conf.space_icon_pos.y, conf.space_icon_pos.x+le, conf.space_icon_pos.y+wi, COLOR_BLACK); // outer right 150 draw_line(conf.space_icon_pos.x+le-1, conf.space_icon_pos.y+1, conf.space_icon_pos.x+le-1, conf.space_icon_pos.y+wi-1, MAKE_COLOR(cl, cl)); // inner right 151 draw_line(conf.space_icon_pos.x+5, conf.space_icon_pos.y, conf.space_icon_pos.x, conf.space_icon_pos.y+5, COLOR_BLACK); // edge 152 draw_line(conf.space_icon_pos.x+5, conf.space_icon_pos.y+1, conf.space_icon_pos.x+1, conf.space_icon_pos.y+5, MAKE_COLOR(cl, cl)); // edge 153 draw_line(conf.space_icon_pos.x+6, conf.space_icon_pos.y+1, conf.space_icon_pos.x+1, conf.space_icon_pos.y+6, MAKE_COLOR(cl, cl)); // edge 154 157 155 // memory fill 158 156 x=le-(perc*(le-3)/100)-2; … … 160 158 if (x>2) draw_line(conf.space_icon_pos.x+x+1, conf.space_icon_pos.y+2, conf.space_icon_pos.x+le-2, conf.space_icon_pos.y+2, MAKE_COLOR(cl, cl)); 161 159 else draw_line(conf.space_icon_pos.x+4, conf.space_icon_pos.y+2, conf.space_icon_pos.x+le-2, conf.space_icon_pos.y+2, MAKE_COLOR(cl, cl)); 162 for(i=3; i<7;i++){// /--------------|163 if (x>7-i) draw_pixel(conf.space_icon_pos.x+8-i, conf.space_icon_pos.y+i, COLOR_BLACK); // / 1st for loop |164 if (x>7-i) draw_pixel(conf.space_icon_pos.x+x, conf.space_icon_pos.y+i, COLOR_BLACK); // /__________________|165 draw_line(conf.space_icon_pos.x+x+1, conf.space_icon_pos.y+i, conf.space_icon_pos.x+le-2, conf.space_icon_pos.y+i, MAKE_COLOR(cl, cl)); // | |166 } // | 2nd for loop |167 for(i=7; i<wi-2;i++){// | |168 if (x>1) draw_pixel(conf.space_icon_pos.x+2, conf.space_icon_pos.y+i, COLOR_BLACK); // |-------------------|160 for(i=3; i<7; i++) { // /--------------| 161 if (x>7-i) draw_pixel(conf.space_icon_pos.x+8-i, conf.space_icon_pos.y+i, COLOR_BLACK); // / 1st for loop | 162 if (x>7-i) draw_pixel(conf.space_icon_pos.x+x, conf.space_icon_pos.y+i, COLOR_BLACK); // /__________________| 163 draw_line(conf.space_icon_pos.x+x+1, conf.space_icon_pos.y+i, conf.space_icon_pos.x+le-2, conf.space_icon_pos.y+i, MAKE_COLOR(cl, cl)); // | | 164 } // | 2nd for loop | 165 for(i=7; i<wi-2; i++) { // | | 166 if (x>1) draw_pixel(conf.space_icon_pos.x+2, conf.space_icon_pos.y+i, COLOR_BLACK); // |-------------------| 169 167 if (x>1) draw_pixel(conf.space_icon_pos.x+x, conf.space_icon_pos.y+i, COLOR_BLACK); 170 168 draw_line(conf.space_icon_pos.x+x+1, conf.space_icon_pos.y+i, conf.space_icon_pos.x+le-2, conf.space_icon_pos.y+i, MAKE_COLOR(cl, cl)); … … 174 172 } 175 173 176 177 //------------------------------------------------------------------- 178 static void gui_space_draw_percent(){ 174 //------------------------------------------------------------------- 175 static void gui_space_draw_percent() { 179 176 int perc = get_space_perc(); 180 177 color cl = conf.space_color; 181 if (conf.space_warn_type == 0) {182 cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color);183 } 184 if (conf.space_warn_type == 1) {185 cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color);186 } 187 if (conf.space_warn_type == 2) {188 cl = conf.space_color;178 if (conf.space_warn_type == 0) { 179 cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 180 } 181 if (conf.space_warn_type == 1) { 182 cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 183 } 184 if (conf.space_warn_type == 2) { 185 cl = conf.space_color; 189 186 } 190 187 sprintf(osd_buf, "%3d%%", get_space_perc()); … … 197 194 int perc = get_space_perc(); 198 195 color cl = conf.space_color; 199 if (conf.space_warn_type == 0){ 200 cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 201 } 202 if (conf.space_warn_type == 1){ 203 cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 204 } 205 if (conf.space_warn_type == 2){ 206 cl = conf.space_color; 207 } 208 unsigned int freemb=GetFreeCardSpaceKb()/1024; 209 if (freemb < 10000) sprintf(osd_buf, "%3d%M",freemb); 210 else sprintf(osd_buf, "%3d%G",freemb/1024); // if 10 GiB or more free, print in GiB instead of MiB. 211 osd_buf[5]=0; 212 draw_string(conf.space_txt_pos.x, conf.space_txt_pos.y, osd_buf, cl); 213 } 214 196 if (conf.space_warn_type == 0) { 197 cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 198 } 199 if (conf.space_warn_type == 1) { 200 cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 201 } 202 if (conf.space_warn_type == 2) { 203 cl = conf.space_color; 204 } 205 unsigned int freemb=GetFreeCardSpaceKb()/1024; 206 if (freemb < 10000) sprintf(osd_buf, "%3d%M",freemb); 207 else sprintf(osd_buf, "%3d%G",freemb/1024); // if 10 GiB or more free, print in GiB instead of MiB 208 osd_buf[5]=0; 209 draw_string(conf.space_txt_pos.x, conf.space_txt_pos.y, osd_buf, cl); 210 } 215 211 216 212 //------------------------------------------------------------------- 217 213 218 214 void gui_space_draw_osd() { 219 if (conf.space_icon_show) {215 if (conf.space_icon_show) { 220 216 gui_space_draw_icon(); 221 217 } 222 if (conf.space_perc_show) {218 if (conf.space_perc_show) { 223 219 gui_space_draw_percent(); 224 220 } else if (conf.space_mb_show) { 225 221 gui_space_draw_mb(); 226 222 } 227 if (conf.space_bar_show==1){223 if (conf.space_bar_show==1) { 228 224 gui_space_draw_spacebar_horizontal(); 229 225 } 230 if (conf.space_bar_show==2) {226 if (conf.space_bar_show==2) { 231 227 gui_space_draw_spacebar_vertical(); 232 228 } -
trunk/core/levent.c
r826 r992 2 2 #include "stdlib.h" 3 3 #include "levent.h" 4 /* function dealing with "logical events"*/ 5 unsigned levent_index_for_name(const char *name) 6 { 7 unsigned i; 8 // TODO could check for id=-1 or id=0, both show up at end of table ? 9 for (i=0; levent_table[i].name; i++) { 10 // case insensitive might be better 11 if (strcmp(levent_table[i].name,name) == 0) { 12 return i; 4 5 // functions dealing with "logical events" 6 7 unsigned levent_index_for_name(const char *name) { 8 unsigned i; 9 // TODO could check for id=-1 or id=0, both show up at end of table ? 10 for (i=0; levent_table[i].name; i++) { 11 // case insensitive might be better 12 if (strcmp(levent_table[i].name,name) == 0) { 13 return i; 14 } 13 15 } 14 } 15 return LEVENT_INVALID_INDEX; 16 return LEVENT_INVALID_INDEX; 16 17 } 17 18 18 unsigned levent_index_for_id(unsigned id) 19 { 20 unsigned i;21 // TODO could check for id=-1 or id=0, both show up at end of table ?22 for (i=0; levent_table[i].name; i++) {23 // case insensitive might be better24 if (id == levent_table[i].id) {25 return i;19 unsigned levent_index_for_id(unsigned id) { 20 unsigned i; 21 // TODO could check for id=-1 or id=0, both show up at end of table ? 22 for (i=0; levent_table[i].name; i++) { 23 // case insensitive might be better 24 if (id == levent_table[i].id) { 25 return i; 26 } 26 27 } 27 } 28 return LEVENT_INVALID_INDEX; 28 return LEVENT_INVALID_INDEX; 29 29 } 30 30 31 unsigned levent_count(void) 32 { 33 static unsigned num_levents = 0;34 if(!num_levents) {35 levent_def *ev;36 // TODO could check for id=-1 or id=0, both show up at end of table ?37 for (ev = levent_table; ev->name; ev++) {38 num_levents++;31 unsigned levent_count(void) { 32 static unsigned num_levents = 0; 33 if(!num_levents) { 34 levent_def *ev; 35 // TODO could check for id=-1 or id=0, both show up at end of table ? 36 for (ev = levent_table; ev->name; ev++) { 37 num_levents++; 38 } 39 39 } 40 } 41 return num_levents; 40 return num_levents; 42 41 } 43 42 44 unsigned levent_id_for_name(const char *name) 45 { 46 unsigned i = levent_index_for_name(name); 47 if (i!=LEVENT_INVALID_INDEX) 48 return levent_table[i].id; 49 else 50 return 0; // or -1 ? both appear at the end of the event list 43 unsigned levent_id_for_name(const char *name) { 44 unsigned i = levent_index_for_name(name); 45 if (i!=LEVENT_INVALID_INDEX) 46 return levent_table[i].id; 47 else 48 return 0; // or -1 ? both appear at the end of the event list 51 49 } 52 50 53 const char * levent_name_for_id(unsigned id) 54 { 55 unsigned i = levent_index_for_id(id); 56 if (i!=LEVENT_INVALID_INDEX) 57 return levent_table[i].name; 58 else 59 return NULL; 51 const char * levent_name_for_id(unsigned id) { 52 unsigned i = levent_index_for_id(id); 53 if (i!=LEVENT_INVALID_INDEX) 54 return levent_table[i].name; 55 else 56 return NULL; 60 57 } 61 58 62 59 // note, slow linear search every time 63 int levent_post_to_ui_by_name(const char *name) 64 { 65 unsigned id=levent_id_for_name(name); 66 if(id) { 67 PostLogicalEventToUI(id,0); 68 return 1; 69 } 70 return 0; 60 int levent_post_to_ui_by_name(const char *name) { 61 unsigned id=levent_id_for_name(name); 62 if(id) { 63 PostLogicalEventToUI(id,0); 64 return 1; 65 } 66 return 0; 71 67 } 72 68 73 69 void levent_set_record(void) { 74 levent_post_to_ui_by_name("PressRecButton");75 levent_post_to_ui_by_name("UnpressRecButton");70 levent_post_to_ui_by_name("PressRecButton"); 71 levent_post_to_ui_by_name("UnpressRecButton"); 76 72 } 77 73 78 74 void levent_set_play(void) { 79 levent_post_to_ui_by_name("PressPBButton");80 levent_post_to_ui_by_name("UnpressPBButton");75 levent_post_to_ui_by_name("PressPBButton"); 76 levent_post_to_ui_by_name("UnpressPBButton"); 81 77 } -
trunk/core/main.c
r980 r992 9 9 #include "motion_detector.h" 10 10 #ifdef OPT_EDGEOVERLAY 11 #include "edgeoverlay.h"11 #include "edgeoverlay.h" 12 12 #endif 13 13 static int raw_need_postprocess; 14 14 static volatile int spytask_can_start; 15 15 16 void core_hook_task_create(void *tcb) 17 { 16 void core_hook_task_create(void *tcb) { 18 17 } 19 18 20 void core_hook_task_delete(void *tcb) 21 { 22 char *name = (char*)(*(long*)((char*)tcb+0x34)); 23 if (strcmp(name,"tInitFileM")==0) core_spytask_can_start(); 19 void core_hook_task_delete(void *tcb) { 20 char *name = (char*)(*(long*)((char*)tcb+0x34)); 21 if (strcmp(name,"tInitFileM")==0) core_spytask_can_start(); 24 22 } 25 23 26 27 long core_get_noise_reduction_value() 28 { 24 long core_get_noise_reduction_value() { 29 25 return conf.raw_nr; 30 26 } 31 27 32 33 void dump_memory() 34 { 28 void dump_memory() { 35 29 int fd; 36 30 static int cnt=1; 37 31 static char fn[32]; 38 32 39 40 33 started(); 41 mkdir("A/DCIM");42 mkdir("A/DCIM/100CANON");43 sprintf(fn, "A/DCIM/100CANON/CRW_%04d.JPG", cnt++);44 fd = open(fn, O_WRONLY|O_CREAT, 0777);45 if (fd) {46 #ifdef CAMERA_ixus65_sd630 // Zero is not readable on ixus65!47 write(fd, (int*)0xFFFF0000, 4);48 write(fd, (int*)4, 0x1900-4);34 mkdir("A/DCIM"); 35 mkdir("A/DCIM/100CANON"); 36 sprintf(fn, "A/DCIM/100CANON/CRW_%04d.JPG", cnt++); 37 fd = open(fn, O_WRONLY|O_CREAT, 0777); 38 if (fd) { 39 #ifdef CAMERA_ixus65_sd630 // Zero is not readable on ixus65! 40 write(fd, (int*)0xFFFF0000, 4); 41 write(fd, (int*)4, 0x1900-4); 49 42 #else 50 write(fd, (void*)0, 0x1900);43 write(fd, (void*)0, 0x1900); 51 44 #endif 52 // TODO actual memory size is larger than 32 MB on many cameras!53 write(fd, (void*)0x1900, 32*1024*1024-0x1900);54 close(fd);55 }45 // TODO actual memory size is larger than 32 MB on many cameras! 46 write(fd, (void*)0x1900, 32*1024*1024-0x1900); 47 close(fd); 48 } 56 49 vid_bitmap_refresh(); 57 50 finished(); … … 60 53 static volatile long raw_data_available; 61 54 62 /* called from another process */ 63 void core_rawdata_available() 64 { 55 // called from another process 56 void core_rawdata_available() { 65 57 raw_data_available = 1; 66 58 } 67 59 68 60 void core_spytask_can_start() { 69 spytask_can_start = 1;61 spytask_can_start = 1; 70 62 } 71 63 72 void core_spytask() 73 { 64 void core_spytask() { 74 65 int cnt = 1; 75 66 int i=0; … … 80 71 81 72 #ifdef CAM_CHDK_PTP 82 init_chdk_ptp_task();73 init_chdk_ptp_task(); 83 74 #endif 84 75 … … 114 105 auto_started = 0; 115 106 116 if (conf.script_startup==1) script_autostart(); // remote autostart 117 if (conf.script_startup==2) { 118 conf.script_startup=0; 119 conf_save(); 120 script_autostart(); 121 } 122 while (1){ 107 if (conf.script_startup==1) script_autostart(); // remote autostart 108 if (conf.script_startup==2) { 109 conf.script_startup=0; 110 conf_save(); 111 script_autostart(); 112 } 123 113 124 if (raw_data_available){ 114 while (1) { 115 if (raw_data_available) { 125 116 raw_need_postprocess = raw_savefile(); 126 hook_raw_save_complete();127 raw_data_available = 0;128 continue;129 }117 hook_raw_save_complete(); 118 raw_data_available = 0; 119 continue; 120 } 130 121 131 if (state_shooting_progress != SHOOTING_PROGRESS_PROCESSING) {132 if (((cnt++) & 3) == 0)133 gui_redraw();122 if (state_shooting_progress != SHOOTING_PROGRESS_PROCESSING) { 123 if (((cnt++) & 3) == 0) 124 gui_redraw(); 134 125 135 histogram_process();126 histogram_process(); 136 127 #ifdef OPT_EDGEOVERLAY 137 if(conf.edge_overlay_thresh && conf.edge_overlay_enable) edge_overlay();128 if(conf.edge_overlay_thresh && conf.edge_overlay_enable) edge_overlay(); 138 129 #endif 139 }130 } 140 131 141 if ((state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) && (!shooting_in_progress())) {142 state_shooting_progress = SHOOTING_PROGRESS_DONE;132 if ((state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) && (!shooting_in_progress())) { 133 state_shooting_progress = SHOOTING_PROGRESS_DONE; 143 134 if (raw_need_postprocess) raw_postprocess(); 144 135 } 145 136 146 msleep(20);137 msleep(20); 147 138 } 148 139 } 149 150 151 152
Note: See TracChangeset
for help on using the changeset viewer.