diff --git a/android/bifrost.c b/android/bifrost.c index 5f8587b161..77af03dfae 100644 --- a/android/bifrost.c +++ b/android/bifrost.c @@ -24,28 +24,64 @@ #include "com_retroarch_rruntime.h" +#include "../console/rarch_console.h" +#include "../../console/rarch_console_config.h" #include "../console/rarch_console_main_wrap.h" #include "../console/rarch_console_rom_ext.h" #include "../console/rarch_console_settings.h" +#include "../console/rarch_console_input.h" +#include "../console/rarch_console_video.h" #include "../general.h" +#include "../conf/config_file.h" +#include "../conf/config_file_macros.h" +#include "../file.h" JNIEXPORT jint JNICALL JNI_OnLoad( JavaVM *vm, void *pvt) { - RARCH_LOG("* JNI_OnLoad.\n" ); + RARCH_LOG("JNI_OnLoad.\n" ); + + rarch_main_clear_state(); + + config_set_defaults(); + input_null.init(); + + char tmp_path[PATH_MAX]; + snprintf(tmp_path, sizeof(tmp_path), "%s/", default_paths.core_dir); + const char *path_prefix = tmp_path; + const char *extension = default_paths.executable_extension; + const input_driver_t *input = &input_ps3; + + char core_exe_path[1024]; + snprintf(core_exe_path, sizeof(core_exe_path), "%sCORE%s", path_prefix, extension); + + bool find_libretro_file = false; + + snprintf(default_paths.config_file, sizeof(default_paths.config_file), "/mnt/extsd/retroarch.cfg"); + + rarch_settings_set_default(); + //rarch_input_set_controls_default(input); + rarch_config_load(default_paths.config_file, path_prefix, extension, find_libretro_file); + init_libretro_sym(); + + input_null.post_init(); + + video_gl.start(); + driver.video = &video_gl; + return JNI_VERSION_1_2; } JNIEXPORT void JNICALL JNI_OnUnLoad( JavaVM *vm, void *pvt) { - RARCH_LOG("* JNI_OnUnLoad.\n" ); + RARCH_LOG("JNI_OnUnLoad.\n" ); } JNIEXPORT void JNICALL Java_com_retroarch_rruntime_load_1game (JNIEnv *env, jclass class, jstring j_path, jint j_extract_zip_mode) { - RARCH_LOG("* rruntime_load_game.\n" ); jboolean is_copy = false; const char * game_path = (*env)->GetStringUTFChars(env, j_path, &is_copy); + RARCH_LOG("rruntime_load_game: %s.\n", game_path); rarch_console_load_game_wrap(game_path, 0, 0); @@ -61,10 +97,11 @@ JNIEXPORT jboolean JNICALL Java_com_retroarch_rruntime_run_1frame JNIEXPORT void JNICALL Java_com_retroarch_rruntime_startup (JNIEnv *env, jclass class, jstring j_config_path) { - RARCH_LOG("* rruntime_startup.\n" ); bool retval = false; jboolean is_copy = false; const char * config_path = (*env)->GetStringUTFChars(env, j_config_path, &is_copy); + + RARCH_LOG("rruntime_startup (config file: %s).\n", config_path); retval = rarch_startup(config_path); diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 040071c51c..33c1f2a5a4 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -9,6 +9,6 @@ LOCAL_SRC_FILES = ../../console/griffin/griffin.c ../../console/rzlib/rzlib.c LOCAL_CFLAGS = -DPERF_TEST -marm -DANDROID -DHAVE_DYNAMIC -DHAVE_DYLIB -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_GLSL -DHAVE_VID_CONTEXT -DHAVE_ZLIB -DHAVE_RARCH_MAIN_WRAP -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 +LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -lGLESv2 -llog -ldl include $(BUILD_SHARED_LIBRARY) diff --git a/android/src/com/retroarch/fileio/FileChooser.java b/android/src/com/retroarch/fileio/FileChooser.java index 50eabdb333..442e68ecf9 100644 --- a/android/src/com/retroarch/fileio/FileChooser.java +++ b/android/src/com/retroarch/fileio/FileChooser.java @@ -7,11 +7,13 @@ import java.util.List; import java.util.Stack; import com.retroarch.R; +import com.retroarch.R.layout; import com.retroarch.rruntime; import android.app.Activity; import android.content.Intent; +import android.content.pm.ApplicationInfo; import android.os.Bundle; import android.os.Environment; import android.view.KeyEvent; @@ -20,6 +22,7 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; +import android.net.Uri; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.Button; @@ -232,7 +235,11 @@ public class FileChooser extends Activity rruntime.settings_set_defaults(); rruntime.load_game(o.getName(), 0); - rruntime.startup(null); + + Uri video = Uri.parse("android.resource://" + getPackageName() + "/" + + R.raw.retroarch); + + rruntime.startup(video.toString()); finish(); }