Search
lxdream.org :: lxdream/src/gui_jni.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gui_jni.c
changeset 1241:74f8e11ab4b8
prev1239:be3121267597
author nkeynes
date Tue Feb 28 18:22:52 2012 +1000 (12 years ago)
permissions -rw-r--r--
last change Add a GL-only video driver for android usage (since the Java code is
responsible for creating the context)
file annotate diff log raw
1.1 --- a/src/gui_jni.c Sat Feb 25 21:30:49 2012 +1000
1.2 +++ b/src/gui_jni.c Tue Feb 28 18:22:52 2012 +1000
1.3 @@ -22,16 +22,33 @@
1.4 #include "dreamcast.h"
1.5 #include "gui.h"
1.6 #include "config.h"
1.7 +#include "lxpaths.h"
1.8 #include "display.h"
1.9 #include "gdlist.h"
1.10 #include "hotkeys.h"
1.11 #include "serial.h"
1.12 #include "aica/audio.h"
1.13 +#include "drivers/video_gl.h"
1.14 #include "maple/maple.h"
1.15 #include "vmu/vmulist.h"
1.16
1.17 -JNIEXPORT void JNICALL Java_org_lxdream_Dreamcast_init(JNIEnv * env, jobject obj, jint width, jint height)
1.18 +static char *getStringChars( JNIEnv *env, jstring str )
1.19 {
1.20 + jboolean iscopy;
1.21 + const char *p = (*env)->GetStringUTFChars(env, str, &iscopy);
1.22 + char *result = strdup(p);
1.23 + (*env)->ReleaseStringUTFChars(env,str,p);
1.24 + return result;
1.25 +}
1.26 +
1.27 +static const char *appHome = NULL;
1.28 +
1.29 +JNIEXPORT void JNICALL Java_org_lxdream_Dreamcast_init(JNIEnv * env, jclass obj, jstring homeDir )
1.30 +{
1.31 + appHome = getStringChars(env, homeDir);
1.32 + const char *confFile = g_strdup_printf("%s/lxdreamrc", appHome);
1.33 + set_user_data_path(appHome);
1.34 + lxdream_set_config_filename( confFile );
1.35 lxdream_make_config_dir( );
1.36 lxdream_load_config( );
1.37 iso_init();
1.38 @@ -49,17 +66,17 @@
1.39 INFO( "%s! ready...", APP_NAME );
1.40 }
1.41
1.42 -JNIEXPORT void JNICALL Java_org_lxdream_Dreamcast_setViewSize(JNIEnv * env, jobject obj, jint width, jint height)
1.43 +JNIEXPORT void JNICALL Java_org_lxdream_Dreamcast_setViewSize(JNIEnv * env, jclass obj, jint width, jint height)
1.44 {
1.45 -
1.46 + gl_set_video_size(width, height);
1.47 }
1.48
1.49 -JNIEXPORT void JNICALL Java_org_lxdream_Dreamcast_run(JNIEnv * env, jobject obj)
1.50 +JNIEXPORT void JNICALL Java_org_lxdream_Dreamcast_run(JNIEnv * env, jclass obj)
1.51 {
1.52 dreamcast_run();
1.53 }
1.54
1.55 -JNIEXPORT void JNICALL Java_org_lxdream_Dreamcast_stop(JNIEnv * env, jobject obj)
1.56 +JNIEXPORT void JNICALL Java_org_lxdream_Dreamcast_stop(JNIEnv * env, jclass obj)
1.57 {
1.58 dreamcast_stop();
1.59 }
.