mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
Cleanups
This commit is contained in:
parent
69f9bc840d
commit
6b4d4447b2
@ -57,12 +57,6 @@
|
|||||||
#include "../../network/netplay/netplay_discovery.h"
|
#include "../../network/netplay/netplay_discovery.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
enum msg_hash_enums enum_idx;
|
|
||||||
char path[PATH_MAX_LENGTH];
|
|
||||||
} menu_file_transfer_t;
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ACTION_OK_LOAD_PRESET = 0,
|
ACTION_OK_LOAD_PRESET = 0,
|
||||||
@ -96,14 +90,7 @@ unsigned rpl_entry_selection_ptr = 0;
|
|||||||
unsigned rdb_entry_start_game_selection_ptr = 0;
|
unsigned rdb_entry_start_game_selection_ptr = 0;
|
||||||
size_t hack_shader_pass = 0;
|
size_t hack_shader_pass = 0;
|
||||||
|
|
||||||
/* HACK - we have to find some way to pass state inbetween
|
|
||||||
* function pointer callback functions that don't necessarily
|
|
||||||
* call each other. */
|
|
||||||
char *core_buf = NULL;
|
|
||||||
size_t core_len = 0;
|
|
||||||
|
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
|
|
||||||
#ifdef HAVE_LAKKA
|
#ifdef HAVE_LAKKA
|
||||||
static char lakka_project[128];
|
static char lakka_project[128];
|
||||||
|
|
||||||
@ -123,111 +110,12 @@ static char *lakka_get_project(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void cb_net_generic_subdir(void *task_data, void *user_data, const char *err)
|
void cb_net_generic_subdir(void *task_data, void *user_data, const char *err);
|
||||||
{
|
|
||||||
char subdir_path[PATH_MAX_LENGTH];
|
|
||||||
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
|
|
||||||
menu_file_transfer_t *state = (menu_file_transfer_t*)user_data;
|
|
||||||
|
|
||||||
subdir_path[0] = '\0';
|
|
||||||
|
|
||||||
if (!data || err)
|
|
||||||
goto finish;
|
|
||||||
|
|
||||||
memcpy(subdir_path, data->data, data->len * sizeof(char));
|
|
||||||
subdir_path[data->len] = '\0';
|
|
||||||
|
|
||||||
finish:
|
|
||||||
if (!err && !strstr(subdir_path, file_path_str(FILE_PATH_INDEX_DIRS_URL)))
|
|
||||||
{
|
|
||||||
char parent_dir[PATH_MAX_LENGTH];
|
|
||||||
|
|
||||||
parent_dir[0] = '\0';
|
|
||||||
|
|
||||||
fill_pathname_parent_dir(parent_dir,
|
|
||||||
state->path, sizeof(parent_dir));
|
|
||||||
|
|
||||||
/*generic_action_ok_displaylist_push(parent_dir, NULL,
|
|
||||||
subdir_path, 0, 0, 0, ACTION_OK_DL_CORE_CONTENT_DIRS_SUBDIR_LIST);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if (err)
|
|
||||||
RARCH_ERR("%s: %s\n", msg_hash_to_str(MSG_DOWNLOAD_FAILED), err);
|
|
||||||
|
|
||||||
if (data)
|
|
||||||
{
|
|
||||||
if (data->data)
|
|
||||||
free(data->data);
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user_data)
|
|
||||||
free(user_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* defined in menu_cbs_deferred_push */
|
/* defined in menu_cbs_deferred_push */
|
||||||
static void cb_net_generic(void *task_data, void *user_data, const char *err)
|
void cb_net_generic(void *task_data, void *user_data, const char *err);
|
||||||
{
|
|
||||||
bool refresh = false;
|
|
||||||
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
|
|
||||||
menu_file_transfer_t *state = (menu_file_transfer_t*)user_data;
|
|
||||||
|
|
||||||
if (core_buf)
|
|
||||||
free(core_buf);
|
|
||||||
|
|
||||||
|
|
||||||
core_buf = NULL;
|
|
||||||
core_len = 0;
|
|
||||||
|
|
||||||
if (!data || err)
|
|
||||||
goto finish;
|
|
||||||
|
|
||||||
core_buf = (char*)malloc((data->len+1) * sizeof(char));
|
|
||||||
|
|
||||||
if (!core_buf)
|
|
||||||
goto finish;
|
|
||||||
|
|
||||||
memcpy(core_buf, data->data, data->len * sizeof(char));
|
|
||||||
core_buf[data->len] = '\0';
|
|
||||||
core_len = data->len;
|
|
||||||
|
|
||||||
finish:
|
|
||||||
refresh = true;
|
|
||||||
menu_entries_ctl(MENU_ENTRIES_CTL_UNSET_REFRESH, &refresh);
|
|
||||||
|
|
||||||
if (err)
|
|
||||||
RARCH_ERR("%s: %s\n", msg_hash_to_str(MSG_DOWNLOAD_FAILED), err);
|
|
||||||
|
|
||||||
if (data)
|
|
||||||
{
|
|
||||||
if (data->data)
|
|
||||||
free(data->data);
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!err && !strstr(state->path, file_path_str(FILE_PATH_INDEX_DIRS_URL)))
|
|
||||||
{
|
|
||||||
char parent_dir[PATH_MAX_LENGTH];
|
|
||||||
menu_file_transfer_t *transf = NULL;
|
|
||||||
|
|
||||||
parent_dir[0] = '\0';
|
|
||||||
|
|
||||||
fill_pathname_parent_dir(parent_dir,
|
|
||||||
state->path, sizeof(parent_dir));
|
|
||||||
strlcat(parent_dir, file_path_str(FILE_PATH_INDEX_DIRS_URL), sizeof(parent_dir));
|
|
||||||
|
|
||||||
transf = (menu_file_transfer_t*)calloc(1, sizeof(*transf));
|
|
||||||
strlcpy(transf->path, parent_dir, sizeof(transf->path));
|
|
||||||
|
|
||||||
task_push_http_transfer(parent_dir, true, "index_dirs", cb_net_generic_subdir, transf);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state)
|
|
||||||
free(state);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int generic_action_ok_displaylist_push(const char *path,
|
int generic_action_ok_displaylist_push(const char *path,
|
||||||
const char *new_path,
|
const char *new_path,
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx,
|
const char *label, unsigned type, size_t idx, size_t entry_idx,
|
||||||
|
@ -103,10 +103,14 @@ enum
|
|||||||
ACTION_OK_DL_CONTENT_SETTINGS
|
ACTION_OK_DL_CONTENT_SETTINGS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
enum msg_hash_enums enum_idx;
|
||||||
|
char path[PATH_MAX_LENGTH];
|
||||||
|
} menu_file_transfer_t;
|
||||||
|
|
||||||
/* FIXME - Externs, refactor */
|
/* FIXME - Externs, refactor */
|
||||||
extern size_t hack_shader_pass;
|
extern size_t hack_shader_pass;
|
||||||
extern char *core_buf;
|
|
||||||
extern size_t core_len;
|
|
||||||
extern unsigned rpl_entry_selection_ptr;
|
extern unsigned rpl_entry_selection_ptr;
|
||||||
|
|
||||||
/* Function callbacks */
|
/* Function callbacks */
|
||||||
|
@ -83,7 +83,109 @@ static char new_lbl_entry[4096] = {0};
|
|||||||
static char new_entry[4096] = {0};
|
static char new_entry[4096] = {0};
|
||||||
static enum msg_hash_enums new_type = MSG_UNKNOWN;
|
static enum msg_hash_enums new_type = MSG_UNKNOWN;
|
||||||
|
|
||||||
|
/* HACK - we have to find some way to pass state inbetween
|
||||||
|
* function pointer callback functions that don't necessarily
|
||||||
|
* call each other. */
|
||||||
|
static char *core_buf = NULL;
|
||||||
|
static size_t core_len = 0;
|
||||||
|
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
|
void cb_net_generic_subdir(void *task_data, void *user_data, const char *err)
|
||||||
|
{
|
||||||
|
char subdir_path[PATH_MAX_LENGTH];
|
||||||
|
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
|
||||||
|
menu_file_transfer_t *state = (menu_file_transfer_t*)user_data;
|
||||||
|
|
||||||
|
subdir_path[0] = '\0';
|
||||||
|
|
||||||
|
if (!data || err)
|
||||||
|
goto finish;
|
||||||
|
|
||||||
|
memcpy(subdir_path, data->data, data->len * sizeof(char));
|
||||||
|
subdir_path[data->len] = '\0';
|
||||||
|
|
||||||
|
finish:
|
||||||
|
if (!err && !strstr(subdir_path, file_path_str(FILE_PATH_INDEX_DIRS_URL)))
|
||||||
|
{
|
||||||
|
char parent_dir[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
|
parent_dir[0] = '\0';
|
||||||
|
|
||||||
|
fill_pathname_parent_dir(parent_dir,
|
||||||
|
state->path, sizeof(parent_dir));
|
||||||
|
|
||||||
|
/*generic_action_ok_displaylist_push(parent_dir, NULL,
|
||||||
|
subdir_path, 0, 0, 0, ACTION_OK_DL_CORE_CONTENT_DIRS_SUBDIR_LIST);*/
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data)
|
||||||
|
{
|
||||||
|
if (data->data)
|
||||||
|
free(data->data);
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user_data)
|
||||||
|
free(user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cb_net_generic(void *task_data, void *user_data, const char *err)
|
||||||
|
{
|
||||||
|
bool refresh = false;
|
||||||
|
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
|
||||||
|
menu_file_transfer_t *state = (menu_file_transfer_t*)user_data;
|
||||||
|
|
||||||
|
if (core_buf)
|
||||||
|
free(core_buf);
|
||||||
|
|
||||||
|
|
||||||
|
core_buf = NULL;
|
||||||
|
core_len = 0;
|
||||||
|
|
||||||
|
if (!data || err)
|
||||||
|
goto finish;
|
||||||
|
|
||||||
|
core_buf = (char*)malloc((data->len+1) * sizeof(char));
|
||||||
|
|
||||||
|
if (!core_buf)
|
||||||
|
goto finish;
|
||||||
|
|
||||||
|
memcpy(core_buf, data->data, data->len * sizeof(char));
|
||||||
|
core_buf[data->len] = '\0';
|
||||||
|
core_len = data->len;
|
||||||
|
|
||||||
|
finish:
|
||||||
|
refresh = true;
|
||||||
|
menu_entries_ctl(MENU_ENTRIES_CTL_UNSET_REFRESH, &refresh);
|
||||||
|
|
||||||
|
if (data)
|
||||||
|
{
|
||||||
|
if (data->data)
|
||||||
|
free(data->data);
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!err && !strstr(state->path, file_path_str(FILE_PATH_INDEX_DIRS_URL)))
|
||||||
|
{
|
||||||
|
char parent_dir[PATH_MAX_LENGTH];
|
||||||
|
menu_file_transfer_t *transf = NULL;
|
||||||
|
|
||||||
|
parent_dir[0] = '\0';
|
||||||
|
|
||||||
|
fill_pathname_parent_dir(parent_dir,
|
||||||
|
state->path, sizeof(parent_dir));
|
||||||
|
strlcat(parent_dir, file_path_str(FILE_PATH_INDEX_DIRS_URL), sizeof(parent_dir));
|
||||||
|
|
||||||
|
transf = (menu_file_transfer_t*)calloc(1, sizeof(*transf));
|
||||||
|
strlcpy(transf->path, parent_dir, sizeof(transf->path));
|
||||||
|
|
||||||
|
task_push_http_transfer(parent_dir, true, "index_dirs", cb_net_generic_subdir, transf);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state)
|
||||||
|
free(state);
|
||||||
|
}
|
||||||
|
|
||||||
static void print_buf_lines(file_list_t *list, char *buf,
|
static void print_buf_lines(file_list_t *list, char *buf,
|
||||||
const char *label, int buf_size,
|
const char *label, int buf_size,
|
||||||
enum msg_file_type type, bool append, bool extended)
|
enum msg_file_type type, bool append, bool extended)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user