Skip to content

Commit 964407c

Browse files
committed
Merge branch 'master' into wip-uef
2 parents 76d4791 + 3aa4267 commit 964407c

13 files changed

+100
-39
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.dir-locals.el
22
/build/
3+
/obj/
34
/etc/b2_tests/[Zz]/
45
/dependencies/ProcessorTests/
56
*.etl

.gitlab-ci.yml

+30-30
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ include:
3131
# file: '/linux-i686.yml'
3232

3333
# MacOS 64-bit
34-
#- project: 'libretro-infrastructure/ci-templates'
35-
# file: '/osx-x64.yml'
34+
- project: 'libretro-infrastructure/ci-templates'
35+
file: '/osx-x64.yml'
3636

3737
# MacOS ARM 64-bit
38-
#- project: 'libretro-infrastructure/ci-templates'
39-
# file: '/osx-arm64.yml'
38+
- project: 'libretro-infrastructure/ci-templates'
39+
file: '/osx-arm64.yml'
4040

4141
################################## CELLULAR ################################
4242
# Android
43-
#- project: 'libretro-infrastructure/ci-templates'
44-
# file: '/android-jni.yml'
43+
- project: 'libretro-infrastructure/ci-templates'
44+
file: '/android-jni.yml'
4545

4646
# iOS
47-
#- project: 'libretro-infrastructure/ci-templates'
48-
# file: '/ios-arm64.yml'
47+
- project: 'libretro-infrastructure/ci-templates'
48+
file: '/ios-arm64.yml'
4949

5050
# iOS (armv7)
5151
#- project: 'libretro-infrastructure/ci-templates'
@@ -77,8 +77,8 @@ include:
7777
# file: '/libnx-static.yml'
7878

7979
# tvOS (AppleTV)
80-
#- project: 'libretro-infrastructure/ci-templates'
81-
# file: '/tvos-arm64.yml'
80+
- project: 'libretro-infrastructure/ci-templates'
81+
file: '/tvos-arm64.yml'
8282

8383
# OpenDingux
8484
#- project: 'libretro-infrastructure/ci-templates'
@@ -129,16 +129,16 @@ libretro-build-linux-x64:
129129
# - .core-defs
130130

131131
# MacOS 64-bit
132-
#libretro-build-osx-x64:
133-
# extends:
134-
# - .libretro-osx-x64-make-default
135-
# - .core-defs
132+
libretro-build-osx-x64:
133+
extends:
134+
- .libretro-osx-x64-make-default
135+
- .core-defs
136136

137137
# MacOS ARM 64-bit
138-
#libretro-build-osx-arm64:
139-
# extends:
140-
# - .libretro-osx-arm64-make-default
141-
# - .core-defs
138+
libretro-build-osx-arm64:
139+
extends:
140+
- .libretro-osx-arm64-make-default
141+
- .core-defs
142142

143143
################################### CELLULAR #################################
144144
# Android ARMv7a
@@ -148,10 +148,10 @@ libretro-build-linux-x64:
148148
# - .core-defs
149149

150150
# Android ARMv8a
151-
#android-arm64-v8a:
152-
# extends:
153-
# - .libretro-android-jni-arm64-v8a
154-
# - .core-defs
151+
android-arm64-v8a:
152+
extends:
153+
- .libretro-android-jni-arm64-v8a
154+
- .core-defs
155155

156156
# Android 64-bit x86
157157
#android-x86_64:
@@ -166,10 +166,10 @@ libretro-build-linux-x64:
166166
# - .core-defs
167167

168168
# iOS
169-
#libretro-build-ios-arm64:
170-
# extends:
171-
# - .libretro-ios-arm64-make-default
172-
# - .core-defs
169+
libretro-build-ios-arm64:
170+
extends:
171+
- .libretro-ios-arm64-make-default
172+
- .core-defs
173173

174174
# iOS (armv7) [iOS 9 and up]
175175
#libretro-build-ios9:
@@ -178,10 +178,10 @@ libretro-build-linux-x64:
178178
# - .core-defs
179179

180180
# tvOS
181-
#libretro-build-tvos-arm64:
182-
# extends:
183-
# - .libretro-tvos-arm64-make-default
184-
# - .core-defs
181+
libretro-build-tvos-arm64:
182+
extends:
183+
- .libretro-tvos-arm64-make-default
184+
- .core-defs
185185

186186
################################### CONSOLES #################################
187187
# PlayStation Vita

