Exemple #1
0
static void nk_menu_context_reset(void *data)
{
   char iconpath[PATH_MAX_LENGTH] = {0};
   nk_menu_handle_t *nk              = (nk_menu_handle_t*)data;
   settings_t *settings           = config_get_ptr();
   unsigned width, height = 0;

   video_driver_get_size(&width, &height);

   if (!nk || !settings)
      return;

   fill_pathname_join(iconpath, settings->directory.assets,
         "nuklear", sizeof(iconpath));
   fill_pathname_slash(iconpath, sizeof(iconpath));

   nk_menu_layout(nk);
   nk_menu_init_device(nk);

   wimp_context_bg_destroy(nk);
   nk_menu_context_reset_textures(nk, iconpath);

   task_push_image_load(settings->path.menu_wallpaper, "cb_menu_wallpaper",
         menu_display_handle_wallpaper_upload, NULL);
}
Exemple #2
0
static void zrmenu_context_reset(void *data)
{
   char iconpath[PATH_MAX_LENGTH] = {0};
   zrmenu_handle_t *zr              = (zrmenu_handle_t*)data;
   settings_t *settings           = config_get_ptr();
   unsigned width, height = 0;

   video_driver_get_size(&width, &height);

   if (!zr || !settings)
      return;

   fill_pathname_join(iconpath, settings->assets_directory,
         "zahnrad", sizeof(iconpath));
   fill_pathname_slash(iconpath, sizeof(iconpath));

   zrmenu_layout(zr);
   zrmenu_init_device(zr);

   wimp_context_bg_destroy(zr);
   zrmenu_context_reset_textures(zr, iconpath);

   rarch_task_push_image_load(settings->menu.wallpaper, "cb_menu_wallpaper",
         menu_display_handle_wallpaper_upload, NULL);
}
Exemple #3
0
static void fill_string_join(char *out_path,
                             const char *append, size_t size)
{
    if (*out_path)
        fill_pathname_slash(out_path, size);

    retro_assert(strlcat(out_path, append, size) < size);
}
Exemple #4
0
void fill_pathname_dir(char *in_dir, const char *in_basename,
      const char *replace, size_t size)
{
   const char *base = NULL;
   fill_pathname_slash(in_dir, size);
   base = path_basename(in_basename);
   rarch_assert(strlcat(in_dir, base, size) < size);
   rarch_assert(strlcat(in_dir, replace, size) < size);
}
Exemple #5
0
void fill_pathname_join(char *out_path,
      const char *dir, const char *path, size_t size)
{
   rarch_assert(strlcpy(out_path, dir, size) < size);

   if (*out_path)
      fill_pathname_slash(out_path, size);

   rarch_assert(strlcat(out_path, path, size) < size);
}
Exemple #6
0
/**
 * fill_pathname_join:
 * @out_path           : output path
 * @dir                : directory
 * @path               : path
 * @size               : size of output path
 *
 * Joins a directory (@dir) and path (@path) together.
 * Makes sure not to get  two consecutive slashes
 * between directory and path.
 **/
