mirror of
https://github.com/libretro/RetroArch
synced 2025-04-18 14:42:30 +00:00
Make sure that network is inited.
This commit is contained in:
parent
a0ec6da2a8
commit
b97644f52f
@ -395,7 +395,7 @@ static bool init_udp_socket(netplay_t *handle, const char *server, uint16_t port
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Platform specific socket library init.
|
// Platform specific socket library init.
|
||||||
static bool init_network(void)
|
bool netplay_init_network(void)
|
||||||
{
|
{
|
||||||
static bool inited = false;
|
static bool inited = false;
|
||||||
if (inited)
|
if (inited)
|
||||||
@ -421,7 +421,7 @@ static bool init_network(void)
|
|||||||
|
|
||||||
static bool init_socket(netplay_t *handle, const char *server, uint16_t port)
|
static bool init_socket(netplay_t *handle, const char *server, uint16_t port)
|
||||||
{
|
{
|
||||||
if (!init_network())
|
if (!netplay_init_network())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!init_tcp_socket(handle, server, port, handle->spectate))
|
if (!init_tcp_socket(handle, server, port, handle->spectate))
|
||||||
|
@ -41,6 +41,8 @@ struct retro_callbacks
|
|||||||
retro_input_state_t state_cb;
|
retro_input_state_t state_cb;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool netplay_init_network(void);
|
||||||
|
|
||||||
// Creates a new netplay handle. A NULL host means we're hosting (player 1). :)
|
// Creates a new netplay handle. A NULL host means we're hosting (player 1). :)
|
||||||
netplay_t *netplay_new(const char *server,
|
netplay_t *netplay_new(const char *server,
|
||||||
uint16_t port, unsigned frames,
|
uint16_t port, unsigned frames,
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "netplay_compat.h"
|
#include "netplay_compat.h"
|
||||||
|
#include "netplay.h"
|
||||||
#include "network_cmd.h"
|
#include "network_cmd.h"
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
@ -42,6 +43,9 @@ static bool socket_nonblock(int fd)
|
|||||||
|
|
||||||
network_cmd_t *network_cmd_new(uint16_t port)
|
network_cmd_t *network_cmd_new(uint16_t port)
|
||||||
{
|
{
|
||||||
|
if (!netplay_init_network())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
network_cmd_t *handle = (network_cmd_t*)calloc(1, sizeof(*handle));
|
network_cmd_t *handle = (network_cmd_t*)calloc(1, sizeof(*handle));
|
||||||
if (!handle)
|
if (!handle)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -264,6 +268,9 @@ static bool verify_command(const char *cmd)
|
|||||||
|
|
||||||
bool network_cmd_send(const char *cmd_)
|
bool network_cmd_send(const char *cmd_)
|
||||||
{
|
{
|
||||||
|
if (!netplay_init_network())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
char *command = strdup(cmd_);
|
char *command = strdup(cmd_);
|
||||||
if (!command)
|
if (!command)
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user