Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Remote RetroPad input #3

Merged
merged 1 commit into from
Jul 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
OsirizX authored Jul 24, 2019
commit d4e30c166092bc01e1c0c82ecc25f56f3afb28f7
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