Index: conf.c
===================================================================
--- conf.c	(Revision 593)
+++ conf.c	(Arbeitskopie)
@@ -53,7 +53,7 @@
 
 // reyalp: putting these in conf, since the conf values are lookups for them
 // prefixes and extentions available for raw images (index with conf.raw_prefix etc)
-const char* img_prefixes[NUM_IMG_PREFIXES]={ "IMG_", "CRW_", "SND_" /*, "AUT_", "ETC_","SDR_", "MVI_", "MRK_"*/};
+const char* img_prefixes[NUM_IMG_PREFIXES]={ "IMG_", "CRW_", "SND_", "crw_" /*, "AUT_", "ETC_","SDR_", "MVI_", "MRK_"*/};
 const char* img_exts[NUM_IMG_EXTS]={ ".JPG", ".CRW", ".CR2", ".THM", ".WAV"/*, ".AVI", ".MRK"*/};
 // ugh
 const char *video_bitrate_strings[VIDEO_BITRATE_STEPS]={ "0.25x", "0.5x","0.75x", "1x", "1.25x", "1.5x", "1.75x", "2x", "2.5x", "3x"};
Index: gui_lang.c
===================================================================
--- gui_lang.c	(Revision 593)
+++ gui_lang.c	(Arbeitskopie)
@@ -546,6 +546,9 @@
 "425 \"RAW buffer cached\"\n"
 "426 \"Cannot load CHDK/badpixel.bin\"\n"
 "427 \"Show saving time\"\n"
+
+"428 \"Property Compare/Dump\"\n"
+"429 \"Params Compare/Dump\"\n"
 ;
 
 //-------------------------------------------------------------------
Index: gui_lang.h
===================================================================
--- gui_lang.h	(Revision 593)
+++ gui_lang.h	(Arbeitskopie)
@@ -535,9 +535,13 @@
 #define LANG_MENU_RAW_CACHED            425
 #define LANG_CANNOT_OPEN_BADPIXEL_FILE  426
 #define LANG_MENU_RAW_TIMER             427
+
+#define LANG_XXX_PROPCOMPARE		428
+#define LANG_XXX_PARAMCOMPARE		429
+
 //-------------------------------------------------------------------
 
-#define GUI_LANG_ITEMS                  427
+#define GUI_LANG_ITEMS                  429
 
 //-------------------------------------------------------------------
 extern void gui_lang_init();
Index: edgeoverlay.c
===================================================================
--- edgeoverlay.c	(Revision 593)
+++ edgeoverlay.c	(Arbeitskopie)
@@ -105,12 +105,14 @@
 	DIR* d;
 	int fnum = 0;
 	int fr = 0;
-	int zoom = shooting_get_zoom();
+	int zoom = 0;
 	struct dirent* de;
 
 	// nothing to save? then dont save
 	if( !imgbuf ) return;
 
+	zoom = shooting_get_zoom();
+
 	// first figure out the most appropriate filename to use
 	d = opendir(EDGE_SAVE_DIR);
 	if( ! d )
