rtissera / libchdr

Standalone library for reading MAME's CHDv1-v5 formats.
BSD 3-Clause "New" or "Revised" License
96 stars 38 forks source link

libretro VFS support? #72

Closed irixxxx closed 2 years ago

irixxxx commented 2 years ago

The macros core_fseek and core_ftell are defined in a way that libretro VFS support is broken. Here is a patch that would solve this:


index c8ec622..338a0f0 100644
--- a/include/libchdr/coretypes.h
+++ b/include/libchdr/coretypes.h
@@ -31,7 +31,11 @@ typedef int8_t INT8;

 #define core_file FILE
 #define core_fopen(file) fopen(file, "rb")
-#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WIN64__)
+
+#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```
rtissera commented 2 years ago

Thanks !

irixxxx commented 2 years ago

I created a PR for this. I guess this is superfluous here now.