mirror of
https://github.com/libretro/citra.git
synced 2026-11-07 10:16:01 -10:00
libretro: Make sure HAVE_LIBRETRO_VFS is defined
This commit is contained in:
1 parent
92daf46889
commit
09a2fa02cf
5 files changed
+51
-16
No files matched your search
+3
-2
@@ -3,7 +3,8 @@
|
||||
JNI_PATH: .
|
||||
CORENAME: citra
|
||||
API_LEVEL: 21
|
||||
CORE_ARGS: -DENABLE_TESTS=OFF -DENABLE_DEDICATED_ROOM=OFF -DENABLE_SDL2=OFF -DENABLE_QT=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_SCRIPTING=OFF -DENABLE_OPENAL=OFF -DENABLE_LIBUSB=OFF -DCITRA_ENABLE_BUNDLE_TARGET=OFF -DCITRA_WARNINGS_AS_ERRORS=OFF
|
||||
BASE_CORE_ARGS: -DENABLE_TESTS=OFF -DENABLE_DEDICATED_ROOM=OFF -DENABLE_SDL2=OFF -DENABLE_QT=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_SCRIPTING=OFF -DENABLE_OPENAL=OFF -DENABLE_LIBUSB=OFF -DCITRA_ENABLE_BUNDLE_TARGET=OFF -DCITRA_WARNINGS_AS_ERRORS=OFF
|
||||
CORE_ARGS: ${BASE_CORE_ARGS}
|
||||
|
||||
variables:
|
||||
STATIC_RETROARCH_BRANCH: master
|
||||
@@ -57,7 +58,7 @@ libretro-build-linux-x64:
|
||||
- .libretro-linux-cmake-x86_64
|
||||
image: $CI_SERVER_HOST:5050/libretro-infrastructure/libretro-build-amd64-ubuntu:latest
|
||||
variables:
|
||||
CORE_ARGS: -DENABLE_TESTS=OFF -DENABLE_DEDICATED_ROOM=OFF -DENABLE_SDL2=OFF -DENABLE_QT=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_SCRIPTING=OFF -DENABLE_OPENAL=OFF -DENABLE_LIBUSB=OFF -DCITRA_ENABLE_BUNDLE_TARGET=OFF -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DCITRA_WARNINGS_AS_ERRORS=OFF
|
||||
CORE_ARGS: ${BASE_CORE_ARGS} -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11
|
||||
before_script:
|
||||
- export NUMPROC=$(($(nproc)/5))
|
||||
- sudo apt-get update -qy
|
||||
|
||||
Vendored
+19
-2
@@ -266,8 +266,25 @@ if (USE_DISCORD_PRESENCE)
|
||||
endif()
|
||||
|
||||
# LibRetro
|
||||
add_library(libretro INTERFACE)
|
||||
target_include_directories(libretro INTERFACE ./libretro)
|
||||
if (ENABLE_LIBRETRO)
|
||||
add_library(libretro INTERFACE)
|
||||
target_include_directories(libretro INTERFACE ./libretro)
|
||||
if (ANDROID)
|
||||
add_library(libretro_common STATIC
|
||||
libretro-common/compat/compat_posix_string.c
|
||||
libretro-common/compat/fopen_utf8.c
|
||||
libretro-common/encodings/encoding_utf.c
|
||||
libretro-common/compat/compat_strl.c
|
||||
libretro-common/file/file_path.c
|
||||
libretro-common/streams/file_stream.c
|
||||
libretro-common/streams/file_stream_transforms.c
|
||||
libretro-common/string/stdstring.c
|
||||
libretro-common/time/rtime.c
|
||||
libretro-common/vfs/vfs_implementation.c
|
||||
)
|
||||
target_include_directories(libretro_common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libretro-common ${CMAKE_CURRENT_SOURCE_DIR}/libretro-common/include)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# JSON
|
||||
add_library(json-headers INTERFACE)
|
||||
|
||||
@@ -37,5 +37,12 @@ set_target_properties(citra_libretro PROPERTIES PREFIX "")
|
||||
target_compile_definitions(citra_libretro PRIVATE HAVE_LIBRETRO)
|
||||
|
||||
if(ANDROID)
|
||||
target_compile_definitions(citra_libretro PRIVATE USING_GLES)
|
||||
target_compile_definitions(citra_common PRIVATE HAVE_LIBRETRO_VFS)
|
||||
target_compile_definitions(citra_core PRIVATE HAVE_LIBRETRO_VFS)
|
||||
target_compile_definitions(video_core PRIVATE HAVE_LIBRETRO_VFS)
|
||||
target_compile_definitions(citra_libretro PRIVATE USING_GLES HAVE_LIBRETRO_VFS)
|
||||
target_link_libraries(citra_common PRIVATE libretro_common)
|
||||
target_link_libraries(citra_core PRIVATE libretro_common)
|
||||
target_link_libraries(video_core PRIVATE libretro_common)
|
||||
target_link_libraries(citra_libretro PRIVATE libretro_common)
|
||||
endif()
|
||||
@@ -362,30 +362,30 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename) {
|
||||
#else
|
||||
|
||||
// Open input file
|
||||
FILE* input = fopen(srcFilename.c_str(), "rb");
|
||||
FILE* input = FOPEN(srcFilename.c_str(), "rb");
|
||||
if (!input) {
|
||||
LOG_ERROR(Common_Filesystem, "opening input failed {} --> {}: {}", srcFilename,
|
||||
destFilename, GetLastErrorMsg());
|
||||
return false;
|
||||
}
|
||||
SCOPE_EXIT({ fclose(input); });
|
||||
SCOPE_EXIT({ FCLOSE(input); });
|
||||
|
||||
// open output file
|
||||
FILE* output = fopen(destFilename.c_str(), "wb");
|
||||
FILE* output = FOPEN(destFilename.c_str(), "wb");
|
||||
if (!output) {
|
||||
LOG_ERROR(Common_Filesystem, "opening output failed {} --> {}: {}", srcFilename,
|
||||
destFilename, GetLastErrorMsg());
|
||||
return false;
|
||||
}
|
||||
SCOPE_EXIT({ fclose(output); });
|
||||
SCOPE_EXIT({ FCLOSE(output); });
|
||||
|
||||
// copy loop
|
||||
std::array<char, 1024> buffer;
|
||||
while (!feof(input)) {
|
||||
while (!FEOF(input)) {
|
||||
// read input
|
||||
std::size_t rnum = fread(buffer.data(), sizeof(char), buffer.size(), input);
|
||||
std::size_t rnum = FREAD(buffer.data(), sizeof(char), buffer.size(), input);
|
||||
if (rnum != buffer.size()) {
|
||||
if (ferror(input) != 0) {
|
||||
if (FERROR(input) != 0) {
|
||||
LOG_ERROR(Common_Filesystem, "failed reading from source, {} --> {}: {}",
|
||||
srcFilename, destFilename, GetLastErrorMsg());
|
||||
return false;
|
||||
@@ -393,7 +393,7 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename) {
|
||||
}
|
||||
|
||||
// write output
|
||||
std::size_t wnum = fwrite(buffer.data(), sizeof(char), rnum, output);
|
||||
std::size_t wnum = FWRITE(buffer.data(), sizeof(char), rnum, output);
|
||||
if (wnum != rnum) {
|
||||
LOG_ERROR(Common_Filesystem, "failed writing to output, {} --> {}: {}", srcFilename,
|
||||
destFilename, GetLastErrorMsg());
|
||||
@@ -1223,7 +1223,15 @@ std::size_t IOFile::ReadAtImpl(void* data, std::size_t length, std::size_t data_
|
||||
|
||||
DEBUG_ASSERT(data != nullptr);
|
||||
|
||||
#ifdef HAVE_LIBRETRO_VFS
|
||||
int64_t pos = filestream_tell(m_file);
|
||||
FSEEK(m_file, offset, RETRO_VFS_SEEK_POSITION_START);
|
||||
int64_t rv = FREAD(data, data_size, length, m_file);
|
||||
FSEEK(m_file, pos, RETRO_VFS_SEEK_POSITION_START);
|
||||
return rv;
|
||||
#else
|
||||
return pread(fileno(m_file), data, data_size * length, offset);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::size_t IOFile::WriteImpl(const void* data, std::size_t length, std::size_t data_size) {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <streams/file_stream_transforms.h>
|
||||
#define CORE_FILE RFILE
|
||||
#else
|
||||
#define CORE_FILE FILE
|
||||
#define CORE_FILE std::FILE
|
||||
#endif
|
||||
|
||||
namespace FileUtil {
|
||||
@@ -363,7 +363,9 @@ public:
|
||||
return m_good;
|
||||
}
|
||||
[[nodiscard]] int GetFd() const {
|
||||
#ifdef ANDROID
|
||||
#ifdef HAVE_LIBRETRO_VFS
|
||||
return fileno(filestream_get_vfs_handle(m_file)->fp);
|
||||
#elif defined(ANDROID)
|
||||
return m_fd;
|
||||
#else
|
||||
if (m_file == nullptr)
|
||||
@@ -400,7 +402,7 @@ private:
|
||||
|
||||
bool Open();
|
||||
|
||||
std::FILE* m_file = nullptr;
|
||||
CORE_FILE* m_file = nullptr;
|
||||
int m_fd = -1;
|
||||
bool m_good = true;
|
||||
|
||||
|
||||
Reference in new issue
Block a user