RetroArch
Classes | Macros | Typedefs | Enumerations | Functions | Variables
netplay_private.h File Reference
#include "netplay.h"
#include <net/net_compat.h>
#include <net/net_natt.h>
#include <features/features_cpu.h>
#include <streams/trans_stream.h>
#include "../../msg_hash.h"
#include "../../verbosity.h"
#include "netplay_keys.h"
Include dependency graph for netplay_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  netplay_input_state
 
struct  delta_frame
 
struct  socket_buffer
 
struct  netplay_connection
 
struct  compression_transcoder
 
struct  netplay
 

Macros

#define NETPLAY_PROTOCOL_VERSION   5
 
#define RARCH_DEFAULT_PORT   55435
 
#define RARCH_DEFAULT_NICK   "Anonymous"
 
#define NETPLAY_NICK_LEN   32
 
#define NETPLAY_PASS_LEN   128
 
#define NETPLAY_PASS_HASH_LEN   64 /* length of a SHA-256 hash */
 
#define MAX_SERVER_STALL_TIME_USEC   (5*1000*1000)
 
#define MAX_CLIENT_STALL_TIME_USEC   (10*1000*1000)
 
#define CATCH_UP_CHECK_TIME_USEC   (500*1000)
 
#define MAX_RETRIES   16
 
#define RETRY_MS   500
 
#define MAX_INPUT_DEVICES   16
 
#define MAX_CLIENTS   32
 
#define RETRO_DEVICE_NETPLAY_KEYBOARD   RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_KEYBOARD, 65535)
 
#define NETPLAY_MAX_STALL_FRAMES   60
 
#define NETPLAY_FRAME_RUN_TIME_WINDOW   120
 
#define NETPLAY_MAX_REQ_STALL_TIME   60
 
#define NETPLAY_MAX_REQ_STALL_FREQUENCY   120
 
#define PREV_PTR(x)   ((x) == 0 ? netplay->buffer_size - 1 : (x) - 1)
 
#define NEXT_PTR(x)   ((x + 1) % netplay->buffer_size)
 
#define NETPLAY_QUIRK_NO_SAVESTATES   (1<<0)
 
#define NETPLAY_QUIRK_NO_TRANSMISSION   (1<<1)
 
#define NETPLAY_QUIRK_INITIALIZATION   (1<<2)
 
#define NETPLAY_QUIRK_ENDIAN_DEPENDENT   (1<<3)
 
#define NETPLAY_QUIRK_PLATFORM_DEPENDENT   (1<<4)
 
#define NETPLAY_QUIRK_MAP_UNDERSTOOD
 
#define NETPLAY_QUIRK_MAP_NO_SAVESTATES   (RETRO_SERIALIZATION_QUIRK_INCOMPLETE)
 
#define NETPLAY_QUIRK_MAP_NO_TRANSMISSION   (RETRO_SERIALIZATION_QUIRK_SINGLE_SESSION)
 
#define NETPLAY_QUIRK_MAP_INITIALIZATION   (RETRO_SERIALIZATION_QUIRK_MUST_INITIALIZE)
 
#define NETPLAY_QUIRK_MAP_ENDIAN_DEPENDENT   (RETRO_SERIALIZATION_QUIRK_ENDIAN_DEPENDENT)
 
#define NETPLAY_QUIRK_MAP_PLATFORM_DEPENDENT   (RETRO_SERIALIZATION_QUIRK_PLATFORM_DEPENDENT)
 
#define NETPLAY_COMPRESSION_ZLIB   (1<<0)
 
#define NETPLAY_COMPRESSION_SUPPORTED   0
 
#define NETPLAY_CMD_SYNC_BIT_PAUSED   (1U<<31)
 
#define NETPLAY_CMD_PLAY_BIT_SLAVE   (1U<<31)
 
#define NETPLAY_CMD_MODE_BIT_YOU   (1U<<31)
 
#define NETPLAY_CMD_MODE_BIT_PLAYING   (1U<<30)
 
