From 178d959cad33f1a630f2e5d86411f1943d70cbc7 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 22 Jan 2017 21:24:57 +0100 Subject: [PATCH] Fix C89_BUILD --- command.c | 6 ++++-- menu/cbs/menu_cbs_ok.c | 5 ++++- menu/cbs/menu_cbs_sublabel.c | 4 +++- menu/menu_displaylist.c | 9 ++++++--- network/netplay/netplay_frontend.c | 8 +++++--- tasks/task_netplay_crc.c | 23 ++++++++--------------- 6 files changed, 30 insertions(+), 25 deletions(-) diff --git a/command.c b/command.c index bbc61603a2..99fcbb0a84 100644 --- a/command.c +++ b/command.c @@ -2453,12 +2453,14 @@ bool command_event(enum event_command cmd, void *data) { /* buf is expected to be address:port, there must be a better way to do this but for now I'll just use a string list */ - char *buf = (char *) data; + char *buf = (char *)data; static struct string_list *hostname = NULL; + settings_t *settings = config_get_ptr(); + hostname = string_split(buf, ":"); - settings_t *settings = config_get_ptr(); command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); + if (!init_netplay_deferred( hostname->elems[0].data, atoi(hostname->elems[1].data))) { diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 6f7dfb117a..ba05aa082c 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -3350,6 +3350,7 @@ finish: { int i, j = 0; char tmp[PATH_MAX_LENGTH]; + char s[PATH_MAX_LENGTH]; static struct string_list *room_data = NULL; file_list_t *file_list = menu_entries_get_selection_buf_ptr(0); @@ -3419,10 +3420,12 @@ finish: netplay_room_list[i].gamename, netplay_room_list[i].gamecrc, netplay_room_list[i].timestamp); + j+=8; - char s[PATH_MAX_LENGTH]; + snprintf(s, sizeof(s), "Nickname: %s", netplay_room_list[i].nickname); + menu_entries_append_enum(file_list, s, msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM), diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index cc9cb3ac92..816a58f4f1 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -156,7 +156,9 @@ static int action_bind_sublabel_netplay_room( snprintf(s,len, "%s (%s)\n%s (%08x)", netplay_room_list[i - 1].corename, netplay_room_list[i - 1].coreversion, netplay_room_list[i - 1].gamename, netplay_room_list[i - 1].gamecrc); - //strlcpy(s, netplay_room_list[i - 1].corename, len); +#if 0 + strlcpy(s, netplay_room_list[i - 1].corename, len); +#endif return 0; } diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 18ade8a5cf..27392939bc 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -2961,10 +2961,13 @@ static int menu_displaylist_parse_netplay_room_list( for (i = 0; i < netplay_room_count; i++) { char s[PATH_MAX_LENGTH]; - snprintf(s, sizeof(s), "Nickname: %s", netplay_room_list[i].nickname); - const char *label = s; + + s[0] = '\0'; + + snprintf(s, sizeof(s), + "Nickname: %s", netplay_room_list[i].nickname); menu_entries_append_enum(info->list, - label, + s, msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM), MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM, MENU_WIFI, 0, 0); diff --git a/network/netplay/netplay_frontend.c b/network/netplay/netplay_frontend.c index fc5dc88c7a..61316177ac 100644 --- a/network/netplay/netplay_frontend.c +++ b/network/netplay/netplay_frontend.c @@ -425,14 +425,16 @@ static void netplay_announce_cb(void *task_data, void *user_data, const char *er static void netplay_announce() { + char buf [2048]; + char url [2048] = "http://lobby.libretro.com/raw/?"; rarch_system_info_t *system = NULL; settings_t *settings = config_get_ptr(); - uint32_t *content_crc_ptr = NULL; + uint32_t *content_crc_ptr = NULL; + content_get_crc(&content_crc_ptr); runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); - char url [2048] = "http://lobby.libretro.com/raw/?"; - char buf [2048]; + buf[0] = '\0'; snprintf(buf, sizeof(buf), "%susername=%s&corename=%s&coreversion=%s&" diff --git a/tasks/task_netplay_crc.c b/tasks/task_netplay_crc.c index 16f7ba0da7..a497b90d58 100644 --- a/tasks/task_netplay_crc.c +++ b/tasks/task_netplay_crc.c @@ -47,11 +47,11 @@ typedef struct static void netplay_crc_scan_callback(void *task_data, void *user_data, const char *error) { - netplay_crc_handle_t *state = (netplay_crc_handle_t*)task_data; - core_info_list_t *info = NULL; + int i; + netplay_crc_handle_t *state = (netplay_crc_handle_t*)task_data; + core_info_list_t *info = NULL; content_ctx_info_t content_info = {0}; - int i; core_info_get_list(&info); if (!state) @@ -63,11 +63,6 @@ static void netplay_crc_scan_callback(void *task_data, break; } - printf("Hostname: %s\n", state->hostname); - printf("Content: %s\n", state->path); - printf("Corename: %s\n", state->corename); - printf("Corepath: %s\n", info->list[i].path); - command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, state->hostname); task_push_content_load_default( info->list[i].path, state->path, @@ -81,8 +76,8 @@ static void netplay_crc_scan_callback(void *task_data, static void task_netplay_crc_scan_handler(retro_task_t *task) { - netplay_crc_handle_t *state = (netplay_crc_handle_t*)task->state; size_t i, j; + netplay_crc_handle_t *state = (netplay_crc_handle_t*)task->state; task_set_progress(task, 0); task_set_title(task, strdup("Checking for ROM presence.")); @@ -102,18 +97,16 @@ static void task_netplay_crc_scan_handler(retro_task_t *task) for (i = 0; i < state->lpl_list->size; i++) { + playlist_t *playlist = NULL; const char *lpl_path = state->lpl_list->elems[i].data; if (!strstr(lpl_path, file_path_str(FILE_PATH_LPL_EXTENSION))) continue; - printf("%s\n", lpl_path); - - playlist_t *playlist = playlist_init(lpl_path, 99999); + playlist = playlist_init(lpl_path, 99999); for (j = 0; j < playlist->size; j++) { - printf("%s\n", playlist->entries[j].crc32); if (string_is_equal(playlist->entries[j].crc32, state->crc)) { strlcpy(state->path, playlist->entries[j].path, sizeof(state->path)); @@ -141,8 +134,8 @@ no_playlists: bool task_push_netplay_crc_scan(uint32_t crc, const char *hostname, const char *corename) { - settings_t *settings = config_get_ptr(); - retro_task_t *task = (retro_task_t *)calloc(1, sizeof(*task)); + settings_t *settings = config_get_ptr(); + retro_task_t *task = (retro_task_t *)calloc(1, sizeof(*task)); netplay_crc_handle_t *state = (netplay_crc_handle_t*)calloc(1, sizeof(*state)); if (!task || !state)