RetroArch
Functions | Variables
netplay_frontend.c File Reference
#include <stdlib.h>
#include <sys/types.h>
#include "../../version.h"
#include <boolean.h>
#include <compat/strl.h>
#include <retro_assert.h>
#include <string/stdstring.h>
#include <net/net_http.h>
#include <file/file_path.h>
#include "netplay_discovery.h"
#include "netplay_private.h"
#include "../../configuration.h"
#include "../../input/input_driver.h"
#include "../../tasks/tasks_internal.h"
#include "../../file_path_special.h"
#include "../../paths.h"
#include "../../command.h"
#include "../../retroarch.h"
Include dependency graph for netplay_frontend.c:

Functions

static bool netplay_disconnect (netplay_t *netplay)
 
static bool netplay_is_alive (void)
 
static bool netplay_should_skip (netplay_t *netplay)
 
static bool netplay_can_poll (netplay_t *netplay)
 
static bool get_self_input_state (netplay_t *netplay)
 
bool init_netplay_deferred (const char *server, unsigned port)
 
static bool netplay_poll (void)
 
void input_poll_net (void)
 
void video_frame_net (const void *data, unsigned width, unsigned height, size_t pitch)
 
void audio_sample_net (int16_t left, int16_t right)
 
size_t audio_sample_batch_net (const int16_t *data, size_t frames)
 
static int16_t netplay_input_state (netplay_t *netplay, unsigned port, unsigned device, unsigned idx, unsigned id)
 
static void netplay_announce_cb (void *task_data, void *user_data, const char *error)
 
void netplay_get_architecture (char *frontend_architecture, size_t size)
 
static void netplay_announce (void)
 
int16_t input_state_net (unsigned port, unsigned device, unsigned idx, unsigned id)
 
bool netplay_command (netplay_t *netplay, struct netplay_connection *connection, enum netplay_cmd cmd, void *data, size_t sz, const char *command_str, const char *success_msg)
 
static void netplay_frontend_paused (netplay_t *netplay, bool paused)
 
bool netplay_pre_frame (netplay_t *netplay)
 
void netplay_post_frame (netplay_t *netplay)
 
static void netplay_force_future (netplay_t *netplay)
 
void netplay_send_savestate (netplay_t *netplay, retro_ctx_serialize_info_t *serial_info, uint32_t cx, struct compression_transcoder *z)
 
void netplay_load_savestate (netplay_t *netplay, retro_ctx_serialize_info_t *serial_info, bool save)
 
static void netplay_core_reset (netplay_t *netplay)
 
uint8_t netplay_settings_share_mode (void)
 
static void netplay_toggle_play_spectate (netplay_t *netplay)
 
void deinit_netplay (void)
 
bool init_netplay (void *direct_host, const char *server, unsigned port)
 
bool netplay_driver_ctl (enum rarch_netplay_ctl_state state, void *data)
 

Variables

static bool netplay_enabled = false
 
static bool netplay_is_client = false
 
static netplay_tnetplay_data = NULL
 
static bool in_netplay = false
 
static bool netplay_client_deferred = false
 
static char server_address_deferred [512] = ""
 
static unsigned server_port_deferred = 0
 
static int reannounce = 0
 
static bool is_mitm = false
 

Function Documentation

◆ audio_sample_batch_net()

size_t audio_sample_batch_net ( const int16_t data,
size_t  frames 
)
Here is the call graph for this function:

◆ audio_sample_net()

void audio_sample_net ( int16_t  left,
int16_t  right 
)
Here is the call graph for this function:

◆ deinit_netplay()

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

◆ get_self_input_state()

static bool get_self_input_state ( netplay_t netplay)
static

get_self_input_state: : pointer to netplay object

Grab our own input state and send this frame's input state (self and remote) over the network

Returns: true (1) if successful, otherwise false (0).

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

◆ init_netplay()

bool init_netplay ( void direct_host,
const char *  server,
unsigned  port 
)

init_netplay : Host to connect to directly, if applicable (client only) : server address to connect to (client only) : TCP port to host on/connect to

Initializes netplay.

If netplay is already initialized, will return false (0).

Returns: true (1) if successful, otherwise false (0).

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

◆ init_netplay_deferred()