void fill_pathname_join(char *out_path,
      const char *dir, const char *path, size_t size)
{
   if (out_path != dir)
      strlcpy(out_path, dir, size);

   if (*out_path)
      fill_pathname_slash(out_path, size);

   strlcat(out_path, path, size);
}
Exemple #7
0
void fill_pathname_join_special_ext(char *out_path,
      const char *dir,  const char *path,
      const char *last, const char *ext,
      size_t size)
{
   fill_pathname_join(out_path, dir, path, size);
   if (*out_path)
      fill_pathname_slash(out_path, size);

   strlcat(out_path, last, size);
   strlcat(out_path, ext, size);
}
Exemple #8
0
static void mui_context_reset(void *data)
{
   char iconpath[PATH_MAX_LENGTH] = {0};
   mui_handle_t *mui              = (mui_handle_t*)data;
   settings_t *settings           = config_get_ptr();

   if (!mui || !settings)
      return;

   fill_pathname_join(iconpath, settings->assets_directory,
         "glui", sizeof(iconpath));
   fill_pathname_slash(iconpath, sizeof(iconpath));

   mui_layout(mui);
   mui_context_bg_destroy(mui);
   mui_allocate_white_texture(mui);
   mui_context_reset_textures(mui, iconpath);

   rarch_task_push_image_load(settings->menu.wallpaper, "cb_menu_wallpaper",
         menu_display_handle_wallpaper_upload, NULL);
}
Exemple #9
0
static void xmb_context_reset(void *data)
{
   int k;
   char bgpath[PATH_MAX];
   char mediapath[PATH_MAX], themepath[PATH_MAX], iconpath[PATH_MAX];
   gl_t *gl = NULL;
   xmb_handle_t *xmb = NULL;
   menu_handle_t *menu = (menu_handle_t*)data;

   if (!menu)
      return;

   gl = (gl_t*)driver_video_resolve(NULL);

   if (!gl)
      return;

   xmb = (xmb_handle_t*)menu->userdata;

   if (!xmb)
      return;
    
   (void)gl;

   driver.gfx_use_rgba = true;

   if (!menu || !xmb)
      return;

   fill_pathname_join(bgpath, g_settings.assets_directory,
         "xmb", sizeof(bgpath));

   fill_pathname_join(bgpath, bgpath, "bg.png", sizeof(bgpath));

   if (path_file_exists(bgpath))
      xmb->bg = xmb_png_texture_load(bgpath);

   fill_pathname_join(mediapath, g_settings.assets_directory,
         "lakka", sizeof(mediapath));
   fill_pathname_join(themepath, mediapath, XMB_THEME, sizeof(themepath));
   fill_pathname_join(iconpath, themepath, xmb->icon_dir, sizeof(iconpath));
   fill_pathname_slash(iconpath, sizeof(iconpath));

   fill_pathname_join(xmb->textures[XMB_TEXTURE_BG].path, iconpath,
         "bg.png", sizeof(xmb->textures[XMB_TEXTURE_BG].path));
   fill_pathname_join(xmb->textures[XMB_TEXTURE_SETTINGS].path, iconpath,
         "settings.png", sizeof(xmb->textures[XMB_TEXTURE_SETTINGS].path));
   fill_pathname_join(xmb->textures[XMB_TEXTURE_SETTING].path, iconpath,
         "setting.png", sizeof(xmb->textures[XMB_TEXTURE_SETTING].path));
   fill_pathname_join(xmb->textures[XMB_TEXTURE_SUBSETTING].path, iconpath,
         "subsetting.png", sizeof(xmb->textures[XMB_TEXTURE_SUBSETTING].path));
   fill_pathname_join(xmb->textures[XMB_TEXTURE_ARROW].path, iconpath,
         "arrow.png", sizeof(xmb->textures[XMB_TEXTURE_ARROW].path));
   fill_pathname_join(xmb->textures[XMB_TEXTURE_RUN].path, iconpath,
         "run.png", sizeof(xmb->textures[XMB_TEXTURE_RUN].path));
   fill_pathname_join(xmb->textures[XMB_TEXTURE_RESUME].path, iconpath,
         "resume.png", sizeof(xmb->textures[XMB_TEXTURE_RESUME].path));
   fill_pathname_join(xmb->textures[XMB_TEXTURE_SAVESTATE].path, iconpath,
         "savestate.png", sizeof(xmb->textures[XMB_TEXTURE_SAVESTATE].path));
   fill_pathname_join(xmb->textures[XMB_TEXTURE_LOADSTATE].path, iconpath,
         "loadstate.png", sizeof(xmb->textures[XMB_TEXTURE_LOADSTATE].path));
   fill_pathname_join(xmb->textures[XMB_TEXTURE_SCREENSHOT].path, iconpath,
         "screenshot.png", sizeof(xmb->textures[XMB_TEXTURE_SCREENSHOT].path));
   fill_pathname_join(xmb->textures[XMB_TEXTURE_RELOAD].path, iconpath,
         "reload.png", sizeof(xmb->textures[XMB_TEXTURE_RELOAD].path));

   for (k = 0; k < XMB_TEXTURE_LAST; k++)
      xmb->textures[k].id = xmb_png_texture_load(xmb->textures[k].path);
}
Exemple #10
0
static void lakka_context_reset(void *data)
{
   int i, j, k;
   char mediapath[PATH_MAX], themepath[PATH_MAX], iconpath[PATH_MAX];
   lakka_handle_t *lakka = NULL;
   menu_handle_t *menu = (menu_handle_t*)data;

   if (!menu)
      return;

   lakka = (lakka_handle_t*)menu->userdata;

   if (!lakka)
      return;

#if defined(HAVE_FBO) && defined(LAKKA_EFFECTS)
   lakka_fbo_reset(lakka);
#endif

   driver.gfx_use_rgba = true;

   fill_pathname_join(mediapath, g_settings.assets_directory,
         "lakka", sizeof(mediapath));
   fill_pathname_join(themepath, mediapath, THEME, sizeof(themepath));
   fill_pathname_join(iconpath, themepath, lakka->icon_dir, sizeof(iconpath));
   fill_pathname_slash(iconpath, sizeof(iconpath));
   
   fill_pathname_join(lakka->textures[TEXTURE_BG].path, iconpath,
         "bg.png", sizeof(lakka->textures[TEXTURE_BG].path));
   fill_pathname_join(lakka->textures[TEXTURE_SETTINGS].path, iconpath,
         "settings.png", sizeof(lakka->textures[TEXTURE_SETTINGS].path));
   fill_pathname_join(lakka->textures[TEXTURE_SETTING].path, iconpath,
         "setting.png", sizeof(lakka->textures[TEXTURE_SETTING].path));
   fill_pathname_join(lakka->textures[TEXTURE_SUBSETTING].path, iconpath,
         "subsetting.png", sizeof(lakka->textures[TEXTURE_SUBSETTING].path));
   fill_pathname_join(lakka->textures[TEXTURE_ARROW].path, iconpath,
         "arrow.png", sizeof(lakka->textures[TEXTURE_ARROW].path));
   fill_pathname_join(lakka->textures[TEXTURE_RUN].path, iconpath,
         "run.png", sizeof(lakka->textures[TEXTURE_RUN].path));
   fill_pathname_join(lakka->textures[TEXTURE_RESUME].path, iconpath,
         "resume.png", sizeof(lakka->textures[TEXTURE_RESUME].path));
   fill_pathname_join(lakka->textures[TEXTURE_SAVESTATE].path, iconpath,
         "savestate.png", sizeof(lakka->textures[TEXTURE_SAVESTATE].path));
   fill_pathname_join(lakka->textures[TEXTURE_LOADSTATE].path, iconpath,
         "loadstate.png", sizeof(lakka->textures[TEXTURE_LOADSTATE].path));
   fill_pathname_join(lakka->textures[TEXTURE_SCREENSHOT].path, iconpath,
         "screenshot.png", sizeof(lakka->textures[TEXTURE_SCREENSHOT].path));
   fill_pathname_join(lakka->textures[TEXTURE_RELOAD].path, iconpath,
         "reload.png", sizeof(lakka->textures[TEXTURE_RELOAD].path));

   for (k = 0; k < TEXTURE_LAST; k++)
      lakka->textures[k].id = lakka_png_texture_load(lakka->textures[k].path);

   lakka_settings_context_reset();

   for (i = 1; i < lakka->num_categories; i++)
   {
      char core_id[PATH_MAX], texturepath[PATH_MAX], content_texturepath[PATH_MAX],
           mediapath[PATH_MAX], themepath[PATH_MAX];

      menu_category_t *category = (menu_category_t*)&lakka->categories[i];
      core_info_t *info = NULL;
      core_info_list_t *info_list = NULL;

      fill_pathname_join(mediapath, g_settings.assets_directory,
            "lakka", sizeof(mediapath));
      fill_pathname_join(themepath, mediapath, THEME, sizeof(themepath));
      fill_pathname_join(iconpath, themepath, lakka->icon_dir, sizeof(iconpath));
      fill_pathname_slash(iconpath, sizeof(iconpath));

      info_list = (core_info_list_t*)g_extern.core_info;
      info = NULL;

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

      if (info && info->systemname)
      {
         char *tmp = str_replace(info->systemname, "/", " ");
         strlcpy(core_id, tmp, sizeof(core_id));
         free(tmp);
      }
      else
         strlcpy(core_id, "default", sizeof(core_id));

      strlcpy(texturepath, iconpath, sizeof(texturepath));
      strlcat(texturepath, core_id, sizeof(texturepath));
      strlcat(texturepath, ".png", sizeof(texturepath));

      strlcpy(content_texturepath, iconpath, sizeof(content_texturepath));
      strlcat(content_texturepath, core_id, sizeof(content_texturepath));
      strlcat(content_texturepath, "-content.png", sizeof(content_texturepath));

      category->icon = lakka_png_texture_load(texturepath);
      category->item_icon = lakka_png_texture_load(content_texturepath);
      
      for (j = 0; j < category->num_items; j++)
      {
         menu_item_t *item = (menu_item_t*)&category->items[j];

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

            switch (k)
            {
               case 0:
                  subitem->icon = lakka->textures[TEXTURE_RUN].id;
                  break;
               case 1:
                  subitem->icon = lakka->textures[TEXTURE_SAVESTATE].id;
                  break;
               case 2:
                  subitem->icon = lakka->textures[TEXTURE_LOADSTATE].id;
                  break;
               case 3:
                  subitem->icon = lakka->textures[TEXTURE_SCREENSHOT].id;
                  break;
               case 4:
                  subitem->icon = lakka->textures[TEXTURE_RELOAD].id;
                  break;
            }
         }
      }
   }
}
Exemple #11
0
static void lakka_context_reset(void *data)
{
   int i, j, k;
   char path[256], dirpath[256];;
   rgui_handle_t *rgui = (rgui_handle_t*)data;
   gl_t *gl = (gl_t*)driver.video_data;

   if (!rgui)
      return;

   fill_pathname_join(dirpath, g_settings.assets_directory, "lakka", sizeof(dirpath));
   fill_pathname_slash(dirpath, sizeof(dirpath));

   fill_pathname_join(textures[TEXTURE_SETTINGS].path, dirpath, "settings.png", sizeof(textures[TEXTURE_SETTINGS].path));
   fill_pathname_join(textures[TEXTURE_SETTING].path, dirpath, "setting.png", sizeof(textures[TEXTURE_SETTING].path));
   fill_pathname_join(textures[TEXTURE_SUBSETTING].path, dirpath, "subsetting.png", sizeof(textures[TEXTURE_SUBSETTING].path));
   fill_pathname_join(textures[TEXTURE_ARROW].path, dirpath, "arrow.png", sizeof(textures[TEXTURE_ARROW].path));
   fill_pathname_join(textures[TEXTURE_RUN].path, dirpath, "run.png", sizeof(textures[TEXTURE_RUN].path));
   fill_pathname_join(textures[TEXTURE_RESUME].path, dirpath, "resume.png", sizeof(textures[TEXTURE_RESUME].path));
   fill_pathname_join(textures[TEXTURE_SAVESTATE].path, dirpath, "savestate.png", sizeof(textures[TEXTURE_SAVESTATE].path));
   fill_pathname_join(textures[TEXTURE_LOADSTATE].path, dirpath, "loadstate.png", sizeof(textures[TEXTURE_LOADSTATE].path));
   fill_pathname_join(textures[TEXTURE_SCREENSHOT].path, dirpath, "screenshot.png", sizeof(textures[TEXTURE_SCREENSHOT].path));
   fill_pathname_join(textures[TEXTURE_RELOAD].path, dirpath, "reload.png", sizeof(textures[TEXTURE_RELOAD].path));

   for (k = 0; k < TEXTURE_LAST; k++)
      textures[k].id = png_texture_load(textures[k].path, &dim, &dim);

   if (font_driver)
   {
      font_driver->render_msg(font, "Run", &run_label);
      font_driver->render_msg(font, "Resume", &resume_label);
   }

   lakka_settings_context_reset();
   for (i = 1; i < num_categories; i++)
   {
      menu_category_t *category = (menu_category_t*)&categories[i];

      char core_id[256], texturepath[256], content_texturepath[256], dirpath[256];
      core_info_t *info;
      core_info_list_t *info_list;

      fill_pathname_join(dirpath, g_settings.assets_directory, "lakka", sizeof(dirpath));
      fill_pathname_slash(dirpath, sizeof(dirpath));

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

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

      strlcpy(core_id, basename(info->path), sizeof(core_id));
      strlcpy(core_id, str_replace(core_id, ".so", ""), sizeof(core_id));
      strlcpy(core_id, str_replace(core_id, ".dll", ""), sizeof(core_id));
      strlcpy(core_id, str_replace(core_id, ".dylib", ""), sizeof(core_id));
      strlcpy(core_id, str_replace(core_id, "-libretro", ""), sizeof(core_id));
      strlcpy(core_id, str_replace(core_id, "_libretro", ""), sizeof(core_id));
      strlcpy(core_id, str_replace(core_id, "libretro-", ""), sizeof(core_id));
      strlcpy(core_id, str_replace(core_id, "libretro_", ""), sizeof(core_id));

      strlcpy(texturepath, dirpath, sizeof(texturepath));
      strlcat(texturepath, core_id, sizeof(texturepath));
      strlcat(texturepath, ".png", sizeof(texturepath));

      strlcpy(content_texturepath, dirpath, sizeof(content_texturepath));
      strlcat(content_texturepath, core_id, sizeof(content_texturepath));
      strlcat(content_texturepath, "-content.png", sizeof(content_texturepath));

      category->icon = png_texture_load(texturepath, &dim, &dim);
      category->item_icon = png_texture_load(content_texturepath, &dim, &dim);
      
      if (font_driver)
         font_driver->render_msg(font, category->name, &category->out);

      for (j = 0; j < category->num_items; j++)
      {
         menu_item_t *item = (menu_item_t*)&category->items[j];

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

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

            switch (k)
            {
               case 0:
                  subitem->icon = textures[TEXTURE_RUN].id;
                  break;
               case 1:
                  subitem->icon = textures[TEXTURE_SAVESTATE].id;
                  break;
               case 2:
                  subitem->icon = textures[TEXTURE_LOADSTATE].id;
                  break;
               case 3:
                  subitem->icon = textures[TEXTURE_SCREENSHOT].id;
                  break;
               case 4:
                  subitem->icon = textures[TEXTURE_RELOAD].id;
                  break;
            }

            if (font_driver)
               font_driver->render_msg(font, subitem->name, &subitem->out);
         }
      }
   }
}
void fill_pathname_application_special(char *s,
      size_t len, enum application_special_type type)
{
   switch (type)
   {
      case APPLICATION_SPECIAL_DIRECTORY_AUTOCONFIG:
         {
            settings_t *settings     = config_get_ptr();
            fill_pathname_join(s,
                  settings->paths.directory_autoconfig,
                  settings->arrays.input_joypad_driver,
                  len);
         }
         break;
      case APPLICATION_SPECIAL_DIRECTORY_CONFIG:
         {
            settings_t *settings     = config_get_ptr();

            /* Try config directory setting first,
             * fallback to the location of the current configuration file. */
            if (!string_is_empty(settings->paths.directory_menu_config))
               strlcpy(s, settings->paths.directory_menu_config, len);
            else if (!path_is_empty(RARCH_PATH_CONFIG))
               fill_pathname_basedir(s, path_get(RARCH_PATH_CONFIG), len);
         }
         break;
      case APPLICATION_SPECIAL_DIRECTORY_ASSETS_ZARCH_ICONS:
#ifdef HAVE_ZARCH
         {
         }
#endif
         break;
      case APPLICATION_SPECIAL_DIRECTORY_ASSETS_ZARCH_FONT:
#ifdef HAVE_ZARCH
         {
            char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
            s1[0]    = '\0';

            fill_pathname_application_special(s1,
                  PATH_MAX_LENGTH * sizeof(char),
                  APPLICATION_SPECIAL_DIRECTORY_ASSETS_ZARCH);
            fill_pathname_join(s,
                  s1, "Roboto-Condensed.ttf", len);

            free(s1);
         }
#endif
         break;
      case APPLICATION_SPECIAL_DIRECTORY_ASSETS_ZARCH:
#ifdef HAVE_ZARCH
         {
            settings_t *settings     = config_get_ptr();
            fill_pathname_join(s,
                  settings->paths.directory_assets,
                  "zarch",
                  len);
         }
#endif
         break;
      case APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS:
#ifdef HAVE_XMB
         {
            char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
            char *s2 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));

            s1[0] = s2[0] = '\0';

            fill_pathname_application_special(s1,
                  PATH_MAX_LENGTH * sizeof(char),
                  APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB);
            fill_pathname_join(s2, s1, "png",
                  PATH_MAX_LENGTH * sizeof(char)
                  );
            fill_pathname_slash(s2,
                  PATH_MAX_LENGTH * sizeof(char)
                  );
            strlcpy(s, s2, len);
            free(s1);
            free(s2);
         }