jni/Android.mk

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
LOCAL_PATH := $(call my-dir)
2+
3+
CORE_DIR := $(LOCAL_PATH)/../src
4+
platform := unix
5+
include $(CORE_DIR)/libretro/Makefile.common
6+
7+
COREFLAGS := -D__LIBRETRO__ -DB2_LIBRETRO_CORE -DHAVE_STRLCPY -DBUILD_TYPE_Final -DBBCMICRO_TRACE $(INCFLAGS)
8+
9+
GIT_VERSION ?= " $(shell git rev-parse --short HEAD || echo unknown)"
10+
ifneq ($(GIT_VERSION)," unknown")
11+
COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
12+
endif
13+
14+
include $(CLEAR_VARS)
15+
LOCAL_MODULE := retro
16+
LOCAL_SRC_FILES := $(SOURCES_C) $(SOURCES_CPP)
17+
LOCAL_CXXFLAGS := $(COREFLAGS) -fexceptions -frtti -std=c++17
18+
LOCAL_CFLAGS := $(COREFLAGS)
19+
LOCAL_LDFLAGS := -Wl,-version-script=$(CORE_DIR)/link.T
20+
LOCAL_LDLIBS := -llog
21+
include $(BUILD_SHARED_LIBRARY)

jni/Application.mk

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
APP_STL := c++_static
2+
APP_ABI := all

src/libretro/Makefile

+13-2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ else ifeq ($(platform), osx)
7777
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
7878
ifeq ($(OSX_LT_MAVERICKS),"YES")
7979
MINVERSION = -mmacosx-version-min=10.5
80+
else
81+
MINVERSION = -mmacosx-version-min=10.12
8082
endif
8183
fpic += $(MINVERSION)
8284

@@ -88,8 +90,8 @@ else ifeq ($(platform), osx)
8890
LDFLAGS += $(TARGET_RULE)
8991
endif
9092

91-
CFLAGS += $(ARCHFLAGS)
92-
CXXFLAGS += $(ARCHFLAGS)
93+
CFLAGS += $(ARCHFLAGS) -DSYSTEM_HAVE_STRLCPY
94+
CXXFLAGS += $(ARCHFLAGS) -DSYSTEM_HAVE_STRLCPY
9395
LDFLAGS += $(ARCHFLAGS)
9496

9597
# iOS
@@ -120,6 +122,10 @@ else
120122
endif
121123
PLATFORM_DEFINES := $(MINVERSION)
122124

125+
CFLAGS += $(ARCHFLAGS) -DSYSTEM_HAVE_STRLCPY -DIOS
126+
CXXFLAGS += $(ARCHFLAGS) -DSYSTEM_HAVE_STRLCPY -DIOS
127+
LDFLAGS += $(ARCHFLAGS)
128+
123129
# tvOS
124130
else ifeq ($(platform), tvos-arm64)
125131
TARGET := $(TARGET_NAME)_libretro_tvos.dylib
@@ -134,6 +140,11 @@ else ifeq ($(platform), tvos-arm64)
134140
CC_AS = perl ./tools/gas-preprocessor.pl $(CC)
135141
CXX = c++ -arch arm64 -isysroot $(IOSSDK)
136142

143+
PLATFORM_DEFINES := -mappletvos-version-min=11.0
144+
145+
CFLAGS += $(ARCHFLAGS) -DSYSTEM_HAVE_STRLCPY -DIOS
146+
CXXFLAGS += $(ARCHFLAGS) -DSYSTEM_HAVE_STRLCPY -DIOS
147+
LDFLAGS += $(ARCHFLAGS)
137148

138149
# Lightweight PS3 Homebrew SDK
139150
else ifneq (,$(filter $(platform), ps3 psl1ght))

src/libretro/Makefile.common

+2-3
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,16 @@ SOURCES_CPP := \
4646
$(CORE_DIR)/shared/c/mutex.cpp \
4747
$(CORE_DIR)/shared/c/sha1.cpp \
4848
$(CORE_DIR)/shared/c/file_io.cpp \
49+
$(CORE_DIR)/shared/c/path.cpp \
4950
$(CORE_DIR)/beeb/src/DiscGeometry.cpp \
5051
$(CORE_DIR)/beeb/src/DirectDiscImage.cpp \
5152
$(CORE_DIR)/b2/filters.cpp \
5253
$(CORE_DIR)/b2/Remapper.cpp \
5354

5455
SOURCES_C := \
5556
$(CORE_DIR)/6502/c/6502.c \
56-
$(CORE_DIR)/shared/c/path.c \
5757

58-
59-
ifneq (,$(findstring osx,$(platform)))
58+
ifneq (,$(filter osx ios-arm64 tvos-arm64,$(platform)))
6059
SOURCES_CPP += \
6160
$(CORE_DIR)/shared/c/system_osx.cpp \
6261

