mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-22 10:49:02 +00:00
Since there's now only one mode, removing netplay_callbacks entirely.
This commit is contained in:
parent
9b2270f5d4
commit
b5cd187077
@ -315,11 +315,6 @@ static void hangup(netplay_t *netplay, struct netplay_connection *connection)
|
||||
netplay->stall = 0;
|
||||
}
|
||||
|
||||
static bool netplay_info_cb(netplay_t* netplay, unsigned delay_frames)
|
||||
{
|
||||
return netplay->net_cbs->info_cb(netplay, delay_frames);
|
||||
}
|
||||
|
||||
/**
|
||||
* netplay_should_skip:
|
||||
* @netplay : pointer to netplay object
|
||||
@ -1477,8 +1472,6 @@ netplay_t *netplay_new(void *direct_host, const char *server, uint16_t port,
|
||||
|
||||
strlcpy(netplay->nick, nick[0] ? nick : RARCH_DEFAULT_NICK, sizeof(netplay->nick));
|
||||
|
||||
netplay->net_cbs = netplay_get_cbs_net();
|
||||
|
||||
if (!init_socket(netplay, direct_host, server, port))
|
||||
{
|
||||
free(netplay);
|
||||
@ -1493,12 +1486,10 @@ netplay_t *netplay_new(void *direct_host, const char *server, uint16_t port,
|
||||
|
||||
if (!netplay->is_server)
|
||||
{
|
||||
fprintf(stderr, "CONNECTION 0 %d\n", netplay->connections[0].active);
|
||||
netplay_handshake_init_send(netplay, &netplay->connections[0]);
|
||||
netplay->connections[0].mode = netplay->self_mode = NETPLAY_CONNECTION_INIT;
|
||||
}
|
||||
|
||||
if(!netplay_info_cb(netplay, delay_frames))
|
||||
goto error;
|
||||
|
||||
/* FIXME: Not really the right place to do this, socket initialization needs
|
||||
* to be fixed in general */
|
||||
if (netplay->is_server)
|
||||
@ -1652,7 +1643,7 @@ void netplay_free(netplay_t *netplay)
|
||||
**/
|
||||
bool netplay_pre_frame(netplay_t *netplay)
|
||||
{
|
||||
retro_assert(netplay && netplay->net_cbs->pre_frame);
|
||||
retro_assert(netplay);
|
||||
|
||||
/* FIXME: This is an ugly way to learn we're not paused anymore */
|
||||
if (netplay->local_paused)
|
||||
@ -1687,7 +1678,7 @@ bool netplay_pre_frame(netplay_t *netplay)
|
||||
}
|
||||
}
|
||||
|
||||
if (!netplay->net_cbs->pre_frame(netplay))
|
||||
if (!netplay_sync_pre_frame(netplay))
|
||||
return false;
|
||||
|
||||
return (!netplay->have_player_connections ||
|
||||
@ -1704,9 +1695,8 @@ bool netplay_pre_frame(netplay_t *netplay)
|
||||
**/
|
||||
void netplay_post_frame(netplay_t *netplay)
|
||||
{
|
||||
retro_assert(netplay && netplay->net_cbs->post_frame);
|
||||
netplay->net_cbs->post_frame(netplay);
|
||||
/* FIXME: Per-connection send buffer */
|
||||
retro_assert(netplay);
|
||||
netplay_sync_post_frame(netplay);
|
||||
if (netplay->connections_size > 0 &&
|
||||
netplay->connections[0].active &&
|
||||
!netplay_send_flush(&netplay->connections[0].send_packet_buffer,
|
||||
|
@ -66,12 +66,12 @@ static void netplay_handle_frame_hash(netplay_t *netplay, struct delta_frame *de
|
||||
}
|
||||
|
||||
/**
|
||||
* netplay_net_pre_frame:
|
||||
* netplay_sync_pre_frame:
|
||||
* @netplay : pointer to netplay object
|
||||
*
|
||||
* Pre-frame for Netplay (normal version).
|
||||
* Pre-frame for Netplay synchronization.
|
||||
**/
|
||||
static bool netplay_net_pre_frame(netplay_t *netplay)
|
||||
bool netplay_sync_pre_frame(netplay_t *netplay)
|
||||
{
|
||||
retro_ctx_serialize_info_t serial_info;
|
||||
|
||||
@ -235,13 +235,13 @@ process:
|
||||
}
|
||||
|
||||
/**
|
||||
* netplay_net_post_frame:
|
||||
* netplay_sync_post_frame:
|
||||
* @netplay : pointer to netplay object
|
||||
*
|
||||
* Post-frame for Netplay (normal version).
|
||||
* Post-frame for Netplay synchronization.
|
||||
* We check if we have new input and replay from recorded input.
|
||||
**/
|
||||
static void netplay_net_post_frame(netplay_t *netplay)
|
||||
void netplay_sync_post_frame(netplay_t *netplay)
|
||||
{
|
||||
netplay->self_ptr = NEXT_PTR(netplay->self_ptr);
|
||||
netplay->self_frame_count++;
|
||||
@ -370,24 +370,3 @@ static void netplay_net_post_frame(netplay_t *netplay)
|
||||
core_unserialize(&serial_info);
|
||||
}
|
||||
}
|
||||
|
||||
static bool netplay_net_info_cb(netplay_t* netplay, unsigned frames)
|
||||
{
|
||||
if (!netplay_is_server(netplay))
|
||||
{
|
||||
netplay_handshake_init_send(netplay, netplay->connections);
|
||||
netplay->connections[0].mode = netplay->self_mode = NETPLAY_CONNECTION_INIT;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
struct netplay_callbacks* netplay_get_cbs_net(void)
|
||||
{
|
||||
static struct netplay_callbacks cbs = {
|
||||
&netplay_net_pre_frame,
|
||||
&netplay_net_post_frame,
|
||||
&netplay_net_info_cb
|
||||
};
|
||||
return &cbs;
|
||||
}
|
||||
|
@ -216,12 +216,6 @@ struct socket_buffer
|
||||
size_t read;
|
||||
};
|
||||
|
||||
struct netplay_callbacks {
|
||||
bool (*pre_frame) (netplay_t *netplay);
|
||||
void (*post_frame)(netplay_t *netplay);
|
||||
bool (*info_cb) (netplay_t *netplay, unsigned frames);
|
||||
};
|
||||
|
||||
/* Each connection gets a connection struct */
|
||||
struct netplay_connection
|
||||
{
|
||||
@ -376,8 +370,6 @@ struct netplay
|
||||
|
||||
/* Frequency with which to check CRCs */
|
||||
uint32_t check_frames;
|
||||
|
||||
struct netplay_callbacks* net_cbs;
|
||||
};
|
||||
|
||||
void input_poll_net(void);
|
||||
@ -463,7 +455,9 @@ void netplay_load_savestate(netplay_t *netplay, retro_ctx_serialize_info_t *seri
|
||||
**/
|
||||
bool netplay_disconnect(netplay_t *netplay);
|
||||
|
||||
struct netplay_callbacks* netplay_get_cbs_net(void);
|
||||
bool netplay_sync_pre_frame(netplay_t *netplay);
|
||||
|
||||
void netplay_sync_post_frame(netplay_t *netplay);
|
||||
|
||||
/* Normally called at init time, unless the INITIALIZATION quirk is set */
|
||||
bool netplay_init_serialization(netplay_t *netplay);
|
||||
|
Loading…
Reference in New Issue
Block a user