|
#define | TRUE 1 |
|
#define | FALSE 0 |
|
#define | CHD_MAKE_TAG(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) |
|
#define | PRINTF_MAX_HUNK (0) |
|
#define | MAP_STACK_ENTRIES 512 /* max number of entries to use on the stack */ |
|
#define | MAP_ENTRY_SIZE 16 /* V3 and later */ |
|
#define | OLD_MAP_ENTRY_SIZE 8 /* V1-V2 */ |
|
#define | METADATA_HEADER_SIZE 16 /* metadata header size */ |
|
#define | CRCMAP_HASH_SIZE 4095 /* number of CRC hashtable entries */ |
|
#define | MAP_ENTRY_FLAG_TYPE_MASK 0x0f /* what type of hunk */ |
|
#define | MAP_ENTRY_FLAG_NO_CRC 0x10 /* no CRC is present */ |
|
#define | CHD_V1_SECTOR_SIZE 512 /* size of a "sector" in the V1 header */ |
|
#define | COOKIE_VALUE 0xbaadf00d |
|
#define | END_OF_LIST_COOKIE "EndOfListCookie" |
|
#define | NO_MATCH (~0) |
|
#define | MAP_ENTRY_TYPE_INVALID 0x0000 /* invalid type */ |
|
#define | MAP_ENTRY_TYPE_COMPRESSED 0x0001 /* standard compression */ |
|
#define | MAP_ENTRY_TYPE_UNCOMPRESSED 0x0002 /* uncompressed data */ |
|
#define | MAP_ENTRY_TYPE_MINI 0x0003 /* mini: use offset as raw data */ |
|
#define | MAP_ENTRY_TYPE_SELF_HUNK 0x0004 /* same as another hunk in this file */ |
|
#define | MAP_ENTRY_TYPE_PARENT_HUNK 0x0005 /* same as a hunk in the parent file */ |
|
#define | MAP_ENTRY_TYPE_2ND_COMPRESSED 0x0006 /* compressed with secondary algorithm (usually FLAC CDDA) */ |
|
#define | SET_ERROR_AND_CLEANUP(err) do { last_error = (err); goto cleanup; } while (0) |
|
#define | EARLY_EXIT(x) do { (void)(x); goto cleanup; } while (0) |
|
#define | CHD_MAKE_TAG(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) |
|
#define | CHD_CODEC_CD_ZLIB CHD_MAKE_TAG('c','d','z','l') |
|
#define | CHD_CODEC_CD_LZMA CHD_MAKE_TAG('c','d','l','z') |
|
#define | CHD_CODEC_CD_FLAC CHD_MAKE_TAG('c','d','f','l') |
|
|
static chd_error | header_validate (const chd_header *header) |
|
static chd_error | header_read (chd_file *chd, chd_header *header) |
|
static chd_error | hunk_read_into_memory (chd_file *chd, UINT32 hunknum, UINT8 *dest) |
|
static chd_error | map_read (chd_file *chd) |
|
static chd_error | metadata_find_entry (chd_file *chd, UINT32 metatag, UINT32 metaindex, metadata_entry *metaentry) |
|
static INLINE UINT64 | get_bigendian_uint64 (const UINT8 *base) |
|
static INLINE void | put_bigendian_uint64 (UINT8 *base, UINT64 value) |
|
static INLINE UINT64 | get_bigendian_uint48 (const UINT8 *base) |
|
static INLINE void | put_bigendian_uint48 (UINT8 *base, UINT64 value) |
|
static INLINE UINT32 | get_bigendian_uint32 (const UINT8 *base) |
|
static INLINE void | put_bigendian_uint24 (UINT8 *base, UINT32 value) |
|
static INLINE void | put_bigendian_uint32 (UINT8 *base, UINT32 value) |
|
static INLINE UINT32 | get_bigendian_uint24 (const UINT8 *base) |
|
static INLINE UINT16 | get_bigendian_uint16 (const UINT8 *base) |
|
static INLINE void | put_bigendian_uint16 (UINT8 *base, UINT16 value) |
|
static INLINE void | map_extract (const UINT8 *base, map_entry *entry) |
|
static INLINE void | map_assemble (UINT8 *base, map_entry *entry) |
|
static INLINE int | map_size_v5 (chd_header *header) |
|
uint16_t | crc16 (const void *data, uint32_t length) |
|
static chd_error | decompress_v5_map (chd_file *chd, chd_header *header) |
|
static INLINE void | map_extract_old (const UINT8 *base, map_entry *entry, UINT32 hunkbytes) |
|
chd_error | chd_open_file (RFILE *file, int mode, chd_file *parent, chd_file **chd) |
|
chd_error | chd_open (const char *filename, int mode, chd_file *parent, chd_file **chd) |
|
chd_error | chd_precache (chd_file *chd) |
|
void | chd_close (chd_file *chd) |
|
RFILE * | chd_core_file (chd_file *chd) |
|
const char * | chd_error_string (chd_error err) |
|
const chd_header * | chd_get_header (chd_file *chd) |
|
chd_error | chd_read (chd_file *chd, UINT32 hunknum, void *buffer) |
|
chd_error | chd_get_metadata (chd_file *chd, UINT32 searchtag, UINT32 searchindex, void *output, UINT32 outputlen, UINT32 *resultlen, UINT32 *resulttag, UINT8 *resultflags) |
|
chd_error | chd_codec_config (chd_file *chd, int param, void *config) |
|
const char * | chd_get_codec_name (UINT32 codec) |
|
static UINT32 | header_guess_unitbytes (chd_file *chd) |
|
static UINT8 * | read_compressed (chd_file *chd, UINT64 offset, size_t size) |
|
static chd_error | read_uncompressed (chd_file *chd, UINT64 offset, size_t size, UINT8 *dest) |
|
static size_t | core_fsize (RFILE *f) |
|