(Android) Refactor JNI code

(Android) Change overlay PNGs to TGAs - add 256x256 quickmenu
texture - change basic_overlay.cfg coords
This commit is contained in:
twinaphex 2012-12-23 14:24:13 +01:00
parent f445c939e9
commit e58ca0b95b
5 changed files with 37 additions and 21 deletions

View File

@ -60,40 +60,57 @@ void jni_get(void *params, void *out_params, unsigned out_type)
return;
JavaVM *vm = in_params->java_vm;
jclass class_ptr = NULL;
jobject obj = NULL;
jmethodID gseid = NULL;
jmethodID giid = NULL;
jstring ret_char;
struct jni_out_params_char *out_params_char = NULL;
(void)ret_char;
(void)out_params_char;
(*vm)->AttachCurrentThread(vm, &env, 0);
if (in_params->class_obj)
{
jclass acl = (*env)->GetObjectClass(env, in_params->class_obj); //class pointer
jmethodID giid = (*env)->GetMethodID(env, acl, in_params->method_name, in_params->method_signature);
class_ptr = (*env)->GetObjectClass(env, in_params->class_obj); //class pointer
giid = (*env)->GetMethodID(env, class_ptr, in_params->method_name, in_params->method_signature);
obj = (*env)->CallObjectMethod(env, in_params->class_obj, giid); //Got our object
}
if (in_params->obj_method_name && obj)
{
jclass class_obj = (*env)->GetObjectClass(env, obj); //class pointer of object
gseid = (*env)->GetMethodID(env, class_obj, in_params->obj_method_name,
class_ptr = (*env)->GetObjectClass(env, obj); //class pointer of object
giid = (*env)->GetMethodID(env, class_ptr, in_params->obj_method_name,
in_params->obj_method_signature);
switch(out_type)
{
case JNI_OUT_CHAR:
{
out_params_char = (struct jni_out_params_char*)out_params;
if (!out_params_char)
goto do_exit;
ret_char = (*env)->CallObjectMethod(env, obj, giid,
(*env)->NewStringUTF(env, out_params_char->in));
}
break;
case JNI_OUT_NONE:
default:
break;
}
}
switch (out_type)
{
case JNI_OUT_CHAR:
if(gseid != NULL)
if(giid != NULL && ret_char)
{
struct jni_out_params_char *out_params_char = (struct jni_out_params_char*)out_params;
if (!out_params_char)
goto do_exit;
jstring jsParam1 = (*env)->CallObjectMethod(env, obj,
gseid, (*env)->NewStringUTF(env, out_params_char->in));
const char *test_argv = (*env)->GetStringUTFChars(env, jsParam1, 0);
const char *test_argv = (*env)->GetStringUTFChars(env, ret_char, 0);
strncpy(out_params_char->out, test_argv, out_params_char->out_sizeof);
(*env)->ReleaseStringUTFChars(env, jsParam1, test_argv);
(*env)->ReleaseStringUTFChars(env, ret_char, test_argv);
}
break;
case JNI_OUT_NONE:

View File

@ -1,7 +1,7 @@
overlays = 2
overlay0_overlay = basic_overlay.png
overlay1_overlay = basic_quickmenu.png
overlay0_overlay = basic_overlay.tga
overlay1_overlay = basic_quickmenu_small.tga
overlay1_rect = "0.25,0.25,0.5,0.5"
@ -23,7 +23,6 @@ overlay0_desc13 = "y,163,210,radial,15,15"
overlay0_desc14 = "overlay_next,111,224,radial,20,20"
overlay1_descs = 3
overlay1_desc0 = "save_state,110,103,rect,100,15"
overlay1_desc1 = "load_state,110,59,rect,100,15"
overlay1_desc2 = "overlay_next,232,480,radial,32,32"
overlay1_desc0 = "save_state,55,51,rect,50,7"
overlay1_desc1 = "load_state,55,29,rect,50,7"
overlay1_desc2 = "overlay_next,116,240,radial,16,16"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB