reading files from CD

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
PrimeTime
Posts: 25
Joined: Thu Aug 19, 2004 7:49 pm

reading files from CD

Post by PrimeTime »

Hello, its me again

I can sucessfully read files from a hard drive, and now i'm working on reading files from the CD drive.

I'm running into a few problems. First, is it possible to use the fileXio library with the cd drive?

Second, I'm trying the following code.

Code: Select all

   cdSync(0);
   fioOpen("cdrom0:/Test/Test file.txt;1", O_RDONLY);
the open function is returning -1 however. Although I checked the CD and the file is there.

Is there something I'm missing here?

Thanks,
Ryan
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

Yeah, fileXio works fine for cds.

Unless I'm mistaken cdrom0 only supports iso level 1 filenames. In other words, the filenames are restricted to 8.3 characters. I _THINK_ the 8.3 filename for "cdrom0:/Test/Test file.txt;1" would end up as "cdrom0:/TEST/TESTFI~1.TXT;1" but don't quote me on that.
Shoot Pixels Not People!
Makeshift Development
pixel
Posts: 791
Joined: Fri Jan 30, 2004 11:43 pm

Post by pixel »

Well, it depends on the driver which is giving the "cdrom0" filesystem. But I second Drak here: you shouldn't use joliet filesystem.

On a side note:

you may want to

Code: Select all

    cdInit(CDVD_INIT_INIT);
    cdSetMediaMode(CDVD_MEDIA_MODE_CD);
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

pixel wrote:Well, it depends on the driver which is giving the "cdrom0" filesystem. But I second Drak here: you shouldn't use joliet filesystem.
Uh... There isn't a lot of choices here ;) And the only way I know of to get support for more than just ISO level 1 doesn't use "cdrom0" as the device name. If there is a third I don't know about, then please by all means let me know.
Shoot Pixels Not People!
Makeshift Development
PrimeTime
Posts: 25
Joined: Thu Aug 19, 2004 7:49 pm

Post by PrimeTime »

Okay, cool.

I'm using fileXio for reading from the hard drive, I just wanted to be able to use both drives without having to change the code as much.

If I want to use the fileXioOpen, Read, Dread, etc... is there any special initialization that I must do? Which device name should I use rather than "cdrom0"?

Thanks,
Ryan
PrimeTime
Posts: 25
Joined: Thu Aug 19, 2004 7:49 pm

Post by PrimeTime »

Hi,

I found out that my problem was that I didn't have the LIBCDVD v1.15
library. So now that I got that, I am able to read files from the cd using
fioOpen and fioRead. However, I still cannot use fileXioOpen and fileXioRead, these functions return < 0. Does anyone have any suggestions?

Code: Select all

   static int fMode =  FIO_S_IRUSR | FIO_S_IWUSR | FIO_S_IXUSR | FIO_S_IRGRP | FIO_S_IWGRP | FIO_S_IXGRP | FIO_S_IROTH | FIO_S_IWOTH | FIO_S_IXOTH;

   CDVD_Init&#40;&#41;;
   CDVD_FlushCache&#40;&#41;;
   int a;
   unsigned char buf&#91;2200+1&#93;;
   a = fileXioOpen&#40;"cdfs&#58;/APPS/PGEN/PGEN.TXT", O_RDONLY, fMode&#41;;
   printf&#40;"opening file returned %d\n", a&#41;;
   fileXioRead&#40;a, buf, 2200&#41;;
   printf&#40;"read&#58; %s\n", buf&#41;;
   
If i replace the Xio with fio, then everything works.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Well fileXio and fileio do not always share file drivers, I recall libcdvd uses fileio so you must access it via the fio functions. There was supposedly some hack to filexio to hook the original file handler but I guess it doesn't work.
Post Reply