RetroArch
Classes | Macros | Typedefs | Enumerations | Functions | Variables
android_input.c File Reference
#include <unistd.h>
#include <dlfcn.h>
#include <android/keycodes.h>
#include <dynamic/dylib.h>
#include <retro_inline.h>
#include <string/stdstring.h>
#include "../input_driver.h"
#include "../../command.h"
#include "../../frontend/drivers/platform_unix.h"
#include "../../gfx/video_driver.h"
#include "../drivers_keyboard/keyboard_event_android.h"
#include "../../tasks/tasks_internal.h"
#include "../../performance_counters.h"
Include dependency graph for android_input.c:

Classes

struct  sensor_t
 
struct  input_pointer
 
struct  state_device
 
struct  android_input
 

Macros

#define MAX_TOUCH   16
 
#define MAX_NUM_KEYBOARDS   3
 
#define AMOTION_EVENT_AXIS_RELATIVE_X   27
 
#define AMOTION_EVENT_AXIS_RELATIVE_Y   28
 
#define ENABLE_TOUCH_SCREEN_MOUSE   1
 
#define AMotionEvent_getAxisValue   (*p_AMotionEvent_getAxisValue)
 
#define AMotionEvent_getButtonState   (*p_AMotionEvent_getButtonState)
 

Typedefs

typedef struct state_device state_device_t
 
typedef struct android_input android_input_t
 

Enumerations

enum  {
  AMOTION_EVENT_BUTTON_PRIMARY = 1 << 0, AMOTION_EVENT_BUTTON_SECONDARY = 1 << 1, AMOTION_EVENT_BUTTON_TERTIARY = 1 << 2, AMOTION_EVENT_BUTTON_BACK = 1 << 3,
  AMOTION_EVENT_BUTTON_FORWARD = 1 << 4, AMOTION_EVENT_AXIS_VSCROLL = 9
}
 
enum  {
  AXIS_X = 0, AXIS_Y = 1, AXIS_Z = 11, AXIS_RZ = 14,
  AXIS_HAT_X = 15, AXIS_HAT_Y = 16, AXIS_LTRIGGER = 17, AXIS_RTRIGGER = 18,
  AXIS_GAS = 22, AXIS_BRAKE = 23
}
 

Functions

static void frontend_android_get_version_sdk (int32_t *sdk)
 
static void frontend_android_get_name (char *s, size_t len)
 
static bool android_input_set_sensor_state (void *data, unsigned port, enum retro_sensor_action action, unsigned event_rate)
 
float AMotionEvent_getAxisValue (const AInputEvent *motion_event, int32_t axis, size_t pointer_idx)
 
static typeof (AMotionEvent_getAxisValue)
 
static bool android_input_lookup_name (char *buf, int *vendorId, int *productId, size_t size, int id)
 
static void android_input_poll_main_cmd (void)
 
static void engine_handle_dpad_default (android_input_t *android, AInputEvent *event, int port, int source)
 
static bool android_input_init_handle (void)
 
static voidandroid_input_init (const char *joypad_driver)
 
static int android_check_quick_tap (android_input_t *android)
 
static int16_t android_mouse_state (android_input_t *android, unsigned id)
 
static int16_t android_lightgun_device_state (android_input_t *android, unsigned id)
 
static INLINE void android_mouse_calculate_deltas (android_input_t *android, AInputEvent *event, size_t motion_ptr)
 
static INLINE int android_input_poll_event_type_motion (android_input_t *android, AInputEvent *event, int port, int source)
 
bool is_keyboard_id (int id)
 
static INLINE void android_input_poll_event_type_keyboard (AInputEvent *event, int keycode, int *handled)
 
static INLINE void android_input_poll_event_type_key (struct android_app *android_app, AInputEvent *event, int port, int keycode, int source, int type_event, int *handled)
 
static int android_input_get_id_port (android_input_t *android, int id, int source)
 
static void handle_hotplug (android_input_t *android, struct android_app *android_app, int *port, int id, int source)
 
static int android_input_get_id (AInputEvent *event)
 
static void android_input_poll_input (void *data)
 
static void android_input_poll_user (void *data)
 
static void android_input_poll_memcpy (void *data)
 
static bool android_input_key_pressed (void *data, int key)
 
static void android_input_poll (void *data)
 
bool android_run_events (void *data)
 
static int16_t android_input_state (void *data, rarch_joypad_info_t joypad_info, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned idx, unsigned id)
 
static void android_input_free_input (void *data)
 
static uint64_t android_input_get_capabilities (void *data)
 
static void android_input_enable_sensor_manager (struct android_app *android_app)
 
static float android_input_get_sensor_input (void *data, unsigned port, unsigned id)
 