@@ -135,7 +137,7 @@
 	{
 		// write the data
 		fwrite(imgbuf,viewport_size,1,fd);
-		fwrite(&zoom,4,1,fd);
+		fwrite(&zoom,sizeof(zoom),1,fd);
 		is_saved = 1;
 		fclose(fd);
 		sprintf(msg, "Saved as %s",fn);
@@ -148,7 +150,7 @@
 // displaying) from a file
 void load_edge_overlay( const char* fn ) {
 	FILE *fd;
-	int ret,ret2=0;
+	int ret,ret2;
 	int zoom;
 
 	is_saved = 1; // won't want to save it again, its already there
@@ -158,12 +160,14 @@
 	if( fd != NULL )
 	{
 		ret = fread(imgbuf,viewport_size,1,fd);
-		ret2 = fread (&zoom,4,1,fd);
+		ret2 = fread (&zoom,sizeof(zoom),1,fd);
 		fclose(fd);
 		if( (ret == 1) && (ret2 == 1) )
 		{
 			inmem = 1; // fake having loaded stuff
-			if (conf.edge_overlay_zoom)	shooting_set_zoom(zoom);
+			if (conf.edge_overlay_zoom)	{
+				shooting_set_zoom(zoom);
+			}
 		}
 	}
 }
Index: gui.c
===================================================================
--- gui.c	(Revision 593)
+++ gui.c	(Arbeitskopie)
@@ -47,7 +47,7 @@
 //-------------------------------------------------------------------
 
 #define OPTIONS_AUTOSAVE
-#define SPLASH_TIME               20
+#define SPLASH_TIME               5 // XXX A configure option for this would be great
 
 int script_params_has_changed=0;
 //shortcuts
@@ -156,6 +156,8 @@
 static void gui_menuproc_edge_load(int arg);
 static void gui_menuproc_edge_free(int arg);
 
+void gui_compare_props(int arg);
+void gui_compare_params(int arg);
 #ifndef OPTIONS_AUTOSAVE
 static void gui_menuproc_save(int arg);
 #endif
@@ -406,6 +408,8 @@
     {0x2a,LANG_MENU_MAIN_DEBUG,              MENUITEM_SUBMENU,   (int*)&debug_submenu },
 #endif
     {0x86,LANG_MENU_REMOTE_PARAM,            MENUITEM_SUBMENU,   (int*)&remote_submenu },
+    {0x80,LANG_XXX_PROPCOMPARE,        MENUITEM_PROC,    (int*)gui_compare_props},
+    {0x80,LANG_XXX_PARAMCOMPARE,        MENUITEM_PROC,   (int*)gui_compare_params},
     {0x51,LANG_MENU_BACK,                    MENUITEM_UP },
     {0},
 };
@@ -594,6 +598,7 @@
     {0x7f,LANG_MENU_EDGE_OVERLAY_TRESH,      MENUITEM_INT|MENUITEM_F_UNSIGNED|MENUITEM_F_MINMAX, &conf.edge_overlay_thresh, MENU_MINMAX(0, 255)},
     {0x65,LANG_MENU_EDGE_OVERLAY_COLOR,      MENUITEM_COLOR_FG,      (int*)&conf.edge_overlay_color },
     {0x5c,LANG_MENU_EDGE_PLAY,			MENUITEM_BOOL,		&conf.edge_overlay_play }, //does not work on cams like s-series, which dont have a real "hardware" play/rec switch, need a workaround, probably another button
+    {0x33,LANG_MENU_EDGE_SAVE,			MENUITEM_PROC,		(int*)gui_menuproc_edge_save },
     {0x33,LANG_MENU_EDGE_FREE,			MENUITEM_PROC,		(int*)gui_menuproc_edge_free },
     {0x33,LANG_MENU_EDGE_LOAD,			MENUITEM_PROC,		(int*)gui_menuproc_edge_load },
     {0x51,LANG_MENU_BACK,                    MENUITEM_UP },
@@ -3147,3 +3152,236 @@
  	}
 }
 
