Search
lxdream.org :: lxdream/src/gdrom/gdrom.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/gdrom/gdrom.h
changeset 678:35eb00945316
prev644:ccae4bfa5f82
next709:18c39a8e504c
author nkeynes
date Thu May 29 11:00:26 2008 +0000 (14 years ago)
permissions -rw-r--r--
last change Split gdrom.h into public and private gddriver.h
Reorganize gdrom mount to use a disc change hook
file annotate diff log raw
nkeynes@125
     1
/**
nkeynes@561
     2
 * $Id$
nkeynes@125
     3
 *
nkeynes@678
     4
 * This file defines the public structures and functions exported by the 
nkeynes@678
     5
 * GD-Rom subsystem
nkeynes@125
     6
 *
nkeynes@125
     7
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@125
     8
 *
nkeynes@125
     9
 * This program is free software; you can redistribute it and/or modify
nkeynes@125
    10
 * it under the terms of the GNU General Public License as published by
nkeynes@125
    11
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@125
    12
 * (at your option) any later version.
nkeynes@125
    13
 *
nkeynes@125
    14
 * This program is distributed in the hope that it will be useful,
nkeynes@125
    15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@125
    16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@125
    17
 * GNU General Public License for more details.
nkeynes@125
    18
 */
nkeynes@125
    19
nkeynes@678
    20
#ifndef lxdream_gdrom_H
nkeynes@678
    21
#define lxdream_gdrom_H 1
nkeynes@125
    22
nkeynes@678
    23
#include "lxdream.h"
nkeynes@678
    24
#include "hook.h"
nkeynes@678
    25
#include <glib/glist.h>
nkeynes@342
    26
nkeynes@149
    27
typedef uint16_t gdrom_error_t;
nkeynes@149
    28
nkeynes@678
    29
typedef struct gdrom_disc *gdrom_disc_t;
nkeynes@138
    30
nkeynes@678
    31
typedef gboolean (*gdrom_disc_change_hook_t)( gdrom_disc_t new_disc, const gchar *new_disc_name, void *user_data );
nkeynes@138
    32
nkeynes@678
    33
DECLARE_HOOK(gdrom_disc_change_hook, gdrom_disc_change_hook_t);
nkeynes@125
    34
nkeynes@138
    35
/**
nkeynes@138
    36
 * Open an image file
nkeynes@138
    37
 */
nkeynes@138
    38
gdrom_disc_t gdrom_image_open( const gchar *filename );
nkeynes@138
    39
nkeynes@138
    40
/**
nkeynes@422
    41
 * Dump image info
nkeynes@422
    42
 */
nkeynes@422
    43
void gdrom_image_dump_info( gdrom_disc_t d );
nkeynes@422
    44
nkeynes@245
    45
nkeynes@138
    46
/**
nkeynes@138
    47
 * Shortcut to open and mount an image file
nkeynes@433
    48
 * @return true on success
nkeynes@138
    49
 */
nkeynes@433
    50
gboolean gdrom_mount_image( const gchar *filename );
nkeynes@138
    51
nkeynes@138
    52
void gdrom_mount_disc( gdrom_disc_t disc );
nkeynes@138
    53
nkeynes@138
    54
void gdrom_unmount_disc( void );
nkeynes@138
    55
nkeynes@138
    56
gboolean gdrom_is_mounted( void );
nkeynes@138
    57
nkeynes@464
    58
gdrom_disc_t gdrom_get_current_disc();
nkeynes@464
    59
nkeynes@678
    60
const gchar *gdrom_get_current_disc_name();
nkeynes@678
    61
nkeynes@464
    62
GList *gdrom_get_native_devices();
nkeynes@464
    63
nkeynes@138
    64
uint32_t gdrom_read_sectors( uint32_t sector, uint32_t sector_count,
nkeynes@422
    65
			     int mode, unsigned char *buf, uint32_t *length );
nkeynes@125
    66
nkeynes@678
    67
nkeynes@613
    68
/**
nkeynes@678
    69
 * Retrieve the disc table of contents, and write it into the buffer in the 
nkeynes@678
    70
 * format expected by the DC.
nkeynes@678
    71
 * @return 0 on success, error code on failure (eg no disc mounted)
nkeynes@613
    72
 */
nkeynes@678
    73
gdrom_error_t gdrom_get_toc( unsigned char *buf );
nkeynes@678
    74
nkeynes@678
    75
/**
nkeynes@678
    76
 * Retrieve the short (6-byte) session info, and write it into the buffer.
nkeynes@678
    77
 * @return 0 on success, error code on failure.
nkeynes@678
    78
 */
nkeynes@678
    79
gdrom_error_t gdrom_get_info( unsigned char *buf, int session );
nkeynes@678
    80
nkeynes@678
    81
uint8_t gdrom_get_track_no_by_lba( uint32_t lba );
nkeynes@613
    82
nkeynes@125
    83
#endif
.