static const input_device_driver_tandroid_input_get_joypad_driver (void *data)
 
static bool android_input_keyboard_mapping_is_blocked (void *data)
 
static void android_input_keyboard_mapping_set_block (void *data, bool value)
 
static void android_input_grab_mouse (void *data, bool state)
 
static bool android_input_set_rumble (void *data, unsigned port, enum retro_rumble_effect effect, uint16_t strength)
 

Variables

static int pad_id1 = -1
 
static int pad_id2 = -1
 
static int kbd_id [MAX_NUM_KEYBOARDS]
 
static int kbd_num = 0
 
bool(* engine_lookup_name )(char *buf, int *vendorId, int *productId, size_t size, int id)
 
void(* engine_handle_dpad )(android_input_t *, AInputEvent *, int, int)
 
input_driver_t input_android
 

Macro Definition Documentation

◆ AMOTION_EVENT_AXIS_RELATIVE_X

#define AMOTION_EVENT_AXIS_RELATIVE_X   27

◆ AMOTION_EVENT_AXIS_RELATIVE_Y

#define AMOTION_EVENT_AXIS_RELATIVE_Y   28

◆ AMotionEvent_getAxisValue

#define AMotionEvent_getAxisValue   (*p_AMotionEvent_getAxisValue)

◆ AMotionEvent_getButtonState

#define AMotionEvent_getButtonState   (*p_AMotionEvent_getButtonState)

◆ ENABLE_TOUCH_SCREEN_MOUSE

#define ENABLE_TOUCH_SCREEN_MOUSE   1

◆ MAX_NUM_KEYBOARDS

#define MAX_NUM_KEYBOARDS   3

◆ MAX_TOUCH

#define MAX_TOUCH   16

Typedef Documentation

◆ android_input_t

◆ state_device_t

typedef struct state_device state_device_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
AMOTION_EVENT_BUTTON_PRIMARY 
AMOTION_EVENT_BUTTON_SECONDARY 
AMOTION_EVENT_BUTTON_TERTIARY 
AMOTION_EVENT_BUTTON_BACK 
AMOTION_EVENT_BUTTON_FORWARD 
AMOTION_EVENT_AXIS_VSCROLL 

◆ anonymous enum

anonymous enum
Enumerator
AXIS_X 
AXIS_Y 
AXIS_Z 
AXIS_RZ 
AXIS_HAT_X 
AXIS_HAT_Y 
AXIS_LTRIGGER 
AXIS_RTRIGGER 
AXIS_GAS 
AXIS_BRAKE 

Function Documentation

◆ AMotionEvent_getAxisValue()

float AMotionEvent_getAxisValue ( const AInputEvent *  motion_event,
int32_t  axis,
size_t  pointer_idx 
)

◆ android_check_quick_tap()

static int android_check_quick_tap ( android_input_t android)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ android_input_enable_sensor_manager()

static void android_input_enable_sensor_manager ( struct android_app *  android_app)
static
Here is the caller graph for this function:

◆ android_input_free_input()

static void android_input_free_input ( void data)
static
Here is the call graph for this function:

◆ android_input_get_capabilities()

static uint64_t android_input_get_capabilities ( void data)
static
Here is the call graph for this function:

◆ android_input_get_id()

static int android_input_get_id ( AInputEvent *  event)
static
Here is the caller graph for this function:

◆ android_input_get_id_port()

static int android_input_get_id_port ( android_input_t android,
int  id,
int  source 
)
static
Here is the caller graph for this function:

◆ android_input_get_joypad_driver()

static const input_device_driver_t* android_input_get_joypad_driver ( void data)
static

◆ android_input_get_sensor_input()

static float android_input_get_sensor_input ( void data,
unsigned  port,
unsigned  id 
)
static

◆ android_input_grab_mouse()

static void android_input_grab_mouse ( void data,
bool  state 
)
static
Here is the call graph for this function:

◆ android_input_init()

static void* android_input_init ( const char *  joypad_driver)
static
Here is the call graph for this function:

◆ android_input_init_handle()

static bool android_input_init_handle ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ android_input_key_pressed()

