PSPSDK and what's implemented in stdio, etc

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Gendal
Posts: 4
Joined: Tue Jul 19, 2005 6:44 am

PSPSDK and what's implemented in stdio, etc

Post by Gendal »

First off I have the latest psptoolchain, 7/13 I believe. I updated via svn PSPSDK this morning too.

I have functions like open, read, lseek, fprintf etc all working with my port effort, and it's working great. I was suprised how much was implemented with the latest toolchain.

However some things like rename, mktime, time, tmpnam, etc seem to be either broken or not implemented. My methods so far have been just seeing what crashes the PSP, which is far from optimal.

So my question is where are these functions, using -lstdc++ -lc -lpspglue typically located? I get so lost inbetween binutils, gcc, newlib, and pspsdk I am not sure where the actual code should be. I would like to take a crack at either fixing or implementing myself the functions listed as not working above, assuming source for another platform or similar is available.

So can anybody point me in the right direction? I know it's sort of vague, with some of those functions probably being implemented in different places, but any help would be much appreciated.
Gendal
Posts: 4
Joined: Tue Jul 19, 2005 6:44 am

Post by Gendal »

Found most of my answers under pspsdk\sdk\libc

Now to start sorting out which missing functions belong under there and which are part of some other package.

Yep heh, there is rename, and it's an empty placeholder.

Code: Select all

int rename(const char *name, const char *newname)
{
  int ret = 0;
  
  return (ret);
}
Which could just as easily become:

Code: Select all

int rename(const char *name, const char *newname)
{
  int ret = 0;
  ret = sceIoRename(name,newname);
  return (ret);
}
Of course I don't know how to match up the error codes returned from sceIoRename to perror, but it doesn't look like anything else does either?

If it doesn't matter I could go to town on a few functions in libc, otherwise I would need some pointers on how it's supposed to be written.
rinco
Posts: 255
Joined: Fri Jan 21, 2005 2:12 pm
Location: Canberra, Australia

Post by rinco »

To determine error conditions I would start by doing something like this:

Code: Select all

        ret = sceIoRename("ms0:/testfile", "ms0:/testfile1");
        printf ("renaming file: %x\n", ret);
        ret = sceIoRename("ms0:/testdir", "ms0:/testdir1");
        printf ("renaming dir: %x\n", ret);
        ret = sceIoRename("ms0:/badfile", "ms0:/doesntmatter");
        printf ("renaming non existent file: 0x%x\n", ret);
        ret = sceIoRename("baddev:/badfile", "ms0:/doesntmatter");
        printf ("renaming non existent device: 0x%x\n", ret);

...

renaming file: 0
renaming dir: 0
renaming non existent file: 0x80010002
renaming non existent device: 0x80020321
The third value looks like the correct value for non-existent file but with 0x8001 on the front. I hear rumours that all 0x8001 error values are standard. So I'm guessing the easiest thing to do is mask the values in perror()... and/or rewrite error_to_string.

edit: and then there's sdk/user/pspkerror.h
Gendal
Posts: 4
Joined: Tue Jul 19, 2005 6:44 am

Post by Gendal »

Was afraid of having to test every possible combination, will have to check out pspkerror.h. Thanks for the pointers, if there is some level of standardization, which I imagine there is, it should get a lot easier over time.

Of course the problem I am having now is figureing out why my modifications to rename and remove in pspsdk\sdk\libc\stdio.c are not working. I did a make clean/install on both the pspsdk and my own app and neither work still. Not sure about the F_xxxx directive above each function but it still didn't work for me even after commenting it out to test.

So it's either not the right place or I am screwing up the install and rebuild process, though I am fairly clueless how.
Post Reply