next up previous contents
Next: Timer Counters (timer.c) Up: Hardware Abstraction Layer: DC Previous: Sound Processor Unit (spu.c)   Contents

Subsections

CD-Rom Access (cdfs.c)

Libdream provides the capability to use CD and CDR discs in the GD-Rom drive using this module.

Note that this file has been specifically crippled (or rather, we just never wrote it in) so that it can't access Sega's GD discs. This means that you can't access the data on any commercial game. There are really only a few legitimate reasons for doing this so we've disabled the feature to avoid coming under fire for assisting with copyright infringement. If you really want to know how, I'm sure you can figure it out =).

The following functions are available:

uint32 iso_open(const char *path, int oflag)

Open a file on the CD, using absolute path ``path'', with open flags ``oflag''. Note that in the current system, ``path'' must use forward slashes for path seperators (but can mix upper and lower case freely with no troubles), and ``oflag'' must be O_RDONLY or (O_RDONLY | O_DIR). A file descriptor will be returned, or a zero on error.

void iso_close(uint32 fd)

Close the file referenced by the given file descriptor.

int iso_read(uint32 fd, void *buf, int count)

Read ``nbyte'' bytes from the file referenced by ``fd'', into buffer ``buf''. Note that this function will always read the surrounding 2048 byte sector before extracting the parts you want, so you should never read less than 2048 bytes unless that's all you want. Reading more than 2048 does work. The number of bytes read will be returned.

long iso_lseek(uint32 fd, long offset, int whence)

Seek in file ``fd'' by ``offset'' bytes, relative to ``whence''. ``whence'' is one of the standard STDIO constants: SEEK_SET, SEEK_CUR, SEEK_END. ``offset'' may be positive or negative depending on the usage. The new file location will be returned.

long iso_tell(uint32 fd)

Returns the current file pointer within ``fd''.

dirent_t *iso_readdir(uint32 dirfd)

Read the next entry (if any) from the opened directory. Returns a pointer to a dirent_t on success (see fs_iso9660.h for more info on dirent_t) or NULL if nothing is left.

int cdrom_init() int iso_init()

Initialize the GD-Rom drive for reading CD/CDR media, and initialize the file system driver.


next up previous contents
Next: Timer Counters (timer.c) Up: Hardware Abstraction Layer: DC Previous: Sound Processor Unit (spu.c)   Contents
Dan Potter 2002-07-29