mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-20 09:48:27 +00:00
We will now be able to know from which input device type the input
event comes from - i.e. keyboard or gamepad
This commit is contained in:
parent
cd1f3510eb
commit
1a20e19c51
@ -858,12 +858,13 @@ static void android_input_poll(void *data)
|
||||
int ident;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const input_driver_t *input = driver ? (const input_driver_t*)driver->input : NULL;
|
||||
enum input_device_type device = INPUT_DEVICE_TYPE_NONE;
|
||||
|
||||
if (!input)
|
||||
return;
|
||||
|
||||
while ((ident =
|
||||
ALooper_pollAll((input->key_pressed(driver->input_data, RARCH_PAUSE_TOGGLE))
|
||||
ALooper_pollAll((input->key_pressed(driver->input_data, RARCH_PAUSE_TOGGLE, &device))
|
||||
? -1 : 0,
|
||||
NULL, NULL, NULL)) >= 0)
|
||||
{
|
||||
@ -948,17 +949,23 @@ static int16_t android_input_state(void *data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool android_input_key_pressed(void *data, int key)
|
||||
static bool android_input_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
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);
|
||||
|
||||
return input_joypad_pressed(android->joypad,
|
||||
0, settings->input.binds[0], key);
|
||||
if (joypad_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return joypad_pressed;
|
||||
}
|
||||
|
||||
static bool android_input_meta_key_pressed(void *data, int key)
|
||||
static bool android_input_meta_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
(void)device;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -396,16 +396,25 @@ static int16_t cocoa_input_state(void *data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool cocoa_input_key_pressed(void *data, int key)
|
||||
static bool cocoa_input_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
return cocoa_input_is_pressed(apple, 0, settings->input.binds[0], key) ||
|
||||
input_joypad_pressed(apple->joypad, 0, settings->input.binds[0], key);
|
||||
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)
|
||||
*device = INPUT_DEVICE_TYPE_KEYBOARD;
|
||||
if (joypad_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return keyboard_pressed || joypad_pressed;
|
||||
}
|
||||
|
||||
static bool cocoa_input_meta_key_pressed(void *data, int key)
|
||||
static bool cocoa_input_meta_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
(void)device;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -83,17 +83,26 @@ static void* ctr_input_initialize(void)
|
||||
return ctr;
|
||||
}
|
||||
|
||||
static bool ctr_input_key_pressed(void *data, int key)
|
||||
static bool ctr_input_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
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);
|
||||
|
||||
return input_joypad_pressed(ctr->joypad, 0, settings->input.binds[0], key);
|
||||
if (joypad_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return joypad_pressed;
|
||||
}
|
||||
|
||||
static bool ctr_input_meta_key_pressed(void *data, int key)
|
||||
static bool ctr_input_meta_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
return (BIT64_GET(lifecycle_state, key));
|
||||
bool meta_pressed = BIT64_GET(lifecycle_state, key);
|
||||
|
||||
if (meta_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return meta_pressed;
|
||||
}
|
||||
|
||||
static uint64_t ctr_input_get_capabilities(void *data)
|
||||
|
@ -351,14 +351,23 @@ static bool dinput_keyboard_pressed(struct dinput_input *di, unsigned key)
|
||||
|
||||
static bool dinput_is_pressed(struct dinput_input *di,
|
||||
const struct retro_keybind *binds,
|
||||
unsigned port, unsigned id)
|
||||
unsigned port, unsigned id, enum input_device_type *device)
|
||||
{
|
||||
const struct retro_keybind *bind = &binds[id];
|
||||
bool joypad_pressed = false;
|
||||
bool keyboard_pressed = false;
|
||||
if (id >= RARCH_BIND_LIST_END)
|
||||
return false;
|
||||
|
||||
return (!di->blocked && dinput_keyboard_pressed(di, bind->key)) ||
|
||||
input_joypad_pressed(di->joypad, port, binds, id);
|
||||
keyboard_pressed = !di->blocked && dinput_keyboard_pressed(di, bind->key);
|
||||
joypad_pressed = input_joypad_pressed(di->joypad, port, binds, id);
|
||||
|
||||
if (keyboard_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_KEYBOARD;
|
||||
if (joypad_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return keyboard_pressed || joypad_pressed;
|
||||
}
|
||||
|
||||
static int16_t dinput_pressed_analog(struct dinput_input *di,
|
||||
@ -385,15 +394,15 @@ static int16_t dinput_pressed_analog(struct dinput_input *di,
|
||||
return pressed_plus + pressed_minus;
|
||||
}
|
||||
|
||||
static bool dinput_key_pressed(void *data, int key)
|
||||
static bool dinput_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
return dinput_is_pressed((struct dinput_input*)data,
|
||||
settings->input.binds[0], 0, key);
|
||||
return dinput_is_pressed((struct dinput_input*)data, settings->input.binds[0], 0, key, device);
|
||||
}
|
||||
|
||||
static bool dinput_meta_key_pressed(void *data, int key)
|
||||
static bool dinput_meta_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
(void)device;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -93,16 +93,22 @@ static void gx_input_poll(void *data)
|
||||
gx->joypad->poll();
|
||||
}
|
||||
|
||||
static bool gx_input_key_pressed(void *data, int key)
|
||||
static bool gx_input_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
gx_input_t *gx = (gx_input_t*)data;
|
||||
return input_joypad_pressed(gx->joypad, 0, settings->input.binds[0], key);
|
||||
bool joypad_pressed = input_joypad_pressed(gx->joypad, 0, settings->input.binds[0], key);
|
||||
|
||||
if (joypad_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return joypad_pressed;
|
||||
}
|
||||
|
||||
static bool gx_input_meta_key_pressed(void *data, int key)
|
||||
static bool gx_input_meta_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
return (BIT64_GET(lifecycle_state, key));
|
||||
bool meta_pressed = BIT64_GET(lifecycle_state, key);
|
||||
return meta_pressed;
|
||||
}
|
||||
|
||||
static uint64_t gx_input_get_capabilities(void *data)
|
||||
|
@ -173,17 +173,24 @@ static int16_t linuxraw_analog_pressed(linuxraw_input_t *linuxraw,
|
||||
return pressed_plus + pressed_minus;
|
||||
}
|
||||
|
||||
static bool linuxraw_input_key_pressed(void *data, int key)
|
||||
static bool linuxraw_input_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
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);
|
||||
|
||||
return linuxraw_is_pressed(linuxraw, settings->input.binds[0], key) ||
|
||||
input_joypad_pressed(linuxraw->joypad, 0, settings->input.binds[0], key);
|
||||
if (keyboard_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_KEYBOARD;
|
||||
if (joypad_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return keyboard_pressed || joypad_pressed;
|
||||
}
|
||||
|
||||
static bool linuxraw_input_meta_key_pressed(void *data, int key)
|
||||
static bool linuxraw_input_meta_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
(void)device;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -41,18 +41,20 @@ static int16_t nullinput_input_state(void *data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool nullinput_input_key_pressed(void *data, int key)
|
||||
static bool nullinput_input_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
(void)data;
|
||||
(void)key;
|
||||
(void)device;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool nullinput_input_meta_key_pressed(void *data, int key)
|
||||
static bool nullinput_input_meta_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
(void)data;
|
||||
(void)key;
|
||||
(void)device;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -174,16 +174,22 @@ static void* ps3_input_init(void)
|
||||
return ps3;
|
||||
}
|
||||
|
||||
static bool ps3_input_key_pressed(void *data, int key)
|
||||
static bool ps3_input_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
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);
|
||||
|
||||
return input_joypad_pressed(ps3->joypad, 0, settings->input.binds[0], key);
|
||||
if (joypad_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return joypad_pressed;
|
||||
}
|
||||
|
||||
static bool ps3_input_meta_key_pressed(void *data, int key)
|
||||
static bool ps3_input_meta_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
(void)device;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -100,17 +100,26 @@ static void* psp_input_initialize(void)
|
||||
return psp;
|
||||
}
|
||||
|
||||
static bool psp_input_key_pressed(void *data, int key)
|
||||
static bool psp_input_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
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);
|
||||
|
||||
return input_joypad_pressed(psp->joypad, 0, settings->input.binds[0], key);
|
||||
if (joypad_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return joypad_pressed;
|
||||
}
|
||||
|
||||
static bool psp_input_meta_key_pressed(void *data, int key)
|
||||
static bool psp_input_meta_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
return (BIT64_GET(lifecycle_state, key));
|
||||
bool meta_pressed = (BIT64_GET(lifecycle_state, key));
|
||||
|
||||
if (meta_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return meta_pressed;
|
||||
}
|
||||
|
||||
static uint64_t psp_input_get_capabilities(void *data)
|
||||
|
@ -786,16 +786,21 @@ static int16_t qnx_input_state(void *data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool qnx_input_key_pressed(void *data, int key)
|
||||
static bool qnx_input_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
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);
|
||||
|
||||
return input_joypad_pressed(qnx->joypad, 0, settings->input.binds[0], key);
|
||||
if (joypad_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return joypad_pressed;
|
||||
}
|
||||
|
||||
static bool qnx_input_meta_key_pressed(void *data, int key)
|
||||
static bool qnx_input_meta_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
(void)device;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -864,7 +869,7 @@ input_driver_t input_qnx = {
|
||||
qnx_input_poll,
|
||||
qnx_input_state,
|
||||
qnx_input_key_pressed,
|
||||
NULL,
|
||||
qnx_input_meta_key_pressed,
|
||||
qnx_input_free_input,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -67,7 +67,7 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool rwebinput_key_pressed__(void *data, int key)
|
||||
static bool rwebinput_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
unsigned sym;
|
||||
bool ret;
|
||||
@ -79,13 +79,17 @@ static bool rwebinput_key_pressed__(void *data, int key)
|
||||
sym = input_keymaps_translate_rk_to_keysym((enum retro_key)key);
|
||||
ret = rwebinput->state.keys[sym >> 3] & (1 << (sym & 7));
|
||||
|
||||
if (ret)
|
||||
*device = INPUT_DEVICE_TYPE_KEYBOARD;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool rwebinput_meta_key_pressed(void *data, int key)
|
||||
static bool rwebinput_meta_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
(void)data;
|
||||
(void)key;
|
||||
(void)device;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -95,7 +99,7 @@ static bool rwebinput_is_pressed(rwebinput_input_t *rwebinput,
|
||||
if (id < RARCH_BIND_LIST_END)
|
||||
{
|
||||
const struct retro_keybind *bind = &binds[id];
|
||||
return bind->valid && rwebinput_key_pressed__(rwebinput, binds[id].key);
|
||||
return bind->valid && rwebinput_key_pressed(rwebinput, binds[id].key);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -145,7 +149,8 @@ static int16_t rwebinput_analog_pressed(rwebinput_input_t *rwebinput,
|
||||
static int16_t rwebinput_input_state(void *data, const struct retro_keybind **binds,
|
||||
unsigned port, unsigned device, unsigned idx, unsigned id)
|
||||
{
|
||||
rwebinput_input_t *rwebinput = (rwebinput_input_t*)data;
|
||||
enum input_device_type device = INPUT_DEVICE_TYPE_NONE;
|
||||
rwebinput_input_t *rwebinput = (rwebinput_input_t*)data;
|
||||
|
||||
switch (device)
|
||||
{
|
||||
@ -156,7 +161,7 @@ static int16_t rwebinput_input_state(void *data, const struct retro_keybind **bi
|
||||
return rwebinput_analog_pressed(rwebinput, binds[port], idx, id);
|
||||
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
return rwebinput_key_pressed(rwebinput, id);
|
||||
return rwebinput_key_pressed(rwebinput, id, &device);
|
||||
|
||||
case RETRO_DEVICE_MOUSE:
|
||||
return rwebinput_mouse_state(rwebinput, id);
|
||||
|
@ -261,8 +261,7 @@ static bool sdl_is_pressed(sdl_input_t *sdl, unsigned port_num, const struct ret
|
||||
{
|
||||
if (sdl_key_pressed(binds[key].key))
|
||||
return true;
|
||||
|
||||
return input_joypad_pressed(sdl->joypad, port_num, binds, key);
|
||||
return false;
|
||||
}
|
||||
|
||||
static int16_t sdl_analog_pressed(sdl_input_t *sdl, const struct retro_keybind *binds,
|
||||
@ -282,26 +281,50 @@ static int16_t sdl_analog_pressed(sdl_input_t *sdl, const struct retro_keybind *
|
||||
return pressed_plus + pressed_minus;
|
||||
}
|
||||
|
||||
static bool sdl_input_key_pressed(void *data, int key)
|
||||
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)
|
||||
return sdl_is_pressed((sdl_input_t*)data, 0, binds, key);
|
||||
{
|
||||
bool keyboard_pressed = sdl_is_pressed(sdl, 0, binds, key);
|
||||
bool joypad_pressed = input_joypad_pressed(sdl->joypad, 0, binds, key);
|
||||
|
||||
if (keyboard_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_KEYBOARD;
|
||||
if (joypad_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return keyboard_pressed || joypad_pressed;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool sdl_input_meta_key_pressed(void *data, int key)
|
||||
static bool sdl_input_meta_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
(void)device;
|
||||
return false;
|
||||
}
|
||||
|
||||
static int16_t sdl_joypad_device_state(sdl_input_t *sdl, const struct retro_keybind **binds_,
|
||||
unsigned port_num, unsigned id)
|
||||
unsigned port_num, unsigned id, enum input_device_type *device)
|
||||
{
|
||||
const struct retro_keybind *binds = binds_[port_num];
|
||||
|
||||
if (id < RARCH_BIND_LIST_END)
|
||||
return binds[id].valid && sdl_is_pressed(sdl, port_num, binds, id);
|
||||
{
|
||||
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)
|
||||
*device = INPUT_DEVICE_TYPE_KEYBOARD;
|
||||
if (joypad_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return keyboard_pressed || joypad_pressed;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -407,12 +430,13 @@ static int16_t sdl_lightgun_device_state(sdl_input_t *sdl, unsigned id)
|
||||
static int16_t sdl_input_state(void *data_, const struct retro_keybind **binds,
|
||||
unsigned port, unsigned device, unsigned idx, unsigned id)
|
||||
{
|
||||
enum input_device_type type = INPUT_DEVICE_TYPE_NONE;
|
||||
sdl_input_t *data = (sdl_input_t*)data_;
|
||||
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
return sdl_joypad_device_state(data, binds, port, id);
|
||||
return sdl_joypad_device_state(data, binds, port, id, &type);
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
return sdl_analog_device_state(data, binds, port, idx, id);
|
||||
case RETRO_DEVICE_MOUSE:
|
||||
|
@ -596,17 +596,24 @@ static int16_t udev_input_state(void *data, const struct retro_keybind **binds,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool udev_input_key_pressed(void *data, int key)
|
||||
static bool udev_input_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
udev_input_t *udev = (udev_input_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
udev_input_t *udev = (udev_input_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool keyboard_pressed = udev_input_is_pressed(udev, settings->input.binds[0], key);
|
||||
bool joypad_pressed = input_joypad_pressed(udev->joypad, 0, settings->input.binds[0], key);
|
||||
|
||||
return udev_input_is_pressed(udev, settings->input.binds[0], key) ||
|
||||
input_joypad_pressed(udev->joypad, 0, settings->input.binds[0], key);
|
||||
if (keyboard_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_KEYBOARD;
|
||||
if (joypad_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return keyboard_pressed || joypad_pressed;
|
||||
}
|
||||
|
||||
static bool udev_input_meta_key_pressed(void *data, int key)
|
||||
static bool udev_input_meta_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
(void)device;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -257,16 +257,24 @@ static int16_t x_pressed_analog(x11_input_t *x11,
|
||||
return pressed_plus + pressed_minus;
|
||||
}
|
||||
|
||||
static bool x_input_key_pressed(void *data, int key)
|
||||
static bool x_input_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
x11_input_t *x11 = (x11_input_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
return x_is_pressed(x11, settings->input.binds[0], key) ||
|
||||
input_joypad_pressed(x11->joypad, 0, settings->input.binds[0], key);
|
||||
x11_input_t *x11 = (x11_input_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool keyboard_pressed = x_is_pressed(x11, settings->input.binds[0], key);
|
||||
bool joypad_pressed = input_joypad_pressed(x11->joypad, 0, settings->input.binds[0], key);
|
||||
|
||||
if (keyboard_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_KEYBOARD;
|
||||
if (joypad_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return keyboard_pressed || joypad_pressed;
|
||||
}
|
||||
|
||||
static bool x_input_meta_key_pressed(void *data, int key)
|
||||
static bool x_input_meta_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
(void)device;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -88,16 +88,22 @@ static void *xdk_input_init(void)
|
||||
return xdk;
|
||||
}
|
||||
|
||||
static bool xdk_input_key_pressed(void *data, int key)
|
||||
static bool xdk_input_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
xdk_input_t *xdk = (xdk_input_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
return input_joypad_pressed(xdk->joypad, 0, settings->input.binds[0], key);
|
||||
bool joypad_pressed = input_joypad_pressed(xdk->joypad, 0, settings->input.binds[0], key);
|
||||
|
||||
if (joypad_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return joypad_pressed;
|
||||
}
|
||||
|
||||
static bool xdk_input_meta_key_pressed(void *data, int key)
|
||||
static bool xdk_input_meta_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
(void)device;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -88,14 +88,25 @@ static void* xenon360_input_init(void)
|
||||
return (void*)-1;
|
||||
}
|
||||
|
||||
static bool xenon360_input_key_pressed(void *data, int key)
|
||||
static bool xenon360_input_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
return (lifecycle_state & (UINT64_C(1) << key));
|
||||
(void)device;
|
||||
bool joypad_pressed = (lifecycle_state & (UINT64_C(1) << key));
|
||||
|
||||
if (joypad_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return joypad_pressed;
|
||||
}
|
||||
|
||||
static bool xenon360_input_meta_key_pressed(void *data, int key)
|
||||
static bool xenon360_input_meta_key_pressed(void *data, int key, enum input_device_type *device)
|
||||
{
|
||||
return (lifecycle_state & (UINT64_C(1) << key));
|
||||
bool meta_pressed = (lifecycle_state & (UINT64_C(1) << key));
|
||||
|
||||
if (meta_pressed)
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
|
||||
return meta_pressed;
|
||||
}
|
||||
|
||||
static uint64_t xenon360_input_get_capabilities(void *data)
|
||||
|
@ -207,12 +207,13 @@ retro_input_t input_driver_keys_pressed(void)
|
||||
for (key = 0; key < RARCH_BIND_LIST_END; key++)
|
||||
{
|
||||
bool state = false;
|
||||
enum input_device_type type = INPUT_DEVICE_TYPE_NONE;
|
||||
if ((!driver->block_libretro_input && ((key < RARCH_FIRST_META_KEY)))
|
||||
|| !driver->block_hotkey)
|
||||
state = input->key_pressed(driver->input_data, key);
|
||||
state = input->key_pressed(driver->input_data, key, &type);
|
||||
|
||||
if (key >= RARCH_FIRST_META_KEY)
|
||||
state |= input->meta_key_pressed(driver->input_data, key);
|
||||
state |= input->meta_key_pressed(driver->input_data, key, &type);
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
state |= input_overlay_key_pressed(key);
|
||||
|
@ -39,6 +39,13 @@ extern "C" {
|
||||
|
||||
typedef uint64_t retro_input_t;
|
||||
|
||||
enum input_device_type
|
||||
{
|
||||
INPUT_DEVICE_TYPE_NONE = 0,
|
||||
INPUT_DEVICE_TYPE_KEYBOARD,
|
||||
INPUT_DEVICE_TYPE_JOYPAD
|
||||
};
|
||||
|
||||
struct retro_keybind
|
||||
{
|
||||
bool valid;
|
||||
@ -67,8 +74,8 @@ typedef struct input_driver
|
||||
int16_t (*input_state)(void *data,
|
||||
const struct retro_keybind **retro_keybinds,
|
||||
unsigned port, unsigned device, unsigned index, unsigned id);
|
||||
bool (*key_pressed)(void *data, int key);
|
||||
bool (*meta_key_pressed)(void *data, int key);
|
||||
bool (*key_pressed)(void *data, int key, enum input_device_type *device);
|
||||
bool (*meta_key_pressed)(void *data, int key, enum input_device_type *device);
|
||||
void (*free)(void *data);
|
||||
bool (*set_sensor_state)(void *data, unsigned port,
|
||||
enum retro_sensor_action action, unsigned rate);
|
||||
|
@ -2671,7 +2671,6 @@ static bool xmb_menu_init_list(void *data)
|
||||
menu_displaylist_info_t info = {0};
|
||||
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr();
|
||||
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
|
||||
menu_handle_t *menu = (menu_handle_t*)data;
|
||||
|
||||
strlcpy(info.label, menu_hash_to_str(MENU_VALUE_MAIN_MENU), sizeof(info.label));
|
||||
|
||||
|
@ -1456,15 +1456,11 @@ static int deferred_push_video_shader_parameters_common(
|
||||
int menu_displaylist_parse_settings(void *data, menu_displaylist_info_t *info,
|
||||
const char *info_label, unsigned parse_type)
|
||||
{
|
||||
uint64_t flags;
|
||||
enum setting_type precond;
|
||||
size_t count = 0;
|
||||
rarch_setting_t *setting = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_handle_t *menu = (menu_handle_t*)data;
|
||||
|
||||
setting = menu_setting_find(info_label);
|
||||
flags = menu_setting_get_flags(setting);
|
||||
rarch_setting_t *setting = menu_setting_find(info_label);
|
||||
uint64_t flags = menu_setting_get_flags(setting);
|
||||
|
||||
|
||||
if (!setting)
|
||||
|
@ -659,7 +659,8 @@ static INLINE retro_input_t input_keys_pressed(driver_t *driver,
|
||||
{
|
||||
unsigned i;
|
||||
const struct retro_keybind *binds[MAX_USERS];
|
||||
retro_input_t ret = 0;
|
||||
retro_input_t ret = 0;
|
||||
enum input_device_type type = INPUT_DEVICE_TYPE_NONE;
|
||||
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
binds[i] = settings->input.binds[i];
|
||||
@ -671,7 +672,7 @@ static INLINE retro_input_t input_keys_pressed(driver_t *driver,
|
||||
|
||||
driver->block_libretro_input = check_block_hotkey(driver,
|
||||
settings, driver->input->key_pressed(
|
||||
driver->input_data, RARCH_ENABLE_HOTKEY));
|
||||
driver->input_data, RARCH_ENABLE_HOTKEY, &type));
|
||||
|
||||
for (i = 0; i < settings->input.max_users; i++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user