#define NETPLAY_CMD_MODE_BIT_SLAVE   (1U<<29)
 
#define K(k)   NETPLAY_KEY_ ## k,
 
#define KL(k, l)   K(k)
 
#define netplay_key_ntoh(k)   (netplay_key_ntoh_mapping[k])
 

Typedefs

typedef uint32_t client_bitmap_t
 
typedef struct netplay_input_statenetplay_input_state_t
 

Enumerations

enum  netplay_cmd {
  NETPLAY_CMD_ACK = 0x0000, NETPLAY_CMD_NAK = 0x0001, NETPLAY_CMD_DISCONNECT = 0x0002, NETPLAY_CMD_INPUT = 0x0003,
  NETPLAY_CMD_NOINPUT = 0x0004, NETPLAY_CMD_NICK = 0x0020, NETPLAY_CMD_PASSWORD = 0x0021, NETPLAY_CMD_INFO = 0x0022,
  NETPLAY_CMD_SYNC = 0x0023, NETPLAY_CMD_SPECTATE = 0x0024, NETPLAY_CMD_PLAY = 0x0025, NETPLAY_CMD_MODE = 0x0026,
  NETPLAY_CMD_MODE_REFUSED = 0x0027, NETPLAY_CMD_CRC = 0x0040, NETPLAY_CMD_REQUEST_SAVESTATE = 0x0041, NETPLAY_CMD_LOAD_SAVESTATE = 0x0042,
  NETPLAY_CMD_PAUSE = 0x0043, NETPLAY_CMD_RESUME = 0x0044, NETPLAY_CMD_STALL = 0x0045, NETPLAY_CMD_RESET = 0x0046,
  NETPLAY_CMD_CHEATS = 0x0047, NETPLAY_CMD_CFG = 0x0061, NETPLAY_CMD_CFG_ACK = 0x0062
}
 
enum  netplay_cmd_mode_reasons {
  NETPLAY_CMD_MODE_REFUSED_REASON_OTHER, NETPLAY_CMD_MODE_REFUSED_REASON_UNPRIVILEGED, NETPLAY_CMD_MODE_REFUSED_REASON_NO_SLOTS, NETPLAY_CMD_MODE_REFUSED_REASON_TOO_FAST,
  NETPLAY_CMD_MODE_REFUSED_REASON_NOT_AVAILABLE
}
 
enum  rarch_netplay_share_preference {
  NETPLAY_SHARE_NO_SHARING = 0x0, NETPLAY_SHARE_NO_PREFERENCE = 0x1, NETPLAY_SHARE_DIGITAL_BITS = 0x1C, NETPLAY_SHARE_DIGITAL_OR = 0x4,
  NETPLAY_SHARE_DIGITAL_XOR = 0x8, NETPLAY_SHARE_DIGITAL_VOTE = 0xC, NETPLAY_SHARE_ANALOG_BITS = 0xE0, NETPLAY_SHARE_ANALOG_MAX = 0x20,
  NETPLAY_SHARE_ANALOG_AVERAGE = 0x40
}
 
enum  rarch_netplay_connection_mode {
  NETPLAY_CONNECTION_NONE = 0, NETPLAY_CONNECTION_DELAYED_DISCONNECT, NETPLAY_CONNECTION_INIT, NETPLAY_CONNECTION_PRE_NICK,
  NETPLAY_CONNECTION_PRE_PASSWORD, NETPLAY_CONNECTION_PRE_INFO, NETPLAY_CONNECTION_PRE_SYNC, NETPLAY_CONNECTION_CONNECTED,
  NETPLAY_CONNECTION_SPECTATING, NETPLAY_CONNECTION_SLAVE, NETPLAY_CONNECTION_PLAYING
}
 
enum  rarch_netplay_stall_reason {
  NETPLAY_STALL_NONE = 0, NETPLAY_STALL_RUNNING_FAST, NETPLAY_STALL_SPECTATOR_WAIT, NETPLAY_STALL_INPUT_LATENCY,
  NETPLAY_STALL_SERVER_REQUESTED, NETPLAY_STALL_NO_CONNECTION
}
 
