dep/libchdr: Sync to upstream (82670d5)

This commit is contained in:
Connor McLaughlin
2020-12-01 23:34:21 +10:00
parent 7e944103c2
commit 2a61620dae
20 changed files with 519 additions and 723 deletions

View File

@ -14,15 +14,14 @@
#define __CDROM_H__
#include <stdint.h>
#include <libchdr/chdconfig.h>
/***************************************************************************
CONSTANTS
***************************************************************************/
/* tracks are padded to a multiple of this many frames */
extern const uint32_t CD_TRACK_PADDING;
#define CD_TRACK_PADDING (4)
#define CD_MAX_TRACKS (99) /* AFAIK the theoretical limit */
#define CD_MAX_SECTOR_DATA (2352)
#define CD_MAX_SUBCODE_DATA (96)
@ -60,10 +59,12 @@ enum
FUNCTION PROTOTYPES
***************************************************************************/
#ifdef WANT_RAW_DATA_SECTOR
/* ECC utilities */
int ecc_verify(const uint8_t *sector);
void ecc_generate(uint8_t *sector);
void ecc_clear(uint8_t *sector);
#endif

View File

@ -46,8 +46,8 @@
extern "C" {
#endif
#include "coretypes.h"
#include <libchdr/coretypes.h>
#include <libchdr/chdconfig.h>
/***************************************************************************
@ -347,6 +347,20 @@ struct _chd_verify_result
FUNCTION PROTOTYPES
***************************************************************************/
#ifdef WIN32
#ifdef CHD_DLL
#ifdef CHD_DLL_EXPORTS
#define CHD_EXPORT __declspec(dllexport)
#else
#define CHD_EXPORT __declspec(dllimport)
#endif
#else
// Static library.
#define CHD_EXPORT
#endif
#else
#define CHD_EXPORT __attribute__ ((visibility("default")))
#endif
/* ----- CHD file management ----- */
@ -357,27 +371,27 @@ struct _chd_verify_result
/* chd_error chd_create_file(core_file *file, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 compression, chd_file *parent); */
/* open an existing CHD file */
chd_error chd_open(const char *filename, int mode, chd_file *parent, chd_file **chd);
chd_error chd_open_file(core_file* file, int mode, chd_file* parent, chd_file** chd);
CHD_EXPORT chd_error chd_open_file(core_file *file, int mode, chd_file *parent, chd_file **chd);
CHD_EXPORT chd_error chd_open(const char *filename, int mode, chd_file *parent, chd_file **chd);
/* precache underlying file */
chd_error chd_precache(chd_file *chd);
CHD_EXPORT chd_error chd_precache(chd_file *chd);
/* close a CHD file */
void chd_close(chd_file *chd);
CHD_EXPORT void chd_close(chd_file *chd);
/* return the associated core_file */
core_file *chd_core_file(chd_file *chd);
CHD_EXPORT core_file *chd_core_file(chd_file *chd);
/* return an error string for the given CHD error */
const char *chd_error_string(chd_error err);
CHD_EXPORT const char *chd_error_string(chd_error err);
/* ----- CHD header management ----- */
/* return a pointer to the extracted CHD header data */
const chd_header *chd_get_header(chd_file *chd);
CHD_EXPORT const chd_header *chd_get_header(chd_file *chd);
@ -385,14 +399,14 @@ const chd_header *chd_get_header(chd_file *chd);
/* ----- core data read/write ----- */
/* read one hunk from the CHD file */
chd_error chd_read(chd_file *chd, UINT32 hunknum, void *buffer);
CHD_EXPORT chd_error chd_read(chd_file *chd, UINT32 hunknum, void *buffer);
/* ----- metadata management ----- */
/* get indexed metadata of a particular sort */
chd_error chd_get_metadata(chd_file *chd, UINT32 searchtag, UINT32 searchindex, void *output, UINT32 outputlen, UINT32 *resultlen, UINT32 *resulttag, UINT8 *resultflags);
CHD_EXPORT chd_error chd_get_metadata(chd_file *chd, UINT32 searchtag, UINT32 searchindex, void *output, UINT32 outputlen, UINT32 *resultlen, UINT32 *resulttag, UINT8 *resultflags);
@ -400,10 +414,10 @@ chd_error chd_get_metadata(chd_file *chd, UINT32 searchtag, UINT32 searchindex,
/* ----- codec interfaces ----- */
/* set internal codec parameters */
chd_error chd_codec_config(chd_file *chd, int param, void *config);
CHD_EXPORT chd_error chd_codec_config(chd_file *chd, int param, void *config);
/* return a string description of a codec */
const char *chd_get_codec_name(UINT32 codec);
CHD_EXPORT const char *chd_get_codec_name(UINT32 codec);
#ifdef __cplusplus
}

View File

@ -0,0 +1,10 @@
#ifndef __CHDCONFIG_H__
#define __CHDCONFIG_H__
/* Configure CHDR features here */
#define WANT_RAW_DATA_SECTOR 1
#define WANT_SUBCODE 1
#define NEED_CACHE_HUNK 1
#define VERIFY_BLOCK_CRC 1
#endif

View File

@ -4,9 +4,8 @@
#include <stdint.h>
#include <stdio.h>
#ifdef _MSC_VER
#include <basetsd.h>
typedef SSIZE_T ssize_t;
#ifdef __LIBRETRO__
#include <streams/file_stream_transforms.h>
#endif
#define ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0]))
@ -29,9 +28,10 @@ typedef int8_t INT8;
#define core_ftell ftell
static size_t core_fsize(core_file *f)
{
long rv;
long p = ftell(f);
fseek(f, 0, SEEK_END);
long rv = ftell(f);
rv = ftell(f);
fseek(f, p, SEEK_SET);
return rv;
}

View File

@ -14,7 +14,7 @@
#define __FLAC_H__
#include <stdint.h>
#include "FLAC/all.h"
#include <FLAC/all.h>
/***************************************************************************
* TYPE DEFINITIONS

View File

@ -13,7 +13,7 @@
#ifndef __HUFFMAN_H__
#define __HUFFMAN_H__
#include "bitstream.h"
#include <libchdr/bitstream.h>
/***************************************************************************
@ -73,6 +73,7 @@ struct huffman_decoder
/* ======================> huffman_decoder */
struct huffman_decoder* create_huffman_decoder(int numcodes, int maxbits);
void delete_huffman_decoder(struct huffman_decoder* decoder);
/* single item operations */
uint32_t huffman_decode_one(struct huffman_decoder* decoder, struct bitstream* bitbuf);