From c4052f4d79cf0103cb10f9948ae1a810b62ff05d Mon Sep 17 00:00:00 2001 From: aliaspider Date: Tue, 29 Sep 2015 18:08:15 +0100 Subject: [PATCH] (vita) build fix. --- Makefile.libretro | 18 +++++++++++++++--- frontend/libretro.c | 12 ++++++++++-- frontend/main.c | 10 +++++----- libpcsxcore/new_dynarec/assem_arm.c | 4 +++- libpcsxcore/new_dynarec/assem_arm.h | 4 ++++ libpcsxcore/new_dynarec/emu_if.c | 2 +- libpcsxcore/socket.c | 17 +++++++++++++++++ plugins/cdrcimg/cdrcimg.c | 4 ++-- 8 files changed, 57 insertions(+), 14 deletions(-) diff --git a/Makefile.libretro b/Makefile.libretro index de2bcebd..71223060 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -119,17 +119,27 @@ else ifeq ($(platform), vita) AR = arm-vita-eabi-ar$(EXE_EXT) CFLAGS += -DVITA CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm + CFLAGS += -I$(VITASDK)/include -Ifrontend/vita + CFLAGS += -DNO_SOCKET -DNO_OS -DNO_DYLIB ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon + +# CFLAGS += -U__ARM_NEON__ HAVE_NEON = 1 BUILTIN_GPU = neon +# USE_DYNAREC = 1 +# DRC_CACHE_BASE = 0 + + ARCH = arm + STATIC_LINKING = 1 + # CTR(3DS) else ifeq ($(platform), ctr) TARGET := $(TARGET_NAME)_libretro_ctr.a CC = $(DEVKITARM)/bin/arm-none-eabi-gcc$(EXE_EXT) CXX = $(DEVKITARM)/bin/arm-none-eabi-g++$(EXE_EXT) AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT) - CFLAGS += -DARM11 -D_3DS -DNO_OS + CFLAGS += -DARM11 -D_3DS -DNO_OS -DNO_DYLIB CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp CFLAGS += -Wall -mword-relocations CFLAGS += -fomit-frame-pointer -ffast-math @@ -172,6 +182,7 @@ else ifeq ($(platform), wii) # QNX else ifeq ($(platform), qnx) TARGET := $(TARGET_NAME)_libretro_qnx.so + fpic := -fPIC CC = qcc -Vgcc_ntoarmv7le CC_AS = $(CC) HAVE_NEON = 1 @@ -186,6 +197,7 @@ else ifeq ($(platform), qnx) else ifneq (,$(findstring armv,$(platform))) TARGET := $(TARGET_NAME)_libretro.so SHARED := -shared -Wl,--no-undefined + fpic := -fPIC DRC_CACHE_BASE = 0 ifneq (,$(findstring cortexa8,$(platform))) CFLAGS += -marm -mcpu=cortex-a8 @@ -209,7 +221,7 @@ else ifneq (,$(findstring armv,$(platform))) ASFLAGS += -mfloat-abi=hard endif ARCH = arm - USE_DYNAREC = 1 + USE_DYNAREC = 1 # Windows else @@ -222,7 +234,7 @@ else MMAP_WIN32=1 endif -CFLAGS += -fPIC +CFLAGS += $(fpic) ifeq ($(platform),win) MAIN_LDLIBS += -lws2_32 else ifneq ($(platform),qnx) diff --git a/frontend/libretro.c b/frontend/libretro.c index 69fad2a3..7243db13 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -1280,7 +1280,7 @@ static bool try_use_bios(const char *path) return true; } -#if 1 +#ifndef VITA #include #include @@ -1336,7 +1336,7 @@ void retro_init(void) exit(1); } -#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) +#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && !defined(VITA) posix_memalign(&vout_buf, 16, VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2); #else vout_buf = malloc(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2); @@ -1405,3 +1405,11 @@ void retro_deinit(void) free(vout_buf); vout_buf = NULL; } + +#ifdef VITA +#include +int usleep (unsigned long us) +{ + sceKernelDelayThread(us); +} +#endif diff --git a/frontend/main.c b/frontend/main.c index c816ba15..2deff706 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -11,7 +11,7 @@ #include #include #include -#if !defined(_WIN32) && !defined(_3DS) +#if !defined(_WIN32) && !defined(NO_DYLIB) #include #endif @@ -985,7 +985,7 @@ void *SysLoadLibrary(const char *lib) { return (void *)(long)(PLUGIN_DL_BASE + builtin_plugin_ids[i]); } -#if !defined(_WIN32) && !defined(_3DS) +#if !defined(_WIN32) && !defined(NO_DYLIB) ret = dlopen(lib, RTLD_NOW); if (ret == NULL) SysMessage("dlopen: %s", dlerror()); @@ -1002,7 +1002,7 @@ void *SysLoadSym(void *lib, const char *sym) { if (PLUGIN_DL_BASE <= plugid && plugid < PLUGIN_DL_BASE + ARRAY_SIZE(builtin_plugins)) return plugin_link(plugid - PLUGIN_DL_BASE, sym); -#if !defined(_WIN32) && !defined(_3DS) +#if !defined(_WIN32) && !defined(NO_DYLIB) return dlsym(lib, sym); #else return NULL; @@ -1010,7 +1010,7 @@ void *SysLoadSym(void *lib, const char *sym) { } const char *SysLibError() { -#if defined(_3DS) +#if defined(NO_DYLIB) return NULL; #elif !defined(_WIN32) return dlerror(); @@ -1025,7 +1025,7 @@ void SysCloseLibrary(void *lib) { if (PLUGIN_DL_BASE <= plugid && plugid < PLUGIN_DL_BASE + ARRAY_SIZE(builtin_plugins)) return; -#if !defined(_WIN32) && !defined(_3DS) +#if !defined(_WIN32) && !defined(NO_DYLIB) dlclose(lib); #endif } diff --git a/libpcsxcore/new_dynarec/assem_arm.c b/libpcsxcore/new_dynarec/assem_arm.c index 6853e9e5..8e0c634c 100644 --- a/libpcsxcore/new_dynarec/assem_arm.c +++ b/libpcsxcore/new_dynarec/assem_arm.c @@ -30,7 +30,9 @@ #endif #include "arm_features.h" -#if !BASE_ADDR_FIXED +#ifdef VITA +char* translation_cache = 0; +#elif !BASE_ADDR_FIXED char translation_cache[1 << TARGET_SIZE_2] __attribute__((aligned(4096))); #endif diff --git a/libpcsxcore/new_dynarec/assem_arm.h b/libpcsxcore/new_dynarec/assem_arm.h index 22546386..da4144dc 100644 --- a/libpcsxcore/new_dynarec/assem_arm.h +++ b/libpcsxcore/new_dynarec/assem_arm.h @@ -64,6 +64,10 @@ extern char *invc_ptr; // "round" address helpful for debug #define BASE_ADDR 0x1000000 #else +#if defined(VITA) +extern char* translation_cache; +#else extern char translation_cache[1 << TARGET_SIZE_2]; +#endif #define BASE_ADDR (u_int)translation_cache #endif diff --git a/libpcsxcore/new_dynarec/emu_if.c b/libpcsxcore/new_dynarec/emu_if.c index 22db5d11..8aebd644 100644 --- a/libpcsxcore/new_dynarec/emu_if.c +++ b/libpcsxcore/new_dynarec/emu_if.c @@ -431,7 +431,7 @@ void do_insn_cmp() {} #ifdef DRC_DISABLE unsigned int address; int pending_exception, stop; -unsigned int next_interupt; +u32 next_interupt; int new_dynarec_did_compile; int cycle_multiplier; int new_dynarec_hacks; diff --git a/libpcsxcore/socket.c b/libpcsxcore/socket.c index 31f82e25..c408bc32 100644 --- a/libpcsxcore/socket.c +++ b/libpcsxcore/socket.c @@ -15,6 +15,22 @@ * along with this program; if not, see . */ +#ifdef NO_SOCKET + +int StartServer() { return 0;} +void StopServer() {} +void GetClient() {} +void CloseClient() {} +int HasClient() { return 0;} +int ReadSocket(char * buffer, int len) { return 0;} +int RawReadSocket(char * buffer, int len) { return 0;} +void WriteSocket(char * buffer, int len) {} + +void SetsBlock() {} +void SetsNonblock() {} + +#else // NO_SOCKET + #ifdef _WIN32 #include #endif @@ -252,3 +268,4 @@ void SetsNonblock() { fcntl(server_socket, F_SETFL, flags | O_NONBLOCK); #endif } +#endif // NO_SOCKET diff --git a/plugins/cdrcimg/cdrcimg.c b/plugins/cdrcimg/cdrcimg.c index 036c68d6..47371aa9 100644 --- a/plugins/cdrcimg/cdrcimg.c +++ b/plugins/cdrcimg/cdrcimg.c @@ -14,7 +14,7 @@ #include #ifndef _WIN32 #define CALLBACK -#ifndef _3DS +#ifndef NO_DYLIB #include #endif #else @@ -287,7 +287,7 @@ static long CDRinit(void) return -1; } } -#if !defined(_WIN32) && !defined(_3DS) +#if !defined(_WIN32) && !defined(NO_DYLIB) if (pBZ2_bzBuffToBuffDecompress == NULL) { void *h = dlopen("/usr/lib/libbz2.so.1", RTLD_LAZY); if (h == NULL) -- 2.39.5