diff --git a/libretro-build/Makefile.common b/libretro-build/Makefile.common index 8007d01371c..a1dff7a427f 100644 --- a/libretro-build/Makefile.common +++ b/libretro-build/Makefile.common @@ -1,6 +1,6 @@ #plain 'make' doesn't include the file that sets this. force it set anyways. RETRODEFS ?= -D__LIBRETRO__ -RETRODEFS += -DMINIMAL_CORE=2 -DM_CORE_GBA -DM_CORE_GB +RETRODEFS += -DMINIMAL_CORE=2 -DM_CORE_GBA -DM_CORE_GB -DENABLE_VFS INCLUDES += -I$(CORE_DIR)/src -I$(CORE_DIR)/src/arm -I$(CORE_DIR)/include -I$(CORE_DIR)/src/platform/libretro RETRODEFS += -DHAVE_STDINT_H -DHAVE_INTTYPES_H -DINLINE=inline -DCOLOR_16_BIT -DRESAMPLE_LIBRARY=2 -DM_PI=3.14159265358979323846 -DMGBA_STANDALONE diff --git a/src/core/cheats.c b/src/core/cheats.c index 2fc97c3ac52..abd0ce28d42 100644 --- a/src/core/cheats.c +++ b/src/core/cheats.c @@ -622,7 +622,7 @@ bool mCheatSaveFile(struct mCheatDevice* device, struct VFile* vf) { return true; } -#ifdef ENABLE_VFS +#if defined(ENABLE_VFS) && !defined(__LIBRETRO__) void mCheatAutosave(struct mCheatDevice* device) { if (!device->autosave) { return; diff --git a/src/core/config.c b/src/core/config.c index 4fa27ba55af..736db7ee4fb 100644 --- a/src/core/config.c +++ b/src/core/config.c @@ -167,7 +167,7 @@ void mCoreConfigDeinit(struct mCoreConfig* config) { free(config->port); } -#ifdef ENABLE_VFS +#if defined(ENABLE_VFS) && !defined(__LIBRETRO__) bool mCoreConfigLoad(struct mCoreConfig* config) { char path[PATH_MAX + 1]; mCoreConfigDirectory(path, PATH_MAX); diff --git a/src/core/core.c b/src/core/core.c index ba7ef914c25..f8c821f7f8e 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -128,6 +128,7 @@ struct mCore* mCoreFind(const char* path) { return NULL; } +#if !defined(__LIBRETRO__) bool mCoreLoadFile(struct mCore* core, const char* path) { core->unloadROM(core); #ifdef FIXED_ROM_BUFFER @@ -153,6 +154,7 @@ bool mCorePreloadVF(struct mCore* core, struct VFile* vf) { bool mCorePreloadFile(struct mCore* core, const char* path) { return mCorePreloadFileCB(core, path, NULL, NULL); } +#endif bool mCorePreloadVFCB(struct mCore* core, struct VFile* vf, void (cb)(size_t, size_t, void*), void* context) { struct VFile* vfm; @@ -209,6 +211,7 @@ bool mCorePreloadVFCB(struct mCore* core, struct VFile* vf, void (cb)(size_t, si return ret; } +#if !defined(__LIBRETRO__) bool mCorePreloadFileCB(struct mCore* core, const char* path, void (cb)(size_t, size_t, void*), void* context) { struct VFile* rom = mDirectorySetOpenPath(&core->dirs, path, core->isROM); if (!rom) { @@ -276,6 +279,7 @@ bool mCoreAutoloadCheats(struct mCore* core) { } return success; } +#endif bool mCoreLoadSaveFile(struct mCore* core, const char* path, bool temporary) { struct VFile* vf = VFileOpen(path, O_CREAT | O_RDWR); @@ -398,7 +402,7 @@ void mCoreInitConfig(struct mCore* core, const char* port) { } void mCoreLoadConfig(struct mCore* core) { -#ifdef ENABLE_VFS +#if defined(ENABLE_VFS) && !defined(__LIBRETRO__) mCoreConfigLoad(&core->config); #endif mCoreLoadForeignConfig(core, &core->config); @@ -406,7 +410,7 @@ void mCoreLoadConfig(struct mCore* core) { void mCoreLoadForeignConfig(struct mCore* core, const struct mCoreConfig* config) { mCoreConfigMap(config, &core->opts); -#ifdef ENABLE_VFS +#if defined(ENABLE_VFS) && !defined(__LIBRETRO__) mDirectorySetMapOptions(&core->dirs, &core->opts); #endif if (core->opts.audioBuffers) { diff --git a/src/gb/core.c b/src/gb/core.c index f71b570e0e9..8a75f788982 100644 --- a/src/gb/core.c +++ b/src/gb/core.c @@ -150,7 +150,7 @@ static bool _GBCoreInit(struct mCore* core) { gbcore->keys = 0; gb->keySource = &gbcore->keys; -#ifdef ENABLE_VFS +#if defined(ENABLE_VFS) && !defined(__LIBRETRO__) mDirectorySetInit(&core->dirs); #endif @@ -162,7 +162,7 @@ static void _GBCoreDeinit(struct mCore* core) { GBDestroy(core->board); mappedMemoryFree(core->cpu, sizeof(struct SM83Core)); mappedMemoryFree(core->board, sizeof(struct GB)); -#ifdef ENABLE_VFS +#if defined(ENABLE_VFS) && !defined(__LIBRETRO__) mDirectorySetDeinit(&core->dirs); #endif #ifdef ENABLE_DEBUGGERS @@ -651,6 +651,7 @@ static void _GBCoreReset(struct mCore* core) { bios = NULL; } } +#ifndef __LIBRETRO__ if (!found) { char path[PATH_MAX]; mCoreConfigDirectory(path, PATH_MAX); @@ -679,6 +680,7 @@ static void _GBCoreReset(struct mCore* core) { bios = NULL; } } +#endif if (found && bios) { GBLoadBIOS(gb, bios); } diff --git a/src/gba/core.c b/src/gba/core.c index da782d06cfb..4b8861f437d 100644 --- a/src/gba/core.c +++ b/src/gba/core.c @@ -296,7 +296,7 @@ static bool _GBACoreInit(struct mCore* core) { gbacore->proxyRenderer.logger = NULL; #endif -#ifdef ENABLE_VFS +#if defined(ENABLE_VFS) && !defined(__LIBRETRO__) mDirectorySetInit(&core->dirs); #endif @@ -308,7 +308,7 @@ static void _GBACoreDeinit(struct mCore* core) { GBADestroy(core->board); mappedMemoryFree(core->cpu, sizeof(struct ARMCore)); mappedMemoryFree(core->board, sizeof(struct GBA)); -#ifdef ENABLE_VFS +#if defined(ENABLE_VFS) && !defined(__LIBRETRO__) mDirectorySetDeinit(&core->dirs); #endif #ifdef ENABLE_DEBUGGERS @@ -782,6 +782,7 @@ static void _GBACoreReset(struct mCore* core) { bios = NULL; } } +#ifndef __LIBRETRO__ if (!found) { char path[PATH_MAX]; mCoreConfigDirectory(path, PATH_MAX); @@ -794,6 +795,7 @@ static void _GBACoreReset(struct mCore* core) { bios = NULL; } } +#endif if (found && bios) { GBALoadBIOS(gba, bios); } diff --git a/src/util/vfs.c b/src/util/vfs.c index f9ddd7048f7..f6342ec06c9 100644 --- a/src/util/vfs.c +++ b/src/util/vfs.c @@ -215,7 +215,7 @@ void separatePath(const char* path, char* dirname, char* basename, char* extensi } } -#ifdef ENABLE_VFS +#if defined(ENABLE_VFS) && !defined(__LIBRETRO__) bool isAbsolute(const char* path) { // XXX: Is this robust? #ifdef _WIN32