Add enum netplay_modus

This commit is contained in:
Bernhard Schelling 2023-06-24 02:46:50 +09:00 committed by LibretroAdmin
parent 9de805c9b1
commit e2621a8474
3 changed files with 28 additions and 2 deletions

View File

@ -268,6 +268,19 @@ enum rarch_netplay_stall_reason
NETPLAY_STALL_SERVER_REQUESTED
};
enum netplay_modus
{
/* Netplay operates by having all participants send input data every
frame and run cores deterministically in sync on all connected devices.
It will rewind frames when input data from the past arrives. */
NETPLAY_MODUS_INPUT_FRAME_SYNC = 0,
/* Netplay operates by having the active core send and receive custom
packets once connection setup and handshake has been completed.
Time skips (pausing, fast forward, save state loading) are refused. */
NETPLAY_MODUS_CORE_PACKET_INTERFACE = 1,
};
/* Input state for a particular client-device pair */
typedef struct netplay_input_state
{
@ -607,6 +620,9 @@ struct netplay
/* Are we stalled? */
enum rarch_netplay_stall_reason stall;
/* Netplay mode of operation (cannot change at runtime) */
enum netplay_modus modus;
/* Keyboard mapping (network and host) */
uint16_t mapping_hton[RETROK_LAST];
uint16_t mapping_ntoh[NETPLAY_KEY_LAST];

View File

@ -2915,6 +2915,10 @@ bool command_event(enum event_command cmd, void *data)
#ifdef HAVE_CHEEVOS
if (rcheevos_hardcore_active())
return false;
#endif
#ifdef HAVE_NETWORKING
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_TIMESKIP, NULL))
return false;
#endif
if (rewind_enable)
{

View File

@ -3487,9 +3487,15 @@ bool runloop_environment_cb(unsigned cmd, void *data)
case RETRO_ENVIRONMENT_SET_NETPACKET_INTERFACE:
#ifdef HAVE_NETWORKING
RARCH_LOG("[Environ]: RETRO_ENVIRONMENT_SET_NETPACKET_INTERFACE.\n");
netplay_driver_ctl(RARCH_NETPLAY_CTL_SET_CORE_PACKET_INTERFACE, data);
#endif
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_SET_CORE_PACKET_INTERFACE, data))
{
RARCH_ERR("[Environ] RETRO_ENVIRONMENT_SET_NETPACKET_INTERFACE set too late\n");
return false;
}
break;
#else
return false;
#endif
default:
RARCH_LOG("[Environ]: UNSUPPORTED (#%u).\n", cmd);