bool init_netplay_deferred ( const char *  server,
unsigned  port 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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:

◆ input_state_net()

int16_t input_state_net ( unsigned  port,
unsigned  device,
unsigned  idx,
unsigned  id 
)
Here is the call graph for this function:

◆ netplay_announce()

static void netplay_announce ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_announce_cb()

static void netplay_announce_cb ( void task_data,
void user_data,
const char *  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_can_poll()

static bool netplay_can_poll ( netplay_t netplay)
static

netplay_can_poll

Just a frontend for netplay->can_poll that handles netplay==NULL

Here is the caller graph for this function:

◆ netplay_command()

bool netplay_command ( netplay_t netplay,
struct netplay_connection connection,
enum netplay_cmd  cmd,
void data,
size_t  sz,
const char *  command_str,
const char *  success_msg 
)

netplay_command: : pointer to netplay object : command to send : data to send as argument : size of data : name of action : message to display upon success

Sends a single netplay command and waits for response. Only actually used for player flipping. FIXME: Should probably just be removed.

Here is the call graph for this function:

◆ netplay_core_reset()

static void netplay_core_reset ( netplay_t netplay)
static

netplay_core_reset : pointer to netplay object

Indicate that the core has been reset to netplay peers

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

◆ netplay_disconnect()

static bool netplay_disconnect ( netplay_t netplay)
static

netplay_disconnect : pointer to netplay object

Disconnect netplay.

Returns: true (1) if successful. At present, cannot fail.

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

◆ netplay_driver_ctl()

bool netplay_driver_ctl ( enum rarch_netplay_ctl_state  state,
void data 
)

netplay_driver_ctl

Frontend access to Netplay functionality

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

◆ netplay_force_future()

static void netplay_force_future ( netplay_t netplay)
static

netplay_force_future : pointer to netplay object

Force netplay to ignore all past input, typically because we've just loaded a state or reset.

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

◆ netplay_frontend_paused()

static void netplay_frontend_paused ( netplay_t netplay,
bool  paused 
)
static

netplay_frontend_paused : pointer to netplay object : true if frontend is paused

Inform Netplay of the frontend's pause state (paused or otherwise)

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

◆ netplay_get_architecture()

void netplay_get_architecture ( char *  frontend_architecture,
size_t  size 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_input_state()

static int16_t netplay_input_state ( netplay_t netplay,
unsigned  port,
unsigned  device,
unsigned  idx,
unsigned  id 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_is_alive()

static bool netplay_is_alive ( void  )
static

netplay_is_alive: : pointer to netplay object

Checks if input port/index is controlled by netplay or not.

Returns: true (1) if alive, otherwise false (0).

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_poll()

static bool netplay_poll ( void  )
static

netplay_poll: : pointer to netplay object

Polls network to see if we have anything new. If our network buffer is full, we simply have to block for new input data.

Returns: true (1) if successful, otherwise false (0).

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

◆ netplay_post_frame()

void netplay_post_frame ( netplay_t netplay)

netplay_post_frame: : pointer to netplay object

Post-frame for Netplay. We check if we have new input and replay from recorded input. Call this after running retro_run().

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

◆ netplay_pre_frame()

bool netplay_pre_frame ( netplay_t netplay)

netplay_pre_frame: : pointer to netplay object

Pre-frame for Netplay. Call this before running retro_run().

Returns: true (1) if the frontend is cleared to emulate the frame, false (0) if we're stalled or paused

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

◆ netplay_send_savestate()

void netplay_send_savestate ( netplay_t netplay,
retro_ctx_serialize_info_t serial_info,
uint32_t  cx,
struct compression_transcoder z 
)

netplay_send_savestate : pointer to netplay object : the savestate being loaded : compression type : compression backend to use

Send a loaded savestate to those connected peers using the given compression scheme.

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_should_skip()

static bool netplay_should_skip ( netplay_t netplay)
static

netplay_should_skip: : pointer to netplay object

If we're fast-forward replaying to resync, check if we should actually show frame.

Returns: bool (1) if we should skip this frame, otherwise false (0).

Here is the caller graph for this function:

◆ netplay_toggle_play_spectate()

static void netplay_toggle_play_spectate ( netplay_t netplay)
static

netplay_toggle_play_spectate

Toggle between play mode and spectate mode

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

◆ video_frame_net()

void video_frame_net ( const void data,
unsigned  width,
unsigned  height,
size_t  pitch 
)
Here is the call graph for this function:

Variable Documentation

◆ in_netplay

bool in_netplay = false
static

◆ is_mitm

bool is_mitm = false
static

◆ netplay_client_deferred

bool netplay_client_deferred = false
static

◆ netplay_data

netplay_t* netplay_data = NULL
static

◆ netplay_enabled

bool netplay_enabled = false
static

◆ netplay_is_client

bool netplay_is_client = false
static

◆ reannounce

int reannounce = 0
static

◆ server_address_deferred

char server_address_deferred[512] = ""
static

◆ server_port_deferred

unsigned server_port_deferred = 0
static