(Netplay) Some refactoring and cleaning

This commit is contained in:
Cthulhu-throwaway 2022-05-27 17:01:39 -03:00
parent 37a17df182
commit e4f8b531d5
4 changed files with 464 additions and 435 deletions

View File

@ -294,8 +294,6 @@ typedef struct
/* Only used before init_netplay */ /* Only used before init_netplay */
bool netplay_enabled; bool netplay_enabled;
bool netplay_is_client; bool netplay_is_client;
/* Used to avoid recursive netplay calls */
bool in_netplay;
bool has_set_netplay_mode; bool has_set_netplay_mode;
bool has_set_netplay_ip_address; bool has_set_netplay_ip_address;
bool has_set_netplay_ip_port; bool has_set_netplay_ip_port;
@ -400,18 +398,6 @@ bool netplay_is_alive(netplay_t *netplay);
**/ **/
bool netplay_should_skip(netplay_t *netplay); bool netplay_should_skip(netplay_t *netplay);
/**
* netplay_post_frame:
* @netplay : 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().
**/
void netplay_post_frame(netplay_t *netplay);
void deinit_netplay(void);
/** /**
* init_netplay * init_netplay
* @server : server address to connect to (client only) * @server : server address to connect to (client only)
@ -428,6 +414,8 @@ bool init_netplay(const char *server, unsigned port, const char *mitm_session);
bool init_netplay_deferred(const char *server, unsigned port, const char *mitm_session); bool init_netplay_deferred(const char *server, unsigned port, const char *mitm_session);
void deinit_netplay(void);
void video_frame_net(const void *data, unsigned width, void video_frame_net(const void *data, unsigned width,
unsigned height, size_t pitch); unsigned height, size_t pitch);
void audio_sample_net(int16_t left, int16_t right); void audio_sample_net(int16_t left, int16_t right);

File diff suppressed because it is too large Load Diff

View File

@ -883,13 +883,6 @@ int netplay_poll_net_input(netplay_t *netplay, bool block);
*/ */
void netplay_handle_slaves(netplay_t *netplay); void netplay_handle_slaves(netplay_t *netplay);
/**
* netplay_announce_nat_traversal
*
* Announce successful NAT traversal.
*/
void netplay_announce_nat_traversal(netplay_t *netplay);
/** /**
* netplay_init_nat_traversal * netplay_init_nat_traversal
* *

View File

@ -276,7 +276,11 @@ finished:
static void netplay_nat_traversal_callback(retro_task_t *task, static void netplay_nat_traversal_callback(retro_task_t *task,
void *task_data, void *user_data, const char *error) void *task_data, void *user_data, const char *error)
{ {
netplay_driver_ctl(RARCH_NETPLAY_CTL_FINISHED_NAT_TRAVERSAL, NULL); struct nat_traversal_data *data = (struct nat_traversal_data*)task_data;
uintptr_t ext_port = ntohs(data->request.addr.sin_port);
netplay_driver_ctl(RARCH_NETPLAY_CTL_FINISHED_NAT_TRAVERSAL,
(void*)ext_port);
} }
static bool nat_task_finder(retro_task_t *task, void *userdata) static bool nat_task_finder(retro_task_t *task, void *userdata)