From d4e30c166092bc01e1c0c82ecc25f56f3afb28f7 Mon Sep 17 00:00:00 2001 From: OsirizX Date: Tue, 23 Jul 2019 22:33:42 -0700 Subject: [PATCH] Fix for Remote RetroPad input This commit fixes processing of Remote RetroPad input. None of the remote inputs are being executed both in menu and in game. This is due to the way current key binds are being detected which block processing of any remote input. It's been tested using Remote RetroPad core on Android including digital dpad and analog control input. --- retroarch.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/retroarch.c b/retroarch.c index 88321f3bac9a..9c751f625ec2 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1378,11 +1378,11 @@ static uint64_t runahead_last_frame_count = 0; struct remote_message { - uint16_t state; int port; int device; int index; int id; + uint16_t state; }; struct input_remote @@ -10782,17 +10782,31 @@ static int16_t input_state_device( int16_t res = 0; settings_t *settings = configuration_settings; +#ifdef HAVE_NETWORKGAMEPAD + bool remote_input = false; +#endif + switch (device) { case RETRO_DEVICE_JOYPAD: #ifdef HAVE_NETWORKGAMEPAD if (input_driver_remote) + { if (input_remote_key_pressed(id, port)) + { res |= 1; + remote_input = true; + } + } #endif - if (id < RARCH_FIRST_META_KEY) + if (id < RARCH_FIRST_META_KEY +#ifdef HAVE_NETWORKGAMEPAD + /* Don't process binds if input is coming from Remote RetroPad */ + && remote_input == false +#endif + ) { bool bind_valid = libretro_input_binds[port] && libretro_input_binds[port][id].valid; @@ -10967,12 +10981,19 @@ static int16_t input_state_device( if (id == RETRO_DEVICE_ID_ANALOG_Y) base += 1; if (input_state->analog[base][port]) + { res = input_state->analog[base][port]; + remote_input = true; + } } } #endif - if (id < RARCH_FIRST_META_KEY) + if (id < RARCH_FIRST_META_KEY +#ifdef HAVE_NETWORKGAMEPAD + && remote_input == false +#endif + ) { bool bind_valid = libretro_input_binds[port] && libretro_input_binds[port][id].valid; @@ -11132,9 +11153,11 @@ static INLINE bool input_keys_pressed_other_sources(unsigned i, } #endif -#ifdef HAVE_NETWORKGAMEPAD - if (input_driver_remote && - input_remote_key_pressed(i, 0)) +#ifdef HAVE_NETWORKGAMEPAD + /* Only process key presses related to game input if using Remote RetroPad */ + if (i < RARCH_CUSTOM_BIND_LIST_END && + input_driver_remote && + input_remote_key_pressed(i, 0)) return true; #endif