Libretro: Fix non-ENABLE_VFS build

This commit is contained in:
Vicki Pfau 2024-04-22 03:24:22 -07:00
parent 21d4f0f5fc
commit 267167a236
2 changed files with 6 additions and 2 deletions

View File

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

View File

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