diff --git a/android/native/jni/jni_macros.h b/android/native/jni/jni_macros.h deleted file mode 100644 index cdb444eed3..0000000000 --- a/android/native/jni/jni_macros.h +++ /dev/null @@ -1,81 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2014 - 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 _JNI_MACROS_H -#define _JNI_MACROS_H - -#include - -#define JNI_EXCEPTION(env) \ - if ((*env)->ExceptionOccurred(env)) \ - { \ - (*env)->ExceptionDescribe(env); \ - (*env)->ExceptionClear(env); \ - } - -#define FIND_CLASS(env, var, classname) \ - var = (*env)->FindClass(env, classname); \ - JNI_EXCEPTION(env) - -#define GET_OBJECT_CLASS(env, var, clazz_obj) \ - var = (*env)->GetObjectClass(env, clazz_obj); \ - JNI_EXCEPTION(env) - -#define GET_FIELD_ID(env, var, clazz, fieldName, fieldDescriptor) \ - var = (*env)->GetFieldID(env, clazz, fieldName, fieldDescriptor); \ - JNI_EXCEPTION(env) - -#define GET_METHOD_ID(env, var, clazz, methodName, fieldDescriptor) \ - var = (*env)->GetMethodID(env, clazz, methodName, fieldDescriptor); \ - JNI_EXCEPTION(env) - -#define GET_STATIC_METHOD_ID(env, var, clazz, methodName, fieldDescriptor) \ - var = (*env)->GetStaticMethodID(env, clazz, methodName, fieldDescriptor); \ - JNI_EXCEPTION(env) - -#define CALL_OBJ_METHOD(env, var, clazz_obj, methodId) \ - var = (*env)->CallObjectMethod(env, clazz_obj, methodId); \ - JNI_EXCEPTION(env) - -#define CALL_OBJ_STATIC_METHOD(env, var, clazz, methodId) \ - var = (*env)->CallStaticObjectMethod(env, clazz, methodId); \ - JNI_EXCEPTION(env) - -#define CALL_OBJ_STATIC_METHOD_PARAM(env, var, clazz, methodId, ...) \ - var = (*env)->CallStaticObjectMethod(env, clazz, methodId, __VA_ARGS__); \ - JNI_EXCEPTION(env) - -#define CALL_OBJ_METHOD_PARAM(env, var, clazz_obj, methodId, ...) \ - var = (*env)->CallObjectMethod(env, clazz_obj, methodId, __VA_ARGS__); \ - JNI_EXCEPTION(env) - -#define CALL_VOID_METHOD(env, clazz_obj, methodId) \ - (*env)->CallVoidMethod(env, clazz_obj, methodId); \ - JNI_EXCEPTION(env) - -#define CALL_VOID_METHOD_PARAM(env, clazz_obj, methodId, ...) \ - (*env)->CallVoidMethod(env, clazz_obj, methodId, __VA_ARGS__); \ - JNI_EXCEPTION(env) - -#define CALL_BOOLEAN_METHOD(env, var, clazz_obj, methodId) \ - var = (*env)->CallBooleanMethod(env, clazz_obj, methodId); \ - JNI_EXCEPTION(env) - -#define CALL_DOUBLE_METHOD(env, var, clazz_obj, methodId) \ - var = (*env)->CallDoubleMethod(env, clazz_obj, methodId); \ - JNI_EXCEPTION(env) - -#endif diff --git a/camera/android.c b/camera/android.c index eaa147e0e9..db3d116625 100644 --- a/camera/android.c +++ b/camera/android.c @@ -17,7 +17,6 @@ #include "../gfx/glsym/glsym.h" #include "../driver.h" -#include "../android/native/jni/jni_macros.h" typedef struct android_camera { diff --git a/frontend/platform/platform_android.c b/frontend/platform/platform_android.c index bc2973a908..db2fd38fce 100644 --- a/frontend/platform/platform_android.c +++ b/frontend/platform/platform_android.c @@ -23,7 +23,6 @@ #include "platform_android.h" #include "../menu/menu_common.h" -#include "../../android/native/jni/jni_macros.h" #include "../../conf/config_file.h" #include "../../general.h" diff --git a/frontend/platform/platform_android.h b/frontend/platform/platform_android.h index 76286129fe..49ab095200 100644 --- a/frontend/platform/platform_android.h +++ b/frontend/platform/platform_android.h @@ -18,6 +18,7 @@ #ifndef _PLATFORM_ANDROID_H #define _PLATFORM_ANDROID_H +#include #include #include @@ -160,6 +161,65 @@ enum { APP_CMD_DEAD, }; +#define JNI_EXCEPTION(env) \ + if ((*env)->ExceptionOccurred(env)) \ + { \ + (*env)->ExceptionDescribe(env); \ + (*env)->ExceptionClear(env); \ + } + +#define FIND_CLASS(env, var, classname) \ + var = (*env)->FindClass(env, classname); \ + JNI_EXCEPTION(env) + +#define GET_OBJECT_CLASS(env, var, clazz_obj) \ + var = (*env)->GetObjectClass(env, clazz_obj); \ + JNI_EXCEPTION(env) + +#define GET_FIELD_ID(env, var, clazz, fieldName, fieldDescriptor) \ + var = (*env)->GetFieldID(env, clazz, fieldName, fieldDescriptor); \ + JNI_EXCEPTION(env) + +#define GET_METHOD_ID(env, var, clazz, methodName, fieldDescriptor) \ + var = (*env)->GetMethodID(env, clazz, methodName, fieldDescriptor); \ + JNI_EXCEPTION(env) + +#define GET_STATIC_METHOD_ID(env, var, clazz, methodName, fieldDescriptor) \ + var = (*env)->GetStaticMethodID(env, clazz, methodName, fieldDescriptor); \ + JNI_EXCEPTION(env) + +#define CALL_OBJ_METHOD(env, var, clazz_obj, methodId) \ + var = (*env)->CallObjectMethod(env, clazz_obj, methodId); \ + JNI_EXCEPTION(env) + +#define CALL_OBJ_STATIC_METHOD(env, var, clazz, methodId) \ + var = (*env)->CallStaticObjectMethod(env, clazz, methodId); \ + JNI_EXCEPTION(env) + +#define CALL_OBJ_STATIC_METHOD_PARAM(env, var, clazz, methodId, ...) \ + var = (*env)->CallStaticObjectMethod(env, clazz, methodId, __VA_ARGS__); \ + JNI_EXCEPTION(env) + +#define CALL_OBJ_METHOD_PARAM(env, var, clazz_obj, methodId, ...) \ + var = (*env)->CallObjectMethod(env, clazz_obj, methodId, __VA_ARGS__); \ + JNI_EXCEPTION(env) + +#define CALL_VOID_METHOD(env, clazz_obj, methodId) \ + (*env)->CallVoidMethod(env, clazz_obj, methodId); \ + JNI_EXCEPTION(env) + +#define CALL_VOID_METHOD_PARAM(env, clazz_obj, methodId, ...) \ + (*env)->CallVoidMethod(env, clazz_obj, methodId, __VA_ARGS__); \ + JNI_EXCEPTION(env) + +#define CALL_BOOLEAN_METHOD(env, var, clazz_obj, methodId) \ + var = (*env)->CallBooleanMethod(env, clazz_obj, methodId); \ + JNI_EXCEPTION(env) + +#define CALL_DOUBLE_METHOD(env, var, clazz_obj, methodId) \ + var = (*env)->CallDoubleMethod(env, clazz_obj, methodId); \ + JNI_EXCEPTION(env) + extern void engine_handle_cmd(void*); extern JNIEnv *jni_thread_getenv(void); diff --git a/griffin/griffin.c b/griffin/griffin.c index 6d8d63688f..8fba86a43b 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -308,7 +308,7 @@ INPUT #elif defined(XENON) #include "../xenon/xenon360_input.c" #elif defined(ANDROID) -#include "../android/native/jni/input_android.c" +#include "../input/android_input.c" #elif defined(IOS) || defined(OSX) #include "../input/apple_input.c" #include "../input/apple_joypad.c" diff --git a/android/native/jni/input_android.c b/input/android_input.c similarity index 99% rename from android/native/jni/input_android.c rename to input/android_input.c index c7b5f03212..12cacf5e31 100644 --- a/android/native/jni/input_android.c +++ b/input/android_input.c @@ -19,12 +19,11 @@ #include #include #include -#include "jni_macros.h" -#include "../../../frontend/platform/platform_android.h" -#include "../../../input/input_common.h" -#include "../../../performance.h" -#include "../../../general.h" -#include "../../../driver.h" +#include "../frontend/platform/platform_android.h" +#include "input_common.h" +#include "../performance.h" +#include "../general.h" +#include "../driver.h" #define MAX_TOUCH 16 #define PRESSED_UP(x, y) ((y <= (-g_settings.input.axis_threshold))) diff --git a/location/android.c b/location/android.c index 69f795b8e7..0ef5eb1593 100644 --- a/location/android.c +++ b/location/android.c @@ -15,7 +15,6 @@ */ #include "../driver.h" -#include "../android/native/jni/jni_macros.h" typedef struct android_location {