enum  netplay_keys { NETPLAY_KEY_UNKNOWN = 0, K, K }
 

Functions

bool netplay_init_socket_buffer (struct socket_buffer *sbuf, size_t size)
 
bool netplay_resize_socket_buffer (struct socket_buffer *sbuf, size_t newsize)
 
void netplay_deinit_socket_buffer (struct socket_buffer *sbuf)
 
bool netplay_send (struct socket_buffer *sbuf, int sockfd, const void *buf, size_t len)
 
bool netplay_send_flush (struct socket_buffer *sbuf, int sockfd, bool block)
 
ssize_t netplay_recv (struct socket_buffer *sbuf, int sockfd, void *buf, size_t len, bool block)
 
void netplay_recv_reset (struct socket_buffer *sbuf)
 
void netplay_recv_flush (struct socket_buffer *sbuf)
 
bool netplay_delta_frame_ready (netplay_t *netplay, struct delta_frame *delta, uint32_t frame)
 
uint32_t netplay_delta_frame_crc (netplay_t *netplay, struct delta_frame *delta)
 
void netplay_delta_frame_free (struct delta_frame *delta)
 
netplay_input_state_t netplay_input_state_for (netplay_input_state_t *list, uint32_t client_num, size_t size, bool must_create, bool must_not_create)
 
uint32_t netplay_expected_input_size (netplay_t *netplay, uint32_t devices)
 
bool netplay_lan_ad_server (netplay_t *netplay)
 
void netplay_load_savestate (netplay_t *netplay, retro_ctx_serialize_info_t *serial_info, bool save)
 
uint8_t netplay_settings_share_mode (void)
 
void input_poll_net (void)
 
bool netplay_handshake_init_send (netplay_t *netplay, struct netplay_connection *connection)
 
bool netplay_handshake (netplay_t *netplay, struct netplay_connection *connection, bool *had_input)
 
bool netplay_try_init_serialization (netplay_t *netplay)
 
bool netplay_wait_and_init_serialization (netplay_t *netplay)
 
netplay_tnetplay_new (void *direct_host, const char *server, uint16_t port, bool stateless_mode, int check_frames, const struct retro_callbacks *cb, bool nat_traversal, const char *nick, uint64_t quirks)
 
void netplay_free (netplay_t *netplay)
 
void netplay_hangup (netplay_t *netplay, struct netplay_connection *connection)
 
void netplay_delayed_state_change (netplay_t *netplay)
 
bool netplay_send_cur_input (netplay_t *netplay, struct netplay_connection *connection)
 
bool netplay_send_raw_cmd (netplay_t *netplay, struct netplay_connection *connection, uint32_t cmd, const void *data, size_t size)
 
void netplay_send_raw_cmd_all (netplay_t *netplay, struct netplay_connection *except, uint32_t cmd, const void *data, size_t size)
 
bool netplay_cmd_crc (netplay_t *netplay, struct delta_frame *delta)
 
bool netplay_cmd_request_savestate (netplay_t *netplay)
 
bool netplay_cmd_mode (netplay_t *netplay, enum rarch_netplay_connection_mode mode)
 
bool netplay_cmd_stall (netplay_t *netplay, struct netplay_connection *connection, uint32_t frames)
 
int netplay_poll_net_input (netplay_t *netplay, bool block)
 
void netplay_handle_slaves (netplay_t *netplay)
 
void netplay_announce_nat_traversal (netplay_t *netplay)
 
void netplay_init_nat_traversal (netplay_t *netplay)
 
uint32_t netplay_key_hton (unsigned key)
 
void netplay_key_hton_init (void)
 
void netplay_update_unread_ptr (netplay_t *netplay)
 
bool netplay_resolve_input (netplay_t *netplay, size_t sim_ptr, bool resim)
 
bool netplay_sync_pre_frame (netplay_t *netplay)
 
void netplay_sync_post_frame (netplay_t *netplay, bool stalled)
 

Variables

