dep/libchdr: Update to a03e693

This commit is contained in:
Connor McLaughlin
2022-04-03 20:27:06 +10:00
parent ef6e18a1b2
commit 6b8486674f
12 changed files with 12610 additions and 181 deletions

View File

@ -347,7 +347,7 @@ struct _chd_verify_result
FUNCTION PROTOTYPES
***************************************************************************/
#ifdef WIN32
#ifdef _MSC_VER
#ifdef CHD_DLL
#ifdef CHD_DLL_EXPORTS
#define CHD_EXPORT __declspec(dllexport)
@ -355,7 +355,6 @@ struct _chd_verify_result
#define CHD_EXPORT __declspec(dllimport)
#endif
#else
// Static library.
#define CHD_EXPORT
#endif
#else
@ -393,6 +392,8 @@ CHD_EXPORT const char *chd_error_string(chd_error err);
/* return a pointer to the extracted CHD header data */
CHD_EXPORT const chd_header *chd_get_header(chd_file *chd);
/* read CHD header data from file into the pointed struct */
CHD_EXPORT chd_error chd_read_header(const char *filename, chd_header *header);

View File

@ -3,8 +3,8 @@
/* Configure CHDR features here */
#define WANT_RAW_DATA_SECTOR 1
#define WANT_SUBCODE 0
#define NEED_CACHE_HUNK 0
#define VERIFY_BLOCK_CRC 0
#define WANT_SUBCODE 1
#define NEED_CACHE_HUNK 1
#define VERIFY_BLOCK_CRC 1
#endif

View File

@ -4,12 +4,21 @@
#include <stdint.h>
#include <stdio.h>
#ifdef __LIBRETRO__
#ifdef USE_LIBRETRO_VFS
#include <streams/file_stream_transforms.h>
#endif
#define ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0]))
#if defined(__PS3__) || defined(__PSL1GHT__)
#undef UINT32
#undef UINT16
#undef UINT8
#undef INT32
#undef INT16
#undef INT8
#endif
typedef uint64_t UINT64;
typedef uint32_t UINT32;
typedef uint16_t UINT16;
@ -22,17 +31,33 @@ typedef int8_t INT8;
#define core_file FILE
#define core_fopen(file) fopen(file, "rb")
#define core_fseek fseek
#if defined USE_LIBRETRO_VFS
#define core_fseek fseek
#define core_ftell ftell
#elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WIN64__)
#define core_fseek _fseeki64
#define core_ftell _ftelli64
#elif defined(_LARGEFILE_SOURCE) && defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
#define core_fseek fseeko64
#define core_ftell ftello64
#elif defined(__PS3__) && !defined(__PSL1GHT__) || defined(__SWITCH__)
#define core_fseek(x,y,z) fseek(x,(off_t)y,z)
#define core_ftell(x) (off_t)ftell(x)
#else
#define core_fseek fseeko
#define core_ftell ftello
#endif
#define core_fread(fc, buff, len) fread(buff, 1, len, fc)
#define core_fclose fclose
#define core_ftell ftell
static inline size_t core_fsize(core_file *f)
static UINT64 core_fsize(core_file *f)
{
long rv;
long p = ftell(f);
fseek(f, 0, SEEK_END);
rv = ftell(f);
fseek(f, p, SEEK_SET);
UINT64 rv;
UINT64 p = core_ftell(f);
core_fseek(f, 0, SEEK_END);
rv = core_ftell(f);
core_fseek(f, p, SEEK_SET);
return rv;
}

View File

@ -14,7 +14,6 @@
#define __FLAC_H__
#include <stdint.h>
#include <FLAC/all.h>
/***************************************************************************
* TYPE DEFINITIONS
@ -24,14 +23,14 @@
typedef struct _flac_decoder flac_decoder;
struct _flac_decoder {
/* output state */
FLAC__StreamDecoder* decoder; /* actual encoder */
void * decoder; /* actual encoder */
uint32_t sample_rate; /* decoded sample rate */
uint8_t channels; /* decoded number of channels */
uint8_t bits_per_sample; /* decoded bits per sample */
uint32_t compressed_offset; /* current offset in compressed data */
const FLAC__byte * compressed_start; /* start of compressed data */
const uint8_t * compressed_start; /* start of compressed data */
uint32_t compressed_length; /* length of compressed data */
const FLAC__byte * compressed2_start; /* start of compressed data */
const uint8_t * compressed2_start; /* start of compressed data */
uint32_t compressed2_length; /* length of compressed data */
int16_t * uncompressed_start[8]; /* pointer to start of uncompressed data (up to 8 streams) */
uint32_t uncompressed_offset; /* current position in uncompressed data */
@ -42,7 +41,7 @@ struct _flac_decoder {
/* ======================> flac_decoder */
void flac_decoder_init(flac_decoder* decoder);
int flac_decoder_init(flac_decoder* decoder);
void flac_decoder_free(flac_decoder* decoder);
int flac_decoder_reset(flac_decoder* decoder, uint32_t sample_rate, uint8_t num_channels, uint32_t block_size, const void *buffer, uint32_t length);
int flac_decoder_decode_interleaved(flac_decoder* decoder, int16_t *samples, uint32_t num_samples, int swap_endian);