Merge pull request #7883 from GregorR/netplay-share-policy

Different (more intuitive?) default netplay share policy
This commit is contained in:
Twinaphex 2019-03-02 18:54:19 +01:00 committed by GitHub
commit 5cb2e9f54c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 12 deletions

View File

@ -245,10 +245,15 @@ Payload:
Description:
Request to enter player mode. The client must wait for a MODE command
before sending input. Server may refuse or force slave connections, so the
request is not necessarily honored. If no devices are explicitly requested,
the server may choose how to assign; the default is to assign the first
unassigned device, and share the first device if all devices are assigned
and the first device is shareable.
request is not necessarily honored. The server may choose to override the
share mode, and if no devices are explicitly requested, the server may
choose how to assign. The default handling of the share mode is to always
accept it if the client is the first to get the device. If the share mode
requested is don't-care, then a default share mode is chosen. The default
device selection depends on the number of devices available: If there is
only one device, then the default is to share that device. If there are
more than one, then the default is to refuse PLAY requests when all are
assigned.
Command: MODE
Payload:

View File

@ -819,16 +819,16 @@ static void handle_play_spectate(netplay_t *netplay, uint32_t client_num,
if (!netplay->device_clients[device])
break;
}
if (device >= MAX_INPUT_DEVICES && share_mode)
if (device >= MAX_INPUT_DEVICES &&
netplay->config_devices[1] == RETRO_DEVICE_NONE && share_mode)
{
/* No device was totally free, maybe one is shareable? */
for (device = 0; device < MAX_INPUT_DEVICES; device++)
/* No device free and no device specifically asked for, but only
* one device, so share it */
if (netplay->device_share_modes[0])
{
if (netplay->device_clients[device] && netplay->device_share_modes[device])
{
share_mode = netplay->device_share_modes[device];
break;
}
device = 0;
share_mode = netplay->device_share_modes[0];
break;
}
}
if (device >= MAX_INPUT_DEVICES)