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 

Reading directory from CD

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



Joined: 06 Apr 2004
Posts: 38
Location: Cape Town

PostPosted: Wed May 26, 2004 5:15 pm    Post subject: Reading directory from CD Reply with quote

Howdy ppl.

I'm trying to get a directory listing of the CD/CDR, using libcdvd 1.5:

strcpy(pathname, "/");

num_files = CDVD_GetDir(pathname, NULL, CDVD_GET_FILES_AND_DIRS, TocEntryList,4000, pathname);

num_files is set to the correct number of files in the root dir of the CD, however, when I try to get the actual directory entry names using:

for(i=0; i<num_files; i++)
printf("%s\n", TocEntryList[i].filename);

the filename is blank !!!

I've been stuck on this for literally months now, also having tried older versions of libcdvd, and the fioDopen() function.

Any help appreciated.

- jum
_________________
8 bits is all you'll ever need...
Back to top
View user's profile Send private message Visit poster's website
t0mb0la



Joined: 20 Jan 2004
Posts: 24
Location: Seattle WA, USA

PostPosted: Thu May 27, 2004 1:42 pm    Post subject: Reply with quote

Hi Jum,

Do you have TocEntryList aligned to 64 bytes?

i.e:

Code:
   TocEntry TocEntryList[4000] __attribute__((aligned(64)));


or

Code:
 struct TocEntry *TocEntryList = (struct TocEntry *) memalign(64, sizeof(struct TocEntry) * 4000);


Other than that, are you calling CDVD_FlushCache(); before CDVD_GetDir(...); ?

Can't think of any other reasons why it should be misbehaving for you.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
jum



Joined: 06 Apr 2004
Posts: 38
Location: Cape Town

PostPosted: Sat May 29, 2004 6:37 am    Post subject: er... Reply with quote

oops. aligned to 16 bytes:

struct TocEntry tocEntries[MAX_DIR_ENTRIES] __attribute__((aligned(16)));

I'll try align to 64 and use CDVD_FlushCache()

Damn, I probably says to align to 64 in the PDF manual somewhere :/

Tx tombola
_________________
8 bits is all you'll ever need...
Back to top
View user's profile Send private message Visit poster's website
jum



Joined: 06 Apr 2004
Posts: 38
Location: Cape Town

PostPosted: Sat May 29, 2004 8:32 pm    Post subject: still doesn't work Reply with quote

... no luck :(

No mention of aligning 64 in the PDF manual.

Strange thing is that the CDVD_GetDir() returns the correct directory/file count, but the target TocEntry struct data just doesn't get filled.

Reading a file off the CD also works OK.

Perhaps my PS2 dev setup is a bit rotten.
_________________
8 bits is all you'll ever need...
Back to top
View user's profile Send private message Visit poster's website
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun May 30, 2004 8:29 am    Post subject: Re: Reading directory from CD Reply with quote

jum wrote:

strcpy(pathname, "/");

num_files = CDVD_GetDir(pathname, NULL, CDVD_GET_FILES_AND_DIRS, TocEntryList,4000, pathname);


You might be getting messed up due to the pathname. ps2menu.c uses the call above like this:

Quote:
num_cd_files = CDVD_GetDir(CDpath, NULL, CDVD_GET_FILES_AND_DIRS, (void *)TocEntryList,MAX_ENTRY, NULL);


Note that they pass NULL for new_pathname. Try that with your code and see what happens.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 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