From 267167a236f1451da59cf17105e07f2836bd0c3a Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 22 Apr 2024 03:24:22 -0700 Subject: [PATCH] Libretro: Fix non-ENABLE_VFS build --- CMakeLists.txt | 2 +- src/platform/libretro/libretro.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae561189e..7fc7e05fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -995,7 +995,7 @@ if(BUILD_LIBRETRO) file(GLOB RETRO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/libretro/*.c) add_library(${BINARY_NAME}_libretro SHARED ${CORE_SRC} ${RETRO_SRC}) add_dependencies(${BINARY_NAME}_libretro ${BINARY_NAME}-version-info) - set_target_properties(${BINARY_NAME}_libretro PROPERTIES PREFIX "" COMPILE_DEFINITIONS "__LIBRETRO__;COLOR_16_BIT;COLOR_5_6_5;DISABLE_THREADING;MGBA_STANDALONE;${OS_DEFINES};${FUNCTION_DEFINES};MINIMAL_CORE=2") + set_target_properties(${BINARY_NAME}_libretro PROPERTIES PREFIX "" COMPILE_DEFINITIONS "__LIBRETRO__;COLOR_16_BIT;COLOR_5_6_5;DISABLE_THREADING;MGBA_STANDALONE;${OS_DEFINES};${FUNCTION_DEFINES};ENABLE_VFS;MINIMAL_CORE=2") target_link_libraries(${BINARY_NAME}_libretro ${OS_LIB}) if(MSVC) install(TARGETS ${BINARY_NAME}_libretro RUNTIME DESTINATION ${LIBRETRO_LIBDIR} COMPONENT ${BINARY_NAME}_libretro) diff --git a/src/platform/libretro/libretro.c b/src/platform/libretro/libretro.c index 8478eb298..86a692837 100644 --- a/src/platform/libretro/libretro.c +++ b/src/platform/libretro/libretro.c @@ -848,9 +848,11 @@ bool retro_load_game(const struct retro_game_info* game) { dataSize = game->size; memcpy(data, game->data, game->size); rom = VFileFromMemory(data, game->size); +#ifdef ENABLE_VFS } else { - data = 0; + data = NULL; rom = VFileOpen(game->path, O_RDONLY); +#endif } if (!rom) { return false; @@ -973,6 +975,7 @@ bool retro_load_game(const struct retro_game_info* game) { } #endif +#ifdef ENABLE_VFS if (core->opts.useBios && sysDir && biosName) { snprintf(biosPath, sizeof(biosPath), "%s%s%s", sysDir, PATH_SEP, biosName); struct VFile* bios = VFileOpen(biosPath, O_RDONLY); @@ -980,6 +983,7 @@ bool retro_load_game(const struct retro_game_info* game) { core->loadBIOS(core, bios, 0); } } +#endif core->reset(core); _setupMaps(core);