const uint16_t netplay_key_ntoh_mapping []
 

Macro Definition Documentation

◆ CATCH_UP_CHECK_TIME_USEC

#define CATCH_UP_CHECK_TIME_USEC   (500*1000)

◆ K

#define K (   k)    NETPLAY_KEY_ ## k,

◆ KL

#define KL (   k,
  l 
)    K(k)

◆ MAX_CLIENT_STALL_TIME_USEC

#define MAX_CLIENT_STALL_TIME_USEC   (10*1000*1000)

◆ MAX_CLIENTS

#define MAX_CLIENTS   32

◆ MAX_INPUT_DEVICES

#define MAX_INPUT_DEVICES   16

◆ MAX_RETRIES

#define MAX_RETRIES   16

◆ MAX_SERVER_STALL_TIME_USEC

#define MAX_SERVER_STALL_TIME_USEC   (5*1000*1000)

◆ NETPLAY_CMD_MODE_BIT_PLAYING

#define NETPLAY_CMD_MODE_BIT_PLAYING   (1U<<30)

◆ NETPLAY_CMD_MODE_BIT_SLAVE

#define NETPLAY_CMD_MODE_BIT_SLAVE   (1U<<29)

◆ NETPLAY_CMD_MODE_BIT_YOU

#define NETPLAY_CMD_MODE_BIT_YOU   (1U<<31)

◆ NETPLAY_CMD_PLAY_BIT_SLAVE

#define NETPLAY_CMD_PLAY_BIT_SLAVE   (1U<<31)

◆ NETPLAY_CMD_SYNC_BIT_PAUSED

#define NETPLAY_CMD_SYNC_BIT_PAUSED   (1U<<31)

◆ NETPLAY_COMPRESSION_SUPPORTED

#define NETPLAY_COMPRESSION_SUPPORTED   0

◆ NETPLAY_COMPRESSION_ZLIB

#define NETPLAY_COMPRESSION_ZLIB   (1<<0)

◆ NETPLAY_FRAME_RUN_TIME_WINDOW

#define NETPLAY_FRAME_RUN_TIME_WINDOW   120

◆ netplay_key_ntoh

#define netplay_key_ntoh (   k)    (netplay_key_ntoh_mapping[k])

◆ NETPLAY_MAX_REQ_STALL_FREQUENCY

#define NETPLAY_MAX_REQ_STALL_FREQUENCY   120

◆ NETPLAY_MAX_REQ_STALL_TIME

#define NETPLAY_MAX_REQ_STALL_TIME   60

◆ NETPLAY_MAX_STALL_FRAMES

#define NETPLAY_MAX_STALL_FRAMES   60

◆ NETPLAY_NICK_LEN

#define NETPLAY_NICK_LEN   32

◆ NETPLAY_PASS_HASH_LEN

#define NETPLAY_PASS_HASH_LEN   64 /* length of a SHA-256 hash */

◆ NETPLAY_PASS_LEN

#define NETPLAY_PASS_LEN   128

◆ NETPLAY_PROTOCOL_VERSION

#define NETPLAY_PROTOCOL_VERSION   5

◆ NETPLAY_QUIRK_ENDIAN_DEPENDENT

#define NETPLAY_QUIRK_ENDIAN_DEPENDENT   (1<<3)

◆ NETPLAY_QUIRK_INITIALIZATION

#define NETPLAY_QUIRK_INITIALIZATION   (1<<2)

◆ NETPLAY_QUIRK_MAP_ENDIAN_DEPENDENT

#define NETPLAY_QUIRK_MAP_ENDIAN_DEPENDENT   (RETRO_SERIALIZATION_QUIRK_ENDIAN_DEPENDENT)

◆ NETPLAY_QUIRK_MAP_INITIALIZATION

#define NETPLAY_QUIRK_MAP_INITIALIZATION   (RETRO_SERIALIZATION_QUIRK_MUST_INITIALIZE)

◆ NETPLAY_QUIRK_MAP_NO_SAVESTATES

