(task_content.c) Reduce dependency on settings_t struct
This commit is contained in:
parent
8c8aaf5bb8
commit
b9602ef57e
|
@ -108,8 +108,10 @@ typedef struct content_stream
|
||||||
typedef struct content_information_ctx
|
typedef struct content_information_ctx
|
||||||
{
|
{
|
||||||
char *valid_extensions;
|
char *valid_extensions;
|
||||||
|
char *directory_cache;
|
||||||
bool block_extract;
|
bool block_extract;
|
||||||
bool need_fullpath;
|
bool need_fullpath;
|
||||||
|
bool set_supports_no_game_enable;
|
||||||
} content_information_ctx_t;
|
} content_information_ctx_t;
|
||||||
|
|
||||||
static struct string_list *temporary_content = NULL;
|
static struct string_list *temporary_content = NULL;
|
||||||
|
@ -349,7 +351,6 @@ static bool load_content_from_compressed_archive(
|
||||||
char new_basedir[PATH_MAX_LENGTH];
|
char new_basedir[PATH_MAX_LENGTH];
|
||||||
ssize_t new_path_len = 0;
|
ssize_t new_path_len = 0;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
|
|
||||||
if (content_ctx->block_extract)
|
if (content_ctx->block_extract)
|
||||||
return true;
|
return true;
|
||||||
|
@ -359,7 +360,7 @@ static bool load_content_from_compressed_archive(
|
||||||
RARCH_LOG("Compressed file in case of need_fullpath."
|
RARCH_LOG("Compressed file in case of need_fullpath."
|
||||||
" Now extracting to temporary directory.\n");
|
" Now extracting to temporary directory.\n");
|
||||||
|
|
||||||
strlcpy(new_basedir, settings->directory.cache,
|
strlcpy(new_basedir, content_ctx->directory_cache,
|
||||||
sizeof(new_basedir));
|
sizeof(new_basedir));
|
||||||
|
|
||||||
if (string_is_empty(new_basedir) || !path_is_directory(new_basedir))
|
if (string_is_empty(new_basedir) || !path_is_directory(new_basedir))
|
||||||
|
@ -411,7 +412,6 @@ static bool content_file_init_extract(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
|
|
||||||
for (i = 0; i < content->size; i++)
|
for (i = 0; i < content->size; i++)
|
||||||
{
|
{
|
||||||
|
@ -444,8 +444,8 @@ static bool content_file_init_extract(
|
||||||
|
|
||||||
if (!valid_ext || !file_archive_extract_file(temp_content,
|
if (!valid_ext || !file_archive_extract_file(temp_content,
|
||||||
sizeof(temp_content), valid_ext,
|
sizeof(temp_content), valid_ext,
|
||||||
!string_is_empty(settings->directory.cache) ?
|
!string_is_empty(content_ctx->directory_cache) ?
|
||||||
settings->directory.cache : NULL,
|
content_ctx->directory_cache : NULL,
|
||||||
new_path, sizeof(new_path)))
|
new_path, sizeof(new_path)))
|
||||||
{
|
{
|
||||||
char str[1024];
|
char str[1024];
|
||||||
|
@ -601,12 +601,12 @@ static const struct retro_subsystem_info *content_file_init_subsystem(
|
||||||
|
|
||||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &sys_info);
|
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &sys_info);
|
||||||
|
|
||||||
if (sys_info)
|
if (!sys_info)
|
||||||
special =
|
goto error;
|
||||||
libretro_find_subsystem_info(
|
|
||||||
sys_info->subsystem.data,
|
special = libretro_find_subsystem_info(
|
||||||
sys_info->subsystem.size,
|
sys_info->subsystem.data, sys_info->subsystem.size,
|
||||||
path_get(RARCH_PATH_SUBSYSTEM));
|
path_get(RARCH_PATH_SUBSYSTEM));
|
||||||
|
|
||||||
if (!special)
|
if (!special)
|
||||||
{
|
{
|
||||||
|
@ -674,15 +674,13 @@ static bool content_file_init_set_attribs(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
|
|
||||||
attr.i = content_ctx->block_extract;
|
attr.i = content_ctx->block_extract;
|
||||||
attr.i |= content_ctx->need_fullpath << 1;
|
attr.i |= content_ctx->need_fullpath << 1;
|
||||||
attr.i |= (!content_does_not_need_content()) << 2;
|
attr.i |= (!content_does_not_need_content()) << 2;
|
||||||
|
|
||||||
if (path_is_empty(RARCH_PATH_CONTENT)
|
if (path_is_empty(RARCH_PATH_CONTENT)
|
||||||
&& content_does_not_need_content()
|
&& content_does_not_need_content()
|
||||||
&& settings->set_supports_no_game_enable)
|
&& content_ctx->set_supports_no_game_enable)
|
||||||
string_list_append(content, "", attr);
|
string_list_append(content, "", attr);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -809,20 +807,25 @@ bool content_init(void)
|
||||||
content_information_ctx_t content_ctx;
|
content_information_ctx_t content_ctx;
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
char *error_string = NULL;
|
char *error_string = NULL;
|
||||||
temporary_content = string_list_new();
|
|
||||||
rarch_system_info_t *sys_info = NULL;
|
rarch_system_info_t *sys_info = NULL;
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
temporary_content = string_list_new();
|
||||||
|
|
||||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &sys_info);
|
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &sys_info);
|
||||||
|
|
||||||
content_ctx.valid_extensions = NULL;
|
content_ctx.directory_cache = NULL;
|
||||||
content_ctx.block_extract = false;
|
content_ctx.valid_extensions = NULL;
|
||||||
content_ctx.need_fullpath = false;
|
content_ctx.block_extract = false;
|
||||||
|
content_ctx.need_fullpath = false;
|
||||||
|
content_ctx.set_supports_no_game_enable = false;
|
||||||
|
|
||||||
if (sys_info)
|
if (sys_info)
|
||||||
{
|
{
|
||||||
content_ctx.valid_extensions = strdup(sys_info->info.valid_extensions);
|
content_ctx.set_supports_no_game_enable = settings->set_supports_no_game_enable;
|
||||||
content_ctx.block_extract = sys_info->info.block_extract;
|
content_ctx.directory_cache = strdup(settings->directory.cache);
|
||||||
content_ctx.need_fullpath = sys_info->info.need_fullpath;
|
content_ctx.valid_extensions = strdup(sys_info->info.valid_extensions);
|
||||||
|
content_ctx.block_extract = sys_info->info.block_extract;
|
||||||
|
content_ctx.need_fullpath = sys_info->info.need_fullpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !temporary_content
|
if ( !temporary_content
|
||||||
|
@ -837,6 +840,8 @@ bool content_init(void)
|
||||||
_content_is_inited = true;
|
_content_is_inited = true;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
if (content_ctx.directory_cache)
|
||||||
|
free(content_ctx.directory_cache);
|
||||||
if (content_ctx.valid_extensions)
|
if (content_ctx.valid_extensions)
|
||||||
free(content_ctx.valid_extensions);
|
free(content_ctx.valid_extensions);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue