Skip to content

Commit

Permalink
Fix for Remote RetroPad input
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
OsirizX committed Jul 24, 2019
1 parent d7fba1a commit d4e30c1
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions retroarch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit d4e30c1

Please sign in to comment.