#define NETPLAY_QUIRK_MAP_NO_SAVESTATES   (RETRO_SERIALIZATION_QUIRK_INCOMPLETE)

◆ NETPLAY_QUIRK_MAP_NO_TRANSMISSION

#define NETPLAY_QUIRK_MAP_NO_TRANSMISSION   (RETRO_SERIALIZATION_QUIRK_SINGLE_SESSION)

◆ NETPLAY_QUIRK_MAP_PLATFORM_DEPENDENT

#define NETPLAY_QUIRK_MAP_PLATFORM_DEPENDENT   (RETRO_SERIALIZATION_QUIRK_PLATFORM_DEPENDENT)

◆ NETPLAY_QUIRK_MAP_UNDERSTOOD

#define NETPLAY_QUIRK_MAP_UNDERSTOOD
Value:
#define RETRO_SERIALIZATION_QUIRK_ENDIAN_DEPENDENT
Definition: libretro.h:1289
#define RETRO_SERIALIZATION_QUIRK_SINGLE_SESSION
Definition: libretro.h:1286
#define RETRO_SERIALIZATION_QUIRK_PLATFORM_DEPENDENT
Definition: libretro.h:1293
#define RETRO_SERIALIZATION_QUIRK_MUST_INITIALIZE
Definition: libretro.h:1279
#define RETRO_SERIALIZATION_QUIRK_CORE_VARIABLE_SIZE
Definition: libretro.h:1281
#define RETRO_SERIALIZATION_QUIRK_INCOMPLETE
Definition: libretro.h:1275

◆ NETPLAY_QUIRK_NO_SAVESTATES

#define NETPLAY_QUIRK_NO_SAVESTATES   (1<<0)

◆ NETPLAY_QUIRK_NO_TRANSMISSION

#define NETPLAY_QUIRK_NO_TRANSMISSION   (1<<1)

◆ NETPLAY_QUIRK_PLATFORM_DEPENDENT

#define NETPLAY_QUIRK_PLATFORM_DEPENDENT   (1<<4)

◆ NEXT_PTR

#define NEXT_PTR (   x)    ((x + 1) % netplay->buffer_size)

◆ PREV_PTR

#define PREV_PTR (   x)    ((x) == 0 ? netplay->buffer_size - 1 : (x) - 1)

◆ RARCH_DEFAULT_NICK

#define RARCH_DEFAULT_NICK   "Anonymous"

◆ RARCH_DEFAULT_PORT

#define RARCH_DEFAULT_PORT   55435

◆ RETRO_DEVICE_NETPLAY_KEYBOARD

#define RETRO_DEVICE_NETPLAY_KEYBOARD   RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_KEYBOARD, 65535)

◆ RETRY_MS

#define RETRY_MS   500

Typedef Documentation

◆ client_bitmap_t

◆ netplay_input_state_t

Enumeration Type Documentation

◆ netplay_cmd

Enumerator
NETPLAY_CMD_ACK 
NETPLAY_CMD_NAK 
NETPLAY_CMD_DISCONNECT 
NETPLAY_CMD_INPUT 
NETPLAY_CMD_NOINPUT 
NETPLAY_CMD_NICK 
NETPLAY_CMD_PASSWORD 
NETPLAY_CMD_INFO 
NETPLAY_CMD_SYNC 
NETPLAY_CMD_SPECTATE 
NETPLAY_CMD_PLAY 
NETPLAY_CMD_MODE 
NETPLAY_CMD_MODE_REFUSED 
NETPLAY_CMD_CRC 
NETPLAY_CMD_REQUEST_SAVESTATE 
NETPLAY_CMD_LOAD_SAVESTATE 
NETPLAY_CMD_PAUSE 
NETPLAY_CMD_RESUME 
NETPLAY_CMD_STALL 
NETPLAY_CMD_RESET 
NETPLAY_CMD_CHEATS 
NETPLAY_CMD_CFG 
NETPLAY_CMD_CFG_ACK 

◆ netplay_cmd_mode_reasons

