core, libretro fixes for chd support

This commit is contained in:
kub 2021-03-10 23:07:25 +01:00
parent 3d1e252313
commit 886ce067c3
6 changed files with 13 additions and 7 deletions

View file

@ -249,7 +249,6 @@ CHDR = pico/cd/libchdr
CHDR_OBJS += $(CHDR)/src/libchdr_chd.o $(CHDR)/src/libchdr_cdrom.o
CHDR_OBJS += $(CHDR)/src/libchdr_flac.o
CHDR_OBJS += $(CHDR)/src/libchdr_bitstream.o $(CHDR)/src/libchdr_huffman.o
$(CHDR_OBJS): CFLAGS += -DHAVE_FSEEKO
# flac
FLAC = $(CHDR)/deps/flac-1.3.3
@ -258,6 +257,7 @@ FLAC_OBJS += $(FLAC)/src/metadata_object.o $(FLAC)/src/metadata_iterators.o
FLAC_OBJS += $(FLAC)/src/bitmath.o $(FLAC)/src/bitreader.o $(FLAC)/src/md5.o
FLAC_OBJS += $(FLAC)/src/memory.o $(FLAC)/src/fixed.o $(FLAC)/src/crc.o
FLAC_OBJS += $(FLAC)/src/window.o $(FLAC)/src/stream_decoder.o
FLAC_OBJS += $(FLAC)/src/windows_unicode_filenames.o
$(FLAC_OBJS): CFLAGS += -DPACKAGE_VERSION=\"1.3.3\" -DFLAC__HAS_OGG=0
$(FLAC_OBJS): CFLAGS += -DHAVE_FSEEKO -DHAVE_LROUND -DHAVE_STDINT_H -DHAVE_STDLIB_H # ugh...

View file

@ -83,7 +83,7 @@ static int get_ext(const char *fname, char ext[4],
strncpy(ext, fname + pos + 1, 4/*sizeof(ext)*/-1);
ext[4/*sizeof(ext)*/-1] = '\0';
if (base != NULL) {
if (base != NULL && base_size > 0) {
if (pos + 1 < base_size)
pos = base_size - 1;

@ -1 +1 @@
Subproject commit 208212ae77f5c4fedca11d797e50cb1954b2c837
Subproject commit 714fc3f268ebddf035a76cc883bd4543b5142a6f

View file

@ -34,8 +34,8 @@
#endif
// There's no standard way to determine endianess at compile time.
// Do not bother with mixed endian platforms, no one will ever compile on that.
// There's no standard way to determine endianess at compile time. Try using
// some well known non-standard macros for detection.
#if defined __BYTE_ORDER__
#define CPU_IS_LE __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#elif defined _BYTE_ORDER
@ -48,6 +48,7 @@
#warning "can't detect byte order, assume little endian"
#define CPU_IS_LE 1
#endif
// NB mixed endian integer platforms are not supported.
#if CPU_IS_LE
// address/offset operations
@ -56,7 +57,7 @@
#define MEM_LE2(a) (a)
#define MEM_LE4(a) (a)
// swapping
#define CPU_BE2(v) (((v)<<16)|((v)>>16))
#define CPU_BE2(v) ((u32)((u64)(v)<<16)|((v)>>16))
#define CPU_BE4(v) (((u32)(v)>>24)|(((v)>>8)&0x00ff00)| \
(((v)<<8)&0xff0000)|(u32)((v)<<24))
#define CPU_LE2(v) (v) // swap of 2*u16 in u32
@ -70,7 +71,7 @@
// swapping
#define CPU_BE2(v) (v)
#define CPU_BE4(v) (v)
#define CPU_LE2(v) (((v)<<16)|((v)>>16))
#define CPU_LE2(v) ((u32)((u64)(v)<<16)|((v)>>16))
#define CPU_LE4(v) (((u32)(v)>>24)|(((v)>>8)&0x00ff00)| \
(((v)<<8)&0xff0000)|(u32)((v)<<24))
#endif

View file

@ -11,6 +11,8 @@ typedef uint16_t u16;
typedef int16_t s16;
typedef uint32_t u32;
typedef int32_t s32;
typedef uint64_t u64;
typedef int64_t s64;
#endif
#endif

View file

@ -328,6 +328,9 @@ int _flush_cache (char *addr, const int size, const int op)
}
/* stubs for libflac (embedded in libchdr) */
#include <utime.h>
#include <malloc.h>
int chown(const char *pathname, uid_t owner, gid_t group) { return -1; }
int chmod(const char *pathname, mode_t mode) { return -1; }
int utime(const char *filename, const struct utimbuf *times) { return -1; }