Don't report unused input ports to cores

RetroArch has the unfortunate behavior of setting unused ports to
RETRO_DEVICE_JOYPAD in the core through
retro_set_controller_port_device(). "Unused" meaning ports higher than
the "maximum users" amount configured in settings/input in RA. This is
unfortunate because some cores (like the dosbox ones) change their
behavior depending on the device type assigned to ports. If all unused
(and thus invisible and unconfigurable through the UI) are set to
RETRO_DEVICE_JOYPAD, the core changes its behavior because from its
point of view there's multiple joypads connected, and there's no way for
users to disconnect these bogus joypads.

Fix this by not calling retro_set_controller_port_device() on ports that
are not used.
This commit is contained in:
Nikos Chantziaras 2020-05-22 22:43:25 +03:00
parent 43293abb41
commit e534373dee
No known key found for this signature in database
GPG Key ID: 15B600E72CA59238

View File

@ -14501,7 +14501,7 @@ static void command_event_init_controllers(struct rarch_state *p_rarch)
unsigned i;
rarch_system_info_t *info = &p_rarch->runloop_system;
for (i = 0; i < MAX_USERS; i++)
for (i = 0; i < p_rarch->input_driver_max_users; i++)
{
retro_ctx_controller_info_t pad;
const char *ident = NULL;
@ -20913,7 +20913,7 @@ static bool secondary_core_create(struct rarch_state *p_rarch)
p_rarch->secondary_core.retro_set_input_state(p_rarch->secondary_callbacks.state_cb);
p_rarch->secondary_core.retro_set_input_poll(p_rarch->secondary_callbacks.poll_cb);
for (port = 0; port < 16; port++)
for (port = 0; port < p_rarch->input_driver_max_users; port++)
{
device = p_rarch->port_map[port];
if (device >= 0)