src/libretro/core.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ char retro_system_bios_directory[512];
127127
char retro_system_save_directory[512];
128128
char retro_content_filepath[512];
129129

130-
uint16_t audioBuffer[B2_SAMPLE_RATE*1000*2];
130+
// TODO: optimize size instead of a full second + add guards when filling
131+
uint16_t audioBuffer[B2_SAMPLE_RATE*2];
131132
bool inputStateMap[256][1];
132133

133134
retro_usec_t curr_frame_time = 0;
@@ -1088,7 +1089,6 @@ void retro_run(void)
10881089
updateCount_prevframe = updateCount;
10891090
}
10901091

1091-
std::vector<uint32_t> result(pixels, pixels + TV_TEXTURE_WIDTH * TV_TEXTURE_HEIGHT);
10921092
unsigned stride = TV_TEXTURE_WIDTH;
10931093
//video_cb(pixels, TV_TEXTURE_WIDTH, TV_TEXTURE_HEIGHT, stride << 2);
10941094
video_cb(pixels, TV_TEXTURE_WIDTH, TV_TEXTURE_HEIGHT/2, stride << 3);

src/link.T

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
global: retro_*;
3+
local: *;
4+
};
5+

src/shared/c/log.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ void LogStackTrace(Log *log) {
671671
if (!log) {
672672
return;
673673
}
674-
674+
#if !defined(ANDROID)
675675
void *buffer[100];
676676
int n = backtrace(buffer, sizeof buffer / sizeof buffer[0]);
677677

@@ -699,6 +699,9 @@ void LogStackTrace(Log *log) {
699699

700700
free(symbols);
701701
symbols = NULL;
702+
#else
703+
log->f("Stack trace not supported on Android");
704+
#endif
702705
}
703706

704707
//////////////////////////////////////////////////////////////////////////

src/shared/c/system_linux.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
#include <strings.h>
77
#include <inttypes.h>
88
#include <stdlib.h>
9+
#if !defined(ANDROID)
910
#include <execinfo.h>
1011
#include <uuid/uuid.h>
12+
#endif
1113
#include <shared/debug.h>
1214
#include <fcntl.h>
1315
#include <sys/wait.h>
@@ -212,7 +214,11 @@ char **GetBacktraceSymbols(void *const *addresses, int num_addresses) {
212214

213215
if (num_addresses <= 0) {
214216
/* somebody else's problem... */
217+
#if !defined(ANDROID)
215218
return backtrace_symbols(addresses, num_addresses);
219+
#else
220+
return (char **)NULL;
221+
#endif
216222
}
217223

218224
char *result = NULL;
@@ -340,7 +346,11 @@ char **GetBacktraceSymbols(void *const *addresses, int num_addresses) {
340346

341347
#else
342348

349+
#if !defined(ANDROID)
343350
return backtrace_symbols(addresses, num_addresses);
351+
#else
352+
return (char **)NULL;
353+
#endif
344354

345355
#endif
346356
}

src/shared/c/system_osx.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,21 @@
2020
#include <vector>
2121
#include <string>
2222
#include <mach/mach_time.h>
23+
#include <pthread.h>
24+
#ifndef IOS
2325
#include <sys/proc_info.h>
26+
#else
27+
#include <TargetConditionals.h>
28+
#endif
2429
//#define THREAD_NAME_SIZE (MAXTHREADNAMESIZE)
2530

2631
//////////////////////////////////////////////////////////////////////////
2732
//////////////////////////////////////////////////////////////////////////
2833

2934
/* If true, use `atos' to get higher-quality backtrace symbols. */
35+
#ifndef IOS
3036
#define USE_ATOS 1
37+
#endif
3138

3239
//////////////////////////////////////////////////////////////////////////
3340
//////////////////////////////////////////////////////////////////////////

src/shared/h/shared/system.h

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <stddef.h>
1414
#include <stdarg.h>
1515
#include <stdlib.h>
16+
#include <errno.h>
1617
#ifdef _MSC_VER
1718
// This is the relevant part of intrin.h. Don't #include it; it is somewhat slow
1819
// to parse (for whatever reason) and it saves a few seconds in a full rebuild

src/shared/h/shared/system_posix.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ extern "C" {
1515
* system_windows.h, and it's certainly convenient. */
1616
#include <signal.h>
1717
#include <unistd.h>
18+
#if !defined(ANDROID)
1819
#include <execinfo.h>
19-
20+
#endif
2021
//////////////////////////////////////////////////////////////////////////
2122
//////////////////////////////////////////////////////////////////////////
2223

0 commit comments

Comments
 (0)