Пример #1
0
/* Initializes and loads a content file for the currently
 * selected libretro core. */
bool content_init(void)
{
   temporary_content = string_list_new();
   if (!temporary_content)
      goto error;

   if (!content_file_init(temporary_content))
      goto error;

   _content_is_inited = true;
   return true;

error:
   content_deinit();
   return false;
}
Пример #2
0
/* Initializes and loads a content file for the currently
 * selected libretro core. */
bool content_init(void)
{
   content_information_ctx_t content_ctx;

   bool ret                                   = true;
   char *error_string                         = 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);

   content_ctx.temporary_content              = temporary_content;
   content_ctx.history_list_enable            = false;
   content_ctx.directory_system               = NULL;
   content_ctx.directory_cache                = NULL;
   content_ctx.valid_extensions               = NULL;
   content_ctx.block_extract                  = false;
   content_ctx.need_fullpath                  = false;
   content_ctx.set_supports_no_game_enable    = false;

   content_ctx.subsystem.data                 = NULL;
   content_ctx.subsystem.size                 = 0;
   
   if (sys_info)
   {
      content_ctx.history_list_enable         = settings->history_list_enable;
      content_ctx.set_supports_no_game_enable = settings->set_supports_no_game_enable;

      if (!string_is_empty(settings->directory.system))
         content_ctx.directory_system         = strdup(settings->directory.system);
      if (!string_is_empty(settings->directory.cache))
         content_ctx.directory_cache          = strdup(settings->directory.cache);
      if (!string_is_empty(sys_info->info.valid_extensions))
         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;

      content_ctx.subsystem.data              = sys_info->subsystem.data;
      content_ctx.subsystem.size              = sys_info->subsystem.size;
   }

   if (     !temporary_content 
         || !content_file_init(&content_ctx, &error_string))
   {
      content_deinit();

      ret = false;
      goto end;
   }

   _content_is_inited = true;

end:
   if (content_ctx.directory_system)
      free(content_ctx.directory_system);
   if (content_ctx.directory_cache)
      free(content_ctx.directory_cache);
   if (content_ctx.valid_extensions)
      free(content_ctx.valid_extensions);

   if (error_string)
   {
      if (ret)
      {
         RARCH_LOG("%s\n", error_string);
      }
      else
      {
         RARCH_ERR("%s\n", error_string);
      }
      runloop_msg_queue_push(error_string, 2, ret ? 1 : 180, true);
      free(error_string);
   }

   return ret;
}