mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-22 21:09:52 +00:00
aioemu
This commit is contained in:
parent
29859c84fc
commit
8ff78cb921
2
.gitignore
vendored
2
.gitignore
vendored
@ -129,3 +129,5 @@ CMakeFiles
|
||||
|
||||
# Clangd
|
||||
.cache/
|
||||
build
|
||||
libretro/obj/local
|
||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
||||
[submodule "libretro/libretro-common"]
|
||||
path = libretro/libretro-common
|
||||
url = https://github.com/libretro/libretro-common.git
|
||||
[submodule "pspautotests"]
|
||||
path = pspautotests
|
||||
url = https://github.com/hrydgard/pspautotests.git
|
||||
|
@ -38,7 +38,11 @@
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifdef HAVE_LIBRETRO_VFS
|
||||
#include <streams/file_stream.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) && !defined(HAVE_LIBRETRO_VFS)
|
||||
|
||||
void LocalFileLoader::DetectSizeFd() {
|
||||
#if PPSSPP_PLATFORM(ANDROID) || (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS < 64)
|
||||
@ -60,7 +64,16 @@ LocalFileLoader::LocalFileLoader(const Path &filename)
|
||||
return;
|
||||
}
|
||||
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
#if HAVE_LIBRETRO_VFS
|
||||
isOpenedByFd_ = false;
|
||||
handle_ = filestream_open(filename.c_str(), RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
filestream_seek(handle_, 0, RETRO_VFS_SEEK_POSITION_END);
|
||||
filesize_ = filestream_tell(handle_);
|
||||
filestream_seek(handle_, 0, RETRO_VFS_SEEK_POSITION_START);
|
||||
return;
|
||||
#endif
|
||||
|
||||
#if PPSSPP_PLATFORM(ANDROID) && !defined(HAVE_LIBRETRO_VFS)
|
||||
if (filename.Type() == PathType::CONTENT_URI) {
|
||||
int fd = Android_OpenContentUriFd(filename.ToString(), Android_OpenContentUriMode::READ);
|
||||
VERBOSE_LOG(SYSTEM, "LocalFileLoader Fd %d for content URI: '%s'", fd, filename.c_str());
|
||||
@ -75,7 +88,9 @@ LocalFileLoader::LocalFileLoader(const Path &filename)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#if defined(HAVE_LIBRETRO_VFS)
|
||||
// Nothing to do here...
|
||||
#elif !defined(_WIN32)
|
||||
|
||||
fd_ = open(filename.c_str(), O_RDONLY | O_CLOEXEC);
|
||||
if (fd_ == -1) {
|
||||
@ -109,7 +124,9 @@ LocalFileLoader::LocalFileLoader(const Path &filename)
|
||||
}
|
||||
|
||||
LocalFileLoader::~LocalFileLoader() {
|
||||
#ifndef _WIN32
|
||||
#if defined(HAVE_LIBRETRO_VFS)
|
||||
filestream_close(handle_);
|
||||
#elif !defined(_WIN32)
|
||||
if (fd_ != -1) {
|
||||
close(fd_);
|
||||
}
|
||||
@ -122,7 +139,10 @@ LocalFileLoader::~LocalFileLoader() {
|
||||
|
||||
bool LocalFileLoader::Exists() {
|
||||
// If we opened it for reading, it must exist. Done.
|
||||
#ifndef _WIN32
|
||||
#if defined(HAVE_LIBRETRO_VFS)
|
||||
return handle_ != 0;
|
||||
|
||||
#elif !defined(_WIN32)
|
||||
if (isOpenedByFd_) {
|
||||
// As an optimization, if we already tried and failed, quickly return.
|
||||
// This is used because Android Content URIs are so slow.
|
||||
@ -164,7 +184,11 @@ size_t LocalFileLoader::ReadAt(s64 absolutePos, size_t bytes, size_t count, void
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if PPSSPP_PLATFORM(SWITCH)
|
||||
#if defined(HAVE_LIBRETRO_VFS)
|
||||
std::lock_guard<std::mutex> guard(readLock_);
|
||||
filestream_seek(handle_, absolutePos, RETRO_VFS_SEEK_POSITION_START);
|
||||
return filestream_read(handle_, data, bytes * count) / bytes;
|
||||
#elif PPSSPP_PLATFORM(SWITCH)
|
||||
// Toolchain has no fancy IO API. We must lock.
|
||||
std::lock_guard<std::mutex> guard(readLock_);
|
||||
lseek(fd_, absolutePos, SEEK_SET);
|
||||
|
@ -27,6 +27,11 @@
|
||||
typedef void *HANDLE;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBRETRO_VFS
|
||||
#include <streams/file_stream.h>
|
||||
typedef RFILE* HANDLE;
|
||||
#endif
|
||||
|
||||
class LocalFileLoader : public FileLoader {
|
||||
public:
|
||||
LocalFileLoader(const Path &filename);
|
||||
@ -41,7 +46,7 @@ public:
|
||||
size_t ReadAt(s64 absolutePos, size_t bytes, size_t count, void *data, Flags flags = Flags::NONE) override;
|
||||
|
||||
private:
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32) && !defined(HAVE_LIBRETRO_VFS)
|
||||
void DetectSizeFd();
|
||||
int fd_ = -1;
|
||||
#else
|
||||
|
@ -100,7 +100,7 @@ LibretroGraphicsContext *LibretroGraphicsContext::CreateGraphicsContext() {
|
||||
}
|
||||
#endif
|
||||
|
||||
if (preferred == RETRO_HW_CONTEXT_DUMMY || preferred == RETRO_HW_CONTEXT_OPENGL) {
|
||||
if (preferred == RETRO_HW_CONTEXT_DUMMY || preferred == RETRO_HW_CONTEXT_OPENGL || preferred == RETRO_HW_CONTEXT_OPENGLES3) {
|
||||
ctx = new LibretroGLContext();
|
||||
|
||||
if (ctx->Init()) {
|
||||
|
@ -7,6 +7,7 @@ GPUDIR = $(CORE_DIR)/GPU
|
||||
EXTDIR = $(CORE_DIR)/ext
|
||||
NATIVEDIR = $(EXTDIR)/native
|
||||
ZSTDDIR = $(EXTDIR)/zstd/lib
|
||||
LIBRETROCOMMONDIR = $(LIBRETRODIR)/libretro-common
|
||||
|
||||
SOURCES_CXX :=
|
||||
SOURCES_C :=
|
||||
@ -882,6 +883,21 @@ SOURCES_C += \
|
||||
$(EXTDIR)/zlib/zutil.c
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LIBRETRO_VFS), 1)
|
||||
DEFINES += -DHAVE_LIBRETRO_VFS
|
||||
INCFLAGS += -I$(LIBRETROCOMMONDIR)/include
|
||||
SOURCES_C += $(LIBRETROCOMMONDIR)/compat/compat_posix_string.c \
|
||||
$(LIBRETROCOMMONDIR)/compat/fopen_utf8.c \
|
||||
$(LIBRETROCOMMONDIR)/encodings/encoding_utf.c \
|
||||
$(LIBRETROCOMMONDIR)/compat/compat_strl.c \
|
||||
$(LIBRETROCOMMONDIR)/file/file_path.c \
|
||||
$(LIBRETROCOMMONDIR)/streams/file_stream.c \
|
||||
$(LIBRETROCOMMONDIR)/streams/file_stream_transforms.c \
|
||||
$(LIBRETROCOMMONDIR)/string/stdstring.c \
|
||||
$(LIBRETROCOMMONDIR)/time/rtime.c \
|
||||
$(LIBRETROCOMMONDIR)/vfs/vfs_implementation.c
|
||||
endif
|
||||
|
||||
GIT_VERSION_SRC = $(CORE_DIR)/git-version.cpp
|
||||
GIT_VERSION := $(shell git describe --always || echo v1.7.0-git)
|
||||
GIT_VERSION_NO_UPDATE = $(findstring 1,$(shell grep -s PPSSPP_GIT_VERSION_NO_UPDATE $(GIT_VERSION_SRC)))
|
||||
|
@ -10,6 +10,7 @@ CORE_DIR := ../..
|
||||
FFMPEGDIR := $(CORE_DIR)/ffmpeg
|
||||
FFMPEGLIBS += libavformat libavcodec libavutil libswresample libswscale
|
||||
WITH_DYNAREC := 1
|
||||
HAVE_LIBRETRO_VFS := 1
|
||||
|
||||
ifeq ($(TARGET_ARCH),arm64)
|
||||
COREFLAGS += -D_ARCH_64
|
||||
@ -74,8 +75,8 @@ include $(CORE_DIR)/libretro/Makefile.common
|
||||
|
||||
COREFLAGS += -DINLINE="inline" -DPPSSPP -DUSE_FFMPEG -DWITH_UPNP -DMOBILE_DEVICE -DBAKE_IN_GIT -DDYNAREC -D__LIBRETRO__ -DUSING_GLES2 -D__STDC_CONSTANT_MACROS -DGLEW_NO_GLU -DMINIUPNP_STATICLIB $(INCFLAGS)
|
||||
LOCAL_SRC_FILES = $(SOURCES_CXX) $(SOURCES_C) $(ASMFILES)
|
||||
LOCAL_CPPFLAGS := -Wall -std=c++17 $(COREFLAGS) -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS
|
||||
LOCAL_CFLAGS := -O2 -DANDROID $(COREFLAGS)
|
||||
LOCAL_CPPFLAGS := -Wall -std=c++17 $(COREFLAGS) -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS $(DEFINES)
|
||||
LOCAL_CFLAGS := -O2 -DANDROID $(COREFLAGS) $(DEFINES)
|
||||
LOCAL_LDLIBS += -lz -llog -lGLESv2 -lEGL -latomic
|
||||
LOCAL_STATIC_LIBRARIES += $(FFMPEGLIBS)
|
||||
|
||||
|
1
libretro/libretro-common
Submodule
1
libretro/libretro-common
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 2a4b12d1a3aa69f521b8322ef48b23a4a585b38c
|
@ -61,6 +61,10 @@
|
||||
#define DIR_SEP_CHRS "/"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBRETRO_VFS
|
||||
#include "streams/file_stream.h"
|
||||
#endif
|
||||
|
||||
#define SAMPLERATE 44100
|
||||
|
||||
#define AUDIO_RING_BUFFER_SIZE (1 << 16)
|
||||
@ -516,6 +520,12 @@ void retro_set_environment(retro_environment_t cb)
|
||||
struct retro_core_options_update_display_callback update_display_cb;
|
||||
update_display_cb.callback = set_variable_visibility;
|
||||
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_UPDATE_DISPLAY_CALLBACK, &update_display_cb);
|
||||
|
||||
#ifdef HAVE_LIBRETRO_VFS
|
||||
struct retro_vfs_interface_info vfs_iface_info { 1, nullptr };
|
||||
if (cb(RETRO_ENVIRONMENT_GET_VFS_INTERFACE, &vfs_iface_info))
|
||||
filestream_vfs_init(&vfs_iface_info);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int get_language_auto(void)
|
||||
|
Loading…
Reference in New Issue
Block a user