This commit is contained in:
twinaphex 2015-10-23 08:34:15 +02:00
parent 90cb9c5157
commit 6ac88eed54
11 changed files with 93 additions and 62 deletions

View File

@ -953,13 +953,15 @@ static bool android_input_key_pressed(void *data, int key, enum input_device_typ
{
android_input_t *android = (android_input_t*)data;
settings_t *settings = config_get_ptr();
bool joypad_pressed = input_joypad_pressed(android->joypad,
0, settings->input.binds[0], key);
if (joypad_pressed)
if (input_joypad_pressed(android->joypad,
0, settings->input.binds[0], key))
{
*device = INPUT_DEVICE_TYPE_JOYPAD;
return true;
}
return joypad_pressed;
return false;
}
static bool android_input_meta_key_pressed(void *data, int key, enum input_device_type *device)

View File

@ -400,15 +400,19 @@ static bool cocoa_input_key_pressed(void *data, int key, enum input_device_type
{
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
settings_t *settings = config_get_ptr();
bool keyboard_pressed = cocoa_input_is_pressed(apple, 0, settings->input.binds[0], key);
bool joypad_pressed = input_joypad_pressed(apple->joypad, 0, settings->input.binds[0], key);
if (keyboard_pressed)
if (cocoa_input_is_pressed(apple, 0, settings->input.binds[0], key))
{
*device = INPUT_DEVICE_TYPE_KEYBOARD;
if (joypad_pressed)
return true;
}
if (input_joypad_pressed(apple->joypad, 0, settings->input.binds[0], key))
{
*device = INPUT_DEVICE_TYPE_JOYPAD;
return true;
}
return keyboard_pressed || joypad_pressed;
return false;
}
static bool cocoa_input_meta_key_pressed(void *data, int key, enum input_device_type *device)

View File

@ -87,22 +87,25 @@ static bool ctr_input_key_pressed(void *data, int key, enum input_device_type *d
{
settings_t *settings = config_get_ptr();
ctr_input_t *ctr = (ctr_input_t*)data;
bool joypad_pressed = input_joypad_pressed(ctr->joypad, 0, settings->input.binds[0], key);
if (joypad_pressed)
if (input_joypad_pressed(ctr->joypad, 0, settings->input.binds[0], key))
{
*device = INPUT_DEVICE_TYPE_JOYPAD;
return true;
}
return joypad_pressed;
return false;
}
static bool ctr_input_meta_key_pressed(void *data, int key, enum input_device_type *device)
{
bool meta_pressed = BIT64_GET(lifecycle_state, key);
if (meta_pressed)
if (BIT64_GET(lifecycle_state, key))
{
*device = INPUT_DEVICE_TYPE_JOYPAD;
return true;
}
return meta_pressed;
return false;
}
static uint64_t ctr_input_get_capabilities(void *data)

View File

@ -97,18 +97,25 @@ static bool gx_input_key_pressed(void *data, int key, enum input_device_type *de
{
settings_t *settings = config_get_ptr();
gx_input_t *gx = (gx_input_t*)data;
bool joypad_pressed = input_joypad_pressed(gx->joypad, 0, settings->input.binds[0], key);
if (joypad_pressed)
if (input_joypad_pressed(gx->joypad, 0, settings->input.binds[0], key))
{
*device = INPUT_DEVICE_TYPE_JOYPAD;
return true;
}
return joypad_pressed;
return false;
}
static bool gx_input_meta_key_pressed(void *data, int key, enum input_device_type *device)
{
bool meta_pressed = BIT64_GET(lifecycle_state, key);
return meta_pressed;
if (BIT64_GET(lifecycle_state, key))
{
*device = INPUT_DEVICE_TYPE_JOYPAD;
return true;
}
return false;
}
static uint64_t gx_input_get_capabilities(void *data)

View File

@ -177,15 +177,20 @@ static bool linuxraw_input_key_pressed(void *data, int key, enum input_device_ty
{
linuxraw_input_t *linuxraw = (linuxraw_input_t*)data;
settings_t *settings = config_get_ptr();
bool keyboard_pressed = linuxraw_is_pressed(linuxraw, settings->input.binds[0], key);
bool joypad_pressed = input_joypad_pressed(linuxraw->joypad, 0, settings->input.binds[0], key);
if (keyboard_pressed)
if (linuxraw_is_pressed(linuxraw, settings->input.binds[0], key))
{
*device = INPUT_DEVICE_TYPE_KEYBOARD;
if (joypad_pressed)
*device = INPUT_DEVICE_TYPE_JOYPAD;
return true;
}
return keyboard_pressed || joypad_pressed;
if (input_joypad_pressed(linuxraw->joypad, 0, settings->input.binds[0], key))
{
*device = INPUT_DEVICE_TYPE_JOYPAD;
return true;
}
return false;
}
static bool linuxraw_input_meta_key_pressed(void *data, int key, enum input_device_type *device)

View File

@ -178,12 +178,14 @@ static bool ps3_input_key_pressed(void *data, int key, enum input_device_type *d
{
ps3_input_t *ps3 = (ps3_input_t*)data;
settings_t *settings = config_get_ptr();
bool joypad_pressed = input_joypad_pressed(ps3->joypad, 0, settings->input.binds[0], key);
if (joypad_pressed)
if (input_joypad_pressed(ps3->joypad, 0, settings->input.binds[0], key))
{
*device = INPUT_DEVICE_TYPE_JOYPAD;
return true;
}
return joypad_pressed;
return false;
}
static bool ps3_input_meta_key_pressed(void *data, int key, enum input_device_type *device)

View File

@ -104,12 +104,14 @@ static bool psp_input_key_pressed(void *data, int key, enum input_device_type *d
{
settings_t *settings = config_get_ptr();
psp_input_t *psp = (psp_input_t*)data;
bool joypad_pressed = input_joypad_pressed(psp->joypad, 0, settings->input.binds[0], key);
if (joypad_pressed)
if (input_joypad_pressed(psp->joypad, 0, settings->input.binds[0], key))
{
*device = INPUT_DEVICE_TYPE_JOYPAD;
return true;
}
return joypad_pressed;
return false;
}
static bool psp_input_meta_key_pressed(void *data, int key, enum input_device_type *device)

View File

@ -790,12 +790,14 @@ static bool qnx_input_key_pressed(void *data, int key, enum input_device_type *d
{
qnx_input_t *qnx = (qnx_input_t*)data;
settings_t *settings = config_get_ptr();
bool joypad_pressed = input_joypad_pressed(qnx->joypad, 0, settings->input.binds[0], key);
if (joypad_pressed)
if (input_joypad_pressed(qnx->joypad, 0, settings->input.binds[0], key))
{
*device = INPUT_DEVICE_TYPE_JOYPAD;
return true;
}
return joypad_pressed;
return false;
}
static bool qnx_input_meta_key_pressed(void *data, int key, enum input_device_type *device)

View File

@ -283,21 +283,22 @@ static int16_t sdl_analog_pressed(sdl_input_t *sdl, const struct retro_keybind *
static bool sdl_input_key_pressed(void *data, int key, enum input_device_type *device)
{
settings_t *settings = config_get_ptr();
const struct retro_keybind *binds = settings->input.binds[0];
sdl_input_t *sdl = (sdl_input_t*)data;
if (key >= 0 && key < RARCH_BIND_LIST_END)
{
bool keyboard_pressed = sdl_is_pressed(sdl, 0, binds, key);
bool joypad_pressed = input_joypad_pressed(sdl->joypad, 0, binds, key);
sdl_input_t *sdl = (sdl_input_t*)data;
settings_t *settings = config_get_ptr();
const struct retro_keybind *binds = settings->input.binds[0];
if (keyboard_pressed)
if (sdl_is_pressed(sdl, 0, binds, key))
{
*device = INPUT_DEVICE_TYPE_KEYBOARD;
if (joypad_pressed)
return true;
}
if (input_joypad_pressed(sdl->joypad, 0, binds, key))
{
*device = INPUT_DEVICE_TYPE_JOYPAD;
return keyboard_pressed || joypad_pressed;
return true;
}
}
return false;
}
@ -311,19 +312,19 @@ static bool sdl_input_meta_key_pressed(void *data, int key, enum input_device_ty
static int16_t sdl_joypad_device_state(sdl_input_t *sdl, const struct retro_keybind **binds_,
unsigned port_num, unsigned id, enum input_device_type *device)
{
const struct retro_keybind *binds = binds_[port_num];
if (id < RARCH_BIND_LIST_END)
{
bool keyboard_pressed = binds[id].valid && sdl_is_pressed(sdl, port_num, binds, id);
bool joypad_pressed = binds[id].valid && input_joypad_pressed(sdl->joypad, 0, binds, id);
if (keyboard_pressed)
const struct retro_keybind *binds = binds_[port_num];
if (binds[id].valid && sdl_is_pressed(sdl, port_num, binds, id))
{
*device = INPUT_DEVICE_TYPE_KEYBOARD;
if (joypad_pressed)
return 1;
}
if (binds[id].valid && input_joypad_pressed(sdl->joypad, 0, binds, id))
{
*device = INPUT_DEVICE_TYPE_JOYPAD;
return keyboard_pressed || joypad_pressed;
return 1;
}
}
return 0;
}

View File

@ -93,12 +93,13 @@ static bool xdk_input_key_pressed(void *data, int key, enum input_device_type *d
xdk_input_t *xdk = (xdk_input_t*)data;
settings_t *settings = config_get_ptr();
bool joypad_pressed = input_joypad_pressed(xdk->joypad, 0, settings->input.binds[0], key);
if (joypad_pressed)
if (input_joypad_pressed(xdk->joypad, 0, settings->input.binds[0], key))
{
*device = INPUT_DEVICE_TYPE_JOYPAD;
return true;
}
return joypad_pressed;
return false;
}
static bool xdk_input_meta_key_pressed(void *data, int key, enum input_device_type *device)

View File

@ -91,12 +91,14 @@ static void* xenon360_input_init(void)
static bool xenon360_input_key_pressed(void *data, int key, enum input_device_type *device)
{
(void)device;
bool joypad_pressed = (lifecycle_state & (UINT64_C(1) << key));
if (joypad_pressed)
if (lifecycle_state & (UINT64_C(1) << key))
{
*device = INPUT_DEVICE_TYPE_JOYPAD;
return true;
}
return joypad_pressed;
return false;
}
static bool xenon360_input_meta_key_pressed(void *data, int key, enum input_device_type *device)