#endif
         break;
      case APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_BG:
#ifdef HAVE_XMB
         {
            settings_t *settings     = config_get_ptr();

            if (!string_is_empty(settings->paths.path_menu_wallpaper))
               strlcpy(s, settings->paths.path_menu_wallpaper, len);
            else
            {
               char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));

               s1[0] = '\0';

               fill_pathname_application_special(s1,
                     PATH_MAX_LENGTH * sizeof(char),
                     APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS);
               fill_pathname_join(s, s1,
                     file_path_str(FILE_PATH_BACKGROUND_IMAGE),
                     len);
               free(s1);
            }
         }
#endif
         break;
      case APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB:
#ifdef HAVE_XMB
         {
            char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
            char *s2 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
            settings_t *settings     = config_get_ptr();

            s1[0] = s2[0] = '\0';

            fill_pathname_join(
                  s1,
                  settings->paths.directory_assets,
                  "xmb",
                  PATH_MAX_LENGTH * sizeof(char)
                  );
            fill_pathname_join(s2,
                  s1, xmb_theme_ident(),
                  PATH_MAX_LENGTH * sizeof(char)
                  );
            strlcpy(s, s2, len);
            free(s1);
            free(s2);
         }
#endif
         break;
      case APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI:
#ifdef HAVE_MATERIALUI
         {
            settings_t *settings = config_get_ptr();

            fill_pathname_join(
                  s,
                  settings->paths.directory_assets,
                  "glui",
                  len);
         }
