From cba281052a6e7ae616674ece18f328db972a2ad1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 12 May 2016 12:03:43 +0200 Subject: [PATCH] Rename np_ functions --- network/netplay.c | 2 +- network/netplay_common.c | 32 ++++++++++++++++---------------- network/netplay_net.c | 4 ++-- network/netplay_private.h | 20 ++++++++++---------- network/netplay_spectate.c | 12 ++++++------ 5 files changed, 35 insertions(+), 35 deletions(-) diff --git a/network/netplay.c b/network/netplay.c index 2a26c5b523..2491f569a8 100644 --- a/network/netplay.c +++ b/network/netplay.c @@ -589,7 +589,7 @@ int16_t input_state_net(unsigned port, unsigned device, #ifndef HAVE_SOCKET_LEGACY /* Custom inet_ntop. Win32 doesn't seem to support this ... */ -void np_log_connection(const struct sockaddr_storage *their_addr, +void netplay_log_connection(const struct sockaddr_storage *their_addr, unsigned slot, const char *nick) { union diff --git a/network/netplay_common.c b/network/netplay_common.c index 764846b7af..7d438e3525 100644 --- a/network/netplay_common.c +++ b/network/netplay_common.c @@ -18,7 +18,7 @@ #include #include "../content.h" -bool np_get_nickname(netplay_t *netplay, int fd) +bool netplay_get_nickname(netplay_t *netplay, int fd) { uint8_t nick_size; @@ -42,7 +42,7 @@ bool np_get_nickname(netplay_t *netplay, int fd) return true; } -bool np_send_nickname(netplay_t *netplay, int fd) +bool netplay_send_nickname(netplay_t *netplay, int fd) { uint8_t nick_size = strlen(netplay->nick); @@ -61,7 +61,7 @@ bool np_send_nickname(netplay_t *netplay, int fd) return true; } -uint32_t *np_bsv_header_generate(size_t *size, uint32_t magic) +uint32_t *netplay_bsv_header_generate(size_t *size, uint32_t magic) { retro_ctx_serialize_info_t serial_info; retro_ctx_size_info_t info; @@ -100,7 +100,7 @@ error: return NULL; } -bool np_bsv_parse_header(const uint32_t *header, uint32_t magic) +bool netplay_bsv_parse_header(const uint32_t *header, uint32_t magic) { retro_ctx_size_info_t info; uint32_t *content_crc_ptr; @@ -146,7 +146,7 @@ bool np_bsv_parse_header(const uint32_t *header, uint32_t magic) } /** - * np_impl_magic: + * netplay_impl_magic: * * Not really a hash, but should be enough to differentiate * implementations from each other. @@ -155,7 +155,7 @@ bool np_bsv_parse_header(const uint32_t *header, uint32_t magic) * The alternative would have been checking serialization sizes, but it * was troublesome for cross platform compat. **/ -uint32_t np_impl_magic(void) +uint32_t netplay_impl_magic(void) { size_t i, len; retro_ctx_api_info_t api_info; @@ -193,7 +193,7 @@ uint32_t np_impl_magic(void) return res; } -bool np_send_info(netplay_t *netplay) +bool netplay_send_info(netplay_t *netplay) { unsigned sram_size; retro_ctx_memory_info_t mem_info; @@ -208,13 +208,13 @@ bool np_send_info(netplay_t *netplay) content_get_crc(&content_crc_ptr); header[0] = htonl(*content_crc_ptr); - header[1] = htonl(np_impl_magic()); + header[1] = htonl(netplay_impl_magic()); header[2] = htonl(mem_info.size); if (!socket_send_all_blocking(netplay->fd, header, sizeof(header), false)) return false; - if (!np_send_nickname(netplay, netplay->fd)) + if (!netplay_send_nickname(netplay, netplay->fd)) { RARCH_ERR("Failed to send nick to host.\n"); return false; @@ -230,7 +230,7 @@ bool np_send_info(netplay_t *netplay) return false; } - if (!np_get_nickname(netplay, netplay->fd)) + if (!netplay_get_nickname(netplay, netplay->fd)) { RARCH_ERR("Failed to receive nick from host.\n"); return false; @@ -243,7 +243,7 @@ bool np_send_info(netplay_t *netplay) return true; } -bool np_get_info(netplay_t *netplay) +bool netplay_get_info(netplay_t *netplay) { unsigned sram_size; uint32_t header[3]; @@ -265,7 +265,7 @@ bool np_get_info(netplay_t *netplay) return false; } - if (np_impl_magic() != ntohl(header[1])) + if (netplay_impl_magic() != ntohl(header[1])) { RARCH_ERR("Implementations differ, make sure you're using exact same " "libretro implementations and RetroArch version.\n"); @@ -282,7 +282,7 @@ bool np_get_info(netplay_t *netplay) return false; } - if (!np_get_nickname(netplay, netplay->fd)) + if (!netplay_get_nickname(netplay, netplay->fd)) { RARCH_ERR("Failed to get nickname from client.\n"); return false; @@ -298,14 +298,14 @@ bool np_get_info(netplay_t *netplay) return false; } - if (!np_send_nickname(netplay, netplay->fd)) + if (!netplay_send_nickname(netplay, netplay->fd)) { RARCH_ERR("Failed to send nickname to client.\n"); return false; } #ifndef HAVE_SOCKET_LEGACY - np_log_connection(&netplay->other_addr, 0, netplay->other_nick); + netplay_log_connection(&netplay->other_addr, 0, netplay->other_nick); #endif return true; @@ -318,7 +318,7 @@ bool netplay_is_server(netplay_t* netplay) return netplay->is_server; } -bool np_is_spectate(netplay_t* netplay) +bool netplay_is_spectate(netplay_t* netplay) { if (!netplay) return false; diff --git a/network/netplay_net.c b/network/netplay_net.c index 5a2fd1c911..d119c73c53 100644 --- a/network/netplay_net.c +++ b/network/netplay_net.c @@ -139,12 +139,12 @@ static bool netplay_net_info_cb(netplay_t* netplay, unsigned frames) { if (netplay_is_server(netplay)) { - if (!np_send_info(netplay)) + if (!netplay_send_info(netplay)) return false; } else { - if (!np_get_info(netplay)) + if (!netplay_get_info(netplay)) return false; } diff --git a/network/netplay_private.h b/network/netplay_private.h index 49158ca859..e52ceae46a 100644 --- a/network/netplay_private.h +++ b/network/netplay_private.h @@ -139,18 +139,18 @@ extern void *netplay_data; struct netplay_callbacks* netplay_get_cbs_net(void); struct netplay_callbacks* netplay_get_cbs_spectate(void); -void np_log_connection(const struct sockaddr_storage *their_addr, +void netplay_log_connection(const struct sockaddr_storage *their_addr, unsigned slot, const char *nick); -bool np_get_nickname(netplay_t *netplay, int fd); -bool np_send_nickname(netplay_t *netplay, int fd); -bool np_send_info(netplay_t *netplay); -uint32_t *np_bsv_header_generate(size_t *size, uint32_t magic); -bool np_bsv_parse_header(const uint32_t *header, uint32_t magic); -uint32_t np_impl_magic(void); -bool np_send_info(netplay_t *netplay); -bool np_get_info(netplay_t *netplay); +bool netplay_get_nickname(netplay_t *netplay, int fd); +bool netplay_send_nickname(netplay_t *netplay, int fd); +bool netplay_send_info(netplay_t *netplay); +uint32_t *netplay_bsv_header_generate(size_t *size, uint32_t magic); +bool netplay_bsv_parse_header(const uint32_t *header, uint32_t magic); +uint32_t netplay_impl_magic(void); +bool netplay_send_info(netplay_t *netplay); +bool netplay_get_info(netplay_t *netplay); bool netplay_is_server(netplay_t* netplay); -bool np_is_spectate(netplay_t* netplay); +bool netplay_is_spectate(netplay_t* netplay); #endif diff --git a/network/netplay_spectate.c b/network/netplay_spectate.c index fea0576625..455b4de174 100644 --- a/network/netplay_spectate.c +++ b/network/netplay_spectate.c @@ -78,22 +78,22 @@ static void netplay_spectate_pre_frame(netplay_t *netplay) return; } - if (!np_get_nickname(netplay, new_fd)) + if (!netplay_get_nickname(netplay, new_fd)) { RARCH_ERR("Failed to get nickname from client.\n"); socket_close(new_fd); return; } - if (!np_send_nickname(netplay, new_fd)) + if (!netplay_send_nickname(netplay, new_fd)) { RARCH_ERR("Failed to send nickname to client.\n"); socket_close(new_fd); return; } - header = np_bsv_header_generate(&header_size, - np_impl_magic()); + header = netplay_bsv_header_generate(&header_size, + netplay_impl_magic()); if (!header) { @@ -118,7 +118,7 @@ static void netplay_spectate_pre_frame(netplay_t *netplay) netplay->spectate.fds[idx] = new_fd; #ifndef HAVE_SOCKET_LEGACY - np_log_connection(&their_addr, idx, netplay->other_nick); + netplay_log_connection(&their_addr, idx, netplay->other_nick); #endif } @@ -167,7 +167,7 @@ static bool netplay_spectate_info_cb(netplay_t *netplay, unsigned frames) unsigned i; if(netplay_is_server(netplay)) { - if(!np_get_info(netplay)) + if(!netplay_get_info(netplay)) return false; }