Fixed broken VFS support, linking issues (#899)

* VFS fix

* Linking errors

* MSVC comoile fix
This commit is contained in:
Alberto Fustinoni 2024-06-11 16:50:32 +09:00 committed by GitHub
parent b8e10a3039
commit 74e5da3482
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 9 deletions

View File

@ -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);

View File

@ -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;
@ -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)

View File

@ -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)