mirror of
https://github.com/libretro/RetroArch
synced 2025-04-04 04:20:29 +00:00
Some C89_BUILD buildfixes
This commit is contained in:
parent
265e36a5d0
commit
9f7afa0862
@ -1628,7 +1628,7 @@ static bool config_load_file(const char *path, bool set_defaults)
|
|||||||
|
|
||||||
#ifdef HAVE_NETWORK_GAMEPAD
|
#ifdef HAVE_NETWORK_GAMEPAD
|
||||||
CONFIG_GET_BOOL_BASE(conf, settings, network_remote_enable, "network_remote_enable");
|
CONFIG_GET_BOOL_BASE(conf, settings, network_remote_enable, "network_remote_enable");
|
||||||
for (int i=0; i < MAX_USERS; i++)
|
for (i = 0; i < MAX_USERS; i++)
|
||||||
{
|
{
|
||||||
char tmp[64] = {0};
|
char tmp[64] = {0};
|
||||||
snprintf(tmp, sizeof(tmp), "network_remote_enable_user_p%u", i + 1);
|
snprintf(tmp, sizeof(tmp), "network_remote_enable_user_p%u", i + 1);
|
||||||
@ -2780,8 +2780,7 @@ bool config_save_file(const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_NETWORK_GAMEPAD
|
#ifdef HAVE_NETWORK_GAMEPAD
|
||||||
|
for (i = 0; i < MAX_USERS; i++)
|
||||||
for (int i=0; i < MAX_USERS; i++)
|
|
||||||
{
|
{
|
||||||
char tmp[64] = {0};
|
char tmp[64] = {0};
|
||||||
snprintf(tmp, sizeof(tmp), "network_remote_enable_user_p%u", i + 1);
|
snprintf(tmp, sizeof(tmp), "network_remote_enable_user_p%u", i + 1);
|
||||||
|
@ -6115,6 +6115,7 @@ static bool setting_append_list_netplay_options(
|
|||||||
const char *parent_group)
|
const char *parent_group)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_NETPLAY
|
#ifdef HAVE_NETPLAY
|
||||||
|
unsigned user;
|
||||||
rarch_setting_group_info_t group_info = {0};
|
rarch_setting_group_info_t group_info = {0};
|
||||||
rarch_setting_group_info_t subgroup_info = {0};
|
rarch_setting_group_info_t subgroup_info = {0};
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
@ -6297,11 +6298,11 @@ static bool setting_append_list_netplay_options(
|
|||||||
menu_settings_list_current_add_range(list, list_info, 1, 99999, 1, true, true);
|
menu_settings_list_current_add_range(list, list_info, 1, 99999, 1, true, true);
|
||||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED);
|
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED);
|
||||||
|
|
||||||
for(int user = 0; user < settings->input.max_users; user++)
|
for(user = 0; user < settings->input.max_users; user++)
|
||||||
{
|
{
|
||||||
char s1[64];
|
char s1[64], s2[64];
|
||||||
|
|
||||||
snprintf(s1, sizeof(s1), "%s_user_p%d", menu_hash_to_str(MENU_LABEL_NETWORK_REMOTE_ENABLE), user + 1);
|
snprintf(s1, sizeof(s1), "%s_user_p%d", menu_hash_to_str(MENU_LABEL_NETWORK_REMOTE_ENABLE), user + 1);
|
||||||
char s2[64];
|
|
||||||
snprintf(s2, sizeof(s2), "User %d Remote Enable", user + 1);
|
snprintf(s2, sizeof(s2), "User %d Remote Enable", user + 1);
|
||||||
|
|
||||||
|
|
||||||
|
26
remote.c
26
remote.c
@ -121,22 +121,23 @@ error:
|
|||||||
|
|
||||||
rarch_remote_t *rarch_remote_new(uint16_t port)
|
rarch_remote_t *rarch_remote_new(uint16_t port)
|
||||||
{
|
{
|
||||||
|
unsigned user;
|
||||||
rarch_remote_t *handle = (rarch_remote_t*)calloc(1, sizeof(*handle));
|
rarch_remote_t *handle = (rarch_remote_t*)calloc(1, sizeof(*handle));
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
if (!handle)
|
if (!handle)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
(void)port;
|
(void)port;
|
||||||
|
|
||||||
#if defined(HAVE_NETWORK_GAMEPAD) && defined(HAVE_NETPLAY)
|
#if defined(HAVE_NETWORK_GAMEPAD) && defined(HAVE_NETPLAY)
|
||||||
for(int user = 0; user < settings->input.max_users; user ++)
|
for(user = 0; user < settings->input.max_users; user ++)
|
||||||
{
|
{
|
||||||
handle->net_fd[user] = -1;
|
handle->net_fd[user] = -1;
|
||||||
if(settings->network_remote_enable_user[user])
|
if(settings->network_remote_enable_user[user])
|
||||||
if (!remote_init_network(handle, port, user))
|
if (!remote_init_network(handle, port, user))
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
@ -150,13 +151,12 @@ error:
|
|||||||
|
|
||||||
void rarch_remote_free(rarch_remote_t *handle)
|
void rarch_remote_free(rarch_remote_t *handle)
|
||||||
{
|
{
|
||||||
|
unsigned user;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
#if defined(HAVE_NETWORK_GAMEPAD) && defined(HAVE_NETPLAY)
|
|
||||||
for(int user = 0; user < settings->input.max_users; user ++)
|
|
||||||
{
|
|
||||||
socket_close(handle->net_fd[user]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
#if defined(HAVE_NETWORK_GAMEPAD) && defined(HAVE_NETPLAY)
|
||||||
|
for(user = 0; user < settings->input.max_users; user ++)
|
||||||
|
socket_close(handle->net_fd[user]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
free(handle);
|
free(handle);
|
||||||
@ -211,24 +211,28 @@ bool input_remote_key_pressed(int key, unsigned port)
|
|||||||
|
|
||||||
void rarch_remote_poll(rarch_remote_t *handle)
|
void rarch_remote_poll(rarch_remote_t *handle)
|
||||||
{
|
{
|
||||||
|
unsigned user;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
input_remote_state_t *ol_state = input_remote_get_state_ptr();
|
input_remote_state_t *ol_state = input_remote_get_state_ptr();
|
||||||
|
|
||||||
for(int user=0; user < settings->input.max_users; user++)
|
for(user = 0; user < settings->input.max_users; user++)
|
||||||
{
|
{
|
||||||
if (settings->network_remote_enable_user[user])
|
if (settings->network_remote_enable_user[user])
|
||||||
{
|
{
|
||||||
|
char buf[8];
|
||||||
|
ssize_t ret;
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
struct timeval tmp_tv = {0};
|
struct timeval tmp_tv = {0};
|
||||||
|
|
||||||
if (handle->net_fd[user] < 0)
|
if (handle->net_fd[user] < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
FD_SET(handle->net_fd[user], &fds);
|
FD_SET(handle->net_fd[user], &fds);
|
||||||
|
|
||||||
char buf[8];
|
ret = recvfrom(handle->net_fd[user], buf,
|
||||||
ssize_t ret = recvfrom(handle->net_fd[user], buf,
|
|
||||||
sizeof(buf) - 1, 0, NULL, NULL);
|
sizeof(buf) - 1, 0, NULL, NULL);
|
||||||
|
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
parse_packet(buf, sizeof(buf), user);
|
parse_packet(buf, sizeof(buf), user);
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user