Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ libretro-build-osx-arm64:

################################### CELLULAR #################################
# Android ARMv7a
#android-armeabi-v7a:
# extends:
# - .libretro-android-jni-armeabi-v7a
# - .core-defs
android-armeabi-v7a:
extends:
- .libretro-android-jni-armeabi-v7a
- .core-defs

# Android ARMv8a
android-arm64-v8a:
Expand All @@ -168,10 +168,10 @@ android-arm64-v8a:
- .core-defs

# Android 64-bit x86
#android-x86_64:
# extends:
# - .libretro-android-jni-x86_64
# - .core-defs
android-x86_64:
extends:
- .libretro-android-jni-x86_64
- .core-defs

# Android 32-bit x86
#android-x86:
Expand Down
29 changes: 29 additions & 0 deletions src/beeb/src/DirectDiscImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
#include <shared/path.h>
#include <shared/log.h>

#ifdef B2_LIBRETRO_CORE
#include "../../libretro/vfs.h"
#endif

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -137,7 +141,11 @@ bool DirectDiscImage::Read(uint8_t *value,
return false;
}

#ifdef B2_LIBRETRO_CORE
int c = retro_vfs_fgetc(reinterpret_cast<retro_vfs_file *>(m_fp));
#else
int c = fgetc(m_fp);
#endif
if (c == EOF) {
// This case is OK - the disc image is logically its full size, even
// when truncated.
Expand Down Expand Up @@ -165,9 +173,15 @@ bool DirectDiscImage::Write(uint8_t side,
}

bool good = false;
#ifdef B2_LIBRETRO_CORE
if (retro_vfs_fputc(value, reinterpret_cast<retro_vfs_file *>(m_fp)) != EOF) {
good = true;
}
#else
if (fputc(value, m_fp) != EOF) {
good = true;
}
#endif

return good;
}
Expand Down Expand Up @@ -248,18 +262,29 @@ bool DirectDiscImage::fopenAndSeek(bool write,
mode = "rb";
}

#ifdef B2_LIBRETRO_CORE
m_fp = reinterpret_cast<FILE *>(retro_vfs_fopen(m_path, mode));
#else
m_fp = fopenUTF8(m_path.c_str(), mode);
#endif
if (!m_fp) {
return false;
}

m_fp_write = write;
}

#ifdef B2_LIBRETRO_CORE
if (retro_vfs_fseek(reinterpret_cast<retro_vfs_file *>(m_fp), (int64_t)index, SEEK_SET) != 0) {
this->Close();
return false;
}
#else
if (fseek(m_fp, (long)index, SEEK_SET) != 0) {
this->Close();
return false;
}
#endif

return true;
}
Expand All @@ -269,7 +294,11 @@ bool DirectDiscImage::fopenAndSeek(bool write,

void DirectDiscImage::Close() const {
if (m_fp) {
#ifdef B2_LIBRETRO_CORE
retro_vfs_fclose(reinterpret_cast<retro_vfs_file *>(m_fp));
#else
fclose(m_fp);
#endif
m_fp = nullptr;
}
}
1 change: 1 addition & 0 deletions src/libretro/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ INCFLAGS := \
SOURCES_CPP := \
$(CORE_DIR)/libretro/adapters.cpp \
$(CORE_DIR)/libretro/core.cpp \
$(CORE_DIR)/libretro/vfs.cpp \
$(CORE_DIR)/beeb/src/6502.cpp \
$(CORE_DIR)/beeb/src/6522.cpp \
$(CORE_DIR)/beeb/src/1770.cpp \
Expand Down
3 changes: 3 additions & 0 deletions src/libretro/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ other QoL
#include "libretro.h"
#include "adapters.h"
#include "b2_libretro_keymap.h"
#include "vfs.h"

LOG_DEFINE(OUTPUT,"OUTPUT",&log_printer_nowhere,false);

Expand Down Expand Up @@ -1201,6 +1202,8 @@ bool retro_load_game(const struct retro_game_info *info)

check_variables();

retro_vfs_init(environ_cb);

if(info != nullptr)
{
log_cb(RETRO_LOG_INFO, "Loading game: %s \n",info->path);
Expand Down
Loading
Loading