Changeset 1494


Ignore:
Timestamp:
12/21/11 16:34:54 (18 months ago)
Author:
tsv
Message:

Flat module branch update. Make modules truly platform independent

  • Isolate palette colors
  • Isolate platform-dependend IO functions/structures
  • A lot of small isolations: DNG, key_erase/display, platformname
  • Rearranged existed exportlist to safe functions (*)
  • Extend module_info.required_ver for future (*)

Because changes marked with * modules from previous revisions are uncompatible

Location:
branches/reyalp-flt
Files:
2 added
25 edited

Legend:

Unmodified
Added
Removed
  • branches/reyalp-flt/core/Makefile

    r1493 r1494  
    5858 
    5959OBJS=entry.o main.o gui_draw.o gui_menu.o gui_mbox.o \ 
    60      gui.o kbd.o action_stack.o conf.o module_exportlist.o \ 
     60     gui.o kbd.o action_stack.o conf.o module_wrappers.o module_exportlist.o \ 
    6161     histogram.o gui_batt.o gui_space.o gui_osd.o raw.o \ 
    6262     gui_usb.o gui_lang.o gui_grid.o modules.o module_load.o\ 
  • branches/reyalp-flt/core/curves.c

    r1483 r1494  
    77#if 1 
    88 
     9#include "module_exportlist.h" 
    910#include "curves.h" 
    1011 
     
    145146         
    146147        // Loop through picture rows 
    147         for (i=CAM_RAW_ROWS; i;i-=2){ 
     148        for (i=CAM_CHDK_RAW_ROWS; i;i-=2){ 
    148149                // Loop through picture columns  
    149                 for (j=CAM_RAW_ROWPIX; j; j-=8, src+=10){ 
     150                for (j=CAM_CHDK_RAW_ROWPIX; j; j-=8, src+=10){ 
    150151                        pixVal0=((0x3fc&(((unsigned short)(src[1]))<<2)) | (src[0] >> 6)); 
    151152                        pixVal1=((0x3f0&(((unsigned short)(src[0]))<<4)) | (src[3] >> 4)); 
     
    178179            *(src+8) = (unsigned char) ((pixVal0)); //7 (=>0)           } 
    179180                } 
    180                 for (j=CAM_RAW_ROWPIX;j; j-=8, src+=10){ 
     181                for (j=CAM_CHDK_RAW_ROWPIX;j; j-=8, src+=10){ 
    181182                        pixVal0=((0x3fc&(((unsigned short)(src[1]))<<2)) | (src[0] >> 6)); 
    182183                        pixVal1=((0x3f0&(((unsigned short)(src[0]))<<4)) | (src[3] >> 4)); 
     
    241242         
    242243        // Loop through picture rows 
    243         for (i=CAM_RAW_ROWS; i;i-=2){ 
     244        for (i=CAM_CHDK_RAW_ROWS; i;i-=2){ 
    244245                // Loop through picture columns  
    245                 for (j=CAM_RAW_ROWPIX; j; j-=8, src+=10){ 
     246                for (j=CAM_CHDK_RAW_ROWPIX; j; j-=8, src+=10){ 
    246247                        pixVal0=((0x3fc&(((unsigned short)(src[1]))<<2)) | (src[0] >> 6)); 
    247248                        pixVal1=((0x3f0&(((unsigned short)(src[0]))<<4)) | (src[3] >> 4)); 
     
    306307            *(src+8) = (unsigned char) ((pixVal0)); //7 (=>0) 
    307308                } 
    308                 for (j=CAM_RAW_ROWPIX;j; j-=8, src+=10){ 
     309                for (j=CAM_CHDK_RAW_ROWPIX;j; j-=8, src+=10){ 
    309310                        pixVal0=((0x3fc&(((unsigned short)(src[1]))<<2)) | (src[0] >> 6)); 
    310311                        pixVal1=((0x3f0&(((unsigned short)(src[0]))<<4)) | (src[3] >> 4)); 
  • branches/reyalp-flt/core/edgeoverlay.c

    r1483 r1494  
    77#include "gui_draw.h" 
    88#include "bitvector.h" 
     9#include "module_exportlist.h" 
     10 
    911 
    1012// the way we save edge overlays on their own... 
     
    132134    char msg[64]; 
    133135    FILE *fd; 
    134     DIR* d; 
     136    STD_DIR* d; 
    135137    int fnum = 0; 
    136138    int fr = 0; 
    137139    int zoom = 0; 
    138     struct dirent* de; 
     140    struct STD_dirent* de; 
    139141    static struct utimbuf t; 
    140142    // nothing to save? then dont save 
     
    149151 
    150152    // first figure out the most appropriate filename to use 
    151     d = opendir(EDGE_SAVE_DIR); 
     153    d = safe_opendir(EDGE_SAVE_DIR); 
    152154    if( ! d ) 
    153155    { 
     
    155157    } 
    156158 
    157     while( (de = readdir(d)) ) 
     159    while( (de = safe_readdir(d)) ) 
    158160    { 
    159161        fr = get_edge_file_num(de->d_name); 
     
    179181        draw_string(0, 0, msg, *conf_osd_color); 
    180182    } 
    181     closedir(d); 
     183    safe_closedir(d); 
    182184} 
    183185 
  • branches/reyalp-flt/core/gui_4wins.c

    r1483 r1494  
    250250                draw_txt_string(x, 4, lang_str(LANG_CONNECT4_HUMAN), TEXT_COLOR); 
    251251        else 
    252                 draw_txt_string(x, 4, PLATFORM, TEXT_COLOR); 
     252                draw_txt_string(x, 4, "cam", TEXT_COLOR); 
    253253} 
    254254//------------------------------------------------------------------- 
  • branches/reyalp-flt/core/gui_bench.c

    r1483 r1494  
    171171    } 
    172172 
    173     x = open("A/BENCH.TMP", O_WRONLY|O_CREAT, 0777); 
     173    x = safe_open("A/BENCH.TMP", O_WRONLY|STD_O_CREAT, 0777); 
    174174    if (x>=0) { 
    175175        bench.disk_write_raw_bps = 0; 
     
    183183    } 
    184184 
    185     x = open("A/BENCH.TMP", O_WRONLY|O_CREAT, 0777); 
     185    x = safe_open("A/BENCH.TMP", O_WRONLY|STD_O_CREAT, 0777); 
    186186    if (x>=0) { 
    187187        bench.disk_write_mem_bps = 0; 
     
    196196 
    197197    if (buf) { 
    198         x = open("A/BENCH.TMP", O_WRONLY|O_CREAT, 0777); 
     198        x = safe_open("A/BENCH.TMP", O_WRONLY|STD_O_CREAT, 0777); 
    199199        if (x>=0) { 
    200200            bench.disk_write_buf_bps = 0; 
     
    210210        } 
    211211 
    212         x = open("A/BENCH.TMP", O_RDONLY, 0777); 
     212        x = safe_open("A/BENCH.TMP", O_RDONLY, 0777); 
    213213        if (x>=0) { 
    214214            bench.disk_read_buf_bps = 0; 
  • branches/reyalp-flt/core/gui_calendar.c

    r1483 r1494  
    120120            need_redraw = 1; 
    121121            break; 
    122       #if CAM_HAS_ERASE_BUTTON 
    123122        case KEY_ERASE: 
    124       #else 
    125123        case KEY_DISPLAY: 
    126       #endif 
    127124            calendar_goto_today(); 
    128125            need_redraw = 1; 
  • branches/reyalp-flt/core/gui_debug.c

    r1483 r1494  
    3737    int i; 
    3838 
    39     if (!(addr<=(void*)MAXRAMADDR || addr>=(void*)ROMBASEADDR)) { addr = &dummy; }; 
     39        // non-significant check. remove to platform independency 
     40    // if (!(addr<=(void*)MAXRAMADDR || addr>=(void*)ROMBASEADDR)) { addr = &dummy; }; 
    4041 
    4142    sprintf(buf, "0x%08X (%10u)", *((unsigned int*)addr), *((unsigned int*)addr)); 
  • branches/reyalp-flt/core/gui_draw.h

    r1493 r1494  
    55 
    66#include "gui.h"        // for color, coord definitions 
     7 
     8 
     9// Common colors that are the same in all palettes 
     10#define COLOR_TRANSPARENT   0x00 
     11#define COLOR_BLACK         0xFF 
    712 
    813//------------------------------------------------------------------- 
     
    1318 
    1419//------------------------------------------------------------------- 
    15  
    16 // Common colors that are the same in all palettes 
    17 #define COLOR_TRANSPARENT   0x00 
    18 #define COLOR_BLACK         0xFF 
    1920 
    2021//------------------------------------------------------------------- 
  • branches/reyalp-flt/core/gui_fselect.c

    r1489 r1494  
    208208//------------------------------------------------------------------- 
    209209static void gui_fselect_read_dir(const char* dir) { 
    210     DIR           *d; 
    211     struct dirent *de; 
    212     static struct stat   st; 
     210    STD_DIR           *d; 
     211    struct STD_dirent *de; 
     212    static struct STD_stat   st; 
    213213    struct fitem  **ptr = &head, *prev = NULL; 
    214214    int    i; 
    215215 
    216216    gui_fselect_free_data(); 
    217 #ifdef CAM_DRYOS_2_3_R39 
     217//#ifdef CAM_DRYOS_2_3_R39 
    218218    if(dir[0]=='A' && dir[1]==0) 
    219         d = opendir("A/"); 
     219        d = safe_opendir("A/"); 
    220220    else 
    221         d = opendir(dir); 
     221        d = safe_opendir(dir); 
     222/* //remove for platf independedncy. looks like sequence above is safe 
    222223#else 
    223     d = opendir(dir); 
     224    d = safe_opendir(dir); 
    224225#endif 
     226*/ 
    225227    if (d) { 
    226         de = readdir(d); 
     228        de = safe_readdir(d); 
    227229        while (de) { 
    228230            if (de->d_name[0] != 0xE5 /* deleted entry */ && (de->d_name[0]!='.' || de->d_name[1]!=0)) { 
     
    234236                        strcpy((*ptr)->name, de->d_name); 
    235237                    sprintf(buf, "%s/%s", dir, de->d_name); 
    236                     if (stat(buf, &st)==0) { 
     238                    if (safe_stat(buf, &st)==0) { 
    237239                        (*ptr)->attr=st.st_attrib; 
    238240                        (*ptr)->size=st.st_size; 
     
    249251                }    
    250252            } 
    251             de = readdir(d); 
    252         } 
    253         closedir(d); 
     253            de = safe_readdir(d); 
     254        } 
     255        safe_closedir(d); 
    254256    } 
    255257    *ptr=NULL; 
     
    308310    while (strlen(current_dir) > 0) 
    309311    { 
    310         struct stat st; 
     312        struct STD_stat st; 
    311313        // check if input 'dir' exists 
    312         if (stat(current_dir,&st) == 0)      
     314        if (safe_stat(current_dir,&st) == 0)      
    313315        { 
    314316            // exists - check if it is a directory or file 
     
    570572static void fselect_purge_cb(unsigned int btn) { 
    571573 
    572    DIR             *d,  *d2,  *d3,  *d4; 
    573    struct dirent   *de, *de2, *de3, *de4; 
     574   STD_DIR             *d,  *d2,  *d3,  *d4; 
     575   struct STD_dirent   *de, *de2, *de3, *de4; 
    574576   struct fitem    *ptr, *ptr2; 
    575577   char            sub_dir[20], sub_dir_search[20]; 
     
    581583       if (selected->name[0] == 'D' && selected->name[1] == 'C' && selected->name[2] == 'I' && selected->name[3] == 'M') { 
    582584           sprintf(current_dir+strlen(current_dir), "/%s", selected->name); 
    583            d=opendir(current_dir); 
    584            while ((de=readdir(d)) != NULL) {//Loop to find all Canon folders 
     585           d=safe_opendir(current_dir); 
     586           while ((de=safe_readdir(d)) != NULL) {//Loop to find all Canon folders 
    585587               if (de->d_name[0] != '.' && de->d_name[1] != '.') {//If item is not UpDir 
    586588                   sprintf(sub_dir, "%s/%s", current_dir, de->d_name); 
    587                    d2=opendir(sub_dir); 
    588                    while ((de2=readdir(d2)) != NULL) {//Loop to find all the RAW files inside a Canon folder 
     589                   d2=safe_opendir(sub_dir); 
     590                   while ((de2=safe_readdir(d2)) != NULL) {//Loop to find all the RAW files inside a Canon folder 
    589591                       if (de2->d_name[0] == 'C' || de2->d_name[9] == 'C') {//If file is RAW (Either CRW/CR2 prefix or file extension) 
    590                            d3=opendir(current_dir); 
    591                            while ((de3=readdir(d3)) != NULL) {//Loop to find all Canon folders 
     592                           d3=safe_opendir(current_dir); 
     593                           while ((de3=safe_readdir(d3)) != NULL) {//Loop to find all Canon folders 
    592594                               if (de3->d_name[0] != '.' && de3->d_name[1] != '.') {//If item is not UpDir 
    593595                                   sprintf(sub_dir_search, "%s/%s", current_dir, de3->d_name); 
    594                                    d4=opendir(sub_dir_search); 
    595                                    while ((de4=readdir(d4)) != NULL) {//Loop to find a corresponding JPG file inside a Canon folder 
     596                                   d4=safe_opendir(sub_dir_search); 
     597                                   while ((de4=safe_readdir(d4)) != NULL) {//Loop to find a corresponding JPG file inside a Canon folder 
    596598                                       if (de2->d_name[4] == de4->d_name[4] && de2->d_name[5] == de4->d_name[5] &&//If the four digits of the Canon number are the same 
    597599                                           de2->d_name[6] == de4->d_name[6] && de2->d_name[7] == de4->d_name[7] && 
     
    601603                                       }                                  
    602604                                   } 
    603                                    closedir(d4);                  
     605                                   safe_closedir(d4);                  
    604606                               }   
    605607                           } 
    606                            closedir(d3); 
     608                           safe_closedir(d3); 
    607609                           //If no JPG found, delete RAW file 
    608610                           if (found == 0) { 
     
    617619                       } 
    618620                   } 
    619                    closedir(d2); 
     621                   safe_closedir(d2); 
    620622               } 
    621623           } 
    622            closedir(d); 
     624           safe_closedir(d); 
    623625           i=strlen(current_dir); 
    624626           while (current_dir[--i] != '/'); 
     
    628630       else if (selected->name[3] == 'C') { 
    629631           sprintf(current_dir+strlen(current_dir), "/%s", selected->name); 
    630            d=opendir(current_dir); 
    631            while ((de=readdir(d)) != NULL) {//Loop to find all the RAW files inside the Canon folder  
     632           d=safe_opendir(current_dir); 
     633           while ((de=safe_readdir(d)) != NULL) {//Loop to find all the RAW files inside the Canon folder  
    632634               if (de->d_name[0] == 'C' || de->d_name[9] == 'C') {//If file is RAW (Either CRW/CR2 prefix or file extension) 
    633                    d2=opendir(current_dir); 
    634                    while ((de2=readdir(d2)) != NULL) {//Loop to find a corresponding JPG file inside the Canon folder 
     635                   d2=safe_opendir(current_dir); 
     636                   while ((de2=safe_readdir(d2)) != NULL) {//Loop to find a corresponding JPG file inside the Canon folder 
    635637                       if (de->d_name[4] == de2->d_name[4] && de->d_name[5] == de2->d_name[5] &&//If the four digits of the Canon number are the same 
    636638                           de->d_name[6] == de2->d_name[6] && de->d_name[7] == de2->d_name[7] && 
     
    640642                       }                                  
    641643                   } 
    642                    closedir(d2);  
     644                   safe_closedir(d2);  
    643645                   //If no JPG found, delete RAW file                 
    644646                   if (found == 0) { 
     
    653655               } 
    654656           } 
    655            closedir(d); 
     657           safe_closedir(d); 
    656658           i=strlen(current_dir); 
    657659           while (current_dir[--i] != '/'); 
     
    691693//------------------------------------------------------------------- 
    692694static void fselect_delete_folder_cb(unsigned int btn) { 
    693     DIR           *d; 
    694     struct dirent *de; 
     695    STD_DIR           *d; 
     696    struct STD_dirent *de; 
    695697    int           i; 
    696698 
    697699    if (btn==MBOX_BTN_YES) { 
    698700        sprintf(current_dir+strlen(current_dir), "/%s", selected->name); 
    699         d = opendir(current_dir); 
     701        d = safe_opendir(current_dir); 
    700702        if (d) { 
    701             de = readdir(d); 
     703            de = safe_readdir(d); 
    702704            while (de) { 
    703705                if (de->d_name[0] != 0xE5 /* deleted entry */ && (de->d_name[0]!='.' || (de->d_name[1]!='.' && de->d_name[1]!=0) || (de->d_name[1]=='.' && de->d_name[2]!=0))) { 
     
    707709                    finished(); 
    708710                } 
    709                 de = readdir(d); 
    710             } 
    711             closedir(d); 
     711                de = safe_readdir(d); 
     712            } 
     713            safe_closedir(d); 
    712714        } 
    713715        started(); 
     
    817819                        gui_browser_progress_show(lang_str(LANG_FSELECT_PROGRESS_TITLE),i*100/marked_count); 
    818820                    sprintf(selected_file, "%s/%s", marked_dir, ptr->name); 
    819                     fsrc = open(selected_file, O_RDONLY, 0777); 
     821                    fsrc = safe_open(selected_file, O_RDONLY, 0777); 
    820822                    if (fsrc>=0) { 
    821823                        sprintf(selected_file, "%s/%s", current_dir, ptr->name); 
    822824                        // trying to open for read to check if file exists 
    823                         fdst = open(selected_file, O_RDONLY, 0777); 
     825                        fdst = safe_open(selected_file, O_RDONLY, 0777); 
    824826                        if (fdst<0) { 
    825                             fdst = open(selected_file, O_WRONLY|O_CREAT, 0777); 
     827                            fdst = safe_open(selected_file, O_WRONLY|STD_O_CREAT, 0777); 
    826828                            if (fdst>=0) { 
    827829                                do { 
     
    923925    buf = umalloc(MARKED_BUF_SIZE); 
    924926    sprintf(selected_file, "%s/%s", current_dir, selected->name); 
    925     fsrc = open(selected_file, O_RDONLY, 0777); 
     927    fsrc = safe_open(selected_file, O_RDONLY, 0777); 
    926928    if (fsrc>=0) { 
    927929            strcpy(selected_file,"A/DISKBOOT.BIN"); 
    928             fdst = open(selected_file, O_WRONLY|O_CREAT|O_TRUNC, 0777); 
     930            fdst = safe_open(selected_file, O_WRONLY|STD_O_CREAT|STD_O_TRUNC, 0777); 
    929931            if (fdst>=0) { 
    930932                do { 
     
    10341036} 
    10351037//------------------------------------------------------------------- 
    1036 #if DNG_SUPPORT 
     1038//#if DNG_SUPPORT 
    10371039void process_dng_to_raw_files(void){ 
    10381040 struct fitem *ptr; 
     
    10471049       sprintf(selected_file, "%s/%s", current_dir, ptr->name); 
    10481050       gui_browser_progress_show(selected_file, (i++)*100/fselect_real_marked_count()) ; 
    1049        convert_dng_to_chdk_raw(selected_file); 
     1051       module_convert_dng_to_chdk_raw(selected_file); 
    10501052      } 
    10511053    } 
    10521054 else { 
    10531055   sprintf(selected_file, "%s/%s", current_dir, selected->name); 
    1054    convert_dng_to_chdk_raw(selected_file); 
     1056   module_convert_dng_to_chdk_raw(selected_file); 
    10551057 } 
    10561058  gui_fselect_read_dir(current_dir); 
    10571059} 
    1058 #endif 
     1060//#endif 
    10591061 
    10601062//------------------------------------------------------------------- 
     
    11381140            break; 
    11391141        } 
    1140 #if DNG_SUPPORT 
     1142//#if DNG_SUPPORT 
    11411143    case MPOPUP_DNG_TO_CRW: 
    11421144            process_dng_to_raw_files(); 
    11431145            break; 
    1144 #endif 
     1146//#endif 
    11451147    } 
    11461148    gui_fselect_redraw = 2; 
     
    12361238                if(selected->size == hook_raw_size()) 
    12371239                    i |= MPOPUP_RAW_DEVELOP; 
    1238 #if DNG_SUPPORT 
     1240//#if DNG_SUPPORT 
    12391241                if((fselect_marked_count()>1)||(selected->size > hook_raw_size())) 
    12401242                    i |= MPOPUP_DNG_TO_CRW; 
    1241 #endif 
     1243//#endif 
    12421244 
    12431245                if (selected->name[9] == 'B' && selected->name[10] == 'I' && selected->name[11] == 'N') //If item is DCIM folder 
     
    12771279            } 
    12781280            break; 
    1279       #if CAM_HAS_ERASE_BUTTON 
    12801281        case KEY_ERASE: 
    1281       #else 
    12821282        case KEY_DISPLAY: 
    1283       #endif 
    12841283            if (selected && selected->attr != 0xFF) { 
    12851284                if (selected->attr & DOS_ATTR_DIRECTORY) { 
  • branches/reyalp-flt/core/gui_mastermind.c

    r1483 r1494  
    2828int curr_y; 
    2929int answer[4]; 
    30 char colors[6] = { COLOR_HISTO_R_PLAY, COLOR_HISTO_G_PLAY, COLOR_HISTO_B_PLAY, COLOR_YELLOW, COLOR_WHITE, COLOR_BLACK }; 
     30char colors[6]; 
    3131int curr_color[4]; 
    3232int GameGo; 
     
    240240 
    241241int basic_module_init() { 
     242        colors[0] = COLOR_HISTO_R_PLAY; 
     243        colors[1] = COLOR_HISTO_G_PLAY; 
     244        colors[2] = COLOR_HISTO_B_PLAY; 
     245        colors[3] = COLOR_YELLOW; 
     246        colors[4] = COLOR_WHITE; 
     247        colors[5] = COLOR_BLACK; 
     248 
    242249        return gui_mastermind_init();  
    243250} 
  • branches/reyalp-flt/core/gui_read.c

    r1483 r1494  
    6565//------------------------------------------------------------------- 
    6666int gui_read_init(const char* file) { 
    67     static struct stat   st; 
    68     read_file = open(file, O_RDONLY, 0777); 
     67    static struct STD_stat   st; 
     68    read_file = safe_open(file, O_RDONLY, 0777); 
    6969    if (strcmp(file, conf_reader_file)!=0) { 
    7070        *conf_reader_pos = 0; 
     
    7272    } 
    7373    read_on_screen = 0; 
    74     read_file_size = (read_file>=0 && stat((char*)file, &st)==0)?st.st_size:0; 
     74    read_file_size = (read_file>=0 && safe_stat((char*)file, &st)==0)?st.st_size:0; 
    7575    if (read_file_size<=*conf_reader_pos) { 
    7676        *conf_reader_pos = 0; 
  • branches/reyalp-flt/core/gui_reversi.c

    r1483 r1494  
    385385            need_redraw = 1; 
    386386            break; 
    387       #if CAM_HAS_ERASE_BUTTON 
    388387        case KEY_ERASE: 
    389       #else 
    390388        case KEY_DISPLAY: 
    391       #endif 
    392389            if (InGame) 
    393390                Computer=COMPUTER_ONLY; 
     
    396393            need_redraw = 1; 
    397394            break; 
    398       #if CAM_HAS_ERASE_BUTTON 
    399         case KEY_DISPLAY: 
    400             gui_mbox_init(LANG_MBOX_ABOUT_TITLE, (int)"REVERSI\n(c) GrAnd, 2007", MBOX_TEXT_CENTER, NULL); 
    401             need_redraw_all = 1; 
    402             break; 
    403       #endif 
    404395    } 
    405396} 
  • branches/reyalp-flt/core/gui_snake.c

    r1483 r1494  
    320320              
    321321            break; 
    322       #if CAM_HAS_ERASE_BUTTON 
    323322        case KEY_ERASE: 
    324       #else 
    325323        case KEY_DISPLAY: 
    326       #endif 
    327324            break; 
    328325    } 
  • branches/reyalp-flt/core/gui_sokoban.c

    r1483 r1494  
    275275        char *buf,*p; 
    276276        FILE *fd;     
    277         struct stat st; 
    278  
    279         if (stat((char *)level_file_name,&st) != 0 || st.st_size==0)  
     277        struct STD_stat st; 
     278 
     279        if (safe_stat((char *)level_file_name,&st) != 0 || st.st_size==0)  
    280280            return 0; 
    281281 
     
    369369            need_redraw = 1; 
    370370            break; 
    371       #if CAM_HAS_ERASE_BUTTON 
    372371        case KEY_ERASE: 
    373       #else 
    374372        case KEY_DISPLAY: 
    375       #endif 
    376373            sokoban_set_level(*conf_sokoban_level); 
    377374            need_redraw_all = 1; 
    378375            break; 
    379       #if CAM_HAS_ERASE_BUTTON 
    380         case KEY_DISPLAY: 
    381             gui_mbox_init(LANG_MBOX_ABOUT_TITLE, (int)"SOKOBAN\n(c) GrAnd, 2007", MBOX_TEXT_CENTER, NULL); 
    382             need_redraw = 1; 
    383             break; 
    384      #endif 
    385376    } 
    386377} 
  • branches/reyalp-flt/core/gui_tetris.c

    r1483 r1494  
    121121{ 
    122122    // Check if directory exists and create it if it does not. 
    123     struct stat st; 
    124     if (stat(dirname,&st) != 0) return mkdir(dirname); 
     123    struct STD_stat st; 
     124    if (safe_stat(dirname,&st) != 0) return mkdir(dirname); 
    125125    return 0;   // Success 
    126126} 
  • branches/reyalp-flt/core/main.c

    r1493 r1494  
    217217                draw_txt_string(2, 2, osd_buf, conf.osd_color); 
    218218#endif   
     219 
     220                // Process async module unload requests 
     221                module_tick_unloader(); 
     222 
    219223        msleep(20); 
    220224    } 
  • branches/reyalp-flt/core/module_exportlist.c

    r1493 r1494  
    99#include "platform.h" 
    1010#include "stdlib.h" 
     11#include "stdlib_unified.h" 
    1112#include "keyboard.h" 
    1213 
     
    1415#include "gui_draw.h" 
    1516#include "gui_batt.h" 
     17#include "gui_menu.h" 
    1618#include "gui_osd.h" 
    1719#include "gui_mbox.h" 
     
    2527#include "module_load.h" 
    2628#include "raw.h" 
    27 #include "dng.h" 
    2829 
    2930 
     
    5455int RAW_CHDK_ROWLEN      = RAW_ROWLEN     ; 
    5556 
     57 
     58char SCREEN__EXPORTEDSYM_COLOR        = SCREEN_COLOR            ; 
     59char COLOR__EXPORTEDSYM_WHITE         = COLOR_WHITE         ; 
     60char COLOR__EXPORTEDSYM_RED           = COLOR_RED           ; 
     61char COLOR__EXPORTEDSYM_GREY          = COLOR_GREY          ; 
     62char COLOR__EXPORTEDSYM_GREEN         = COLOR_GREEN         ; 
     63char COLOR__EXPORTEDSYM_BLUE_LT       = COLOR_BLUE_LT       ; 
     64char COLOR__EXPORTEDSYM_BLUE          = COLOR_BLUE          ; 
     65char COLOR__EXPORTEDSYM_YELLOW        = COLOR_YELLOW        ; 
     66char COLOR__EXPORTEDSYM_BG            = COLOR_BG            ; 
     67char COLOR__EXPORTEDSYM_FG            = COLOR_FG            ; 
     68char COLOR__EXPORTEDSYM_SELECTED_BG   = COLOR_SELECTED_BG   ; 
     69char COLOR__EXPORTEDSYM_SELECTED_FG   = COLOR_SELECTED_FG   ; 
     70char COLOR__EXPORTEDSYM_ALT_BG        = COLOR_ALT_BG        ; 
     71char COLOR__EXPORTEDSYM_SPLASH_RED    = COLOR_SPLASH_RED    ; 
     72char COLOR__EXPORTEDSYM_SPLASH_PINK   = COLOR_SPLASH_PINK   ; 
     73char COLOR__EXPORTEDSYM_SPLASH_GREY   = COLOR_SPLASH_GREY   ; 
     74char COLOR__EXPORTEDSYM_HISTO_R       = COLOR_HISTO_R       ; 
     75char COLOR__EXPORTEDSYM_HISTO_R_PLAY  = COLOR_HISTO_R_PLAY  ; 
     76char COLOR__EXPORTEDSYM_HISTO_B       = COLOR_HISTO_B       ; 
     77char COLOR__EXPORTEDSYM_HISTO_G       = COLOR_HISTO_G       ; 
     78char COLOR__EXPORTEDSYM_HISTO_G_PLAY  = COLOR_HISTO_G_PLAY  ; 
     79char COLOR__EXPORTEDSYM_HISTO_BG      = COLOR_HISTO_BG      ; 
     80char COLOR__EXPORTEDSYM_HISTO_RG      = COLOR_HISTO_RG      ; 
     81char COLOR__EXPORTEDSYM_HISTO_RB      = COLOR_HISTO_RB      ; 
     82char COLOR__EXPORTEDSYM_HISTO_RB_PLAY = COLOR_HISTO_RB_PLAY ; 
     83char COLOR__EXPORTEDSYM_HISTO_B_PLAY  = COLOR_HISTO_B_PLAY  ; 
     84char COLOR__EXPORTEDSYM_HISTO_BG_PLAY = COLOR_HISTO_BG_PLAY ; 
     85char COLOR__EXPORTEDSYM_HISTO_RG_PLAY = COLOR_HISTO_RG_PLAY ; 
     86 
     87short EDGE__EXPORTEDSYM_HMARGIN = EDGE_HMARGIN; 
     88short CAM__EXPORTEDSYM_TS_BUTTON_BORDER = CAM_TS_BUTTON_BORDER; 
     89 
     90 
    5691/* EXPORTED_DEFINES_END */ 
    5792 
     
    5994//    1. DO NOT CHANGE ORDER AND DO NOT DELETE EXISTED ENTRIES 
    6095//    2. VARIABLE conf SHOULDN'T EXIST IN THE LIST TO KEEP ISOLATION. USE set|get_chdk_conf|get_chdk_conf_ptr INSTEAD 
     96//      STOPLIST: conf, open, opendir, closedir, rewinddir, readdir, stat 
    6197 
    6298void* CHDK_EXPORT_LIST[] = { 
     
    72108            umalloc, 
    73109            ufree, 
    74             open, 
     110            safe_open, 
    75111            write, 
    76112            lseek, 
     
    84120            fread, 
    85121            fwrite, 
    86             stat, 
    87             opendir, 
    88             readdir, 
    89             closedir, 
     122            safe_stat, 
     123            safe_opendir, 
     124            safe_readdir, 
     125            safe_closedir, 
    90126 
    91127            get_tick_count, 
     
    193229                        msleep, 
    194230            GetTotalCardSpaceKb, 
    195                         convert_dng_to_chdk_raw, 
     231                        module_convert_dng_to_chdk_raw, 
    196232                        raw_prepare_develop, 
    197233 
     
    221257                        gui_menu_run_fltmodule, 
    222258 
     259                        // export palette 
     260                        &SCREEN__EXPORTEDSYM_COLOR               , 
     261                        &COLOR__EXPORTEDSYM_WHITE        , 
     262                        &COLOR__EXPORTEDSYM_RED          , 
     263                        &COLOR__EXPORTEDSYM_GREY         , 
     264                        &COLOR__EXPORTEDSYM_GREEN        , 
     265                        &COLOR__EXPORTEDSYM_BLUE_LT      , 
     266                        &COLOR__EXPORTEDSYM_BLUE         , 
     267                        &COLOR__EXPORTEDSYM_YELLOW       , 
     268                        &COLOR__EXPORTEDSYM_BG           , 
     269                        &COLOR__EXPORTEDSYM_FG           , 
     270                        &COLOR__EXPORTEDSYM_SELECTED_BG  , 
     271                        &COLOR__EXPORTEDSYM_SELECTED_FG  , 
     272                        &COLOR__EXPORTEDSYM_ALT_BG       , 
     273                        &COLOR__EXPORTEDSYM_SPLASH_RED   , 
     274                        &COLOR__EXPORTEDSYM_SPLASH_PINK  , 
     275                        &COLOR__EXPORTEDSYM_SPLASH_GREY  , 
     276                        &COLOR__EXPORTEDSYM_HISTO_R      , 
     277                        &COLOR__EXPORTEDSYM_HISTO_R_PLAY , 
     278                        &COLOR__EXPORTEDSYM_HISTO_B      , 
     279                        &COLOR__EXPORTEDSYM_HISTO_G      , 
     280                        &COLOR__EXPORTEDSYM_HISTO_G_PLAY , 
     281                        &COLOR__EXPORTEDSYM_HISTO_BG     , 
     282                        &COLOR__EXPORTEDSYM_HISTO_RG     , 
     283                        &COLOR__EXPORTEDSYM_HISTO_RB     , 
     284                        &COLOR__EXPORTEDSYM_HISTO_RB_PLAY, 
     285                        &COLOR__EXPORTEDSYM_HISTO_B_PLAY , 
     286                        &COLOR__EXPORTEDSYM_HISTO_BG_PLAY, 
     287                        &COLOR__EXPORTEDSYM_HISTO_RG_PLAY, 
     288 
     289                        // some common required sym 
     290                        &EDGE__EXPORTEDSYM_HMARGIN, 
     291                        &CAM__EXPORTEDSYM_TS_BUTTON_BORDER, 
     292 
     293                        // profile.flt 
     294                        find_mnu, 
     295                        lang_strhash31, 
     296 
    223297                        0 
    224298}; 
    225  
    226 /*                      debug_open, 
    227                         debug_print_int, 
    228                         debug_print, 
    229                         debug_flush, 
    230                         debug_close, 
    231 */ 
    232  
  • branches/reyalp-flt/core/modules.c

    r1477 r1494  
    1313#include "conf.h" 
    1414#include "gui_draw.h" 
     15#include "dng.h" 
    1516 
    1617/************* DYNAMIC LIBRARY RAWOPERATION ******/ 
     
    242243} 
    243244 
    244  
     245/************* OTHER MODULES ******/ 
     246 
     247void module_convert_dng_to_chdk_raw(char* fn) 
     248{ 
     249#if DNG_SUPPORT 
     250        convert_dng_to_chdk_raw(fn); 
     251#endif 
     252} 
  • branches/reyalp-flt/core/modules.h

    r1467 r1494  
    3838 
    3939 
     40 
     41//-------------------------- 
     42void module_convert_dng_to_chdk_raw(char* fn); 
     43 
     44 
    4045#endif 
  • branches/reyalp-flt/core/modules/Makefile

    r1489 r1494  
    1515LDLIBS= -lgcc 
    1616LDOPTS=-nostdlib -Wl,--allow-shlib-undefined -Wl,-T,$(topdir)tools/link-boot.ld 
    17 LDOPTS+=-Wl,-N,-Ttext,$(MEMISOSTART) -r -Wl,-d 
     17LDOPTS+=-Wl,-N,-Ttext,0x0016ee30 -r -Wl,-d 
    1818 
    1919OBJS=../gui_calendar.o ../gui_bench.o ../gui_4wins.o ../gui_mastermind.o ../gui_reversi.o \ 
  • branches/reyalp-flt/core/modules/module_menu.c

    r1489 r1494  
    122122CMenu* scan_directory(const char* dir) { 
    123123 
    124     DIR           *d; 
    125     struct dirent *de; 
    126     static struct stat   st; 
     124    STD_DIR           *d; 
     125    struct STD_dirent *de; 
     126    static struct STD_stat   st; 
    127127 
    128128        char curdir[100]; 
     
    139139        for ( iter=1; iter<=2; iter++ ) 
    140140        { 
    141             d = opendir(curdir); 
     141            d = safe_opendir(curdir); 
    142142        if (!d) return 0; 
    143143 
    144144                count = 0; 
    145             for( de = readdir(d); de; de = readdir(d) ) { 
     145            for( de = safe_readdir(d); de; de = safe_readdir(d) ) { 
    146146 
    147147            if (de->d_name[0] == 0xE5 /* deleted entry */ ) 
     
    155155 
    156156                sprintf(buf, "%s/%s", curdir, de->d_name); 
    157                 if (stat(buf, &st)!=0)  
     157                if (safe_stat(buf, &st)!=0)  
    158158                                continue; 
    159159                         
     
    213213                } 
    214214 
    215                 closedir(d); 
     215                safe_closedir(d); 
    216216 
    217217                // Iteration#1 final: allocate menuitems 
    218218                if (iter==1) { 
    219219 
    220                         if ( count==0 ) { closedir(d); return 0;} 
     220                        if ( count==0 ) { safe_closedir(d); return 0;} 
    221221 
    222222                        len = sizeof(CMenu) + sizeof(CMenuItem)*(count+2); 
  • branches/reyalp-flt/core/raw.h

    r1035 r1494  
    3232void unpatch_bad_pixels_b(void); 
    3333int badpixel_list_loaded_b(void); 
    34 char* get_raw_image_addr(void); 
    3534void create_badpixel_bin(); 
    3635#endif 
     36char* get_raw_image_addr(void); 
    3737 
    3838//------------------------------------------------------------------- 
  • branches/reyalp-flt/core/raw_merge.c

    r1483 r1494  
    5656    static struct utimbuf t; 
    5757 
    58     struct stat st; 
    59  
    60     if (stat((char *)from,&st) != 0 || st.st_size!=hook_raw_size())  
     58    struct STD_stat st; 
     59 
     60    if (safe_stat((char *)from,&st) != 0 || st.st_size!=hook_raw_size())  
    6161        return 0; 
    6262 
    63     if (stat((char *)sub,&st) != 0 || st.st_size!=hook_raw_size())  
     63    if (safe_stat((char *)sub,&st) != 0 || st.st_size!=hook_raw_size())  
    6464        return 0; 
    6565 
     
    212212  int  t,src,i,j,nrow; 
    213213  FILE *fbrawin=NULL,*fbrawout,*fcraw; 
    214   struct stat st; 
     214  struct STD_stat st; 
    215215 
    216216  if (!filename) 
    217217    return; 
    218218 
    219   stat(filename,&st); 
     219  safe_stat(filename,&st); 
    220220  if (st.st_size!=hook_raw_size()) 
    221221    return; 
  • branches/reyalp-flt/include/stdlib.h

    r1249 r1494  
    1313#define O_WRONLY        1 
    1414#define O_RDWR          2 
     15 
     16#ifndef THIS_IS_CHDK_CORE 
     17#include "stdlib_unified.h" 
     18#endif 
    1519 
    1620 
     
    8690#endif//CAM_DRYOS_2_3_R39 
    8791 
    88 #endif 
     92#endif //CAM_DRYOS 
    8993 
    9094extern int rand(void); 
  • branches/reyalp-flt/tools/elf2flt/flt.h

    r1488 r1494  
    9090        uint32_t sizeof_struct; 
    9191        uint16_t chdk_required_branch; 
    92         uint16_t chdk_required_ver; 
     92        uint32_t chdk_required_ver; 
    9393        uint32_t chdk_required_platfid; 
    9494        uint32_t flags; 
Note: See TracChangeset for help on using the changeset viewer.