18 #ifndef __RARCH_NETPLAY_PRIVATE_H 19 #define __RARCH_NETPLAY_PRIVATE_H 28 #include "../../msg_hash.h" 29 #include "../../verbosity.h" 31 #define NETPLAY_PROTOCOL_VERSION 5 33 #define RARCH_DEFAULT_PORT 55435 34 #define RARCH_DEFAULT_NICK "Anonymous" 36 #define NETPLAY_NICK_LEN 32 37 #define NETPLAY_PASS_LEN 128 38 #define NETPLAY_PASS_HASH_LEN 64 40 #define MAX_SERVER_STALL_TIME_USEC (5*1000*1000) 41 #define MAX_CLIENT_STALL_TIME_USEC (10*1000*1000) 42 #define CATCH_UP_CHECK_TIME_USEC (500*1000) 43 #define MAX_RETRIES 16 45 #define MAX_INPUT_DEVICES 16 48 #define MAX_CLIENTS 32 53 #define RETRO_DEVICE_NETPLAY_KEYBOARD RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_KEYBOARD, 65535) 55 #define NETPLAY_MAX_STALL_FRAMES 60 56 #define NETPLAY_FRAME_RUN_TIME_WINDOW 120 57 #define NETPLAY_MAX_REQ_STALL_TIME 60 58 #define NETPLAY_MAX_REQ_STALL_FREQUENCY 120 60 #define PREV_PTR(x) ((x) == 0 ? netplay->buffer_size - 1 : (x) - 1) 61 #define NEXT_PTR(x) ((x + 1) % netplay->buffer_size) 65 #define NETPLAY_QUIRK_NO_SAVESTATES (1<<0) 66 #define NETPLAY_QUIRK_NO_TRANSMISSION (1<<1) 67 #define NETPLAY_QUIRK_INITIALIZATION (1<<2) 68 #define NETPLAY_QUIRK_ENDIAN_DEPENDENT (1<<3) 69 #define NETPLAY_QUIRK_PLATFORM_DEPENDENT (1<<4) 72 #define NETPLAY_QUIRK_MAP_UNDERSTOOD \ 73 (RETRO_SERIALIZATION_QUIRK_INCOMPLETE \ 74 |RETRO_SERIALIZATION_QUIRK_CORE_VARIABLE_SIZE \ 75 |RETRO_SERIALIZATION_QUIRK_MUST_INITIALIZE \ 76 |RETRO_SERIALIZATION_QUIRK_SINGLE_SESSION \ 77 |RETRO_SERIALIZATION_QUIRK_ENDIAN_DEPENDENT \ 78 |RETRO_SERIALIZATION_QUIRK_PLATFORM_DEPENDENT) 79 #define NETPLAY_QUIRK_MAP_NO_SAVESTATES \ 80 (RETRO_SERIALIZATION_QUIRK_INCOMPLETE) 81 #define NETPLAY_QUIRK_MAP_NO_TRANSMISSION \ 82 (RETRO_SERIALIZATION_QUIRK_SINGLE_SESSION) 83 #define NETPLAY_QUIRK_MAP_INITIALIZATION \ 84 (RETRO_SERIALIZATION_QUIRK_MUST_INITIALIZE) 85 #define NETPLAY_QUIRK_MAP_ENDIAN_DEPENDENT \ 86 (RETRO_SERIALIZATION_QUIRK_ENDIAN_DEPENDENT) 87 #define NETPLAY_QUIRK_MAP_PLATFORM_DEPENDENT \ 88 (RETRO_SERIALIZATION_QUIRK_PLATFORM_DEPENDENT) 91 #define NETPLAY_COMPRESSION_ZLIB (1<<0) 93 #define NETPLAY_COMPRESSION_SUPPORTED NETPLAY_COMPRESSION_ZLIB 95 #define NETPLAY_COMPRESSION_SUPPORTED 0 181 #define NETPLAY_CMD_SYNC_BIT_PAUSED (1U<<31) 182 #define NETPLAY_CMD_PLAY_BIT_SLAVE (1U<<31) 183 #define NETPLAY_CMD_MODE_BIT_YOU (1U<<31) 184 #define NETPLAY_CMD_MODE_BIT_PLAYING (1U<<30) 185 #define NETPLAY_CMD_MODE_BIT_SLAVE (1U<<29) 679 uint32_t client_num,
size_t size,
bool must_create,
bool must_not_create);
794 bool stateless_mode,
int check_frames,
795 const struct retro_callbacks *cb,
bool nat_traversal,
const char *nick,
925 #define K(k) NETPLAY_KEY_ ## k, 935 #define netplay_key_ntoh(k) (netplay_key_ntoh_mapping[k]) enum rarch_netplay_stall_reason stall
Definition: netplay_private.h:366
bool local_paused
Definition: netplay_private.h:530
bool netplay_handshake_init_send(netplay_t *netplay, struct netplay_connection *connection)
Definition: netplay_handshake.c:205
bool have_local
Definition: netplay_private.h:313
enum rarch_netplay_connection_mode self_mode
Definition: netplay_private.h:401
bool netplay_send_flush(struct socket_buffer *sbuf, int sockfd, bool block)
Definition: netplay_buf.c:176
int check_frames
Definition: netplay_private.h:563
void * state
Definition: netplay_private.h:296
Definition: netplay_private.h:237
bool force_rewind
Definition: netplay_private.h:509
bool netplay_try_init_serialization(netplay_t *netplay)
Definition: netplay_init.c:318
retro_time_t stall_time
Definition: netplay_private.h:367
rarch_netplay_stall_reason
Definition: netplay_private.h:250
unsigned timeout_cnt
Definition: netplay_private.h:527
bool netplay_sync_pre_frame(netplay_t *netplay)
Definition: netplay_sync.c:545
GLenum mode
Definition: glext.h:6857
bool netplay_wait_and_init_serialization(netplay_t *netplay)
Definition: netplay_init.c:350
uint32_t netplay_key_hton(unsigned key)
Definition: netplay_keyboard.c:35
void netplay_update_unread_ptr(netplay_t *netplay)
Definition: netplay_sync.c:40
uint32_t unread_frame_count
Definition: netplay_private.h:483
Definition: netplay_private.h:106
Definition: netplay_private.h:217
uint32_t salt
Definition: netplay_private.h:343
Definition: netplay_private.h:141
void netplay_delta_frame_free(struct delta_frame *delta)
Definition: netplay_delta.c:105
uint32_t connected_players
Definition: netplay_private.h:409
size_t server_ptr
Definition: netplay_private.h:491
uint32_t self_devices
Definition: netplay_private.h:425
Definition: netplay_private.h:103
retro_time_t frame_run_time[NETPLAY_FRAME_RUN_TIME_WINDOW]
Definition: netplay_private.h:540
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:8418
Definition: netplay_private.h:239
Definition: ffmpeg_core.c:151
Definition: netplay_private.h:265
bool netplay_init_socket_buffer(struct socket_buffer *sbuf, size_t size)
Definition: netplay_buf.c:57
Definition: netplay_private.h:238
void netplay_free(netplay_t *netplay)
Definition: netplay_init.c:528
char nick[NETPLAY_NICK_LEN]
Definition: netplay_private.h:392
uint32_t connected_slaves
Definition: netplay_private.h:413
netplay_input_state_t real_input[MAX_INPUT_DEVICES]
Definition: netplay_private.h:306
int frame_run_time_ptr
Definition: netplay_private.h:541
Definition: netplay_private.h:138
size_t other_ptr
Definition: netplay_private.h:475
Definition: netplay_private.h:319
Definition: netplay_private.h:240
Definition: netplay_private.h:194
size_t packet_buffer_size
Definition: netplay_private.h:463
GLenum GLsizei len
Definition: glext.h:7389
bool can_play
Definition: netplay_private.h:346
uint32_t delay_frame
Definition: netplay_private.h:357
Definition: netplay_private.h:164
uint64_t quirks
Definition: netplay_private.h:515
void netplay_delayed_state_change(netplay_t *netplay)
Definition: netplay_io.c:178
Definition: netplay_private.h:120
GLsizeiptr size
Definition: glext.h:6559
Definition: netplay_private.h:123
bool netplay_cmd_mode(netplay_t *netplay, enum rarch_netplay_connection_mode mode)
Definition: netplay_io.c:472
size_t end
Definition: netplay_private.h:323
uint32_t replay_frame_count
Definition: netplay_private.h:496
includes all by default used to find thumbnails Please choose a single playlist first Add Entry Add Folder Select Files< multiple > Please fill out all required fields RetroArch updated successfully Please restart the application for the changes to take effect Contributors Move Down Load Remove Add Pass No shader passes Reset All Passes Download thumbnail Start on Download All Thumbnails This Playlist Configured in port
Definition: msg_hash_us.h:7699
Definition: netplay_private.h:245
int netplay_poll_net_input(netplay_t *netplay, bool block)
Definition: netplay_io.c:1846
bool is_connected
Definition: netplay_private.h:389
void netplay_key_hton_init(void)
Definition: netplay_keyboard.c:44
void netplay_handle_slaves(netplay_t *netplay)
Definition: netplay_io.c:1921
netplay_cmd
Definition: netplay_private.h:98
void netplay_recv_reset(struct socket_buffer *sbuf)
Definition: netplay_buf.c:342
int64_t retro_time_t
Definition: libretro.h:1610
uint32_t other_frame_count
Definition: netplay_private.h:476
bool remote_paused
Definition: netplay_private.h:531
uint8_t * zbuffer
Definition: netplay_private.h:459
uint32_t run_frame_count
Definition: netplay_private.h:472
retro_time_t catch_up_time
Definition: netplay_private.h:557
size_t state_size
Definition: netplay_private.h:499
Definition: netplay_private.h:231
void netplay_sync_post_frame(netplay_t *netplay, bool stalled)
Definition: netplay_sync.c:738
int listen_fd
Definition: netplay_private.h:395
const struct trans_stream_backend * compression_backend
Definition: netplay_private.h:377
bool have_updown_device
Definition: netplay_private.h:440
Definition: netplay_private.h:146
Definition: net_natt.h:33
bool netplay_cmd_crc(netplay_t *netplay, struct delta_frame *delta)
Definition: netplay_io.c:431
Definition: netplay_private.h:158
uint32_t server_frame_count
Definition: netplay_private.h:492
netplay_keys
Definition: netplay_private.h:923
uint32_t client_num
Definition: netplay_private.h:281
#define sockaddr_storage
Definition: socket.h:49
struct netplay_connection one_connection
Definition: netplay_private.h:406
Definition: netplay_private.h:197
uint32_t self_client_num
Definition: netplay_private.h:398
bool force_send_savestate
Definition: netplay_private.h:518
rarch_netplay_connection_mode
Definition: netplay_private.h:229
bool crcs_valid
Definition: netplay_private.h:569
ubyte cmd
Definition: wiiuse_internal.h:319
uint32_t stall_frame
Definition: netplay_private.h:371
struct socket_buffer send_packet_buffer recv_packet_buffer
Definition: netplay_private.h:349
void input_poll_net(void)
Definition: netplay_frontend.c:532
Definition: netplay_private.h:241
Definition: netplay_private.h:375
bool netplay_send_cur_input(netplay_t *netplay, struct netplay_connection *connection)
Definition: netplay_io.c:290
bool is_replay
Definition: netplay_private.h:502
size_t replay_ptr
Definition: netplay_private.h:495
bool netplay_delta_frame_ready(netplay_t *netplay, struct delta_frame *delta, uint32_t frame)
Definition: netplay_delta.c:44
struct netplay_input_state * next
Definition: netplay_private.h:275
Definition: netplay_private.h:247
Definition: netplay_private.h:290
uint16_t tcp_port
Definition: netplay_private.h:445
struct retro_callbacks cbs
Definition: netplay_private.h:442
void netplay_announce_nat_traversal(netplay_t *netplay)
Definition: netplay_io.c:1990
GLenum const GLvoid * addr
Definition: glext.h:10528
void netplay_hangup(netplay_t *netplay, struct netplay_connection *connection)
Definition: netplay_io.c:93
Definition: netplay_private.h:268
Definition: netplay_private.h:233
struct compression_transcoder compress_nil compress_zlib
Definition: netplay_private.h:455
bool netplay_send(struct socket_buffer *sbuf, int sockfd, const void *buf, size_t len)
Definition: netplay_buf.c:127
bool crc_validity_checked
Definition: netplay_private.h:566
Definition: netplay_private.h:220
bool stateless_mode
Definition: netplay_private.h:534
bool is_server
Definition: netplay_private.h:386
Definition: netplay_private.h:256
Definition: netplay_private.h:132
size_t connections_size
Definition: netplay_private.h:405
client_bitmap_t device_clients[MAX_INPUT_DEVICES]
Definition: netplay_private.h:419
void netplay_send_raw_cmd_all(netplay_t *netplay, struct netplay_connection *except, uint32_t cmd, const void *data, size_t size)
Definition: netplay_io.c:378
void netplay_init_nat_traversal(netplay_t *netplay)
Definition: netplay_io.c:2035
enum rarch_netplay_connection_mode mode
Definition: netplay_private.h:352
bool used
Definition: netplay_private.h:278
const struct trans_stream_backend * decompression_backend
Definition: netplay_private.h:379
netplay_input_state_t resolved_input[MAX_INPUT_DEVICES]
Definition: netplay_private.h:303
bool force_reset
Definition: netplay_private.h:512
Definition: netplay_private.h:259
Definition: netplay_private.h:200
size_t bufsz
Definition: netplay_private.h:322
bool can_poll
Definition: netplay_private.h:505
static struct frame frames[2]
Definition: ffmpeg_core.c:162
uint8_t netplay_settings_share_mode(void)
Definition: netplay_frontend.c:1303
Definition: netplay_private.h:191
Definition: netplay_private.h:328
Definition: netplay_private.h:223
bool paused
Definition: netplay_private.h:363
Definition: netplay_private.h:272
Definition: netplay_private.h:149
bool nat_traversal
Definition: netplay_private.h:448
bool netplay_handshake(netplay_t *netplay, struct netplay_connection *connection, bool *had_input)
Definition: netplay_handshake.c:1136
bool nat_traversal_task_oustanding
Definition: netplay_private.h:448
size_t start
Definition: netplay_private.h:323
bool netplay_cmd_request_savestate(netplay_t *netplay)
Definition: netplay_io.c:453
Definition: netplay_private.h:244
static int block
Definition: psp2.c:31
Definition: trans_stream.h:53
size_t buffer_size
Definition: netplay_private.h:452
uint32_t self_frame_count
Definition: netplay_private.h:467
int fd
Definition: netplay_private.h:334
static void save(LexState *ls, int c)
Definition: llex.c:57
Definition: netplay_private.h:129
unsigned char * data
Definition: netplay_private.h:321
bool used
Definition: netplay_private.h:292
Definition: netplay_private.h:225
uint32_t read_frame_count[MAX_CLIENTS]
Definition: netplay_private.h:487
bool netplay_cmd_stall(netplay_t *netplay, struct netplay_connection *connection, uint32_t frames)
Definition: netplay_io.c:534
#define MAX_CLIENTS
Definition: netplay_private.h:48
Definition: netplay_private.h:109
bool have_real[MAX_CLIENTS]
Definition: netplay_private.h:316
bool netplay_resolve_input(netplay_t *netplay, size_t sim_ptr, bool resim)
Definition: netplay_sync.c:341
Definition: netplay_private.h:214
Definition: netplay_private.h:262
size_t read_ptr[MAX_CLIENTS]
Definition: netplay_private.h:486
Definition: netplay_private.h:383
int input_latency_frames
Definition: netplay_private.h:545
static char server[64]
Definition: net_retropad_core.c:73
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)
Definition: netplay_delta.c:128
Definition: netplay_private.h:218
uint32_t netplay_delta_frame_crc(netplay_t *netplay, struct delta_frame *delta)
Definition: netplay_delta.c:77
struct natt_status nat_traversal_state
Definition: netplay_private.h:449
const uint16_t netplay_key_ntoh_mapping[]
Definition: netplay_keyboard.c:21
Definition: netplay_private.h:924
bool netplay_send_raw_cmd(netplay_t *netplay, struct netplay_connection *connection, uint32_t cmd, const void *data, size_t size)
Definition: netplay_io.c:352
uint32_t compression_supported
Definition: netplay_private.h:360
Definition: netplay_private.h:252
bool netplay_lan_ad_server(netplay_t *netplay)
Definition: netplay_discovery.c:238
struct netplay_connection * connections
Definition: netplay_private.h:404
Definition: netplay_private.h:246
bool savestate_request_outstanding
Definition: netplay_private.h:521
struct netplay_input_state * netplay_input_state_t
void netplay_recv_flush(struct socket_buffer *sbuf)
Definition: netplay_buf.c:353
struct delta_frame * buffer
Definition: netplay_private.h:451
netplay_cmd_mode_reasons
Definition: netplay_private.h:188
enum rarch_netplay_stall_reason stall
Definition: netplay_private.h:548
Definition: netplay_private.h:115
uint32_t desync
Definition: netplay_private.h:429
uint32_t crc
Definition: netplay_private.h:299
rarch_netplay_share_preference
Definition: netplay_private.h:207
void netplay_deinit_socket_buffer(struct socket_buffer *sbuf)
Definition: netplay_buf.c:111
void * decompression_stream
Definition: netplay_private.h:380
Definition: netplay_private.h:210
Definition: netplay_private.h:178
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)
Definition: netplay_init.c:418
bool catch_up
Definition: netplay_private.h:554
Definition: netplay_private.h:112
struct addrinfo * addr
Definition: netplay_private.h:524
size_t read
Definition: netplay_private.h:324
size_t zbuffer_size
Definition: netplay_private.h:460
Definition: netplay_private.h:219
char nick[NETPLAY_NICK_LEN]
Definition: netplay_private.h:340
Definition: netplay_private.h:167
uint32_t netplay_expected_input_size(netplay_t *netplay, uint32_t devices)
Definition: netplay_delta.c:170
Definition: netplay_private.h:224
#define NETPLAY_FRAME_RUN_TIME_WINDOW
Definition: netplay_private.h:56
netplay_input_state_t simlated_input[MAX_INPUT_DEVICES]
Definition: netplay_private.h:310
retro_time_t frame_run_time_sum
Definition: netplay_private.h:542
Definition: netplay_private.h:152
bool active
Definition: netplay_private.h:331
Definition: netplay_private.h:173
#define NETPLAY_NICK_LEN
Definition: netplay_private.h:36
void * compression_stream
Definition: netplay_private.h:378
retro_time_t stall_time
Definition: netplay_private.h:551
size_t unread_ptr
Definition: netplay_private.h:482
Definition: netplay_private.h:135
Definition: netplay_private.h:203
Definition: netplay_private.h:155
size_t self_ptr
Definition: netplay_private.h:466
uint32_t client_bitmap_t
Definition: netplay_private.h:49
#define MAX_INPUT_DEVICES
Definition: netplay_private.h:45
uint8_t device_share_modes[MAX_INPUT_DEVICES]
Definition: netplay_private.h:422
bool netplay_resize_socket_buffer(struct socket_buffer *sbuf, size_t newsize)
Definition: netplay_buf.c:72
unsigned short uint16_t
Definition: stdint.h:125
uint32_t config_devices[MAX_INPUT_DEVICES]
Definition: netplay_private.h:433
ssize_t netplay_recv(struct socket_buffer *sbuf, int sockfd, void *buf, size_t len, bool block)
Definition: netplay_buf.c:245
unsigned __int64 uint64_t
Definition: stdint.h:136
Definition: netplay_private.h:126
unsigned char uint8_t
Definition: stdint.h:124
unsigned int uint32_t
Definition: stdint.h:126
retro_time_t frame_run_time_avg
Definition: netplay_private.h:542
uint32_t frame
Definition: netplay_private.h:293
Definition: netplay_private.h:161
size_t run_ptr
Definition: netplay_private.h:471
void netplay_load_savestate(netplay_t *netplay, retro_ctx_serialize_info_t *serial_info, bool save)
Definition: netplay_frontend.c:1211
uint32_t catch_up_behind
Definition: netplay_private.h:560
uint32_t client_devices[MAX_CLIENTS]
Definition: netplay_private.h:416
uint32_t size
Definition: netplay_private.h:284