mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
(input) Cleanups
This commit is contained in:
parent
ae922a9593
commit
4205b3e8f3
@ -19,7 +19,7 @@
|
|||||||
static const char *android_joypad_name(unsigned pad)
|
static const char *android_joypad_name(unsigned pad)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
return settings->input.device_names[pad];
|
return settings ? settings->input.device_names[pad] : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool android_joypad_init(void)
|
static bool android_joypad_init(void)
|
||||||
@ -60,8 +60,8 @@ static bool android_joypad_init(void)
|
|||||||
|
|
||||||
static bool android_joypad_button(unsigned port, uint16_t joykey)
|
static bool android_joypad_button(unsigned port, uint16_t joykey)
|
||||||
{
|
{
|
||||||
uint8_t *buf = NULL;
|
uint8_t *buf = NULL;
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
android_input_t *android = (android_input_t*)driver->input_data;
|
android_input_t *android = (android_input_t*)driver->input_data;
|
||||||
|
|
||||||
if (!android || port >= MAX_PADS)
|
if (!android || port >= MAX_PADS)
|
||||||
@ -95,11 +95,11 @@ static bool android_joypad_button(unsigned port, uint16_t joykey)
|
|||||||
|
|
||||||
static int16_t android_joypad_axis(unsigned port, uint32_t joyaxis)
|
static int16_t android_joypad_axis(unsigned port, uint32_t joyaxis)
|
||||||
{
|
{
|
||||||
int val = 0;
|
int val = 0;
|
||||||
int axis = -1;
|
int axis = -1;
|
||||||
bool is_neg = false;
|
bool is_neg = false;
|
||||||
bool is_pos = false;
|
bool is_pos = false;
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
android_input_t *android = (android_input_t*)driver->input_data;
|
android_input_t *android = (android_input_t*)driver->input_data;
|
||||||
|
|
||||||
if (!android || joyaxis == AXIS_NONE || port >= MAX_PADS)
|
if (!android || joyaxis == AXIS_NONE || port >= MAX_PADS)
|
||||||
@ -132,7 +132,7 @@ static void android_joypad_poll(void)
|
|||||||
|
|
||||||
static bool android_joypad_query_pad(unsigned pad)
|
static bool android_joypad_query_pad(unsigned pad)
|
||||||
{
|
{
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
android_input_t *android = (android_input_t*)driver->input_data;
|
android_input_t *android = (android_input_t*)driver->input_data;
|
||||||
return (pad < MAX_USERS && pad < android->pads_connected);
|
return (pad < MAX_USERS && pad < android->pads_connected);
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ static const char *gx_joypad_name_static(unsigned pad)
|
|||||||
static void handle_hotplug(unsigned port, uint32_t ptype)
|
static void handle_hotplug(unsigned port, uint32_t ptype)
|
||||||
{
|
{
|
||||||
autoconfig_params_t params = {{0}};
|
autoconfig_params_t params = {{0}};
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
pad_type[port] = ptype;
|
pad_type[port] = ptype;
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ static bool gx_joypad_init(void)
|
|||||||
{
|
{
|
||||||
int autoconf_pad;
|
int autoconf_pad;
|
||||||
autoconfig_params_t params = {{0}};
|
autoconfig_params_t params = {{0}};
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
SYS_SetResetCallback(reset_cb);
|
SYS_SetResetCallback(reset_cb);
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
@ -269,8 +269,11 @@ static uint64_t gx_joypad_get_buttons(unsigned port)
|
|||||||
|
|
||||||
static int16_t gx_joypad_axis(unsigned port, uint32_t joyaxis)
|
static int16_t gx_joypad_axis(unsigned port, uint32_t joyaxis)
|
||||||
{
|
{
|
||||||
int val = 0, axis = -1;
|
int val = 0;
|
||||||
bool is_neg = false, is_pos = false;
|
int axis = -1;
|
||||||
|
bool is_neg = false;
|
||||||
|
bool is_pos = false;
|
||||||
|
|
||||||
if (joyaxis == AXIS_NONE || port >= MAX_PADS)
|
if (joyaxis == AXIS_NONE || port >= MAX_PADS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -62,8 +62,11 @@ static uint64_t psp_joypad_get_buttons(unsigned port_num)
|
|||||||
|
|
||||||
static int16_t psp_joypad_axis(unsigned port_num, uint32_t joyaxis)
|
static int16_t psp_joypad_axis(unsigned port_num, uint32_t joyaxis)
|
||||||
{
|
{
|
||||||
int val = 0, axis = -1;
|
int val = 0;
|
||||||
bool is_neg = false, is_pos = false;
|
int axis = -1;
|
||||||
|
bool is_neg = false;
|
||||||
|
bool is_pos = false;
|
||||||
|
|
||||||
if (joyaxis == AXIS_NONE || port_num >= MAX_PADS)
|
if (joyaxis == AXIS_NONE || port_num >= MAX_PADS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -106,7 +109,7 @@ static void psp_joypad_poll(void)
|
|||||||
{
|
{
|
||||||
int32_t ret;
|
int32_t ret;
|
||||||
SceCtrlData state_tmp;
|
SceCtrlData state_tmp;
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
uint64_t *lifecycle_state = (uint64_t*)&global->lifecycle_state;
|
uint64_t *lifecycle_state = (uint64_t*)&global->lifecycle_state;
|
||||||
|
|
||||||
#ifdef PSP
|
#ifdef PSP
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
static const char *qnx_joypad_name(unsigned pad)
|
static const char *qnx_joypad_name(unsigned pad)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
return settings->input.device_names[pad];
|
return settings ? settings->input.device_names[pad] : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool qnx_joypad_init(void)
|
static bool qnx_joypad_init(void)
|
||||||
@ -68,18 +68,16 @@ static uint64_t qnx_joypad_get_buttons(unsigned port_num)
|
|||||||
|
|
||||||
static int16_t qnx_joypad_axis(unsigned port_num, uint32_t joyaxis)
|
static int16_t qnx_joypad_axis(unsigned port_num, uint32_t joyaxis)
|
||||||
{
|
{
|
||||||
|
int val = 0;
|
||||||
|
int axis = -1;
|
||||||
|
bool is_neg = false;
|
||||||
|
bool is_pos = false;
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
qnx_input_t *qnx = (qnx_input_t*)driver->input_data;
|
qnx_input_t *qnx = (qnx_input_t*)driver->input_data;
|
||||||
|
|
||||||
if (!qnx || joyaxis == AXIS_NONE || port_num >= MAX_PADS)
|
if (!qnx || joyaxis == AXIS_NONE || port_num >= MAX_PADS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int val = 0;
|
|
||||||
|
|
||||||
int axis = -1;
|
|
||||||
bool is_neg = false;
|
|
||||||
bool is_pos = false;
|
|
||||||
|
|
||||||
if (AXIS_NEG_GET(joyaxis) < 4)
|
if (AXIS_NEG_GET(joyaxis) < 4)
|
||||||
{
|
{
|
||||||
axis = AXIS_NEG_GET(joyaxis);
|
axis = AXIS_NEG_GET(joyaxis);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user