 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
jum

Joined: 06 Apr 2004 Posts: 38 Location: Cape Town
|
Posted: Wed May 26, 2004 5:15 pm Post subject: Reading directory from CD |
|
|
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 |
|
 |
t0mb0la
Joined: 20 Jan 2004 Posts: 24 Location: Seattle WA, USA
|
Posted: Thu May 27, 2004 1:42 pm Post subject: |
|
|
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 |
|
 |
jum

Joined: 06 Apr 2004 Posts: 38 Location: Cape Town
|
Posted: Sat May 29, 2004 6:37 am Post subject: er... |
|
|
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 |
|
 |
jum

Joined: 06 Apr 2004 Posts: 38 Location: Cape Town
|
Posted: Sat May 29, 2004 8:32 pm Post subject: still doesn't work |
|
|
... 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 |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sun May 30, 2004 8:29 am Post subject: Re: Reading directory from CD |
|
|
| 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 |
|
 |
|
|
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
|