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 

Anyone else had trouble with directory listing?

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



Joined: 20 Oct 2004
Posts: 75
Location: Brisbane, Australia

PostPosted: Wed Jul 13, 2005 10:27 pm    Post subject: Anyone else had trouble with directory listing? Reply with quote

heres a snip of code:

Code:
SceIoDirent findData;
int findStatus;

SceUID hFind = sceIoDopen(pFindPattern);
DBGASSERT(hFind >= 0, "Couldnt start find..");

findStatus = sceIoDread(hFind, &findData);

DBGASSERT(false, STR("hmmmm %d.. i crash before i ever get here...", findStatus));


any ideas?
this is correct usage right?

when it calls sceIoDread(), it locks up and then turns the PSP off...
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Wed Jul 13, 2005 10:35 pm    Post subject: Reply with quote

It gets unhappy if findData is on the stack. Make it a global and it works ok. I found this out by trial and error. I have no idea why it works this way.

JimS
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
turkeyman



Joined: 20 Oct 2004
Posts: 75
Location: Brisbane, Australia

PostPosted: Wed Jul 13, 2005 11:17 pm    Post subject: Reply with quote

hahaha...
wow....
....

thats....


bent :P


cool thanks heaps man!!!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
turkeyman



Joined: 20 Oct 2004
Posts: 75
Location: Brisbane, Australia

PostPosted: Wed Jul 13, 2005 11:43 pm    Post subject: Reply with quote

and i've immediately hit another wall....

that function now succeeds... the first file it returns is '.' .. then i call the function again, and it returns 0 (no more files?) ..

the directory is definately populated.. and i can open files and read them directly.. they just dont seem to show in the directory listing.. :/

an interesting behaviour i found is, if i search on a path with a '/' on the end, the file it finds is named '.' .. if i search on a path without the '/' .. the file it returns is named '/.' .. this seems weird to me ... i'll keep playing with it..
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Thu Jul 14, 2005 2:04 am    Post subject: Reply with quote

Actually, you have to memset() the dirent before calling sceIoDread(). Then it works on stack or global.
Back to top
View user's profile Send private message
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Thu Jul 14, 2005 8:31 am    Post subject: Reply with quote

Interesting you say that, because you are able to use the same buffer over and over again with only setting dir.file[0]='\0' (emptying the filename) without memsets in between, but that doesn't work on its own.
Just luck I suppose.

Jim
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
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