#endif
         break;
      case APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_ICONS:
#ifdef HAVE_MATERIALUI
         {
            char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));

            s1[0] = '\0';

            fill_pathname_application_special(s1,
                  PATH_MAX_LENGTH * sizeof(char),
                  APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI);
            fill_pathname_slash(s1,
                  PATH_MAX_LENGTH * sizeof(char)
                  );
            strlcpy(s, s1, len);

            free(s1);
         }
#endif
         break;
      case APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_FONT:
#ifdef HAVE_MATERIALUI
         {
            char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));

            s1[0] = '\0';

            fill_pathname_application_special(s1,
                  PATH_MAX_LENGTH * sizeof(char),
                  APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI);
            fill_pathname_join(s, s1, "font.ttf", len);

            free(s1);
         }
#endif
         break;
      case APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_FONT:
#ifdef HAVE_XMB
         {
            settings_t *settings = config_get_ptr();

            if (!string_is_empty(settings->paths.path_menu_xmb_font))
               strlcpy(s, settings->paths.path_menu_xmb_font, len);
            else
            {
               char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));

               s1[0] = '\0';

               fill_pathname_application_special(s1,
                     PATH_MAX_LENGTH * sizeof(char),
                     APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB);
               fill_pathname_join(s, s1,
                     file_path_str(FILE_PATH_TTF_FONT),
                     len);

               free(s1);
            }
         }