static bool android_input_key_pressed ( void data,
int  key 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ android_input_keyboard_mapping_is_blocked()

static bool android_input_keyboard_mapping_is_blocked ( void data)
static

◆ android_input_keyboard_mapping_set_block()

static void android_input_keyboard_mapping_set_block ( void data,
bool  value 
)
static

◆ android_input_lookup_name()

static bool android_input_lookup_name ( char *  buf,
int *  vendorId,
int *  productId,
size_t  size,
int  id 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ android_input_poll()

static void android_input_poll ( void data)
static
Here is the call graph for this function:

◆ android_input_poll_event_type_key()

static INLINE void android_input_poll_event_type_key ( struct android_app *  android_app,
AInputEvent *  event,
int  port,
int  keycode,
int  source,
int  type_event,
int *  handled 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ android_input_poll_event_type_keyboard()

static INLINE void android_input_poll_event_type_keyboard ( AInputEvent *  event,
int  keycode,
int *  handled 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ android_input_poll_event_type_motion()

static INLINE int android_input_poll_event_type_motion ( android_input_t android,
AInputEvent *  event,
int  port,
int  source 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ android_input_poll_input()

static void android_input_poll_input ( void data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ android_input_poll_main_cmd()

static void android_input_poll_main_cmd ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ android_input_poll_memcpy()

static void android_input_poll_memcpy ( void data)
static
Here is the caller graph for this function:

◆ android_input_poll_user()

static void android_input_poll_user ( void data)
static
Here is the caller graph for this function:

◆ android_input_set_rumble()

static bool android_input_set_rumble ( void data,
unsigned  port,
enum retro_rumble_effect  effect,
uint16_t  strength 
)
static
Here is the call graph for this function:

◆ android_input_set_sensor_state()

static bool android_input_set_sensor_state ( void data,
unsigned  port,
enum retro_sensor_action  action,
unsigned  event_rate 
)
static
Here is the call graph for this function:

◆ android_input_state()

static int16_t android_input_state ( void data,
rarch_joypad_info_t  joypad_info,
const struct retro_keybind **  binds,
unsigned  port,
unsigned  device,
unsigned  idx,
unsigned  id 
)
static
Here is the call graph for this function:

◆ android_lightgun_device_state()

static int16_t android_lightgun_device_state ( android_input_t android,
unsigned  id 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ android_mouse_calculate_deltas()

static INLINE void android_mouse_calculate_deltas ( android_input_t android,
AInputEvent *  event,
size_t  motion_ptr 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ android_mouse_state()

static int16_t android_mouse_state ( android_input_t android,
unsigned  id 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ android_run_events()

bool android_run_events ( void data)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ engine_handle_dpad_default()

static void engine_handle_dpad_default ( android_input_t android,
AInputEvent *  event,
int  port,
int  source 
)
static
Here is the caller graph for this function:

◆ frontend_android_get_name()

static void frontend_android_get_name ( char *  s,
size_t  len 
)
static
Here is the caller graph for this function:

◆ frontend_android_get_version_sdk()

static void frontend_android_get_version_sdk ( int32_t sdk)
static
Here is the caller graph for this function:

◆ handle_hotplug()

static void handle_hotplug ( android_input_t android,
struct android_app *  android_app,
int *  port,
int  id,
int  source 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_keyboard_id()

bool is_keyboard_id ( int  id)
Here is the caller graph for this function:

◆ typeof()

static typeof ( AMotionEvent_getAxisValue  )
static

Variable Documentation

◆ engine_handle_dpad

void(* engine_handle_dpad) (android_input_t *, AInputEvent *, int, int)

◆ engine_lookup_name

bool(* engine_lookup_name) (char *buf, int *vendorId, int *productId, size_t size, int id)

◆ input_android

input_driver_t input_android
Initial value:
= {
"android",
}
static void android_input_poll(void *data)
Definition: android_input.c:1339
static const input_device_driver_t * android_input_get_joypad_driver(void *data)
Definition: android_input.c:1585
static bool android_input_set_sensor_state(void *data, unsigned port, enum retro_sensor_action action, unsigned event_rate)
Definition: android_input.c:1524
static void android_input_keyboard_mapping_set_block(void *data, bool value)
Definition: android_input.c:1601
#define NULL
Pointer to 0.
Definition: gctypes.h:65
static void android_input_free_input(void *data)
Definition: android_input.c:1475
static bool android_input_set_rumble(void *data, unsigned port, enum retro_rumble_effect effect, uint16_t strength)
Definition: android_input.c:1615
static bool android_input_keyboard_mapping_is_blocked(void *data)
Definition: android_input.c:1593
static uint64_t android_input_get_capabilities(void *data)
Definition: android_input.c:1501
static void android_input_grab_mouse(void *data, bool state)
Definition: android_input.c:1609
static void * android_input_init(const char *joypad_driver)
Definition: android_input.c:506
static int16_t android_input_state(void *data, rarch_joypad_info_t joypad_info, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned idx, unsigned id)
Definition: android_input.c:1406
static float android_input_get_sensor_input(void *data, unsigned port, unsigned id)
Definition: android_input.c:1567

◆ kbd_id

int kbd_id[MAX_NUM_KEYBOARDS]
static

◆ kbd_num

int kbd_num = 0
static

◆ pad_id1

int pad_id1 = -1
static

◆ pad_id2

int pad_id2 = -1
static