Little change to see changing Property Cases - General Discussion and Assistance - CHDK Forum supplierdeeply

Little change to see changing Property Cases

  • 5 Replies
  • 2473 Views
*

Offline kwf

  • **
  • 72
Little change to see changing Property Cases
« on: 10 / March / 2008, 09:30:27 »
Advertisements
I did a little change to gui.c to see which property cases changes when don't some action, maybe it will miss some changes when they are too fast (e.g. changed back before function is called again). But i think its quite useful to explore the property cases especially for the digic III, where many are yet unknown. Is activated by setting propcase page to 30, max. propcase should be 280 at least for the a570, so you shouldn't miss any. I also added the possibility to hide known propcases on-screen, but you have to change the code for that (hide_pc...). But as this is really only interesting for developers this should not pose any problem :)
Just exchange the standard propcase display to following code in gui.c:

 
Code: [Select]
int pcase[281];
 static int pcase_old[281];
 static int pcl=0;
 static int fd;
#define NUM_HIDE 38
 int hide_pc[NUM_HIDE] = {5 ,  6,  8, 21, 57, 60, 91, 92, 94, 95,
               102,107,117,141,143,145,149,155,166,169,
184,195,207,213,218,220,223,224,268,269,
277, 26,264, 49, 50,262, 23, 79};

  if (debug_propcase_show){
if (!fd) {
fd = open("A/PropCases.txt", O_WRONLY|O_CREAT, 0777);
for (i=0;i<281;i++) pcase_old[i]=0;
}
if (!fd) return;

if (debug_propcase_page==30) {

for (i=0;i<281;i++) {
get_property_case(i, &pcase[i], 4);
// property case changed, then print on screen and write to file
p=0;
if (pcase_old[i]!=pcase[i]) {
len=sprintf(sbuf, "%3d: %d -> %d              \n", i, pcase_old[i],pcase[i]);
write(fd, sbuf, len);
for (r=0;r<NUM_HIDE;r++) if (i==hide_pc[r]) p=1;
if (p==0) {
sbuf[25]=0; draw_string(64,16+16*pcl,sbuf, conf.osd_color);
pcl=(pcl+1)%10;
}
}
pcase_old[i]=pcase[i];
        }
        } else {
        for (i=0;i<10;i++){
                     r = 0;
     p = debug_propcase_page*10+i;
     get_property_case(p, &r, 4);
     sprintf(sbuf, "%3d: %d              ", p, r);sbuf[20]=0;
     draw_string(64,16+16*i,sbuf, conf.osd_color);
        }
        }
    } else {
if (fd) close(fd);
fd=0;
   }

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Little change to see changing Property Cases
« Reply #1 on: 10 / March / 2008, 09:41:38 »
thanks, that will help alot!

*

Offline whim

  • ******
  • 2013
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: Little change to see changing Property Cases
« Reply #2 on: 10 / March / 2008, 10:24:32 »
Very useful ! Thanks,

wim

*

Offline kwf

  • **
  • 72
Re: Little change to see changing Property Cases
« Reply #3 on: 10 / March / 2008, 10:53:24 »
Optimized the code a little bit, propcase page = 30 displays all changes, propcase page = 31 hides known ones. Just exchange the standard propcase display to following code in gui.c:

 
Code: [Select]
    int pcase[281];
    static int pcase_old[281];
    int pc_num[14];
    int pc_old[14];
    int pc_new[14];
    static int pc_line=0;
    static int fd;
    #define NUM_HIDE 38
    int hide_pc[NUM_HIDE] = {5 ,  6,  8, 21, 57, 60, 91, 92, 94, 95,
        102,107,117,141,143,145,149,155,166,169,
        184,195,207,213,218,220,223,224,268,269,
277, 26,264, 49, 50,262, 23, 79};

    if (debug_propcase_show){
if (!fd) {
fd = open("A/PropCases.txt", O_WRONLY|O_CREAT, 0777);
for (i=0;i<281;i++) pcase_old[i]=0;
}
if (!fd) return;

if (debug_propcase_page>29) {
for (i=0;i<281;i++) {
get_property_case(i, &pcase[i], 4);
// property case changed, then print on screen and write to file
p=0;
if (pcase_old[i]!=pcase[i]) {
len=sprintf(sbuf, "%3d: %d -> %d\n", i, pcase_old[i],pcase[i]);
write(fd, sbuf, len);
// hide known property cases, don't display them on screen
if (debug_propcase_page==31) for (r=0;r<NUM_HIDE;r++) if (i==hide_pc[r]) p=1;
// if unknown print store property case for display, if more than 14 change, see written file
if (p==0) {
pc_num[pc_line]=i;
pc_old[pc_line]=pcase_old[i];
pc_new[pc_line]=pcase[i];
pc_line=(pc_line+1)%14;
}
}
pcase_old[i]=pcase[i];
}
// now print the array of changing property cases on screen
for (r=0;r<14;r++) {
                                // Mark the last change with a *
if (r==((pc_line+13)%14))
len=sprintf(sbuf, "* %3d: %d -> %d              ", pc_num[r], pc_old[r],pc_new[r]);
else
len=sprintf(sbuf, "  %3d: %d -> %d              ", pc_num[r], pc_old[r],pc_new[r]);
sbuf[25]=0; draw_string(64,16+16*r,sbuf, conf.osd_color);
}
} else {
for (i=0;i<10;i++){
r = 0;
p = debug_propcase_page*10+i;
get_property_case(p, &r, 4);
sprintf(sbuf, "%3d: %d              ", p, r);sbuf[20]=0;
draw_string(64,16+16*i,sbuf, conf.osd_color);
}
}
    } else {
if (fd) close(fd);
fd=0;
    }



*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Little change to see changing Property Cases
« Reply #4 on: 10 / March / 2008, 15:59:37 »
where exactly do i have to exchange the lines in gui.c? what will be replaced?

*

Offline kwf

  • **
  • 72
Re: Little change to see changing Property Cases
« Reply #5 on: 10 / March / 2008, 16:17:05 »
This piece of code should be replaced by the above:

Code: [Select]
if (debug_propcase_show){
    for (i=0;i<10;i++){
        r = 0;
        p = debug_propcase_page*10+i;
        get_property_case(p, &r, 4);
        sprintf(sbuf, "%3d: %d              ", p, r);sbuf[20]=0;
        draw_string(64,16+16*i,sbuf, conf.osd_color);
    }
}
   

Hope the PropertyCase table on the wiki will soon be completed with this little change. I already added some of my results.

 

Related Topics