(Android) Input - Move files around

This commit is contained in:
twinaphex 2014-06-10 22:15:23 +02:00
parent f24c507362
commit 8193eb4b3d
7 changed files with 66 additions and 91 deletions

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef _JNI_MACROS_H
#define _JNI_MACROS_H
#include <jni.h>
#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

View File

@ -17,7 +17,6 @@
#include "../gfx/glsym/glsym.h"
#include "../driver.h"
#include "../android/native/jni/jni_macros.h"
typedef struct android_camera
{

View File

@ -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"

View File

@ -18,6 +18,7 @@
#ifndef _PLATFORM_ANDROID_H
#define _PLATFORM_ANDROID_H
#include <jni.h>
#include <poll.h>
#include <sched.h>
@ -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);

View File

@ -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"

View File

@ -19,12 +19,11 @@
#include <android/keycodes.h>
#include <unistd.h>
#include <dlfcn.h>
#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)))

View File

@ -15,7 +15,6 @@
*/
#include "../driver.h"
#include "../android/native/jni/jni_macros.h"
typedef struct android_location
{