(Android) Begin RetroArch bridge code - JNI - call it 'Bifrost'

This commit is contained in:
Twinaphex 2012-09-16 21:00:00 +02:00
parent dac374605d
commit e84db7ba1f
2 changed files with 45 additions and 2 deletions

43
android/bifrost.c Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*/
/* RetroArch Bifrost:
* A burning rainbow bridge that reaches between Java (the world)
* and C/C++, the realm of the gods */
#include <stdio.h>
#include <jni.h>
#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();
}

View File

@ -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