+void gui_compare_props(int arg)
+{
+#define NUM_PROPS 512
+    static int initialized = 0;
+    static int props[NUM_PROPS] = { };
+    char buf[64];
+    int i;
+    int p;
+    int c;
+
+
+    if( initialized )
+    { // we have previous data set! do a comparison
+	c = 0;
+	for( i = 0; i < NUM_PROPS; ++i )
+	{
+	    p = shooting_get_prop(i);
+	    if( props[i] != p )
+	    {
+		++c;
+		sprintf(buf,"%4d is %8d was %8d",i,p,props[i]);
+		draw_string(16,16*c,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+	    }
+	    props[i] = p;
+	    if( c == 12 )
+	    {
+		++c;
+		sprintf(buf,"%s","Waiting 10 Seconds");
+		draw_string(16,16*c,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+		msleep(10000);
+		c = 0;
+	    }
+	}
+	++c;
+	sprintf(buf,"%s","Waiting 10 Seconds");
+	draw_string(16,16*c,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+	msleep(10000);
+    }
+    else
+    {
+	// no previous data was set so we save the data initially
+	for( i = 0; i < NUM_PROPS; ++i )
+	{
+	    props[i] = shooting_get_prop(i);
+	}
+    }
+    initialized = 1;
+}
+
+#define NUM_params 256
+#define BLACKLIST_FILENAME "A/CHDK/DATA/BLACKLIST.PAR"
+static signed char *blacklist = 0;
+int shooting_get_param( int id )
+{
+    int r = 0;
+    int s = sizeof(r);
+    if( blacklist )
+    {
+	if( id < 0 || id >= NUM_params )
+	{
+	    s = 0;
+	}
+	else
+	{
+	    s = blacklist[id];
+	}
+    }
+    if( s )
+    {
+	get_parameter_data(id,&r,s);
+    }
+    return r;
+}
+
+void write_blacklist_file( const signed char* bl )
+{
+    int fd;
+    fd = open(BLACKLIST_FILENAME, O_RDWR|O_CREAT|O_TRUNC, 0777);
+    write(fd,bl,NUM_params);
+    close(fd);
+}
+
+void gui_compare_params(int arg)
+{
+    static int initialized = 0;
+    static int *params = 0;
+    char buf[64];
+    int i;
+    int p;
+    int c;
+    int fd;
+    int test = 0;
+
+    if( 0 == blacklist )
+    { 
+	blacklist = malloc(NUM_params);
+	// blacklist creation/loading of next step wasn't done yet, lets have a look if...
+	// the file exists at all
+	struct stat s;
+	s.st_size = 0;
+
+	stat(BLACKLIST_FILENAME,&s);
+	if( s.st_size < NUM_params )
+	{ // either from another compile or broken in another way or not there or... well whatever
+	    for(i = 0; i < NUM_params; ++i )
+	    { // initialize all to -8 meaning: not yet tested
+		blacklist[i] = -8;
+	    }
+	}
+	else
+	{
+	    // open and read the file
+	    fd = open(BLACKLIST_FILENAME, O_RDONLY,0);
+	    read(fd,blacklist,NUM_params);
+	    close(fd);
+	}
+	/*
+	 * The following entries are possible with the said meaning in the
+	 * blacklist file:
+	 * -8 : This param has not yet been tested, you should do this
+	 * -4 : The last test was tried with reading 4 bytes and failed. Action to be taken: write 2
+	 * -2 : The last test was tried with reading 4 bytes and failed. Action to be taken: write 1
+	 * -1 : The last test was tried with reading 4 bytes and failed. Action to be taken: write 0
+	 *  0 : Not a single byte can ever be read from this location
+	 *  1 : Only ever read 1 byte from the location
+	 *  2 : Only ever read 2 bytes from the location
+	 *  4 : It is save to read 4 bytes from this location
+	 */
+	i = 0;
+	// skip all entries that have been tested already
+	while( i < NUM_params )
+	{
+	    switch(blacklist[i])
+	    {
+		case -8:
+		    sprintf(buf,"Testing param %d read 1",i);
+		    draw_string(16,16,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+		    // need to test, so... note in the array
+		    blacklist[i] = -1;
+		    write_blacklist_file(blacklist);
+		    get_parameter_data(i,&test,1);
+
+		    sprintf(buf,"Testing param %d read 2",i);
+		    draw_string(16,16,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+		    // no crash? try more!
+		    blacklist[i] = -2;
+		    write_blacklist_file(blacklist);
+		    get_parameter_data(i,&test,2);
+
+		    sprintf(buf,"Testing param %d read 4",i);
+		    draw_string(16,16,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+		    // no crash? try more!
+		    blacklist[i] = -4;
+		    write_blacklist_file(blacklist);
+		    get_parameter_data(i,&test,4);
+
+		    sprintf(buf,"Testing param %d was successfull up to 4",i);
+		    draw_string(16,16,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+		    // still no crash? wow, nice
+		    blacklist[i] = 4;
+		    write_blacklist_file(blacklist);
+		    break;
+		case -4: // last test failed, record this
+		    blacklist[i] = 2;
+		    break;
+		case -2: // last test failed, record this
+		    blacklist[i] = 1;
+		    break;
+		case -1: // last test failed, record this
+		    blacklist[i] = 0;
+		    break;
+		case 0:
+		case 1:
+		case 2:
+		case 4:
+		default:
+		    // this one is safe...
+		    break;
+	    }
+	    // advance to the next...
+	    ++i;
+	}
+	// we went here without any crashes, that means the blacklist is
+	// complete now
+	write_blacklist_file(blacklist);
+    }
+    if( 0 == params )
+    {
+	params = malloc(NUM_params * sizeof(int));
+    }
+
+    if( initialized )
+    { // we have previous data set! do a comparison
+	c = 0;
+	for( i = 0; i < NUM_params; ++i )
+	{
+	    p = shooting_get_param(i);
+	    if( params[i] != p )
+	    {
+		++c;
+		sprintf(buf,"%4d is %8d was %8d",i,p,params[i]);
+		draw_string(16,16*c,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+	    }
+	    params[i] = p;
+	    if( c == 12 )
+	    {
+		++c;
+		sprintf(buf,"%s","Waiting 10 Seconds");
+		draw_string(16,16*c,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+		msleep(10000);
+		c = 0;
+	    }
+	}
+	++c;
+	sprintf(buf,"%s","Waiting 10 Seconds");
+	draw_string(16,16*c,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+	msleep(10000);
+    }
+    else
+    {
+	// no previous data was set so we save the data initially
+	for( i = 0; i < NUM_params; ++i )
+	{
+#if 0
+	    sprintf(buf,"About to read %d",i);
+	    draw_string(16,16,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+	    msleep(1000);
+#endif
+	    params[i] = shooting_get_param(i);
+	}
+    }
+    initialized = 1;
+}
Index: makefile.inc.new
===================================================================
--- makefile.inc.new	(Revision 0)
+++ makefile.inc.new	(Revision 0)
@@ -0,0 +1,92 @@
+
+LOCAL_CFLAGS:=$(CTHUMB)
+
+# warning: library order matters!
+CORE_LDLIBS:= -lgcc
+CORE_LDOPTS=-nostdlib -Wl,--allow-shlib-undefined -Wl,-T,$(TOPDIR)/tools/link-boot.ld
+CORE_LDOPTS+=-Wl,-N,-Ttext,$(MEMISOSTART)
+
+OPT_OBJS:=
+ifdef OPT_GAME_REVERSI
+LOCAL_CFLAGS +=-DOPT_GAME_REVERSI
+OPT_OBJS+=gui_reversi.o
+endif
+ifdef OPT_GAME_SOKOBAN
+LOCAL_CFLAGS+=-DOPT_GAME_SOKOBAN
+OPT_OBJS+=gui_sokoban.o
+endif
+ifdef OPT_BOOTLOGO
+LOCAL_CFLAGS+=-DOPT_BOOTLOGO
+endif
+ifdef OPT_CURVES
+LOCAL_CFLAGS+=-DOPT_CURVES
+OPT_OBJS+=curves.o
+endif
+ifdef OPT_TEXTREADER
+LOCAL_CFLAGS+=-DOPT_TEXTREADER
+OPT_OBJS+=gui_read.o 
+endif
+ifdef OPT_CALENDAR
+LOCAL_CFLAGS+=-DOPT_CALENDAR
+OPT_OBJS+=gui_calendar.o 
+endif
+ifdef OPT_DEBUGGING
+LOCAL_CFLAGS+=-DOPT_DEBUGGING
+OPT_OBJS+=gui_debug.o gui_bench.o 
+endif
+ifdef OPT_EDGEOVERLAY
+CFLAGS+=-DOPT_EDGEOVERLAY
+OPT_OBJS+=edgeoverlay.o 
+endif
+C_OBJS:= main.o gui_draw.o gui_menu.o gui_palette.o gui_mbox.o \
+     gui_fselect.o gui.o kbd.o conf.o \
+     histogram.o gui_batt.o gui_space.o gui_osd.o script.o raw.o \
+     gui_lang.o gui_mpopup.o gui_grid.o motion_detector.o raw_merge.o \
+     luascript.o shot_histogram.o dng_hdr.o $(OPT_OBJS)
+N_OBJS:= nothumb.o
+
+ASM_OBJS:=entry.o
+
+OBJS := $(call subdirize,$(ASM_OBJS) $(C_OBJS) $(N_OBJS) )
+N_OBJS:=$(call subdirize, $(N_OBJS) )
+C_OBJS:=$(call subdirize, $(C_OBJS) )
+ASM_OBJS:=$(call subdirize, $(ASM_OBJS) )
+
+MAIN_LIBS := \
+	$(TOPDIR)/platform/$(PLATFORM)/libplatform.a \
+	$(TOPDIR)/platform/$(PLATFORM)/sub/$(PLATFORMSUB)/libplatformsub.a \
+	$(TOPDIR)/lib/font/libfont.a \
+	$(TOPDIR)/lib/math/libmath.a \
+	$(TOPDIR)/lib/ubasic/libubasic.a \
+	$(TOPDIR)/lib/lang/liblang.a \
+	$(TOPDIR)/lib/lua/liblua.a
+
+core/nothumb.o:: core/nothumb.c
+	@echo $< \-\> $@
+	$(CC) $(CFLAGS) -marm -nostdinc -c -o $@ $<
+
+$(eval $(call compile-targets,$(C_OBJS),$(LOCAL_CFLAGS)))
+$(eval $(call compile-asm-targets,$(ASM_OBJS),$(LOCAL_CFLAGS)))
+
+$(eval $(call gen-rule, $(subdir)/main.bin, $(OBJS) $(subdir)/main.elf,  \
+	$(OBJDUMP) -z -d $(subdir)/main.elf > $(subdir)/main.dump; \
+	$(OBJCOPY) -O binary $(subdir)/main.elf $(subdir)/main.bin ))
+
+define postprocess-main-elf
+	( $(NM) $(subdir)/main.elf | grep ' U ' > $(subdir)/main.elf.syms ) && exit 1 || exit 0;
+	$(SIZE) $(subdir)/main.elf | tee $(TOPDIR)/size.txt;
+	$(SIZLENCE)printf " %s-%s (%s, #%s): MEMISOSIZE used: 0x%s\n" \
+	$(PLATFORM) $(PLATFORMSUB) $(PLATFORMOS) $(PLATFORMID) \
+	`cut -f5 $(TOPDIR)/size.txt | tail -1` >> $(TOPDIR)/bin/caminfo.txt;
+endef
+
+$(eval $(call gen-rule, $(subdir)/main.elf, $(OBJS) $(MAIN_LIBS), \
+    $(CC) $(CFLAGS) $(LOCAL_CFLAGS) -o $$@ --start-group $$^  $(CORE_LDLIBS) --end-group $(LDFLAGS) $(CORE_LDOPTS) || exit 1; \
+    $(call postprocess-main-elf) \
+    ))
+
+$(eval $(call gen-rule, core-clean,, rm -f $(OBJS) $(subdir)/*.$(DEPSUFFIX) $(subdir)/main.bin $(subdir)/main.elf $(subdir)/main.dump $(subdir)/main.elf.syms ))
+
+$(eval $(call gen-rule, core-distclean, core-clean, rm -f $(OBJS:.o=.d) ))
+
+# vim: filetype=make
Index: gui_fselect.c
===================================================================
--- gui_fselect.c	(Revision 593)
+++ gui_fselect.c	(Arbeitskopie)
@@ -655,7 +655,7 @@
 //-------------------------------------------------------------------
 static void fselect_marked_paste_cb(unsigned int btn) {
     struct fitem  *ptr;
-    int ss, sd, fsrc, fdst, i=0;
+    int ss, sd = 0, fsrc, fdst, i=0;
     register int *buf;
     unsigned char fend;
     static struct utimbuf t;
Index: main.c
===================================================================
--- main.c	(Revision 593)
+++ main.c	(Arbeitskopie)
@@ -68,6 +68,22 @@
         spytask_can_start = 1;
 }
 
+#include "gui.h"
+#include "gui_draw.h"
+
+void brain_dump() 
+{
+    char buf[64];
+    static const int p = 20;
+    static const long a = 4;
+    static int v = 0;
+
+    get_parameter_data(p,&v,a);
+
+    sprintf(buf,"param %d is %d",p,v);
+    draw_string(16,0,buf,MAKE_COLOR(COLOR_BLACK,COLOR_YELLOW));
+}
+
 void core_spytask()
 {
     int cnt = 1;
@@ -106,6 +122,7 @@
 #ifdef OPT_EDGEOVERLAY
     mkdir("A/CHDK/EDGE");
 #endif
+
     auto_started = 0;
 
     if (conf.script_startup==1) script_autostart();				// remote autostart
@@ -133,6 +150,8 @@
 #endif
 	}
 
+//	brain_dump();
+
 	if ((state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) && (!shooting_in_progress())) {
 	    state_shooting_progress = SHOOTING_PROGRESS_DONE;
             if (raw_need_postprocess) raw_postprocess();
