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 files from CD

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



Joined: 19 Aug 2004
Posts: 25

PostPosted: Sat Sep 04, 2004 3:31 pm    Post subject: reading files from CD Reply with quote

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:

   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
Back to top
View user's profile Send private message
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Sat Sep 04, 2004 4:13 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
pixel



Joined: 30 Jan 2004
Posts: 791

PostPosted: Sat Sep 04, 2004 7:48 pm    Post subject: Reply with quote

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:
    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.
Back to top
View user's profile Send private message
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Sun Sep 05, 2004 4:05 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
PrimeTime



Joined: 19 Aug 2004
Posts: 25

PostPosted: Sun Sep 05, 2004 6:02 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
PrimeTime



Joined: 19 Aug 2004
Posts: 25

PostPosted: Sat Sep 11, 2004 3:58 pm    Post subject: Reply with quote

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:

   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();
   CDVD_FlushCache();
   int a;
   unsigned char buf[2200+1];
   a = fileXioOpen("cdfs:/APPS/PGEN/PGEN.TXT", O_RDONLY, fMode);
   printf("opening file returned %d\n", a);
   fileXioRead(a, buf, 2200);
   printf("read: %s\n", buf);
   


If i replace the Xio with fio, then everything works.
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Sat Sep 11, 2004 5:55 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
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