#endif
         break;
      case APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_CHEEVOS_BADGES:
      {
        char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
        char *s2 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
        settings_t *settings     = config_get_ptr();

        s1[0] = s2[0] = '\0';

        fill_pathname_join(s1,
              settings->paths.directory_thumbnails,
              "cheevos",
              len);
        fill_pathname_join(s2,
              s1, "badges",
              PATH_MAX_LENGTH * sizeof(char)
              );
        fill_pathname_slash(s2,
              PATH_MAX_LENGTH * sizeof(char)
              );
        strlcpy(s, s2, len);
        free(s1);
        free(s2);
      }
      break;

      case APPLICATION_SPECIAL_NONE:
      default:
         break;
   }
}
Exemple #13
0
int lutro_load(const char *path)
{
   char mainfile[PATH_MAX_LENGTH];
   char gamedir[PATH_MAX_LENGTH];

   strlcpy(mainfile, path, PATH_MAX_LENGTH);
   strlcpy(gamedir, path, PATH_MAX_LENGTH);

   if (path_is_directory(mainfile))
      fill_pathname_join(mainfile, gamedir, "main.lua", sizeof(mainfile));
   else
      path_basedir(gamedir);

   if (!strcmp(path_get_extension(mainfile), "lutro"))
   {
      fill_pathname(gamedir, mainfile, "/", sizeof(gamedir));
      lutro_unzip(mainfile, gamedir);
      fill_pathname_join(mainfile, gamedir, "main.lua", sizeof(mainfile));
   }

   fill_pathname_slash(gamedir, sizeof(gamedir));

   char package_path[PATH_MAX_LENGTH];
   snprintf(package_path, PATH_MAX_LENGTH, ";%s?.lua;%s?/init.lua", gamedir, gamedir);
   lutro_set_package_path(L, package_path);

   if(luaL_dofile(L, mainfile))
   {
       fprintf(stderr, "%s\n", lua_tostring(L, -1));
       lua_pop(L, 1);

       return 0;
   }

   lua_getglobal(L, "lutro");

   strlcpy(settings.gamedir, gamedir, PATH_MAX_LENGTH);

   lua_pushnumber(L, 0);
   lua_setfield(L, -2, "camera_x");

   lua_pushnumber(L, 0);
   lua_setfield(L, -2, "camera_y");

   lua_getfield(L, -1, "conf");

   if (lua_isnoneornil(L, -1))
   {
      puts("skipping custom configuration.");
   }
   else
   {
      lua_getfield(L, -2, "settings");

      if(lua_pcall(L, 1, 0, 0))
      {
         fprintf(stderr, "%s\n", lua_tostring(L, -1));
         lua_pop(L, 1);

         return 0;
      }

      lua_getfield(L, -1, "settings");

      lua_getfield(L, -1, "width");
      settings.width = lua_tointeger(L, -1);
      lua_remove(L, -1);

      lua_getfield(L, -1, "height");
      settings.height = lua_tointeger(L, -1);
      lua_remove(L, -1);

      lua_getfield(L, -1, "live_enable");
      settings.live_enable = lua_toboolean(L, -1);
      lua_remove(L, -1);

      lua_getfield(L, -1, "live_call_load");
      settings.live_call_load = lua_toboolean(L, -1);
      lua_remove(L, -1);
   }

   lua_pop(L, 1); // either lutro.settings or lutro.conf

   lutro_graphics_init();

#ifdef HAVE_INOTIFY
   if (settings.live_enable)
      lutro_live_init();
#endif

   lua_getfield(L, -1, "load");

   if (lua_isnoneornil(L, -1))
   {
      puts("skipping custom initialization.");
   }
   else
   {
      if(lua_pcall(L, 0, 0, 0))
      {
         fprintf(stderr, "%s\n", lua_tostring(L, -1));
         lua_pop(L, 1);

         return 0;
      }
   }

   lua_pop(L, 1);

   return 1;
}
Exemple #14
0
static void lakka_context_reset(void *data)
{
   int i, j, k;
   char path[256], mediapath[256], themepath[256], iconpath[256];
   menu_handle_t *menu = (menu_handle_t*)data;
   gl_t *gl = (gl_t*)driver.video_data;

   driver.gfx_use_rgba = true;

   if (!menu)
      return;

   fill_pathname_join(mediapath, g_settings.assets_directory, "lakka", sizeof(mediapath));
   fill_pathname_join(themepath, mediapath, THEME, sizeof(themepath));
   fill_pathname_join(iconpath, themepath, icon_dir, sizeof(iconpath));
   fill_pathname_slash(iconpath, sizeof(iconpath));
   
   fill_pathname_join(font_path, themepath, "font.ttf", sizeof(font_path));

   gl_font_init_first(&font_driver, &font, gl, font_path, lakka_font_size);

   fill_pathname_join(textures[TEXTURE_BG].path, iconpath, "bg.png", sizeof(textures[TEXTURE_BG].path));
   fill_pathname_join(textures[TEXTURE_SETTINGS].path, iconpath, "settings.png", sizeof(textures[TEXTURE_SETTINGS].path));
   fill_pathname_join(textures[TEXTURE_SETTING].path, iconpath, "setting.png", sizeof(textures[TEXTURE_SETTING].path));
   fill_pathname_join(textures[TEXTURE_SUBSETTING].path, iconpath, "subsetting.png", sizeof(textures[TEXTURE_SUBSETTING].path));
   fill_pathname_join(textures[TEXTURE_ARROW].path, iconpath, "arrow.png", sizeof(textures[TEXTURE_ARROW].path));
   fill_pathname_join(textures[TEXTURE_RUN].path, iconpath, "run.png", sizeof(textures[TEXTURE_RUN].path));
   fill_pathname_join(textures[TEXTURE_RESUME].path, iconpath, "resume.png", sizeof(textures[TEXTURE_RESUME].path));
   fill_pathname_join(textures[TEXTURE_SAVESTATE].path, iconpath, "savestate.png", sizeof(textures[TEXTURE_SAVESTATE].path));
   fill_pathname_join(textures[TEXTURE_LOADSTATE].path, iconpath, "loadstate.png", sizeof(textures[TEXTURE_LOADSTATE].path));
   fill_pathname_join(textures[TEXTURE_SCREENSHOT].path, iconpath, "screenshot.png", sizeof(textures[TEXTURE_SCREENSHOT].path));
   fill_pathname_join(textures[TEXTURE_RELOAD].path, iconpath, "reload.png", sizeof(textures[TEXTURE_RELOAD].path));

   for (k = 0; k < TEXTURE_LAST; k++)
      textures[k].id = png_texture_load(textures[k].path);

   lakka_settings_context_reset();
   for (i = 1; i < num_categories; i++)
   {
      menu_category_t *category = (menu_category_t*)&categories[i];

      char core_id[256], texturepath[256], content_texturepath[256], mediapath[256], themepath[256];
      core_info_t *info;
      core_info_list_t *info_list;

      fill_pathname_join(mediapath, g_settings.assets_directory, "lakka", sizeof(mediapath));
      fill_pathname_join(themepath, mediapath, THEME, sizeof(themepath));
      fill_pathname_join(iconpath, themepath, icon_dir, sizeof(iconpath));
      fill_pathname_slash(iconpath, sizeof(iconpath));

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

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

      if (info->systemname) {
         strlcpy(core_id, info->systemname, sizeof(core_id));
         strlcpy(core_id, str_replace(core_id, "/", " "), sizeof(core_id));
      } else {
         strlcpy(core_id, "default", sizeof(core_id));
      }

      strlcpy(texturepath, iconpath, sizeof(texturepath));
      strlcat(texturepath, core_id, sizeof(texturepath));
      strlcat(texturepath, ".png", sizeof(texturepath));

      strlcpy(content_texturepath, iconpath, sizeof(content_texturepath));
      strlcat(content_texturepath, core_id, sizeof(content_texturepath));
      strlcat(content_texturepath, "-content.png", sizeof(content_texturepath));

      category->icon = png_texture_load(texturepath);
      category->item_icon = png_texture_load(content_texturepath);
      
      for (j = 0; j < category->num_items; j++)
      {
         menu_item_t *item = (menu_item_t*)&category->items[j];

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

            switch (k)
            {
               case 0:
                  subitem->icon = textures[TEXTURE_RUN].id;
                  break;
               case 1:
                  subitem->icon = textures[TEXTURE_SAVESTATE].id;
                  break;
               case 2:
                  subitem->icon = textures[TEXTURE_LOADSTATE].id;
                  break;
               case 3:
                  subitem->icon = textures[TEXTURE_SCREENSHOT].id;
                  break;
               case 4:
                  subitem->icon = textures[TEXTURE_RELOAD].id;
                  break;
            }
         }
      }
   }
}