Ignore:
Timestamp:
11/29/08 16:36:02 (4 years ago)
Author:
phyrephox
Message:

several fixes in edgeoverlay.c:

  • changed file prefix from edge_ to EDG_ which fixes both filelength & saving issues on dryos
  • the timestamp of the edge files now is always correct (thx ewavr on hints for both of these)
  • the edge overalay now can be moved in alt-mode only. reason: some cameras have functions for up/down/left/right in original firmware, also the overlay was moved when in a menu (before)
  • some smaller fixes (i/o & layout) thx to plasmahh
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/edgeoverlay.c

    r580 r599  
    2121 
    2222// the way we save edge overlays on their own... 
    23 #define EDGE_FILE_PREFIX "edge_" 
     23#define EDGE_FILE_PREFIX "EDG_" 
    2424#define EDGE_FILE_FORMAT EDGE_FILE_PREFIX "%04d.edg" 
    2525 
     
    106106        int fnum = 0; 
    107107        int fr = 0; 
    108         int zoom = shooting_get_zoom(); 
     108        int zoom = 0; 
    109109        struct dirent* de; 
    110  
     110        static struct utimbuf t; 
    111111        // nothing to save? then dont save 
    112112        if( !imgbuf ) return; 
    113  
     113        zoom = shooting_get_zoom(); 
     114         
    114115        // first figure out the most appropriate filename to use 
    115116        d = opendir(EDGE_SAVE_DIR); 
     
    136137                // write the data 
    137138                fwrite(imgbuf,viewport_size,1,fd); 
    138                 fwrite(&zoom,4,1,fd); 
     139                fwrite(&zoom,sizeof(zoom),1,fd); 
    139140                is_saved = 1; 
    140141                fclose(fd); 
     142                t.actime = t.modtime = time(NULL); 
     143                utime(fn, &t); 
    141144                sprintf(msg, "Saved as %s",fn); 
    142145                draw_string(30, 10, msg, conf.osd_color); 
     
    149152void load_edge_overlay( const char* fn ) { 
    150153        FILE *fd; 
    151         int ret,ret2=0; 
     154        int ret,ret2; 
    152155        int zoom; 
    153156 
     
    159162        { 
    160163                ret = fread(imgbuf,viewport_size,1,fd); 
    161                 ret2 = fread (&zoom,4,1,fd); 
     164                ret2 = fread (&zoom,sizeof(zoom),1,fd); 
    162165                fclose(fd); 
    163166                if( (ret == 1) && (ret2 == 1) ) 
    164167                { 
    165168                        inmem = 1; // fake having loaded stuff 
    166                         if (conf.edge_overlay_zoom)     shooting_set_zoom(zoom); 
     169                        if (conf.edge_overlay_zoom)     { 
     170                                shooting_set_zoom(zoom); 
     171                        } 
    167172                } 
    168173        } 
     
    204209        if(imgbuf == 0) return; // ensure failed, make the best we can out of it 
    205210 
    206         if(conf.edge_overlay_play || ((mode_get()&MODE_MASK) != MODE_PLAY) ) { 
     211        if(conf.edge_overlay_play || ((mode_get()&MODE_MASK) != MODE_PLAY)) { 
    207212                // setup offsets for moving the edge overlay around. Always set 
    208213                // need_redraw so that we actually do a complete redraw, overwriting 
    209214                // also old pixels 
    210                 if (kbd_is_key_pressed(KEY_RIGHT)) { 
    211                         xoffset -=XINC; 
    212                         ++need_redraw; 
    213                 } 
    214                 if (kbd_is_key_pressed(KEY_LEFT)) { 
    215                         xoffset +=XINC; 
    216                         ++need_redraw; 
    217                 } 
    218                 if (kbd_is_key_pressed(KEY_DOWN)) { 
    219                         yoffset -=YINC; 
    220                         ++need_redraw; 
    221                 } 
    222                 if (kbd_is_key_pressed(KEY_UP)) { 
    223                         yoffset +=YINC; 
    224                         ++need_redraw; 
    225                 } 
    226  
     215                if (gui_get_mode()==GUI_MODE_ALT) { 
     216                                if (kbd_is_key_pressed(KEY_RIGHT)) { 
     217                                        xoffset -=XINC; 
     218                                        ++need_redraw; 
     219                                } 
     220                                if (kbd_is_key_pressed(KEY_LEFT)) { 
     221                                        xoffset +=XINC; 
     222                                        ++need_redraw; 
     223                                } 
     224                                if (kbd_is_key_pressed(KEY_DOWN)) { 
     225                                        yoffset -=YINC; 
     226                                        ++need_redraw; 
     227                                } 
     228                                if (kbd_is_key_pressed(KEY_UP)) { 
     229                                        yoffset +=YINC; 
     230                                        ++need_redraw; 
     231                                } 
     232                } 
    227233                if ((kbd_is_key_pressed(KEY_SHOOT_HALF)||kbd_is_key_pressed(KEY_SHOOT_FULL)) && (conf.edge_overlay_lock!=1)) { 
    228234                        if (kbd_is_key_pressed(KEY_SHOOT_FULL) && !full_press) { 
Note: See TracChangeset for help on using the changeset viewer.