From e84db7ba1f2bd4d234705f52f4acff6a2cacae9c Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sun, 16 Sep 2012 21:00:00 +0200 Subject: [PATCH] (Android) Begin RetroArch bridge code - JNI - call it 'Bifrost' --- android/bifrost.c | 43 ++++++++++++++++++++++++++++++++++++++++++ android/jni/Android.mk | 4 ++-- 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 android/bifrost.c diff --git a/android/bifrost.c b/android/bifrost.c new file mode 100644 index 0000000000..17dbdc0ea9 --- /dev/null +++ b/android/bifrost.c @@ -0,0 +1,43 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2012 - Hans-Kristian Arntzen + * Copyright (C) 2011-2012 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +/* RetroArch Bifrost: + * A burning rainbow bridge that reaches between Java (the world) + * and C/C++, the realm of the gods */ + +#include +#include +#include "../boolean.h" + +#include "../console/rarch_console_rom_ext.h" +#include "../general.h" + +JNIEXPORT void JNICALL Java_com_retroarch_RRuntime_load_game + (JNIEnv *env, jclass class, jstring j_path, jint j_extract_zip_mode) +{ + jboolean is_copy = false; + const char * game_path = (*env)->GetStringUTFChars(env, j_path, &is_copy); + + rarch_console_load_game_wrap(game_path, 0, 0); + + (*env)->ReleaseStringUTFChars(env, j_path, game_path); +} + +JNIEXPORT jboolean JNICALL Java_com_retroarch_RRuntime_run_frame + (JNIEnv *env, jclass class) +{ + return rarch_main_iterate(); +} diff --git a/android/jni/Android.mk b/android/jni/Android.mk index a1094f1218..b18c1d73ea 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -5,9 +5,9 @@ include $(CLEAR_VARS) LOCAL_MODULE := retroarch -LOCAL_SRC_FILES = ../../console/griffin/griffin.c ../../console/rzlib/rzlib.c +LOCAL_SRC_FILES = ../../console/griffin/griffin.c ../../console/rzlib/rzlib.c ../bifrost.c -LOCAL_CFLAGS = -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_VID_CONTEXT -DHAVE_ZLIB -DINLINE=inline -DRARCH_CONSOLE -DLSB_FIRST -D__LIBRETRO__ -DHAVE_CONFIGFILE=1 -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -Dmain=rarch_main -std=gnu99 +LOCAL_CFLAGS = -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_GLSL -DHAVE_VID_CONTEXT -DHAVE_ZLIB -DINLINE=inline -DRARCH_CONSOLE -DLSB_FIRST -D__LIBRETRO__ -DHAVE_CONFIGFILE=1 -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -Dmain=rarch_main -std=gnu99 LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -lGLESv2 -llog