diff --git a/android/native/jni/android_general.h b/android/native/jni/android_general.h
index 74cb0ed7f2..511ff0b311 100644
--- a/android/native/jni/android_general.h
+++ b/android/native/jni/android_general.h
@@ -40,8 +40,27 @@ struct droid
float disp_refresh_rate;
};
+struct jni_params
+{
+ JavaVM *java_vm;
+ jobject class_obj;
+ char class_name[128];
+ char method_name[128];
+ char method_signature[128];
+ char obj_method_name[128];
+ char obj_method_signature[128];
+};
+
+struct jni_out_params_char
+{
+ char *out;
+ size_t out_sizeof;
+ char in[128];
+};
+
extern struct droid g_android;
-extern int android_get_sdk_version(void);
+int android_get_sdk_version(void);
+void jni_get_char_argv(struct jni_params *params, struct jni_out_params_char *out_params);
#endif
diff --git a/android/native/jni/input_android.c b/android/native/jni/input_android.c
index 337091a432..10e82a5e75 100644
--- a/android/native/jni/input_android.c
+++ b/android/native/jni/input_android.c
@@ -286,40 +286,38 @@ static void android_input_poll(void *data)
if(id == LOOPER_ID_INPUT)
{
AInputEvent* event = NULL;
+ AInputQueue_getEvent(android_app->inputQueue, &event);
+ int32_t handled = 1;
- if (AInputQueue_getEvent(android_app->inputQueue, &event) >= 0)
+ int id = AInputEvent_getDeviceId(event);
+ int type = AInputEvent_getType(event);
+ int i = state_device_ids[id];
+
+ if(i == -1)
+ i = state_device_ids[id] = pads_connected++;
+
+ if(type == AINPUT_EVENT_TYPE_MOTION)
+ {
+ float x = AMotionEvent_getX(event, 0);
+ float y = AMotionEvent_getY(event, 0);
+#ifdef RARCH_INPUT_DEBUG
+ RARCH_LOG("AINPUT_EVENT_TYPE_MOTION, pad: %d, x: %f, y: %f.\n", i, x, y);
+#endif
+ state[i] &= ~((1 << RETRO_DEVICE_ID_JOYPAD_LEFT) | (1 << RETRO_DEVICE_ID_JOYPAD_RIGHT) |
+ (1 << RETRO_DEVICE_ID_JOYPAD_UP) | (1 << RETRO_DEVICE_ID_JOYPAD_DOWN));
+ state[i] |= PRESSED_LEFT(x, y) ? (1 << RETRO_DEVICE_ID_JOYPAD_LEFT) : 0;
+ state[i] |= PRESSED_RIGHT(x, y) ? (1 << RETRO_DEVICE_ID_JOYPAD_RIGHT) : 0;
+ state[i] |= PRESSED_UP(x, y) ? (1 << RETRO_DEVICE_ID_JOYPAD_UP) : 0;
+ state[i] |= PRESSED_DOWN(x, y) ? (1 << RETRO_DEVICE_ID_JOYPAD_DOWN) : 0;
+ }
+ else
{
int keycode = AKeyEvent_getKeyCode(event);
- int32_t handled = 1;
uint64_t input_state = keycode_lut[keycode];
-
-
- int id = AInputEvent_getDeviceId(event);
- int type = AInputEvent_getType(event);
- int i = state_device_ids[id];
-
- if(i == -1)
- i = state_device_ids[id] = pads_connected++;
-
#ifdef RARCH_INPUT_DEBUG
RARCH_LOG("Keycode RetroPad %d : %d.\n", i, keycode);
#endif
-
- if(type == AINPUT_EVENT_TYPE_MOTION)
- {
- float x = AMotionEvent_getX(event, 0);
- float y = AMotionEvent_getY(event, 0);
-#ifdef RARCH_INPUT_DEBUG
- RARCH_LOG("AINPUT_EVENT_TYPE_MOTION, pad: %d, x: %f, y: %f.\n", i, x, y);
-#endif
- state[i] &= ~((1 << RETRO_DEVICE_ID_JOYPAD_LEFT) | (1 << RETRO_DEVICE_ID_JOYPAD_RIGHT) |
- (1 << RETRO_DEVICE_ID_JOYPAD_UP) | (1 << RETRO_DEVICE_ID_JOYPAD_DOWN));
- state[i] |= PRESSED_LEFT(x, y) ? (1 << RETRO_DEVICE_ID_JOYPAD_LEFT) : 0;
- state[i] |= PRESSED_RIGHT(x, y) ? (1 << RETRO_DEVICE_ID_JOYPAD_RIGHT) : 0;
- state[i] |= PRESSED_UP(x, y) ? (1 << RETRO_DEVICE_ID_JOYPAD_UP) : 0;
- state[i] |= PRESSED_DOWN(x, y) ? (1 << RETRO_DEVICE_ID_JOYPAD_DOWN) : 0;
- }
- else if(input_state < (1 << RARCH_FIRST_META_KEY))
+ if(input_state < (1 << RARCH_FIRST_META_KEY))
{
int action = AKeyEvent_getAction(event);
@@ -333,9 +331,9 @@ static void android_input_poll(void *data)
g_android.input_state = input_state;
handled = 0;
}
-
- AInputQueue_finishEvent(android_app->inputQueue, event, handled);
}
+
+ AInputQueue_finishEvent(android_app->inputQueue, event, handled);
}
else
{
diff --git a/android/native/jni/jni_utils.c b/android/native/jni/jni_utils.c
deleted file mode 100644
index f98c096fd6..0000000000
--- a/android/native/jni/jni_utils.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* 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 .
- */
-
-#include
-#include
-#include "jni_utils.h"
-
-void jni_get_char_argv(struct jni_params *params, struct jni_out_params_char *out_params)
-{
- JNIEnv *env;
- JavaVM *vm = params->java_vm;
-
- (*vm)->AttachCurrentThread(vm, &env, 0);
-
- jclass acl = (*env)->GetObjectClass(env, params->class_obj); //class pointer
- jmethodID giid = (*env)->GetMethodID(env, acl, params->method_name, params->method_signature);
- jobject obj = (*env)->CallObjectMethod(env, params->class_obj, giid); //Got our object
-
- jclass class_obj = (*env)->GetObjectClass(env, obj); //class pointer of object
- jmethodID gseid = (*env)->GetMethodID(env, class_obj, params->obj_method_name, params->obj_method_signature);
-
- jstring jsParam1 = (*env)->CallObjectMethod(env, obj, gseid, (*env)->NewStringUTF(env, out_params->in));
- const char *test_argv = (*env)->GetStringUTFChars(env, jsParam1, 0);
-
- strncpy(out_params->out, test_argv, out_params->out_sizeof);
-
- (*env)->ReleaseStringUTFChars(env, jsParam1, test_argv);
-
- (*vm)->DetachCurrentThread(vm);
-}
diff --git a/android/native/jni/jni_utils.h b/android/native/jni/jni_utils.h
deleted file mode 100644
index 0e1b11b6d4..0000000000
--- a/android/native/jni/jni_utils.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* 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 .
- */
-
-#ifndef _RARCH_JNI_UTILS_H
-#define _RARCH_JNI_UTILS_H
-
-#include
-#include "android_glue.h"
-
-struct jni_params
-{
- JavaVM *java_vm;
- jobject class_obj;
- char class_name[128];
- char method_name[128];
- char method_signature[128];
- char obj_method_name[128];
- char obj_method_signature[128];
-};
-
-struct jni_out_params_char
-{
- char *out;
- size_t out_sizeof;
- char in[128];
-};
-
-void jni_get_char_argv(struct jni_params *params, struct jni_out_params_char *out_params);
-
-#endif
diff --git a/android/native/jni/main.c b/android/native/jni/main.c
index b3b6489005..385fae7c2f 100644
--- a/android/native/jni/main.c
+++ b/android/native/jni/main.c
@@ -20,7 +20,7 @@
#include
#include
-#include "jni_utils.h"
+#include
#include "android_general.h"
#include "../../../general.h"
#include "../../../performance.h"
@@ -73,6 +73,30 @@ int android_get_sdk_version(void)
return AConfiguration_getSdkVersion(g_android.app->config);
}
+void jni_get_char_argv(struct jni_params *params, struct jni_out_params_char *out_params)
+{
+ JNIEnv *env;
+ JavaVM *vm = params->java_vm;
+
+ (*vm)->AttachCurrentThread(vm, &env, 0);
+
+ jclass acl = (*env)->GetObjectClass(env, params->class_obj); //class pointer
+ jmethodID giid = (*env)->GetMethodID(env, acl, params->method_name, params->method_signature);
+ jobject obj = (*env)->CallObjectMethod(env, params->class_obj, giid); //Got our object
+
+ jclass class_obj = (*env)->GetObjectClass(env, obj); //class pointer of object
+ jmethodID gseid = (*env)->GetMethodID(env, class_obj, params->obj_method_name, params->obj_method_signature);
+
+ jstring jsParam1 = (*env)->CallObjectMethod(env, obj, gseid, (*env)->NewStringUTF(env, out_params->in));
+ const char *test_argv = (*env)->GetStringUTFChars(env, jsParam1, 0);
+
+ strncpy(out_params->out, test_argv, out_params->out_sizeof);
+
+ (*env)->ReleaseStringUTFChars(env, jsParam1, test_argv);
+
+ (*vm)->DetachCurrentThread(vm);
+}
+
/**
* Process the next main command.
*/
diff --git a/console/griffin/griffin.c b/console/griffin/griffin.c
index 5523043ba6..a653be692c 100644
--- a/console/griffin/griffin.c
+++ b/console/griffin/griffin.c
@@ -28,14 +28,6 @@ LOGGERS
#include "../logger/logger.c"
#endif
-/*============================================================
-JNI UTILS
-============================================================ */
-
-#ifdef ANDROID
-#include "../../android/native/jni/jni_utils.c"
-#endif
-
/*============================================================
CONSOLE EXTENSIONS
============================================================ */