forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PSPSDK and what's implemented in stdio, etc

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Gendal



Joined: 19 Jul 2005
Posts: 4

PostPosted: Tue Jul 19, 2005 3:42 pm    Post subject: PSPSDK and what's implemented in stdio, etc Reply with quote

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.
Back to top
View user's profile Send private message
Gendal



Joined: 19 Jul 2005
Posts: 4

PostPosted: Wed Jul 20, 2005 5:18 pm    Post subject: Reply with quote

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:

int rename(const char *name, const char *newname)
{
  int ret = 0;
 
  return (ret);
}

Which could just as easily become:
Code:

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.
Back to top
View user's profile Send private message
rinco



Joined: 21 Jan 2005
Posts: 255
Location: Canberra, Australia

PostPosted: Wed Jul 20, 2005 7:31 pm    Post subject: Reply with quote

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

Code:
        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
Back to top
View user's profile Send private message
Gendal



Joined: 19 Jul 2005
Posts: 4

PostPosted: Thu Jul 21, 2005 8:56 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group