Enumerator
NETPLAY_CMD_MODE_REFUSED_REASON_OTHER 
NETPLAY_CMD_MODE_REFUSED_REASON_UNPRIVILEGED 
NETPLAY_CMD_MODE_REFUSED_REASON_NO_SLOTS 
NETPLAY_CMD_MODE_REFUSED_REASON_TOO_FAST 
NETPLAY_CMD_MODE_REFUSED_REASON_NOT_AVAILABLE 

◆ netplay_keys

Enumerator
NETPLAY_KEY_UNKNOWN 

◆ rarch_netplay_connection_mode

Enumerator
NETPLAY_CONNECTION_NONE 
NETPLAY_CONNECTION_DELAYED_DISCONNECT 
NETPLAY_CONNECTION_INIT 
NETPLAY_CONNECTION_PRE_NICK 
NETPLAY_CONNECTION_PRE_PASSWORD 
NETPLAY_CONNECTION_PRE_INFO 
NETPLAY_CONNECTION_PRE_SYNC 
NETPLAY_CONNECTION_CONNECTED 
NETPLAY_CONNECTION_SPECTATING 
NETPLAY_CONNECTION_SLAVE 
NETPLAY_CONNECTION_PLAYING 

◆ rarch_netplay_share_preference

Enumerator
NETPLAY_SHARE_NO_SHARING 
NETPLAY_SHARE_NO_PREFERENCE 
NETPLAY_SHARE_DIGITAL_BITS 
NETPLAY_SHARE_DIGITAL_OR 
NETPLAY_SHARE_DIGITAL_XOR 
NETPLAY_SHARE_DIGITAL_VOTE 
NETPLAY_SHARE_ANALOG_BITS 
NETPLAY_SHARE_ANALOG_MAX 
NETPLAY_SHARE_ANALOG_AVERAGE 

◆ rarch_netplay_stall_reason

Enumerator
NETPLAY_STALL_NONE 
NETPLAY_STALL_RUNNING_FAST 
NETPLAY_STALL_SPECTATOR_WAIT 
NETPLAY_STALL_INPUT_LATENCY 
NETPLAY_STALL_SERVER_REQUESTED 
NETPLAY_STALL_NO_CONNECTION 

Function Documentation

◆ input_poll_net()

void input_poll_net ( void  )

input_poll_net

Poll the network if necessary.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_announce_nat_traversal()

void netplay_announce_nat_traversal ( netplay_t netplay)

netplay_announce_nat_traversal

Announce successful NAT traversal.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_cmd_crc()

bool netplay_cmd_crc ( netplay_t netplay,
struct delta_frame delta 
)

netplay_cmd_crc

Send a CRC command to all active clients.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_cmd_mode()

bool netplay_cmd_mode ( netplay_t netplay,
enum rarch_netplay_connection_mode  mode 
)

netplay_cmd_mode

Send a mode change request. As a server, the request is to ourself, and so honored instantly.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_cmd_request_savestate()

bool netplay_cmd_request_savestate ( netplay_t netplay)

netplay_cmd_request_savestate

Send a savestate request command.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_cmd_stall()

bool netplay_cmd_stall ( netplay_t netplay,
struct netplay_connection connection,
uint32_t  frames 
)

netplay_cmd_stall

Send a stall command.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_deinit_socket_buffer()

void netplay_deinit_socket_buffer ( struct socket_buffer sbuf)

netplay_deinit_socket_buffer

Free a socket buffer.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_delayed_state_change()

void netplay_delayed_state_change ( netplay_t netplay)

netplay_delayed_state_change:

Handle any pending state changes which are ready as of the beginning of the current frame.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_delta_frame_crc()

uint32_t netplay_delta_frame_crc ( netplay_t netplay,
struct delta_frame delta 
)

netplay_delta_frame_crc

Get the CRC for the serialization of this frame.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_delta_frame_free()

void netplay_delta_frame_free ( struct delta_frame delta)

netplay_delta_frame_free

Free a delta frame's dependencies

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_delta_frame_ready()

