From 571eafd14956eae46cdcc86ddf801a03da72aca3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 25 Jan 2020 15:58:22 +0100 Subject: [PATCH] Get rid of send debug info in a more safe way that won't mess with people's existing configs --- retroarch.c | 680 ---------------------------------------------------- 1 file changed, 680 deletions(-) diff --git a/retroarch.c b/retroarch.c index 426772a3d7..3e1a99f530 100644 --- a/retroarch.c +++ b/retroarch.c @@ -3572,9 +3572,6 @@ static void core_free_retro_game_info(struct retro_game_info *dest); static bool core_load(unsigned poll_type_behavior); static bool core_unload_game(void); -#ifdef HAVE_NETWORKING -static void rarch_send_debug_info(void); -#endif static bool rarch_environment_cb(unsigned cmd, void *data); static bool driver_location_get_position(double *lat, double *lon, @@ -6750,9 +6747,6 @@ TODO: Add a setting for these tweaks */ } break; case CMD_EVENT_SEND_DEBUG_INFO: -#ifdef HAVE_NETWORKING - rarch_send_debug_info(); -#endif break; case CMD_EVENT_FPS_TOGGLE: { @@ -27209,61 +27203,6 @@ static enum runloop_state runloop_check_state(void) old_pressed = pressed; } - /* Check if we have pressed the "send debug info" button. - * Must press 3 times in a row to activate, but it will - * alert the user of this with each press of the hotkey. */ - { - int any_i; - static uint32_t debug_seq = 0; - static bool old_pressed = false; - static bool old_any_pressed = false; - bool any_pressed = false; - bool pressed = BIT256_GET(current_bits, RARCH_SEND_DEBUG_INFO); - - for (any_i = 0; any_i < ARRAY_SIZE(current_bits.data); any_i++) - { - if (current_bits.data[any_i]) - { - any_pressed = true; - break; - } - } - - if (pressed && !old_pressed) - debug_seq |= pressed ? 1 : 0; - - switch (debug_seq) - { - case 1: /* pressed hotkey one time */ - runloop_msg_queue_push( - msg_hash_to_str(MSG_PRESS_TWO_MORE_TIMES_TO_SEND_DEBUG_INFO), - 2, 180, true, - NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - break; - case 3: /* pressed hotkey two times */ - runloop_msg_queue_push( - msg_hash_to_str(MSG_PRESS_ONE_MORE_TIME_TO_SEND_DEBUG_INFO), - 2, 180, true, - NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - break; - case 7: /* pressed hotkey third and final time */ - debug_seq = 0; - command_event(CMD_EVENT_SEND_DEBUG_INFO, NULL); - break; - } - - if (any_pressed && !old_any_pressed) - { - debug_seq <<= 1; - - if (debug_seq > 7) - debug_seq = 0; - } - - old_pressed = pressed; - old_any_pressed = any_pressed; - } - /* Check if we have pressed the FPS toggle button */ HOTKEY_CHECK(RARCH_FPS_TOGGLE, CMD_EVENT_FPS_TOGGLE, true, NULL); @@ -27951,625 +27890,6 @@ void rarch_get_cpu_architecture_string(char *cpu_arch_str, size_t len) } } -#ifdef HAVE_NETWORKING -static bool rarch_write_debug_info(void) -{ - int i; - char str[PATH_MAX_LENGTH]; - char debug_filepath[PATH_MAX_LENGTH]; - gfx_ctx_mode_t mode_info = {0}; - settings_t *settings = configuration_settings; - RFILE *file = NULL; - const frontend_ctx_driver_t *frontend = frontend_get_ptr(); - const char *cpu_model = NULL; - const char *path_config = path_get(RARCH_PATH_CONFIG); - unsigned lang = - *msg_hash_get_uint(MSG_HASH_USER_LANGUAGE); - - str[0] = - debug_filepath[0] = '\0'; - - /* Only print our debug info in English */ - if (lang != RETRO_LANGUAGE_ENGLISH) - msg_hash_set_uint(MSG_HASH_USER_LANGUAGE, RETRO_LANGUAGE_ENGLISH); - - fill_pathname_resolve_relative( - debug_filepath, - path_config, - DEBUG_INFO_FILENAME, - sizeof(debug_filepath)); - - file = filestream_open(debug_filepath, - RETRO_VFS_FILE_ACCESS_WRITE, RETRO_VFS_FILE_ACCESS_HINT_NONE); - - if (!file) - { - RARCH_ERR("Could not open debug info file for writing: %s\n", debug_filepath); - goto error; - } - -#ifdef HAVE_MENU - { - time_t time_; - char timedate[255]; - - timedate[0] = '\0'; - - time(&time_); - - setlocale(LC_TIME, ""); - - strftime(timedate, sizeof(timedate), - "%Y-%m-%d %H:%M:%S", localtime(&time_)); - - filestream_printf(file, "Log Date/Time: %s\n", timedate); - } -#endif - filestream_printf(file, "RetroArch Version: %s\n", PACKAGE_VERSION); - -#ifdef HAVE_LAKKA - if (frontend->get_lakka_version) - { - frontend->get_lakka_version(str, sizeof(str)); - filestream_printf(file, "Lakka Version: %s\n", str); - str[0] = '\0'; - } -#endif - - filestream_printf(file, "RetroArch Build Date: %s\n", __DATE__); -#ifdef HAVE_GIT_VERSION - filestream_printf(file, "RetroArch Git Commit: %s\n", retroarch_git_version); -#endif - - filestream_printf(file, "\n"); - - cpu_model = frontend_driver_get_cpu_model_name(); - - if (!string_is_empty(cpu_model)) - filestream_printf(file, "CPU Model Name: %s\n", cpu_model); - - retroarch_get_capabilities(RARCH_CAPABILITIES_CPU, str, sizeof(str)); - filestream_printf(file, "CPU Capabilities: %s\n", str); - - str[0] = '\0'; - - rarch_get_cpu_architecture_string(str, sizeof(str)); - - filestream_printf(file, "CPU Architecture: %s\n", str); - filestream_printf(file, "CPU Cores: %u\n", cpu_features_get_core_amount()); - - { - uint64_t memory_free = frontend_driver_get_free_memory(); - uint64_t memory_total = frontend_driver_get_total_memory(); - - filestream_printf(file, "Memory: %" PRIu64 "/%" PRIu64 " MB\n", memory_free / 1024 / 1024, memory_total / 1024 / 1024); - } - - filestream_printf(file, "GPU Device: %s\n", !string_is_empty(video_driver_get_gpu_device_string()) ? - video_driver_get_gpu_device_string() : "n/a"); - filestream_printf(file, "GPU API/Driver Version: %s\n", !string_is_empty(video_driver_get_gpu_api_version_string()) ? - video_driver_get_gpu_api_version_string() : "n/a"); - - filestream_printf(file, "\n"); - - video_context_driver_get_video_size(&mode_info); - - filestream_printf(file, "Window Resolution: %u x %u\n", mode_info.width, mode_info.height); - - { - float width = 0, height = 0, refresh = 0.0f; - gfx_ctx_metrics_t metrics; - - metrics.type = DISPLAY_METRIC_PIXEL_WIDTH; - metrics.value = &width; - - video_context_driver_get_metrics(&metrics); - - metrics.type = DISPLAY_METRIC_PIXEL_HEIGHT; - metrics.value = &height; - video_context_driver_get_metrics(&metrics); - - video_context_driver_get_refresh_rate(&refresh); - - filestream_printf(file, "Monitor Resolution: %d x %d @ %.2f Hz (configured for %.2f Hz)\n", (int)width, (int)height, refresh, settings->floats.video_refresh_rate); - } - - filestream_printf(file, "\n"); - - str[0] = '\0'; - - retroarch_get_capabilities(RARCH_CAPABILITIES_COMPILER, str, sizeof(str)); - filestream_printf(file, "%s\n", str); - - str[0] = '\0'; - - filestream_printf(file, "Frontend Identifier: %s\n", frontend->ident); - - if (frontend->get_name) - { - frontend->get_name(str, sizeof(str)); - filestream_printf(file, "Frontend Name: %s\n", str); - str[0] = '\0'; - } - - if (frontend->get_os) - { - int major = 0, minor = 0; - const char *warning = ""; - - frontend->get_os(str, sizeof(str), &major, &minor); - - if (strstr(str, "Build 16299")) - warning = " (WARNING: Fall Creator's Update detected... OpenGL performance may be low)"; - - filestream_printf(file, "Frontend OS: %s (v%d.%d)%s\n", str, major, minor, warning); - - str[0] = '\0'; - } - - filestream_printf(file, "\n"); - filestream_printf(file, "Input Devices (autoconfig is %s):\n", settings->bools.input_autodetect_enable ? "enabled" : "disabled"); - - for (i = 0; i < 4; i++) - { - if (input_is_autoconfigured(i)) - { - unsigned retro_id; - unsigned rebind = 0; - unsigned device = settings->uints.input_libretro_device[i]; - - device &= RETRO_DEVICE_MASK; - - if (device == RETRO_DEVICE_JOYPAD || device == RETRO_DEVICE_ANALOG) - { - for (retro_id = 0; retro_id < RARCH_ANALOG_BIND_LIST_END; retro_id++) - { - char descriptor[300]; - const struct retro_keybind *keybind = &input_config_binds[i][retro_id]; - const struct retro_keybind *auto_bind = (const struct retro_keybind*) - input_config_get_bind_auto(i, retro_id); - - input_config_get_bind_string(descriptor, - keybind, auto_bind, sizeof(descriptor)); - - if (!strstr(descriptor, "Auto") - && auto_bind - && !auto_bind->valid - && (auto_bind->joykey != 0xFFFF) - && !string_is_empty(auto_bind->joykey_label)) - rebind++; - } - } - - if (rebind) - filestream_printf(file, " - Port #%d autoconfigured (WARNING: %u keys rebinded):\n", i, rebind); - else - filestream_printf(file, " - Port #%d autoconfigured:\n", i); - - filestream_printf(file, " - Device name: %s (#%d)\n", - input_config_get_device_name(i), - input_autoconfigure_get_device_name_index(i)); - filestream_printf(file, " - Display name: %s\n", - input_config_get_device_display_name(i) ? - input_config_get_device_display_name(i) : "N/A"); - filestream_printf(file, " - Config path: %s\n", - input_config_get_device_display_name(i) ? - input_config_get_device_config_path(i) : "N/A"); - filestream_printf(file, " - VID/PID: %d/%d (0x%04X/0x%04X)\n", - input_config_get_vid(i), input_config_get_pid(i), - input_config_get_vid(i), input_config_get_pid(i)); - } - else - filestream_printf(file, " - Port #%d not autoconfigured\n", i); - } - - filestream_printf(file, "\n"); - - filestream_printf(file, "Drivers:\n"); - - { - gfx_ctx_ident_t ident_info = {0}; - input_driver_t *input_driver = NULL; - const input_device_driver_t *joypad_driver = NULL; - const char *driver = NULL; -#ifdef HAVE_MENU - driver = menu_driver_ident(); - - if (string_is_equal(driver, settings->arrays.menu_driver)) - filestream_printf(file, " - Menu: %s\n", - !string_is_empty(driver) ? driver : "n/a"); - else - filestream_printf(file, " - Menu: %s (configured for %s)\n", - !string_is_empty(driver) - ? driver - : "n/a", - !string_is_empty(settings->arrays.menu_driver) - ? settings->arrays.menu_driver - : "n/a"); -#endif - driver = video_driver_get_ident(); - - if (string_is_equal(driver, settings->arrays.video_driver)) - filestream_printf(file, " - Video: %s\n", - !string_is_empty(driver) - ? driver - : "n/a"); - else - filestream_printf(file, " - Video: %s (configured for %s)\n", - !string_is_empty(driver) - ? driver - : "n/a", - !string_is_empty(settings->arrays.video_driver) - ? settings->arrays.video_driver - : "n/a"); - - video_context_driver_get_ident(&ident_info); - filestream_printf(file, " - Video Context: %s\n", - ident_info.ident ? ident_info.ident : "n/a"); - - driver = NULL; - if (current_audio) - driver = current_audio->ident; - - if (string_is_equal(driver, settings->arrays.audio_driver)) - filestream_printf(file, " - Audio: %s\n", - !string_is_empty(driver) ? driver : "n/a"); - else - filestream_printf(file, " - Audio: %s (configured for %s)\n", - !string_is_empty(driver) ? driver : "n/a", - !string_is_empty(settings->arrays.audio_driver) ? settings->arrays.audio_driver : "n/a"); - - input_driver = current_input; - - if (input_driver && string_is_equal(input_driver->ident, settings->arrays.input_driver)) - filestream_printf(file, " - Input: %s\n", !string_is_empty(input_driver->ident) ? input_driver->ident : "n/a"); - else - filestream_printf(file, " - Input: %s (configured for %s)\n", !string_is_empty(input_driver->ident) ? input_driver->ident : "n/a", !string_is_empty(settings->arrays.input_driver) ? settings->arrays.input_driver : "n/a"); - - joypad_driver = (input_driver->get_joypad_driver ? input_driver->get_joypad_driver(current_input_data) : NULL); - - if (joypad_driver && string_is_equal(joypad_driver->ident, settings->arrays.input_joypad_driver)) - filestream_printf(file, " - Joypad: %s\n", !string_is_empty(joypad_driver->ident) ? joypad_driver->ident : "n/a"); - else - filestream_printf(file, " - Joypad: %s (configured for %s)\n", !string_is_empty(joypad_driver->ident) ? joypad_driver->ident : "n/a", !string_is_empty(settings->arrays.input_joypad_driver) ? settings->arrays.input_joypad_driver : "n/a"); - } - - filestream_printf(file, "\n"); - - filestream_printf(file, "Configuration related settings:\n"); - filestream_printf(file, " - Save on exit: %s\n", settings->bools.config_save_on_exit ? "yes" : "no"); - filestream_printf(file, " - Load content-specific core options automatically: %s\n", settings->bools.game_specific_options ? "yes" : "no"); - filestream_printf(file, " - Load override files automatically: %s\n", settings->bools.auto_overrides_enable ? "yes" : "no"); - filestream_printf(file, " - Load remap files automatically: %s\n", settings->bools.auto_remaps_enable ? "yes" : "no"); - filestream_printf(file, " - Sort saves in folders: %s\n", settings->bools.sort_savefiles_enable ? "yes" : "no"); - filestream_printf(file, " - Sort states in folders: %s\n", settings->bools.sort_savestates_enable ? "yes" : "no"); - filestream_printf(file, " - Write saves in content dir: %s\n", settings->bools.savefiles_in_content_dir ? "yes" : "no"); - filestream_printf(file, " - Write savestates in content dir: %s\n", settings->bools.savestates_in_content_dir ? "yes" : "no"); - - filestream_printf(file, "\n"); - - filestream_printf(file, "Auto load state: %s\n", settings->bools.savestate_auto_load ? "yes (WARNING: not compatible with all cores)" : "no"); - filestream_printf(file, "Auto save state: %s\n", settings->bools.savestate_auto_save ? "yes" : "no"); - - filestream_printf(file, "\n"); - - filestream_printf(file, "Buildbot cores URL: %s\n", settings->paths.network_buildbot_url); - filestream_printf(file, "Auto-extract downloaded archives: %s\n", settings->bools.network_buildbot_auto_extract_archive ? "yes" : "no"); - - { - size_t count = 0; - core_info_list_t *core_info_list = NULL; - struct string_list *list = NULL; - const char *ext = ".rdb"; - - /* remove dot */ - if (!string_is_empty(ext) && ext[0] == '.' && strlen(ext) > 1) - ext++; - - core_info_get_list(&core_info_list); - - if (core_info_list) - count = core_info_list->count; - - filestream_printf(file, "Core info: %u entries\n", count); - - count = 0; - - list = dir_list_new(settings->paths.path_content_database, ext, false, true, false, true); - - if (list) - { - count = list->size; - string_list_free(list); - } - - filestream_printf(file, "Databases: %u entries\n", count); - } - - filestream_printf(file, "\n"); - - filestream_printf(file, "Performance and latency-sensitive features (may have a large impact depending on the core):\n"); - filestream_printf(file, " - Video:\n"); - filestream_printf(file, " - Runahead: %s\n", settings->bools.run_ahead_enabled ? "yes (WARNING: not compatible with all cores)" : "no"); - filestream_printf(file, " - Rewind: %s\n", settings->bools.rewind_enable ? "yes (WARNING: not compatible with all cores)" : "no"); - filestream_printf(file, " - Hard GPU Sync: %s\n", settings->bools.video_hard_sync ? "yes" : "no"); - filestream_printf(file, " - Frame Delay: %u frames\n", settings->uints.video_frame_delay); - filestream_printf(file, " - Max Swapchain Images: %u\n", settings->uints.video_max_swapchain_images); - filestream_printf(file, " - Max Run Speed: %.1f x\n", settings->floats.fastforward_ratio); - filestream_printf(file, " - Sync to exact content framerate: %s\n", settings->bools.vrr_runloop_enable ? "yes (note: designed for G-Sync/FreeSync displays only)" : "no"); - filestream_printf(file, " - Fullscreen: %s\n", settings->bools.video_fullscreen ? "yes" : "no"); - filestream_printf(file, " - Windowed Fullscreen: %s\n", settings->bools.video_windowed_fullscreen ? "yes" : "no"); - filestream_printf(file, " - Threaded Video: %s\n", settings->bools.video_threaded ? "yes" : "no"); - filestream_printf(file, " - Vsync: %s\n", settings->bools.video_vsync ? "yes" : "no"); - filestream_printf(file, " - Vsync Swap Interval: %u frames\n", settings->uints.video_swap_interval); - filestream_printf(file, " - Black Frame Insertion: %s\n", settings->bools.video_black_frame_insertion ? "yes" : "no"); - filestream_printf(file, " - Bilinear Filtering: %s\n", settings->bools.video_smooth ? "yes" : "no"); - filestream_printf(file, " - Video CPU Filter: %s\n", !string_is_empty(settings->paths.path_softfilter_plugin) ? settings->paths.path_softfilter_plugin : "n/a"); - filestream_printf(file, " - CRT SwitchRes: %s\n", (settings->uints.crt_switch_resolution > CRT_SWITCH_NONE) ? "yes" : "no"); - filestream_printf(file, " - Video Shared Context: %s\n", settings->bools.video_shared_context ? "yes" : "no"); - -#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL) - { - video_shader_ctx_t shader_info = {0}; - - video_shader_driver_get_current_shader(&shader_info); - - if (shader_info.data) - { - if (string_is_equal(shader_info.data->path, runtime_shader_preset)) - filestream_printf(file, " - Video Shader: %s\n", !string_is_empty(runtime_shader_preset) ? runtime_shader_preset : "n/a"); - else - filestream_printf(file, " - Video Shader: %s (configured for %s)\n", !string_is_empty(shader_info.data->path) ? shader_info.data->path : "n/a", !string_is_empty(runtime_shader_preset) ? runtime_shader_preset : "n/a"); - } - else - filestream_printf(file, " - Video Shader: n/a\n"); - } -#endif - - filestream_printf(file, " - Audio:\n"); - filestream_printf(file, " - Audio Enabled: %s\n", settings->bools.audio_enable ? "yes" : "no (WARNING: content framerate will be incorrect)"); - filestream_printf(file, " - Audio Sync: %s\n", settings->bools.audio_sync ? "yes" : "no (WARNING: content framerate will be incorrect)"); - - { - const char *s = NULL; - - switch (settings->uints.audio_resampler_quality) - { - case RESAMPLER_QUALITY_DONTCARE: - s = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DONT_CARE); - break; - case RESAMPLER_QUALITY_LOWEST: - s = msg_hash_to_str(MSG_RESAMPLER_QUALITY_LOWEST); - break; - case RESAMPLER_QUALITY_LOWER: - s = msg_hash_to_str(MSG_RESAMPLER_QUALITY_LOWER); - break; - case RESAMPLER_QUALITY_HIGHER: - s = msg_hash_to_str(MSG_RESAMPLER_QUALITY_HIGHER); - break; - case RESAMPLER_QUALITY_HIGHEST: - s = msg_hash_to_str(MSG_RESAMPLER_QUALITY_HIGHEST); - break; - case RESAMPLER_QUALITY_NORMAL: - s = msg_hash_to_str(MSG_RESAMPLER_QUALITY_NORMAL); - break; - } - - filestream_printf(file, " - Resampler Quality: %s\n", !string_is_empty(s) ? s : "n/a"); - } - - filestream_printf(file, " - Audio Latency: %u ms\n", settings->uints.audio_latency); - filestream_printf(file, " - Dynamic Rate Control (DRC): %.3f\n", *audio_get_float_ptr(AUDIO_ACTION_RATE_CONTROL_DELTA)); - filestream_printf(file, " - Max Timing Skew: %.2f\n", settings->floats.audio_max_timing_skew); - filestream_printf(file, " - Output Rate: %u Hz\n", settings->uints.audio_out_rate); - filestream_printf(file, " - DSP Plugin: %s\n", !string_is_empty(settings->paths.path_audio_dsp_plugin) ? settings->paths.path_audio_dsp_plugin : "n/a"); - - { - core_info_list_t *core_info_list = NULL; - bool found = false; - - filestream_printf(file, "\n"); - filestream_printf(file, "Firmware files found:\n"); - - core_info_get_list(&core_info_list); - - if (core_info_list) - { - unsigned i; - - for (i = 0; i < core_info_list->count; i++) - { - core_info_t *info = &core_info_list->list[i]; - - if (!info) - continue; - - if (info->firmware_count) - { - unsigned j; - bool core_found = false; - - for (j = 0; j < info->firmware_count; j++) - { - core_info_firmware_t *firmware = &info->firmware[j]; - char path[PATH_MAX_LENGTH]; - - if (!firmware) - continue; - - path[0] = '\0'; - - fill_pathname_join( - path, - settings->paths.directory_system, - firmware->path, - sizeof(path)); - - if (filestream_exists(path)) - { - found = true; - - if (!core_found) - { - core_found = true; - filestream_printf(file, " - %s:\n", !string_is_empty(info->core_name) ? info->core_name : path_basename(info->path)); - } - - filestream_printf(file, " - %s (%s)\n", firmware->path, firmware->optional ? "optional" : "required"); - } - } - } - } - } - - if (!found) - filestream_printf(file, " - n/a\n"); - } - - filestream_close(file); - - RARCH_LOG("Wrote debug info to %s\n", debug_filepath); - - msg_hash_set_uint(MSG_HASH_USER_LANGUAGE, lang); - - return true; - -error: - return false; -} - -static void send_debug_info_cb(retro_task_t *task, - void *task_data, void *user_data, const char *error) -{ - if (task_data) - { - http_transfer_data_t *data = (http_transfer_data_t*)task_data; - - if (!data || data->len == 0) - { - RARCH_LOG("%s\n", msg_hash_to_str(MSG_FAILED_TO_SEND_DEBUG_INFO)); - - runloop_msg_queue_push( - msg_hash_to_str(MSG_FAILED_TO_SEND_DEBUG_INFO), - 2, 180, true, - NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); - free(task_data); - return; - } - - /* don't use string_is_equal() here instead of the memcmp() because the data isn't NULL-terminated */ - if (!string_is_empty(data->data) && data->len >= 2 && !memcmp(data->data, "OK", 2)) - { - char buf[32] = {0}; - struct string_list *list; - - memcpy(buf, data->data, data->len); - - list = string_split(buf, " "); - - if (list && list->size > 1) - { - unsigned id = 0; - char msg[PATH_MAX_LENGTH]; - - msg[0] = '\0'; - - sscanf(list->elems[1].data, "%u", &id); - - snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_SENT_DEBUG_INFO), id); - - RARCH_LOG("%s\n", msg); - - runloop_msg_queue_push( - msg, - 2, 600, true, - NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - } - - if (list) - string_list_free(list); - } - else - { - RARCH_LOG("%s\n", msg_hash_to_str(MSG_FAILED_TO_SEND_DEBUG_INFO)); - - runloop_msg_queue_push( - msg_hash_to_str(MSG_FAILED_TO_SEND_DEBUG_INFO), - 2, 180, true, - NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); - } - - free(task_data); - } - else - { - RARCH_LOG("%s\n", msg_hash_to_str(MSG_FAILED_TO_SEND_DEBUG_INFO)); - - runloop_msg_queue_push( - msg_hash_to_str(MSG_FAILED_TO_SEND_DEBUG_INFO), - 2, 180, true, - NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); - } -} - -static void rarch_send_debug_info(void) -{ - char debug_filepath[PATH_MAX_LENGTH]; - const char *url = "http://lobby.libretro.com/debuginfo/add/"; - char *info_buf = NULL; - const size_t param_buf_size = 65535; - char *param_buf = (char*)malloc(param_buf_size); - char *param_buf_tmp = NULL; - int param_buf_pos = 0; - int64_t len = 0; - const char *path_config = path_get(RARCH_PATH_CONFIG); - bool info_written = rarch_write_debug_info(); - - debug_filepath[0] = - param_buf[0] = '\0'; - - fill_pathname_resolve_relative( - debug_filepath, - path_config, - DEBUG_INFO_FILENAME, - sizeof(debug_filepath)); - - if (info_written) - filestream_read_file(debug_filepath, (void**)&info_buf, &len); - - if (string_is_empty(info_buf) || len == 0 || !info_written) - { - runloop_msg_queue_push( - msg_hash_to_str(MSG_FAILED_TO_SAVE_DEBUG_INFO), - 2, 180, true, - NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); - goto finish; - } - - RARCH_LOG("%s\n", msg_hash_to_str(MSG_SENDING_DEBUG_INFO)); - - runloop_msg_queue_push( - msg_hash_to_str(MSG_SENDING_DEBUG_INFO), - 2, 180, true, - NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - - param_buf_pos = (int)strlcpy(param_buf, "info=", param_buf_size); - param_buf_tmp = param_buf + param_buf_pos; - - net_http_urlencode(¶m_buf_tmp, info_buf); - - strlcat(param_buf, param_buf_tmp, param_buf_size - param_buf_pos); - - task_push_http_post_transfer(url, param_buf, true, NULL, send_debug_info_cb, NULL); - -finish: - if (param_buf) - free(param_buf); - if (info_buf) - free(info_buf); -} -#endif - void rarch_log_file_init(void) { char log_directory[PATH_MAX_LENGTH];