G11 porting - page 18 - DryOS Development - CHDK Forum

G11 porting

  • 530 Replies
  • 249195 Views
*

Offline ERR99

  • ****
  • 339
Re: G11 porting
« Reply #170 on: 04 / January / 2010, 09:56:52 »
Advertisements
Yes, this will be my next task.
But now, with prinft() support for debugging, i found something regarding the file load function.
The splashcreen loading does not fail because fread is now working, it is failing because stat() returns a filesize of zero.
Code: [Select]
            if (stat(logo_name,&st) == 0) {
logo_size=st.st_size;
logo=malloc(logo_size);

if(logo) {
fd = fopen(logo_name, "rb");
So no memory is allocated and the file is not read. If i a "fake" the logo_size variable to the known file_size direct in the code,
fopen() & fread() are working and i can see the logo, loaded from the sd-card. So i think, i have to check the function address for stat().

Re: G11 porting
« Reply #171 on: 04 / January / 2010, 09:59:04 »
Quote
Success, i added the call of this function:

I thought the only time that function is normally called is when you change the codepage ?

Re: G11 porting
« Reply #172 on: 04 / January / 2010, 10:06:12 »
Not sure what this means  :-

NSTUB(stat, 0xff835b08)
// ALT: NSTUB(stat, 0xff86d0c4) // 30/0
// Best match: 61%

Does that means it was found with 100% match ?

*

Offline ERR99

  • ****
  • 339
Re: G11 porting
« Reply #173 on: 04 / January / 2010, 10:34:33 »
Yes, i have seen that there are two stat() functions found (both are not 100% hits), and i tryed allready both of them.
But stat() it still not working correctly, the returned filesize is in both cases zero.

*

Offline ERR99

  • ****
  • 339
Re: G11 porting
« Reply #174 on: 04 / January / 2010, 12:24:04 »
Okay, i dumped the returned stat() structure of LOGO.dat into a file on the sd-card, and i think i found the problem.
It looks like, that the structure of "struct stat" has changed. I found the filesize in the binary dump now on another position.
In chdk struct stat, the item st_size is located unter st_ctime. In my dump, if found the size now unter st_ino.
Code: [Select]
struct stat
    {
    unsigned long st_dev; //?
    unsigned long st_ino; //?
    unsigned long st_size; //   <--- New location
    unsigned short st_mode; //?
    short st_nlink; //?
    short st_uid; //?
    short st_gid; //?
    unsigned long st_atime; //?
    unsigned long st_mtime; //?
    unsigned long st_ctime; //?
//    unsigned long st_size; <--- Old location
    long st_blksize; //?
    long st_blocks; //?
    unsigned char st_attrib;
    int reserved1; //
    int reserved2; //
    int reserved3; //
    int reserved4; //
    int reserved5; //
    int reserved6; //
};

If i am correct with my theorie here, then i am in doubt that this is maybe not the only change and possible more of the structure has changed.

Re: G11 porting
« Reply #175 on: 04 / January / 2010, 12:48:33 »
Hmmm ... are there any tests you can do to determine the entire structure ?

Maybe you just need to find the location of the structure members that are used by CHDK ?

I guess you can just put a #if defined(CAMERA_g11) around the new structure.



In the 'old' days the FUT  api was not used.

Not sure with which port that changed and why.
« Last Edit: 04 / January / 2010, 12:51:32 by Microfunguy »

*

Offline ERR99

  • ****
  • 339
Re: G11 porting
« Reply #176 on: 04 / January / 2010, 13:14:20 »
Okay, i will take a look on this later. I will now  try to get the keys working.
I also managed to find out which function in conf_load_defaults() is crashing during load.
It is config entry number 65 (id=66):
    CONF_INFO( 66, conf.menu_rbf_file,          CONF_DEF_PTR,   ptr:"", conf_change_menu_rbf_file),

If i skip this entry during loading in conf_load_defaults(), the function does not crash.
BTW: The current splashscreen at startup looks not so bad now.  :)

Re: G11 porting
« Reply #177 on: 04 / January / 2010, 13:30:22 »
You will know if the palette is suitable when you do the histograms.

You may be able to access the menus fairly soon.

I would guess the clock is working and you live in Germany !

static void conf_change_menu_rbf_file()
{
    if (!rbf_load(conf.menu_rbf_file))
        rbf_load_from_8x16(current_font);
    rbf_set_codepage(FONT_CP_WIN);
}

Guess there is a problem with that.
rbf_load_from_8x16 is passed an array so no file opening there.
rbf_set_codepage is simply passed an integer value defining the codepage.
rbf_load is the one that opens a file.


So, because of the changed 'stat'  structure any operation with files is going to cause a crash.
« Last Edit: 04 / January / 2010, 13:57:44 by Microfunguy »

Re: G11 porting
« Reply #178 on: 04 / January / 2010, 14:28:41 »

*

Offline ERR99

  • ****
  • 339
Re: G11 porting
« Reply #179 on: 04 / January / 2010, 17:23:42 »

 

Related Topics


SimplePortal © 2008-2014, SimplePortal