bool netplay_delta_frame_ready ( netplay_t netplay,
struct delta_frame delta,
uint32_t  frame 
)

netplay_delta_frame_ready

Prepares, if possible, a delta frame for input, and reports whether it is ready.

Returns: True if the delta frame is ready for input at the given frame, false otherwise.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_expected_input_size()

uint32_t netplay_expected_input_size ( netplay_t netplay,
uint32_t  devices 
)

netplay_expected_input_size

Size in words for a given set of devices.

Here is the caller graph for this function:

◆ netplay_free()

void netplay_free ( netplay_t netplay)

netplay_free : pointer to netplay object

Frees netplay data/

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_handle_slaves()

void netplay_handle_slaves ( netplay_t netplay)

netplay_handle_slaves

Handle any slave connections

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_handshake()

bool netplay_handshake ( netplay_t netplay,
struct netplay_connection connection,
bool had_input 
)

netplay_handshake

Data receiver for all handshake states.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_handshake_init_send()

bool netplay_handshake_init_send ( netplay_t netplay,
struct netplay_connection connection 
)

netplay_handshake_init_send

Initialize our handshake and send the first part of the handshake protocol.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_hangup()

void netplay_hangup ( netplay_t netplay,
struct netplay_connection connection 
)

netplay_hangup:

Disconnects an active Netplay connection due to an error

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_init_nat_traversal()

void netplay_init_nat_traversal ( netplay_t netplay)

netplay_init_nat_traversal

Initialize the NAT traversal library and try to open a port

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_init_socket_buffer()

bool netplay_init_socket_buffer ( struct socket_buffer sbuf,
size_t  size 
)

netplay_init_socket_buffer

Initialize a new socket buffer.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_input_state_for()

netplay_input_state_t netplay_input_state_for ( netplay_input_state_t list,
uint32_t  client_num,
size_t  size,
bool  must_create,
bool  must_not_create 
)

netplay_input_state_for

Get an input state for a particular client

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_key_hton()

uint32_t netplay_key_hton ( unsigned  key)
Here is the caller graph for this function:

◆ netplay_key_hton_init()

void netplay_key_hton_init ( void  )
Here is the caller graph for this function:

◆ netplay_lan_ad_server()

bool netplay_lan_ad_server ( netplay_t netplay)

netplay_lan_ad_server

Respond to any LAN ad queries that the netplay server has received.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_load_savestate()

void netplay_load_savestate ( netplay_t netplay,
retro_ctx_serialize_info_t serial_info,
bool  save 
)

netplay_load_savestate : pointer to netplay object : the savestate being loaded, NULL means "load it yourself" : Whether to save the provided serial_info into the frame buffer

Inform Netplay of a savestate load and send it to the other side

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_new()

netplay_t* netplay_new ( void direct_host,
const char *  server,
uint16_t  port,
bool  stateless_mode,
int  check_frames,
const struct retro_callbacks cb,
bool  nat_traversal,
const char *  nick,
uint64_t  quirks 
)

netplay_new: : Netplay host discovered from scanning. : IP address of server. : Port of server. : Shall we run in stateless mode? : Frequency with which to check CRCs. : Libretro callbacks. : If true, attempt NAT traversal. : Nickname of user. : Netplay quirks required for this session.

Creates a new netplay handle. A NULL server means we're hosting.

Returns: new netplay data.

netplay_new: : Netplay host discovered from scanning. : IP address of server. : Port of server. : Shall we use stateless mode? : Frequency with which to check CRCs. : Libretro callbacks. : If true, attempt NAT traversal. : Nickname of user. : Netplay quirks required for this session.

Creates a new netplay handle. A NULL server means we're hosting.

Returns: new netplay data.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_poll_net_input()

int netplay_poll_net_input ( netplay_t netplay,
bool  block 
)

netplay_poll_net_input

Poll input from the network

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_recv()

ssize_t netplay_recv ( struct socket_buffer sbuf,
int  sockfd,
void buf,
size_t  len,
bool  block 
)

netplay_recv

Receive buffered or fresh data.

