1.1 --- a/src/gdrom/gdrom.h Wed Mar 22 14:29:02 2006 +0000
1.2 +++ b/src/gdrom/gdrom.h Sun Apr 30 01:51:08 2006 +0000
1.5 - * $Id: gdrom.h,v 1.1 2006-03-22 14:29:02 nkeynes Exp $
1.6 + * $Id: gdrom.h,v 1.2 2006-04-30 01:51:08 nkeynes Exp $
1.8 * This file defines the structures and functions used by the GD-Rom
1.9 * disc driver. (ie, the modules that supply a CD image to be used by the
1.14 -typedef struct gdrom_toc {
1.16 uint32_t tracks[99];
1.17 uint32_t first, last, leadout;
1.21 +#define GDROM_PREGAP 150 /* Sectors */
1.23 +extern uint32_t gdrom_sector_size[];
1.24 +#define GDROM_SECTOR_SIZE(x) gdrom_sector_size[x]
1.32 +} gdrom_track_mode_t;
1.34 +/* The disc register indicates the current contents of the drive. When open
1.37 +#define IDE_DISC_AUDIO 0x00
1.38 +#define IDE_DISC_NONE 0x06
1.39 +#define IDE_DISC_CDROM 0x20
1.40 +#define IDE_DISC_GDROM 0x80
1.41 +#define IDE_DISC_READY 0x01 /* ored with above */
1.42 +#define IDE_DISC_IDLE 0x02 /* ie spun-down */
1.44 +struct gdrom_track {
1.45 + gdrom_track_mode_t mode;
1.46 + int session; /* session # containing this track */
1.47 + uint32_t lba; /* start sector address */
1.48 + uint32_t sector_size; /* For convenience, determined by mode */
1.49 + uint32_t sector_count;
1.50 + uint32_t offset; /* File offset of start of track - image files only */
1.54 typedef struct gdrom_disc {
1.56 - gboolean (*read_toc)( gdrom_toc_t toc );
1.58 - gboolean (*read_data_sectors)( uint32_t lba, uint32_t sector_count,
1.62 + struct gdrom_track track[99];
1.63 + gchar mcn[14]; /* Media catalogue number */
1.64 + const gchar *filename; /* Image filename */
1.65 + FILE *file; /* Stream, for image files */
1.66 + uint32_t (*read_sectors)( struct gdrom_disc *disc,
1.67 + uint32_t lba, uint32_t sector_count,
1.69 + void (*close)( struct gdrom_disc *disc );
1.72 -void gdrom_mount( gdrom_disc_t disc );
1.74 + * Construct a new image file using the default methods.
1.76 +gdrom_disc_t gdrom_image_new( FILE *file );
1.78 -void gdrom_unmount( void );
1.80 + * Open an image file
1.82 +gdrom_disc_t gdrom_image_open( const gchar *filename );
1.83 +gdrom_disc_t nrg_image_open( const gchar *filename );
1.86 + * Retrieve the disc table of contents, and write it into the buffer in the
1.87 + * format expected by the DC.
1.88 + * @return TRUE on success, FALSE on failure (eg no disc mounted)
1.90 +gboolean gdrom_get_toc( char *buf );
1.93 + * Shortcut to open and mount an image file
1.95 +gdrom_disc_t gdrom_mount_image( const gchar *filename );
1.97 +void gdrom_mount_disc( gdrom_disc_t disc );
1.99 +void gdrom_unmount_disc( void );
1.101 +gboolean gdrom_is_mounted( void );
1.103 +uint32_t gdrom_read_sectors( uint32_t sector, uint32_t sector_count,