diff --git a/android/native/jni/Android.mk b/android/native/jni/Android.mk index 2537c1fb27..ab1b327b7f 100644 --- a/android/native/jni/Android.mk +++ b/android/native/jni/Android.mk @@ -21,54 +21,17 @@ endif LOCAL_MODULE := retroarch-activity RARCH_PATH := ../../.. -LOCAL_SRC_FILES = $(RARCH_PATH)/retroarch.c \ - $(RARCH_PATH)/file.c \ - $(RARCH_PATH)/file_path.c \ - $(RARCH_PATH)/hash.c \ - $(RARCH_PATH)/driver.c \ - $(RARCH_PATH)/settings.c \ - $(RARCH_PATH)/dynamic.c \ - $(RARCH_PATH)/message.c \ - $(RARCH_PATH)/rewind.c \ - $(RARCH_PATH)/gfx/gfx_common.c \ - $(RARCH_PATH)/input/input_common.c \ - $(RARCH_PATH)/patch.c \ - $(RARCH_PATH)/fifo_buffer.c \ - $(RARCH_PATH)/compat/compat.c \ - $(RARCH_PATH)/audio/null.c \ - $(RARCH_PATH)/audio/utils.c \ - $(RARCH_PATH)/audio/hermite.c \ - $(RARCH_PATH)/gfx/null.c \ - $(RARCH_PATH)/gfx/gl.c \ - $(RARCH_PATH)/gfx/scaler/scaler.c \ - $(RARCH_PATH)/gfx/scaler/pixconv.c \ - $(RARCH_PATH)/gfx/scaler/scaler_int.c \ - $(RARCH_PATH)/gfx/scaler/filter.c \ - $(RARCH_PATH)/gfx/gfx_context.c \ - $(RARCH_PATH)/gfx/context/androidegl_ctx.c \ - $(RARCH_PATH)/gfx/math/matrix.c \ - $(RARCH_PATH)/gfx/shader_glsl.c \ - $(RARCH_PATH)/gfx/fonts/null_fonts.c \ - $(RARCH_PATH)/gfx/state_tracker.c \ - $(RARCH_PATH)/input/null.c \ - input_android.c \ - $(RARCH_PATH)/conf/config_file.c \ - $(RARCH_PATH)/autosave.c \ - $(RARCH_PATH)/thread.c \ - cpufeatures.c \ - $(RARCH_PATH)/performance.c \ - main.c +LOCAL_SRC_FILES = $(RARCH_PATH)/console/griffin/griffin.c ifeq ($(PERF_TEST), 1) LOCAL_CFLAGS += -DPERF_TEST endif -LOCAL_CFLAGS += -O3 -fno-stack-protector -funroll-loops -DNDEBUG -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_GLSL -DHAVE_ZLIB -DINLINE=inline -DLSB_FIRST -D__LIBRETRO__ -DHAVE_CONFIGFILE=1 -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -std=gnu99 +LOCAL_CFLAGS += -O3 -fno-stack-protector -funroll-loops -DNDEBUG -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_VID_CONTEXT -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_GLSL -DHAVE_ZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREAD -D__LIBRETRO__ -DHAVE_CONFIGFILE=1 -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -std=gnu99 LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -landroid -lEGL -lGLESv2 -llog -ldl -lz ifeq ($(HAVE_OPENSL), 1) -LOCAL_SRC_FILES += $(RARCH_PATH)/audio/opensl.c LOCAL_CFLAGS += -DHAVE_SL LOCAL_LDLIBS += -lOpenSLES endif diff --git a/android/native/jni/cpufeatures.c b/android/native/jni/cpufeatures.c index 5f3a24d1c8..b8fccdc6b6 100644 --- a/android/native/jni/cpufeatures.c +++ b/android/native/jni/cpufeatures.c @@ -74,7 +74,7 @@ static int g_cpuCount; } while (0) #ifdef __i386__ -static __inline__ void x86_cpuid(int func, int values[4]) +static __inline__ void cpu_x86_cpuid(int func, int values[4]) { int a, b, c, d; /* We need to preserve ebx since we're compiling PIC code */ @@ -100,7 +100,7 @@ static __inline__ void x86_cpuid(int func, int values[4]) * than 'buffsize' bytes. */ static int -read_file(const char* pathname, char* buffer, size_t buffsize) +cpu_read_file(const char* pathname, char* buffer, size_t buffsize) { int fd, len; @@ -340,7 +340,7 @@ cpulist_read_from(CpuList* list, const char* filename) cpulist_init(list); - filelen = read_file(filename, file, sizeof file); + filelen = cpu_read_file(filename, file, sizeof file); if (filelen < 0) { D("Could not read %s: %s\n", filename, strerror(errno)); return; @@ -382,7 +382,7 @@ android_cpuInit(void) g_cpuFeatures = 0; g_cpuCount = 1; - cpuinfo_len = read_file("/proc/cpuinfo", cpuinfo, sizeof cpuinfo); + cpuinfo_len = cpu_read_file("/proc/cpuinfo", cpuinfo, sizeof cpuinfo); D("cpuinfo_len is (%d):\n%.*s\n", cpuinfo_len, cpuinfo_len >= 0 ? cpuinfo_len : 0, cpuinfo); @@ -503,12 +503,12 @@ android_cpuInit(void) #define VENDOR_INTEL_c 0x6c65746e #define VENDOR_INTEL_d 0x49656e69 - x86_cpuid(0, regs); + cpu_x86_cpuid(0, regs); int vendorIsIntel = (regs[1] == VENDOR_INTEL_b && regs[2] == VENDOR_INTEL_c && regs[3] == VENDOR_INTEL_d); - x86_cpuid(1, regs); + cpu_x86_cpuid(1, regs); if ((regs[2] & (1 << 9)) != 0) { g_cpuFeatures |= ANDROID_CPU_X86_FEATURE_SSSE3; } diff --git a/android/native/jni/input_android.c b/android/native/jni/input_android.c index e3839b0413..ca503634d7 100644 --- a/android/native/jni/input_android.c +++ b/android/native/jni/input_android.c @@ -273,7 +273,7 @@ static void setup_keycode_lut(void) keycode_lut[AKEYCODE_F9] = (1ULL << RARCH_MUTE); } -static void *android_input_init(void) +static void *android_input_initialize(void) { pads_connected = 0; @@ -422,7 +422,7 @@ static void android_input_free(void *data) } const input_driver_t input_android = { - android_input_init, + android_input_initialize, android_input_poll, android_input_state, android_input_key_pressed, diff --git a/console/griffin/griffin.c b/console/griffin/griffin.c index 18fdfb1eca..8e9dee6235 100644 --- a/console/griffin/griffin.c +++ b/console/griffin/griffin.c @@ -18,14 +18,16 @@ #include "../../msvc/msvc_compat.h" #endif -#include "../rarch_console.h" - -default_paths_t default_paths; - +#ifdef RARCH_CONSOLE /*============================================================ CONSOLE EXTENSIONS ============================================================ */ + +#include "../rarch_console.h" + +default_paths_t default_paths; + #include "../rarch_console_rom_ext.c" #include "../rarch_console_video.c" @@ -42,10 +44,6 @@ CONSOLE EXTENSIONS #include "../rarch_console_exec.c" #endif -#ifdef PERF_TEST -#include "../../performance.c" -#endif - #ifdef HAVE_RSOUND #include "../rarch_console_rsound.c" #endif @@ -68,6 +66,18 @@ CONSOLE EXTENSIONS #include "../rarch_console_libretro_mgmt.c" #endif +#endif + +/*============================================================ +PERFORMANCE +============================================================ */ + +#ifdef ANDROID +#include "../../android/native/jni/cpufeatures.c" +#endif + +#include "../../performance.c" + /*============================================================ COMPATIBILITY ============================================================ */ @@ -97,6 +107,8 @@ VIDEO CONTEXT #include "../../gfx/context/ps3_ctx.c" #elif defined(_XBOX) #include "../../gfx/context/xdk_ctx.c" +#elif defined(ANDROID) +#include "../../gfx/context/androidegl_ctx.c" #endif #endif @@ -185,6 +197,8 @@ INPUT #include "../../gx/gx_input.c" #elif defined(_XBOX) #include "../../xdk/xdk_xinput_input.c" +#elif defined(ANDROID) +#include "../../android/native/jni/input_android.c" #endif #include "../../input/null.c" @@ -253,6 +267,10 @@ AUDIO #include "../../audio/ext_audio.c" #endif +#ifdef HAVE_SL +#include "../../audio/opensl.c" +#endif + #include "../../audio/null.c" /*============================================================ @@ -298,6 +316,8 @@ MAIN #include "../../gx/frontend/main.c" #elif defined(__PSL1GHT__) #include "../../ps3/frontend/main.c" +#elif defined(ANDROID) +#include "../../android/native/jni/main.c" #endif /*============================================================ @@ -310,6 +330,7 @@ THREAD ============================================================ */ #ifdef HAVE_THREAD #include "../../thread.c" +#include "../../autosave.c" #endif /*============================================================ diff --git a/console/griffin/hook.h b/console/griffin/hook.h index 2d96770b9b..bcf9dc84c9 100644 --- a/console/griffin/hook.h +++ b/console/griffin/hook.h @@ -27,7 +27,7 @@ VIDEO ============================================================ */ -#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) /* PS3, GL */ +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) /* GL */ #define video_init_func(video_info, input, input_data) \ gl_init(video_info, input, input_data) #define video_frame_func(data, width, height, pitch, msg) \ @@ -126,6 +126,13 @@ #define input_key_pressed_func(key) ps3_key_pressed(driver.input_data, key) #define input_free_func() ps3_free_input(driver.input_data) +#elif defined(ANDROID) /* ANDROID */ +#define input_init_func() android_input_initialize() +#define input_poll_func() android_input_poll(driver.input_data) +#define input_input_state_func(retro_keybinds, port, device, index, id) \ + android_input_state(driver.input_data, retro_keybinds, port, device, index, id) +#define input_key_pressed_func(key) android_input_key_pressed(driver.input_data, key) +#define input_free_func() android_input_free(driver.input_data) #else #define input_init_func() null_input_init()