diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c7265b..164825a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.9) -project(chdr VERSION 0.3 LANGUAGES C) +project(chdr VERSION 0.2 LANGUAGES C) if(CMAKE_PROJECT_NAME STREQUAL "chdr") option(BUILD_SHARED_LIBS "Build libchdr also as a shared library" ON) diff --git a/include/libchdr/coretypes.h b/include/libchdr/coretypes.h index 2261fe7..805359b 100644 --- a/include/libchdr/coretypes.h +++ b/include/libchdr/coretypes.h @@ -4,8 +4,8 @@ #include #include -#ifdef __LIBRETRO__ -#include +#ifdef USE_LIBRETRO_VFS +#include #endif #define ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0])) @@ -29,39 +29,6 @@ typedef int32_t INT32; typedef int16_t INT16; typedef int8_t INT8; -#ifdef __LIBRETRO__ -#define core_file RFILE -#define core_fopen(file) rfopen(file, "rb") -#define core_fseek rfseek -#define core_ftell rftell -#define core_fread(fc, buff, len) rfread(buff, 1, len, fc) -#define core_fclose rfclose - -#ifdef __cplusplus -extern "C" { -#endif - -RFILE* rfopen(const char *path, const char *mode); -extern int64_t rfseek(RFILE* stream, int64_t offset, int origin); -extern int64_t rftell(RFILE* stream); -extern int64_t rfread(void* buffer, - size_t elem_size, size_t elem_count, RFILE* stream); -extern int rfclose(RFILE* stream); - -#ifdef __cplusplus -} -#endif - -static INLINE UINT64 core_fsize(core_file *f) -{ - 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; -} -#else typedef struct chd_core_file { /* * arbitrary pointer to data the implementation uses to implement the below functions @@ -107,6 +74,5 @@ static inline UINT64 core_fsize(core_file *fp) { return fp->fsize(fp); } -#endif #endif diff --git a/src/libchdr_chd.c b/src/libchdr_chd.c index 80d8040..076202b 100644 --- a/src/libchdr_chd.c +++ b/src/libchdr_chd.c @@ -3225,7 +3225,7 @@ static core_file *core_stdio_fopen(char const *path) { getting file size with stdio -------------------------------------------------*/ static UINT64 core_stdio_fsize(core_file *file) { -#if defined __LIBRETRO__ +#if defined USE_LIBRETRO_VFS #define core_stdio_fseek_impl fseek #define core_stdio_ftell_impl ftell #elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WIN64__)