From bd36c9c77dcbd7c6c91159071fa92bdb2d7b0d78 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 9 Mar 2021 22:05:36 +0100 Subject: [PATCH] Add osx-arm64 target --- .gitlab-ci.yml | 10 ++++++++++ Makefile | 39 +++++++++++++++++---------------------- libretro.c | 10 +++++----- 3 files changed, 32 insertions(+), 27 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a39a36d..424847a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,6 +33,10 @@ include: - project: 'libretro-infrastructure/ci-templates' file: '/osx-x64.yml' + # MacOS ARM 64-bit + - project: 'libretro-infrastructure/ci-templates' + file: '/osx-arm64.yml' + ################################## CELLULAR ################################ # Android - project: 'libretro-infrastructure/ci-templates' @@ -114,6 +118,12 @@ libretro-build-osx-x64: - .libretro-osx-x64-make-default - .core-defs +# MacOS ARM 64-bit +libretro-build-osx-arm64: + extends: + - .libretro-osx-arm64-make-default + - .core-defs + ################################### CELLULAR ################################# # Android ARMv8a android-arm64-v8a: diff --git a/Makefile b/Makefile index fa6ae4f..b1f11e4 100644 --- a/Makefile +++ b/Makefile @@ -7,26 +7,18 @@ HAVE_MMAP_WIN32=0 UNAME=$(shell uname -a) -ifneq ($(EMSCRIPTEN),) - platform = emscripten -endif - +# platform ifeq ($(platform),) - platform = unix - ifeq ($(UNAME),) - platform = win - else ifneq ($(findstring MINGW,$(UNAME)),) - platform = win - else ifneq ($(findstring Darwin,$(UNAME)),) - platform = osx - arch = intel - ifeq ($(shell uname -p),powerpc) - arch = ppc - FORCE_32BIT_ARCH = 1 - endif - else ifneq ($(findstring win,$(UNAME)),) - platform = win - endif +platform = unix +ifeq ($(shell uname -s),) + platform = win +else ifneq ($(findstring MINGW,$(shell uname -s)),) + platform = win +else ifneq ($(findstring Darwin,$(shell uname -s)),) + platform = osx +else ifneq ($(findstring win,$(shell uname -s)),) + platform = win +endif endif @@ -48,16 +40,19 @@ endif # system platform system_platform = unix -ifeq ($(UNAME),) +ifeq ($(shell uname -a),) EXE_EXT = .exe system_platform = win -else ifneq ($(findstring Darwin,$(UNAME)),) +else ifneq ($(findstring Darwin,$(shell uname -a)),) system_platform = osx arch = intel ifeq ($(shell uname -p),powerpc) arch = ppc endif - else ifneq ($(findstring MINGW,$(UNAME)),) + ifeq ($(shell uname -p),arm) + arch = arm + endif +else ifneq ($(findstring MINGW,$(shell uname -a)),) system_platform = win endif diff --git a/libretro.c b/libretro.c index 165600e..a25fb09 100644 --- a/libretro.c +++ b/libretro.c @@ -833,17 +833,17 @@ bool retro_load_game(const struct retro_game_info* info) extract_directory(main_path, info->path, sizeof(main_path)); if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir) - strncpy(filename_bios, dir, sizeof(filename_bios)); + strcpy(filename_bios, dir); else - strncpy(filename_bios, main_path, sizeof(filename_bios)); + strcpy(filename_bios, main_path); - strncat(filename_bios, "/gba_bios.bin", sizeof(filename_bios)); + strcat(filename_bios, "/gba_bios.bin"); if (environ_cb(RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY, &dir) && dir) - strncpy(save_path, dir, sizeof(save_path)); + strcpy(save_path, dir); else - strncpy(save_path, main_path, sizeof(save_path)); + strcpy(save_path, main_path); if (load_bios(filename_bios) != 0) {