Exemple #1
0
static void lakka_init_items(lakka_handle_t *lakka,
      int i, menu_category_t *category,
      core_info_t *info, const char* path)
{
   int num_items, j;
   struct string_list *list = NULL;

   if (category == NULL || info == NULL)
      return;

   list = (struct string_list*)dir_list_new(path, info->supported_extensions, true);

   dir_list_sort(list, true);

   num_items = list ? list->size : 0;

   for (j = 0; j < num_items; j++)
   {
      if (list->elems[j].attr.i == RARCH_DIRECTORY) // is a directory
         lakka_init_items(lakka, i, category, info, list->elems[j].data);
      else
      {
         lakka_init_item(lakka, i, j, category, info, list, 
               path_basename(list->elems[j].data));
      }
   }

   string_list_free(list);
}
Exemple #2
0
static bool lakka_init_lists(void *data)
{
   int i;
   menu_handle_t *menu = (menu_handle_t*)data;
   lakka_handle_t *lakka = NULL;

   if (!menu)
      return false;

   lakka = (lakka_handle_t*)menu->userdata;

   if (!lakka)
      return false;

   if (!lakka_init_settings(menu))
      return false;

   for (i = 1; i < lakka->num_categories; i++)
   {
      core_info_t *info = NULL;
      menu_category_t *category = (menu_category_t*)&lakka->categories[i];
      core_info_list_t *info_list = (core_info_list_t*)g_extern.core_info;

      if (info_list)
         info = (core_info_t*)&info_list->list[i-1];

      if (!info)
         return false;

      strlcpy(category->name, info->display_name, sizeof(category->name));
      strlcpy(category->libretro, info->path, sizeof(category->libretro));
      category->alpha       = lakka->i_passive_alpha;
      category->zoom        = lakka->c_passive_zoom;
      category->active_item = 0;
      category->num_items   = 0;
      category->items       = (menu_item_t*)
         calloc(category->num_items + 1, sizeof(menu_item_t));

      if (! info->supports_no_game)
         lakka_init_items(lakka, i, category, info, g_settings.content_directory);
      else
         lakka_init_item(lakka, i, 0, category, info, NULL, 
               info->display_name);
   }

   return true;
}
Exemple #3
0
static void *lakka_init(void)
{
   int i, j;
   rgui_handle_t *rgui = (rgui_handle_t*)calloc(1, sizeof(*rgui));
   gl_t *gl = (gl_t*)driver.video_data;
   if (!rgui || !gl)
      return NULL;

   init_font(gl, g_settings.video.font_path, g_settings.video.font_size, gl->win_width, gl->win_height);

   lakka_init_core_info(rgui);
   categories = (menu_category_t*)calloc(num_categories, sizeof(menu_category_t));

   lakka_init_settings();

   for (i = 1; i < num_categories; i++)
   {
      core_info_t *info;
      core_info_list_t *info_list;
      menu_category_t *category = (menu_category_t*)&categories[i];

      info_list = (core_info_list_t*)rgui->core_info;
      info = NULL;

      if (info_list)
         info = (core_info_t*)&info_list->list[i-1];

      strlcpy(category->name, info->display_name, sizeof(category->name));
      strlcpy(category->libretro, info->path, sizeof(category->libretro));
      category->alpha       = 0.5;
      category->zoom        = C_PASSIVE_ZOOM;
      category->active_item = 0;
      category->num_items   = 0;
      category->items       = (menu_item_t*)calloc(category->num_items, sizeof(menu_item_t));

      lakka_init_items(i, category, info, g_settings.content_directory);
   }

   return rgui;
}
Exemple #4
0
static void *lakka_init(void)
{
   int i, j;
   menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
   gl_t *gl = (gl_t*)driver.video_data;
   if (!menu || !gl)
      return NULL;

   lakka_responsive();

   lakka_init_core_info(menu);
   categories = (menu_category_t*)calloc(num_categories, sizeof(menu_category_t));

   lakka_init_settings();

   for (i = 1; i < num_categories; i++)
   {
      core_info_t *info;
      core_info_list_t *info_list;
      menu_category_t *category = (menu_category_t*)&categories[i];

      info_list = (core_info_list_t*)menu->core_info;
      info = NULL;

      if (info_list)
         info = (core_info_t*)&info_list->list[i-1];

      strlcpy(category->name, info->display_name, sizeof(category->name));
      strlcpy(category->libretro, info->path, sizeof(category->libretro));
      category->alpha       = 0.5;
      category->zoom        = c_passive_zoom;
      category->active_item = 0;
      category->num_items   = 0;
      category->items       = (menu_item_t*)calloc(category->num_items, sizeof(menu_item_t));

      lakka_init_items(i, category, info, g_settings.content_directory);
   }

   return menu;
}
Exemple #5
0
static void lakka_init_items(int i, menu_category_t *category, core_info_t *info, const char* path)
{
   int num_items, j, n, k;
   struct string_list *list = (struct string_list*)dir_list_new(path, info->supported_extensions, true);

   dir_list_sort(list, true);

   num_items = list ? list->size : 0;

   for (j = 0; j < num_items; j++)
   {
      if (list->elems[j].attr.b) // is a directory
         lakka_init_items(i, category, info, list->elems[j].data);
      else
      {
         menu_item_t *item;

         n = category->num_items;

         category->num_items++;
         category->items = (menu_item_t*)realloc(category->items, category->num_items * sizeof(menu_item_t));
         item = (menu_item_t*)&category->items[n];

         strlcpy(item->name, path_basename(list->elems[j].data), sizeof(item->name));
         strlcpy(item->rom, list->elems[j].data, sizeof(item->rom));
         item->alpha          = i != menu_active_category ? 0 : n ? 0.5 : 1;
         item->zoom           = n ? I_PASSIVE_ZOOM : I_ACTIVE_ZOOM;
         item->y              = n ? VSPACING*(3+n) : VSPACING*2.4;
         item->active_subitem = 0;
         item->num_subitems   = 5;
         item->subitems       = (menu_subitem_t*)calloc(item->num_subitems, sizeof(menu_subitem_t));

         for (k = 0; k < item->num_subitems; k++)
         {
            menu_subitem_t *subitem = (menu_subitem_t*)&item->subitems[k];

            if (!subitem)
               continue;

            switch (k)
            {
               case 0:
                  strlcpy(subitem->name, "Run", sizeof(subitem->name));
                  break;
               case 1:
                  strlcpy(subitem->name, "Save State", sizeof(subitem->name));
                  break;
               case 2:
                  strlcpy(subitem->name, "Load State", sizeof(subitem->name));
                  break;
               case 3:
                  strlcpy(subitem->name, "Take Screenshot", sizeof(subitem->name));
                  break;
               case 4:
                  strlcpy(subitem->name, "Reset", sizeof(subitem->name));
                  break;
            }
            subitem->alpha = 0;
            subitem->zoom = k ? I_PASSIVE_ZOOM : I_ACTIVE_ZOOM;
            subitem->y = k ? VSPACING * (3+k) : VSPACING * 2.4;

            if (font_driver)
               font_driver->render_msg(font, subitem->name, &subitem->out);
         }
      }
   }
}