SD980 port - page 14 - DryOS Development - CHDK Forum

SD980 port

  • 169 Replies
  • 45305 Views
*

Offline RaduP

  • *****
  • 908
Re: SD980 port
« Reply #130 on: 12 / October / 2009, 00:59:33 »
Advertisements
I can't find rename/RenameFile_Fut ...
I really wonder if that still exists, along with stat() and SetFileTimeStamp()
I guess I have to write a wrapper for rename, but that sucks.

*

Offline RaduP

  • *****
  • 908
Re: SD980 port
« Reply #131 on: 12 / October / 2009, 16:12:14 »
Well, finished my rename implementation. In case someone else needs it, here it is, in all its glory:
Code: [Select]
int _rename(const char *oldname, const char *newname)
{
FILE * fd_old;
FILE *fd_new;
char * buffer;
int size_read;

fd_old = Fopen_Fut(oldname, "r+b");
if(!fd_old)return -1;

fd_new = Fopen_Fut(newname, "w+b");
buffer=malloc(10000);

while(1)
{
size_read=Fread_Fut(buffer,1,10000,fd_old);
Fwrite_Fut(buffer,size_read,1,fd_new);
if(size_read!=10000)break;
}

Fclose_Fut(fd_new);
Fclose_Fut(fd_old);
free(buffer);
remove(oldname);
return 1;
}

*

Offline RaduP

  • *****
  • 908
Re: SD980 port
« Reply #132 on: 14 / October / 2009, 04:03:43 »
I got the bad pixel script to work, as well as the USB remote control (tested with the basic script). Fixing the bad pixel script also fixed some bugs in other scripts as well.
Will release a new binary in a few days.

*

Offline RaduP

  • *****
  • 908
Re: SD980 port
« Reply #133 on: 14 / October / 2009, 04:29:27 »
BTW, I noticed that if get_parameter_data() is called with 'arbitrary' values, such as 0, 1, etc. it will crash the camera. If called with a right value (such as camera name thing) it will work fine.
The problem is, if you activate the debug menu and have it print the parameters, it will crash the camera at startup, and unless if you comment out that line in gui.c or delete the config file, you can't use CHDK.


*

Offline RaduP

  • *****
  • 908
Re: SD980 port
« Reply #134 on: 14 / October / 2009, 17:54:58 »
Yes, the video will be next, once I do some more cleaning of the code and possibly get the flash working.

*

Offline RaduP

  • *****
  • 908
Re: SD980 port
« Reply #135 on: 16 / October / 2009, 00:11:52 »
Got the optical zoom to work, please download again from here: http://chdk.setepontos.com/index.php/topic,4335.0.html

*

Offline RaduP

  • *****
  • 908
Re: SD980 port
« Reply #136 on: 16 / October / 2009, 15:26:06 »
I don't think that's possible due to the sensor hardware. Only CMOS sensors (for P&S cameras) are capable of stuff like that.

*

Online reyalp

  • ******
  • 13432
Re: SD980 port
« Reply #137 on: 18 / October / 2009, 03:17:30 »
BTW, some functions still need to be found.
Here are some functions I am still missing, if someone wants to hunt for them:
//implemented in the wrappers, in C
//NHSTUB(strrchr, 0xDEADC0DE)
//NHSTUB(strncpy, 0xDEADC0DE)
//NHSTUB(strcat, 0xDEADC0DE)
//NHSTUB(rename, 0xDEADC0DE)
//NHSTUB(RenameFile_Fut, 0xDEADC0DE)
//NHSTUB(stat, 0xFF835560)
NHSTUB(SetFileTimeStamp, 0xFF810B04)//nullsubed

I guess people can use my implementation of those functions, but my implementation of stat() so far only puts the file size, and now I need to handle the attributes (directories do not show properly in the file menus because of that).

strrchr FF813FE4 from sub_FFA7274C, via the string "ErrorResult = %lX(ReadFile:%s)"
Also made me realize this was wrong in sd990. Bad reyalp, no cookie for me :(

strncpy FF813F38 via sub_FF887AA4, eventproc "CheckSumAll"

strcat FF8A5524 via sub_FF8ED1BC strings "V/" and "V/GLOBALOB.JPG"

RenameFile_Fut FF834D00 via sub_FF9D23A8, identified by calls to sub_FFAB2570 "PBCommon.c"

not sure about rename, but RenameFile_Fut should be a direct replacement.

stat was discussed earlier, just need to reverse engineer the struct that the function that calls stat on other ports fills in.

edit:
if you can verify these, I'll add them to the sigs as appropriate.
« Last Edit: 18 / October / 2009, 03:22:06 by reyalp »
Don't forget what the H stands for.


*

Offline RaduP

  • *****
  • 908
Re: SD980 port
« Reply #138 on: 18 / October / 2009, 03:29:36 »
I'll verify your functions soon and let you know.

Quote
Also made me realize this was wrong in sd990. Bad reyalp, no cookie for me
That's strange, because without it working properly the scripts won't run well...
« Last Edit: 18 / October / 2009, 03:37:56 by RaduP »

*

Offline RaduP

  • *****
  • 908
Re: SD980 port
« Reply #139 on: 18 / October / 2009, 03:46:36 »
RenameFile_Fut/rename confirmed.
strcat confirmed.
strncpy confirmed.
strrchr confirmed.

Tomorrow I will dump to a file what stat() outputs and see if it is the right function or not.
« Last Edit: 18 / October / 2009, 04:43:05 by RaduP »

 

Related Topics