Skip to content

Commit

Permalink
Fixed broken VFS support, linking issues (#899)
Browse files Browse the repository at this point in the history
* VFS fix

* Linking errors

* MSVC comoile fix
  • Loading branch information
albertofustinoni authored Jun 11, 2024
1 parent b8e10a3 commit 74e5da3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
23 changes: 16 additions & 7 deletions deps/libchdr/include/libchdr/coretypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,31 @@ typedef int32_t INT32;
typedef int16_t INT16;
typedef int8_t INT8;

#ifdef USE_LIBRETRO_VFS
#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) fread(buff, 1, len, fc)
#define core_fclose rfclose
#else /* USE_LIBRETRO_VFS */
#define core_file FILE
#define core_fopen(file) fopen(file, "rb")
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WIN64__)
#define core_fseek _fseeki64
#define core_ftell _ftelli64
#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
#define core_fseek fseeko64
#define core_ftell ftello64
#else
#define core_fseek fseeko
#define core_ftell ftello
#define core_fseek fseeko
#define core_ftell ftello
#endif
#define core_fread(fc, buff, len) fread(buff, 1, len, fc)
#define core_fclose fclose
#endif /* USE_LIBRETRO_VFS */

static UINT64 core_fsize(core_file *f)
static UINT64 core_fsize(core_file* f)
{
UINT64 rv;
UINT64 p = core_ftell(f);
Expand Down
7 changes: 5 additions & 2 deletions libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ retro_input_state_t dbg_input_state_cb = 0;
#endif /* HAVE_LIGHTREC */

//Fast Save States exclude string labels from variables in the savestate, and are at least 20% faster.
extern bool FastSaveStates;
extern "C" {
extern bool FastSaveStates;
}

const int DEFAULT_STATE_SIZE = 16 * 1024 * 1024;

static bool libretro_supports_option_categories = false;
Expand Down Expand Up @@ -113,7 +116,7 @@ int memfd;
#endif
#endif

uint32 EventCycles = 128;
int32 EventCycles = 128;
uint8_t spu_samples = 1;

// CPU overclock factor (or 0 if disabled)
Expand Down
4 changes: 4 additions & 0 deletions mednafen/clamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ extern "C" {
#include <unistd.h>
#endif

#ifdef _MSC_VER
#include <compat/msvc.h>
#endif

static INLINE void clamp(int32_t *val, ssize_t min, ssize_t max)
{
if(*val < min)
Expand Down

0 comments on commit 74e5da3

Please sign in to comment.