Returns number of bytes returned, which may be short or 0, or -1 on error.

Here is the call graph for this function:

◆ netplay_recv_flush()

void netplay_recv_flush ( struct socket_buffer sbuf)

netplay_recv_flush

Flush our recv buffer, so a future netplay_recv_reset will reset to this point.

Here is the caller graph for this function:

◆ netplay_recv_reset()

void netplay_recv_reset ( struct socket_buffer sbuf)

netplay_recv_reset

Reset our recv buffer so that future netplay_recvs will read the same data again.

Here is the caller graph for this function:

◆ netplay_resize_socket_buffer()

bool netplay_resize_socket_buffer ( struct socket_buffer sbuf,
size_t  newsize 
)

netplay_resize_socket_buffer

Resize the given socket_buffer's buffer to the requested size.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_resolve_input()

bool netplay_resolve_input ( netplay_t netplay,
size_t  sim_ptr,
bool  resim 
)

netplay_resolve_input : pointer to netplay object : frame pointer for which to resolve input : are we resimulating, or simulating this frame for the first time?

"Simulate" input by assuming it hasn't changed since the last read input. Returns true if the resolved input changed from the last time it was resolved.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_send()

bool netplay_send ( struct socket_buffer sbuf,
int  sockfd,
const void buf,
size_t  len 
)

netplay_send

Queue the given data for sending.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_send_cur_input()

bool netplay_send_cur_input ( netplay_t netplay,
struct netplay_connection connection 
)

netplay_send_cur_input

Send the current input frame to a given connection.

Returns true if successful, false otherwise.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_send_flush()

bool netplay_send_flush ( struct socket_buffer sbuf,
int  sockfd,
bool  block 
)

netplay_send_flush

Flush unsent data in the given socket buffer, blocking to do so if requested.

Returns false only on socket failures, true otherwise.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_send_raw_cmd()

bool netplay_send_raw_cmd ( netplay_t netplay,
struct netplay_connection connection,
uint32_t  cmd,
const void data,
size_t  size 
)

netplay_send_raw_cmd

Send a raw Netplay command to the given connection.

Returns true on success, false on failure.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_send_raw_cmd_all()

void netplay_send_raw_cmd_all ( netplay_t netplay,
struct netplay_connection except,
uint32_t  cmd,
const void data,
size_t  size 
)

netplay_send_raw_cmd_all

Send a raw Netplay command to all connections, optionally excluding one (typically the client that the relevant command came from)

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_settings_share_mode()

uint8_t netplay_settings_share_mode ( void  )

netplay_settings_share_mode

Get the preferred share mode

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_sync_post_frame()

void netplay_sync_post_frame ( netplay_t netplay,
bool  stalled 
)

netplay_sync_post_frame : pointer to netplay object : true if we're currently stalled

Post-frame for Netplay synchronization. We check if we have new input and replay from recorded input.

netplay_sync_post_frame : pointer to netplay object

Post-frame for Netplay synchronization. We check if we have new input and replay from recorded input.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_sync_pre_frame()

bool netplay_sync_pre_frame ( netplay_t netplay)

netplay_sync_pre_frame : pointer to netplay object

Pre-frame for Netplay synchronization.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_try_init_serialization()

bool netplay_try_init_serialization ( netplay_t netplay)

netplay_try_init_serialization

Try to initialize serialization. For quirky cores.

Returns true if serialization is now ready, false otherwise.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_update_unread_ptr()

void netplay_update_unread_ptr ( netplay_t netplay)

netplay_update_unread_ptr

Update the global unread_ptr and unread_frame_count to correspond to the earliest unread frame count of any connected player

Here is the caller graph for this function:

◆ netplay_wait_and_init_serialization()

bool netplay_wait_and_init_serialization ( netplay_t netplay)

netplay_wait_and_init_serialization

Try very hard to initialize serialization, simulating multiple frames if necessary. For quirky cores.

Returns true if serialization is now ready, false otherwise.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ netplay_key_ntoh_mapping

const uint16_t netplay_key_ntoh_mapping[]