Create CONTENT_CTL_INIT

This commit is contained in:
twinaphex 2016-01-19 22:15:00 +01:00
parent 2836c9755a
commit ae704048bc
3 changed files with 15 additions and 18 deletions

View File

@ -536,7 +536,7 @@ static bool event_init_content(void)
if (!global->inited.core.no_content) if (!global->inited.core.no_content)
rarch_ctl(RARCH_CTL_FILL_PATHNAMES, NULL); rarch_ctl(RARCH_CTL_FILL_PATHNAMES, NULL);
if (!init_content_file()) if (!content_ctl(CONTENT_CTL_INIT, NULL))
return false; return false;
if (global->inited.core.no_content) if (global->inited.core.no_content)

View File

@ -688,7 +688,7 @@ static bool init_content_file_set_attribs(
} }
/** /**
* init_content_file: * content_init_file:
* *
* Initializes and loads a content file for the currently * Initializes and loads a content file for the currently
* selected libretro core. * selected libretro core.
@ -698,7 +698,7 @@ static bool init_content_file_set_attribs(
* *
* Returns : true if successful, otherwise false. * Returns : true if successful, otherwise false.
**/ **/
bool init_content_file(void) static bool content_init_file(void)
{ {
unsigned i; unsigned i;
struct retro_game_info *info = NULL; struct retro_game_info *info = NULL;
@ -729,8 +729,7 @@ bool init_content_file(void)
calloc(content->size, sizeof(*info)); calloc(content->size, sizeof(*info));
additional_path_allocs = string_list_new(); additional_path_allocs = string_list_new();
ret = load_content(info, content, special, additional_path_allocs); ret = load_content(info, content, special, additional_path_allocs);
for (i = 0; i < content->size; i++) for (i = 0; i < content->size; i++)
free((void*)info[i].data); free((void*)info[i].data);
@ -760,6 +759,8 @@ bool content_ctl(enum content_ctl_state state, void *data)
switch(state) switch(state)
{ {
case CONTENT_CTL_INIT:
return content_init_file();
case CONTENT_CTL_TEMPORARY_FREE: case CONTENT_CTL_TEMPORARY_FREE:
if (!temporary_content) if (!temporary_content)
return false; return false;

View File

@ -31,6 +31,15 @@ enum content_ctl_state
{ {
CONTENT_CTL_NONE = 0, CONTENT_CTL_NONE = 0,
/* Initializes and loads a content file for the currently
* selected libretro core.
*
* global->content_is_init will be set to the return value
* on exit.
*
* Returns : true if successful, otherwise false. */
CONTENT_CTL_INIT,
/* Frees temporary content handle. */ /* Frees temporary content handle. */
CONTENT_CTL_TEMPORARY_FREE CONTENT_CTL_TEMPORARY_FREE
}; };
@ -78,19 +87,6 @@ void load_ram_file(const char *path, int type);
*/ */
void save_ram_file(const char *path, int type); void save_ram_file(const char *path, int type);
/**
* init_content_file:
*
* Initializes and loads a content file for the currently
* selected libretro core.
*
* global->content_is_init will be set to the return value
* on exit.
*
* Returns : true if successful, otherwise false.
**/
bool init_content_file(void);
bool content_ctl(enum content_ctl_state state, void *data); bool content_ctl(enum content_ctl_state state, void *data);
#ifdef __cplusplus #ifdef __cplusplus