Unverified Commit 7f166e57 authored by Libretro-Admin's avatar Libretro-Admin Committed by GitHub
Browse files

Merge pull request #4 from phcoder/most-rb

Add compilation for most platforms, switch to VFS and fix few bugs
parents 57fc03ff 1833632d
Pipeline #82985 passed with stages
in 1 minute and 53 seconds
......@@ -10,6 +10,7 @@
JNI_PATH: .
CORENAME: minivmac
MAKEFILE: Makefile
GIT_SUBMODULE_STRATEGY: recursive
# Inclusion templates, required for the build to work
include:
......@@ -18,15 +19,94 @@ include:
- project: 'libretro-infrastructure/ci-templates'
file: '/windows-x64-mingw.yml'
# Windows 32-bit
- project: 'libretro-infrastructure/ci-templates'
file: '/windows-i686-mingw.yml'
# Linux 64-bit
- project: 'libretro-infrastructure/ci-templates'
file: '/linux-x64.yml'
# Linux 32-bit
- project: 'libretro-infrastructure/ci-templates'
file: '/linux-i686.yml'
# MacOS 64-bit
- project: 'libretro-infrastructure/ci-templates'
file: '/osx-x64.yml'
# MacOS ARM 64-bit
- project: 'libretro-infrastructure/ci-templates'
file: '/osx-arm64.yml'
# MacOS PPC
- project: 'libretro-infrastructure/ci-templates'
file: '/osx-ppc.yml'
################################## CELLULAR ################################
# Android
- project: 'libretro-infrastructure/ci-templates'
file: '/android-jni.yml'
# iOS
- project: 'libretro-infrastructure/ci-templates'
file: '/ios-arm64.yml'
# iOS (armv7)
- project: 'libretro-infrastructure/ci-templates'
file: '/ios9.yml'
################################## CONSOLES ################################
# PlayStation Portable
- project: 'libretro-infrastructure/ci-templates'
file: '/psp-static.yml'
# PlayStation Vita
- project: 'libretro-infrastructure/ci-templates'
file: '/vita-static.yml'
# PlayStation2
- project: 'libretro-infrastructure/ci-templates'
file: '/ps2-static.yml'
# Nintendo 3DS
- project: 'libretro-infrastructure/ci-templates'
file: '/ctr-static.yml'
# Nintendo GameCube
- project: 'libretro-infrastructure/ci-templates'
file: '/ngc-static.yml'
# Nintendo Wii
- project: 'libretro-infrastructure/ci-templates'
file: '/wii-static.yml'
# Nintendo WiiU
- project: 'libretro-infrastructure/ci-templates'
file: '/wiiu-static.yml'
# Nintendo Switch
- project: 'libretro-infrastructure/ci-templates'
file: '/libnx-static.yml'
# OpenDingux
- project: 'libretro-infrastructure/ci-templates'
file: '/dingux-mips32.yml'
# OpenDingux
- project: 'libretro-infrastructure/ci-templates'
file: '/dingux-arm32.yml'
# tvOS (AppleTV)
- project: 'libretro-infrastructure/ci-templates'
file: '/tvos-arm64.yml'
#################################### MISC ##################################
# Emscripten
- project: 'libretro-infrastructure/ci-templates'
file: '/emscripten-static.yml'
# Stages for building
stages:
- build-prepare
......@@ -44,12 +124,47 @@ libretro-build-windows-x64:
- .libretro-windows-x64-mingw-make-default
- .core-defs
# Windows 32-bit
libretro-build-windows-i686:
extends:
- .libretro-windows-i686-mingw-make-default
- .core-defs
# Linux 64-bit
libretro-build-linux-x64:
extends:
- .libretro-linux-x64-make-default
- .core-defs
# Linux 32-bit
libretro-build-linux-i686:
extends:
- .libretro-linux-i686-make-default
- .core-defs
# MacOS 64-bit
libretro-build-osx-x64:
extends:
- .libretro-osx-x64-make-default
- .core-defs
# MacOS ARM 64-bit
libretro-build-osx-arm64:
extends:
- .libretro-osx-arm64-make-default
- .core-defs
# MacOS PPC
libretro-build-osx-ppc:
extends:
- .libretro-osx-ppc-make-default
- .core-defs
variables:
CFLAGS: -mmacosx-version-min=10.4
CXXFLAGS: -mmacosx-version-min=10.4
LDFLAGS: -mmacosx-version-min=10.4
################################### CELLULAR #################################
# Android ARMv7a
android-armeabi-v7a:
......@@ -74,3 +189,107 @@ android-x86:
extends:
- .libretro-android-jni-x86
- .core-defs
# iOS
libretro-build-ios-arm64:
extends:
- .libretro-ios-arm64-make-default
- .core-defs
# iOS (armv7) [iOS 9 and up]
libretro-build-ios9:
extends:
- .libretro-ios9-make-default
- .core-defs
# tvOS
libretro-build-tvos-arm64:
extends:
- .libretro-tvos-arm64-make-default
- .core-defs
################################### CONSOLES #################################
# PlayStation Portable
libretro-build-psp:
extends:
- .libretro-psp-static-retroarch-master
- .core-defs
# PlayStation Vita
libretro-build-vita:
extends:
- .libretro-vita-static-retroarch-master
- .core-defs
# PlayStation2
libretro-build-ps2:
extends:
- .libretro-ps2-static-retroarch-master
- .core-defs
# Nintendo 3DS
libretro-build-ctr:
extends:
- .libretro-ctr-static-retroarch-master
- .core-defs
# Nintendo GameCube
libretro-build-ngc:
extends:
- .libretro-ngc-static-retroarch-master
- .core-defs
# Nintendo Wii
libretro-build-wii:
extends:
- .libretro-wii-static-retroarch-master
- .core-defs
# Nintendo WiiU
libretro-build-wiiu:
extends:
- .libretro-wiiu-static-retroarch-master
- .core-defs
# Nintendo Switch
libretro-build-libnx-aarch64:
extends:
- .libretro-libnx-static-retroarch-master
- .core-defs
# OpenDingux
libretro-build-dingux-mips32:
extends:
- .libretro-dingux-mips32-make-default
- .core-defs
# OpenDingux Beta
libretro-build-dingux-odbeta-mips32:
extends:
- .libretro-dingux-odbeta-mips32-make-default
- .core-defs
# OpenDingux Beta
libretro-build-rs90-odbeta-mips32:
extends:
- .libretro-rs90-odbeta-mips32-make-default
- .core-defs
# OpenDingux
libretro-build-dingux-arm32:
extends:
- .libretro-miyoo-arm32-make-default
- .core-defs
# RetroFW
libretro-build-retrofw-mips32:
extends:
- .libretro-retrofw-mips32-make-default
- .core-defs
#################################### MISC ##################################
# Emscripten
libretro-build-emscripten:
extends:
- .libretro-emscripten-static-retroarch-master
- .core-defs
[submodule "libretro-common"]
path = libretro-common
url = https://github.com/libretro/libretro-common
......@@ -57,6 +57,166 @@ else ifeq ($(platform), classic_armv7_a7)
endif
endif
#######################################
# tvOS
else ifeq ($(platform), tvos-arm64)
TARGET := $(TARGET_NAME)_libretro_tvos.dylib
fpic := -fPIC
SHARED := -dynamiclib
CFLAGS += -DIOS
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk appletvos Path)
endif
else ifneq (,$(findstring ios,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ios.dylib
fpic := -fPIC
SHARED := -dynamiclib
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
endif
DEFINES := -DIOS
CC = cc -arch armv7 -isysroot $(IOSSDK)
LD = cc -arch armv7 -isysroot $(IOSSDK)
ifeq ($(platform),ios9)
CC += -miphoneos-version-min=8.0
CXXFLAGS += -miphoneos-version-min=8.0
else
CC += -miphoneos-version-min=5.0
CXXFLAGS += -miphoneos-version-min=5.0
endif
# Nintendo Game Cube
else ifeq ($(platform), ngc)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float
HAVE_RZLIB := 1
STATIC_LINKING=1
# QNX / BLackberry
else ifneq (,$(findstring qnx,$(platform)))
TARGET := $(TARGET_NAME)_libretro_qnx.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined
CC = qcc -Vgcc_ntoarmv7le
CXX = QCC -Vgcc_ntoarmv7le
# Nintendo Wii
else ifeq ($(platform), wii)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float
HAVE_RZLIB := 1
STATIC_LINKING=1
# Nintendo Switch (libnx)
else ifeq ($(platform), libnx)
include $(DEVKITPRO)/libnx/switch_rules
EXT=a
TARGET := $(TARGET_NAME)_libretro_$(platform).$(EXT)
DEFINES := -DSWITCH=1 -U__linux__ -U__linux -DRARCH_INTERNAL
CFLAGS := $(DEFINES) -g -O3 \
-fPIE -I$(LIBNX)/include/ -ffunction-sections -fdata-sections -ftls-model=local-exec -Wl,--allow-multiple-definition -specs=$(LIBNX)/switch.specs
CFLAGS += $(INCDIRS)
CFLAGS += -D__SWITCH__ -DHAVE_LIBNX -march=armv8-a -mtune=cortex-a57 -mtp=soft
CXXFLAGS := $(ASFLAGS) $(CFLAGS) -fno-rtti -std=gnu++11
CFLAGS += -std=gnu11
STATIC_LINKING = 1
# Nintendo WiiU
else ifeq ($(platform), wiiu)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
CFLAGS += -DGEKKO -DWIIU -DHW_RVL -mwup -mcpu=750 -meabi -mhard-float
HAVE_RZLIB := 1
STATIC_LINKING=1
#######################################
# CTR/3DS
else ifeq ($(platform), ctr)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(DEVKITARM)/bin/arm-none-eabi-gcc$(EXE_EXT)
AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT)
CFLAGS += -DARM11 -D_3DS
CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard
CFLAGS += -Wall -mword-relocations
CFLAGS += -fomit-frame-pointer -ffast-math
HAVE_RZLIB := 1
DISABLE_ERROR_LOGGING := 1
ARM = 1
STATIC_LINKING=1
# RETROFW
else ifeq ($(platform), retrofw)
EXT ?= so
TARGET := $(TARGET_NAME)_libretro.$(EXT)
CC = /opt/retrofw-toolchain/usr/bin/mipsel-linux-gcc
AR = /opt/retrofw-toolchain/usr/bin/mipsel-linux-ar
fpic := -fPIC
SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined
CFLAGS += -ffast-math -march=mips32 -mtune=mips32 -mhard-float
LIBS = -lm
# Emscripten
else ifeq ($(platform), emscripten)
TARGET := $(TARGET_NAME)_libretro_$(platform).bc
fpic := -fPIC
SHARED := -shared -r
STATIC_LINKING=1
# PS2
else ifeq ($(platform), ps2)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = mips64r5900el-ps2-elf-gcc
AR = mips64r5900el-ps2-elf-ar
CFLAGS += -G0 -DPS2 -DUSE_RGB565 -DABGR1555
CXXFLAGS += -G0 -DPS2 -DUSE_RGB565 -DABGR1555
STATIC_LINKING=1
# PSP
else ifeq ($(platform), psp1)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = psp-gcc
AR = psp-ar
CFLAGS += -G0 -DPSP -DUSE_RGB565
CXXFLAGS += -G0 -DPSP -DUSE_RGB565
STATIC_LINKING=1
# Playstation Vita
else ifeq ($(platform), vita)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = arm-vita-eabi-gcc
AR = arm-vita-eabi-ar
CXXFLAGS += -Wl,-q -Wall -O3
CFLAGS += -DVITA=1
STATIC_LINKING=1
# RS90
else ifeq ($(platform), rs90)
TARGET := $(TARGET_NAME)_libretro.so
CC = /opt/rs90-toolchain/usr/bin/mipsel-linux-gcc
CXX = /opt/rs90-toolchain/usr/bin/mipsel-linux-g++
AR = /opt/rs90-toolchain/usr/bin/mipsel-linux-ar
fpic := -fPIC
SHARED := -shared -Wl,-version-script=$(CORE_DIR)/link.T
PLATFORM_DEFINES := -DCC_RESAMPLER -DCC_RESAMPLER_NO_HIGHPASS
CFLAGS += -fomit-frame-pointer -ffast-math -march=mips32 -mtune=mips32
CXXFLAGS += $(CFLAGS)
# GCW0
else ifeq ($(platform), gcw0)
TARGET := $(TARGET_NAME)_libretro.so
CC = /opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc
AR = /opt/gcw0-toolchain/usr/bin/mipsel-linux-ar
fpic := -fPIC
SHARED := -shared -Wl,--version-script=link.T -Wl,-no-undefined
DISABLE_ERROR_LOGGING := 1
CFLAGS += -march=mips32 -mtune=mips32r2 -mhard-float
LIBS = -lm
else
CC ?= gcc
TARGET := $(TARGET_NAME)_libretro.dll
......@@ -92,7 +252,13 @@ LDFLAGS += -lm
all: $(TARGET)
$(TARGET): $(OBJECTS)
ifeq ($(platform), emscripten)
$(LD) $(fpic) $(SHARED) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS)
else ifeq ($(STATIC_LINKING),1)
$(AR) rcs $@ $(OBJECTS)
else
$(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LDFLAGS)
endif
%.o: %.c
$(CC) $(fpic) $(CFLAGS) $(INCFLAGS) -c -o $@ $<
......
......@@ -5,6 +5,7 @@ INCFLAGS := \
-I$(CORE_DIR)/minivmac/cfg \
-I$(CORE_DIR)/libretro \
-I$(CORE_DIR)/libretro/include \
-I$(CORE_DIR)/libretro-common/include \
-I$(GUI) \
-I$(GUI)/nuklear \
-I$(GUI)/retro
......@@ -33,3 +34,17 @@ SOURCES_C := \
$(GUI)/retro/SDL_gfxPrimitives.c \
$(GUI)/retro/retro_surface.c \
$(GUI)/app.c
ifneq ($(STATIC_LINKING), 1)
SOURCES_C += \
$(CORE_DIR)/libretro-common/compat/compat_strl.c \
$(CORE_DIR)/libretro-common/compat/fopen_utf8.c \
$(CORE_DIR)/libretro-common/encodings/encoding_utf.c \
$(CORE_DIR)/libretro-common/file/file_path.c \
$(CORE_DIR)/libretro-common/file/retro_dirent.c \
$(CORE_DIR)/libretro-common/time/rtime.c \
$(CORE_DIR)/libretro-common/streams/file_stream.c \
$(CORE_DIR)/libretro-common/string/stdstring.c \
$(CORE_DIR)/libretro-common/vfs/vfs_implementation.c
endif
Subproject commit 996376e36d3f4f56eba202cb96230568628d2583
......@@ -8,7 +8,9 @@
#include <features_cpu.h>
#endif
#include "libretro.h"
#include <libretro.h>
#include <streams/file_stream.h>
#include <retro_dirent.h>
#include "libretro-core.h"
#include "MACkeymap.h"
#include "vkbd.i"
......@@ -35,6 +37,7 @@ void retro_poll_event(int joyon);
void retro_key_up(int key);
void retro_key_down(int key);
void retro_loop(void);
void retro_init_time(void);
/* Variables */
#ifdef _WIN32
......@@ -44,6 +47,7 @@ char slash = '/';
#endif
bool retro_load_ok = false;
struct retro_vfs_interface *vfs_interface;
char RETRO_DIR[512];
......@@ -116,15 +120,22 @@ static char CMDFILE[512];
int loadcmdfile(char *argv)
{
int res = 0;
FILE *fp = fopen(argv,"r");
if (fp)
{
if ( fgets (CMDFILE , 512 , fp) != NULL )
res=1;
fclose (fp);
memset(CMDFILE, 0, sizeof(CMDFILE));
RFILE *h = filestream_open(argv, RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
char *p;
if (h) {
filestream_read(h, CMDFILE, sizeof(CMDFILE) - 1);
filestream_close(h);
res = 1;
}
p = strchr(CMDFILE, '\n');
if (p)
*p = '\0';
p = strchr(CMDFILE, '\r');
if (p)
*p = '\0';
return res;
}
......@@ -349,7 +360,19 @@ void retro_set_environment(retro_environment_t cb)
{ NULL, NULL },
};
bool no_content = true;
cb(RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME, &no_content);
cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
struct retro_vfs_interface_info vfs_interface_info;
vfs_interface_info.required_interface_version = 3;
vfs_interface_info.iface = NULL;
if(cb(RETRO_ENVIRONMENT_GET_VFS_INTERFACE, &vfs_interface_info)) {
vfs_interface = vfs_interface_info.iface;
}
dirent_vfs_init(&vfs_interface_info);
filestream_vfs_init(&vfs_interface_info);
}
static void update_variables(void)
......@@ -480,7 +503,7 @@ void retro_init(void)
exit(0);
}
struct retro_input_descriptor inputDescriptors[] = {
static struct retro_input_descriptor inputDescriptors[] = {
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "A" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "B" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X, "X" },
......@@ -496,7 +519,10 @@ void retro_init(void)
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2, "R2" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2, "L2" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R3, "R3" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L3, "L3" }
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L3, "L3" },
{ 0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X, "Mouse X" },
{ 0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y, "Mouse Y" },
{ 0, 0, 0, 0, NULL }
};
environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, &inputDescriptors);
......@@ -615,12 +641,15 @@ bool retro_load_game(const struct retro_game_info *info)
struct retro_keyboard_callback cb = { keyboard_cb };
environ_cb(RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK, &cb);
*/
const char *full_path = info->path;
memset(RPATH, 0, sizeof(info->path));
strcpy(RPATH,full_path);
if (info && info->path)
strncpy(RPATH, info->path, sizeof(RPATH) - 1);
update_variables();
retro_init_time();
app_init();
memset(SNDBUF,0,1024*2*2);
......
......@@ -22,14 +22,27 @@ extern unsigned minivmac_devices[ 2 ];
//TYPES
#define UINT16 uint16_t
#define UINT32 uint32_t
#define uint32 uint32_t
#define uint8 uint8_t
typedef uint8_t Uint8;
typedef uint16_t Uint16;
typedef uint32_t Uint32;
typedef uint64_t Uint64;
#define Uint8 uint8_t
#define Uint16 uint16_t
#define Uint32 uint32_t
typedef int8_t Sint8;
typedef int16_t Sint16;
typedef int32_t Sint32;
typedef int64_t Sint64;
typedef uint8_t uint8;
typedef uint16_t uint16;
typedef uint32_t uint32;
typedef int8_t int8;
typedef int16_t int16;
typedef int32_t int32;
typedef uint8_t UINT8;
typedef uint16_t UINT16;
typedef uint32_t UINT32;
#define WINDOW_WIDTH 640
#define WINDOW_HEIGHT 480
......@@ -92,6 +105,7 @@ extern int VIRTUAL_WIDTH;
extern int retrow ;
extern int retroh ;
extern int minivmac_statusbar;
extern struct retro_vfs_interface *vfs_interface;
//FUNCS
extern void mainloop_retro(void);
......
This diff is collapsed.
......@@ -36,7 +36,6 @@ int LOADCONTENT=-1;
int LDRIVE=8;
#define NK_INCLUDE_FIXED_TYPES