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.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
Reading directory from CD
Reading directory from CD
8 bits is all you'll ever need...
Hi Jum,
Do you have TocEntryList aligned to 64 bytes?
i.e:
or
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.
Do you have TocEntryList aligned to 64 bytes?
i.e:
Code: Select all
TocEntry TocEntryList[4000] __attribute__((aligned(64)));
Code: Select all
struct TocEntry *TocEntryList = (struct TocEntry *) memalign(64, sizeof(struct TocEntry) * 4000);
Can't think of any other reasons why it should be misbehaving for you.
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
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...
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.
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...
Re: Reading directory from CD
You might be getting messed up due to the pathname. ps2menu.c uses the call above like this:jum wrote: strcpy(pathname, "/");
num_files = CDVD_GetDir(pathname, NULL, CDVD_GET_FILES_AND_DIRS, TocEntryList,4000, pathname);
Note that they pass NULL for new_pathname. Try that with your code and see what happens.num_cd_files = CDVD_GetDir(CDpath, NULL, CDVD_GET_FILES_AND_DIRS, (void *)TocEntryList,MAX_ENTRY, NULL);