static int action_toggle_mainmenu(unsigned type, const char *label,
      unsigned action)
{
   menu_file_list_cbs_t *cbs = NULL;
   unsigned push_list = 0;
   menu_handle_t *menu = menu_driver_resolve();
   if (!menu)
      return -1;

   if (file_list_get_size(menu->menu_list->menu_stack) == 1)
   {
      if (!strcmp(driver.menu_ctx->ident, "xmb"))
      {
         menu->navigation.selection_ptr = 0;
         switch (action)
         {
            case MENU_ACTION_LEFT:
               if (menu->categories.selection_ptr == 0)
                  break;
               push_list = 1;
               break;
            case MENU_ACTION_RIGHT:
               if (menu->categories.selection_ptr == (menu->categories.size - 1))
                  break;
               push_list = 1;
               break;
         }
      }
   }
   else 
      push_list = 2;

   cbs = (menu_file_list_cbs_t*)
      menu_list_get_actiondata_at_offset(menu->menu_list->selection_buf,
            menu->navigation.selection_ptr);

   switch (push_list)
   {
      case 1:
         if (driver.menu_ctx->list_cache)
            driver.menu_ctx->list_cache(true, action);

         if (cbs && cbs->action_content_list_switch)
            return cbs->action_content_list_switch(
                  menu->menu_list->selection_buf,
                  menu->menu_list->menu_stack,
                  "",
                  "",
                  0);
         break;
      case 2:
         action_toggle_scroll(0, "", action);
         break;
      case 0:
      default:
         break;
   }

   return 0;
}
Beispiel #2
0
size_t menu_entries_get_size(void)
{
   menu_list_t *menu_list         = menu_entries_list;
   if (!menu_list)
      return 0;
   return file_list_get_size(menu_list_get_selection(menu_list, 0));
}
Beispiel #3
0
size_t menu_entries_get_size(void)
{
   menu_list_t *menu_list         = menu_list_get_ptr();
   if (!menu_list)
      return 0;
   return file_list_get_size(menu_list->selection_buf[0]);
}
Beispiel #4
0
size_t menu_entries_get_size(void)
{
   menu_list_t *menu_list         = NULL;
   menu_entries_ctl(MENU_ENTRIES_CTL_LIST_GET, &menu_list);
   if (!menu_list)
      return 0;
   return file_list_get_size(menu_list->selection_buf[0]);
}
Beispiel #5
0
size_t file_list_get_entry_index(const file_list_t *list)
{
   size_t size = 0;
   if (!list)
      return 0;
   size = file_list_get_size(list);
   return list->list[size].entry_idx;
}
Beispiel #6
0
size_t file_list_get_directory_ptr(const file_list_t *list)
{
   size_t size;
   if (!list)
      return 0;

   size = file_list_get_size(list);
   return list->list[size].directory_ptr;
}
Beispiel #7
0
void menu_list_pop_stack(menu_list_t *list)
{
   menu_handle_t *menu = menu_driver_get_ptr();
   if (!menu || !list)
      return;

   if (file_list_get_size(list->menu_stack) <= 1)
      return;

   menu_driver_list_cache(false, 0);

   menu_list_pop(list->menu_stack, &menu->navigation.selection_ptr);
   menu->need_refresh = true;
}
Beispiel #8
0
void menu_list_pop_stack(menu_list_t *list)
{
   if (!list)
      return;

   if (file_list_get_size(list->menu_stack) > 1)
   {
#ifdef HAVE_XMB
      file_list_copy(driver.menu->menu_list->selection_buf, driver.menu->menu_list->selection_buf_old);
      file_list_copy(driver.menu->menu_list->menu_stack, driver.menu->menu_list->menu_stack_old);
      driver.menu->selection_ptr_old = driver.menu->selection_ptr;
#endif
      menu_list_pop(list->menu_stack, &driver.menu->selection_ptr);
      driver.menu->need_refresh = true;
   }
}
Beispiel #9
0
static void xmb_selection_pointer_changed(void)
{
   int i, current, end;
   xmb_handle_t *xmb = (xmb_handle_t*)driver.menu->userdata;

   if (!xmb)
      return;

   current = driver.menu->selection_ptr;
   end = file_list_get_size(driver.menu->selection_buf);

   for (i = 0; i < end; i++)
   {
      float iy;
      float ia = 0.5;
      float iz = 0.5;
      xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset(
            driver.menu->selection_buf, i);

      if (!node)
         continue;

      iy = (i < current) ? xmb->vspacing *
         (i - current + xmb->above_item_offset) :
         xmb->vspacing * (i - current + xmb->under_item_offset);

      if (i == current)
      {
         ia = 1.0;
         iz = 1.0;
         iy = xmb->vspacing * xmb->active_item_factor;
      }

      add_tween(XMB_DELAY, ia, &node->alpha, &inOutQuad, NULL);
      add_tween(XMB_DELAY, iz, &node->zoom,  &inOutQuad, NULL);
      add_tween(XMB_DELAY, iy, &node->y,     &inOutQuad, NULL);
   }
}
Beispiel #10
0
static void rmenu_xui_render(void)
{
   size_t begin, end;
   char title[256];
   const char *dir = NULL;
   unsigned menu_type = 0;
   unsigned menu_type_is = 0;

   if (!driver.menu || driver.menu->need_refresh && 
         (g_extern.lifecycle_state & (1ULL << MODE_MENU))
         && !driver.menu->msg_force)
      return;

   begin = driver.menu->selection_ptr;
   end   = file_list_get_size(driver.menu->selection_buf);

   rmenu_xui_render_background();

   file_list_get_last(driver.menu->menu_stack, &dir, &menu_type);

   if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->type_is)
      menu_type_is = driver.menu_ctx->backend->type_is(menu_type);

   if (menu_type == MENU_SETTINGS_CORE)
      snprintf(title, sizeof(title), "CORE SELECTION %s", dir);
   else if (menu_type == MENU_SETTINGS_DEFERRED_CORE)
      snprintf(title, sizeof(title), "DETECTED CORES %s", dir);
   else if (menu_type == MENU_SETTINGS_CONFIG)
      snprintf(title, sizeof(title), "CONFIG %s", dir);
   else if (menu_type == MENU_SETTINGS_DISK_APPEND)
      snprintf(title, sizeof(title), "DISK APPEND %s", dir);
   else if (menu_type == MENU_SETTINGS_VIDEO_OPTIONS)
      strlcpy(title, "VIDEO OPTIONS", sizeof(title));
   else if (menu_type == MENU_SETTINGS_INPUT_OPTIONS)
      strlcpy(title, "INPUT OPTIONS", sizeof(title));
   else if (menu_type == MENU_SETTINGS_OVERLAY_OPTIONS)
      strlcpy(title, "OVERLAY OPTIONS", sizeof(title));
   else if (menu_type == MENU_SETTINGS_NETPLAY_OPTIONS)
      strlcpy(title, "NETPLAY OPTIONS", sizeof(title));
   else if (menu_type == MENU_SETTINGS_PATH_OPTIONS)
      strlcpy(title, "PATH OPTIONS", sizeof(title));
   else if (menu_type == MENU_SETTINGS_OPTIONS)
      strlcpy(title, "SETTINGS", sizeof(title));
   else if (menu_type == MENU_SETTINGS_DRIVERS)
      strlcpy(title, "DRIVER OPTIONS", sizeof(title));
   else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS)
      strlcpy(title, "PERFORMANCE COUNTERS", sizeof(title));
   else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS_LIBRETRO)
      strlcpy(title, "CORE PERFORMANCE COUNTERS", sizeof(title));
   else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS_FRONTEND)
      strlcpy(title, "FRONTEND PERFORMANCE COUNTERS", sizeof(title));
#ifdef HAVE_SHADER_MANAGER
   else if (menu_type == MENU_SETTINGS_SHADER_OPTIONS)
      strlcpy(title, "SHADER OPTIONS", sizeof(title));
#endif
   else if (menu_type == MENU_SETTINGS_FONT_OPTIONS)
      strlcpy(title, "FONT OPTIONS", sizeof(title));
   else if (menu_type == MENU_SETTINGS_GENERAL_OPTIONS)
      strlcpy(title, "GENERAL OPTIONS", sizeof(title));
   else if (menu_type == MENU_SETTINGS_AUDIO_OPTIONS)
      strlcpy(title, "AUDIO OPTIONS", sizeof(title));
   else if (menu_type == MENU_SETTINGS_DISK_OPTIONS)
      strlcpy(title, "DISK OPTIONS", sizeof(title));
   else if (menu_type == MENU_SETTINGS_CORE_OPTIONS)
      strlcpy(title, "CORE OPTIONS", sizeof(title));
   else if (menu_type == MENU_SETTINGS_CORE_INFO)
      strlcpy(title, "CORE INFO", sizeof(title));		  
   else if (menu_type == MENU_SETTINGS_PRIVACY_OPTIONS)
      strlcpy(title, "PRIVACY OPTIONS", sizeof(title)); 	  
#ifdef HAVE_SHADER_MANAGER
   else if (menu_type_is == MENU_SETTINGS_SHADER_OPTIONS)
      snprintf(title, sizeof(title), "SHADER %s", dir);
#endif
   else if ((menu_type == MENU_SETTINGS_INPUT_OPTIONS) ||
         (menu_type == MENU_SETTINGS_PATH_OPTIONS) ||
         (menu_type == MENU_SETTINGS_OPTIONS) ||
         (menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT || menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT_2) ||
         menu_type == MENU_SETTINGS_CUSTOM_BIND ||
         menu_type == MENU_START_SCREEN ||
         menu_type == MENU_SETTINGS)
      snprintf(title, sizeof(title), "MENU %s", dir);
   else if (menu_type == MENU_SETTINGS_OPEN_HISTORY)
      strlcpy(title, "LOAD HISTORY", sizeof(title));
   else if (menu_type == MENU_INFO_SCREEN)
      strlcpy(title, "INFO", sizeof(title));
#ifdef HAVE_OVERLAY
   else if (menu_type == MENU_SETTINGS_OVERLAY_PRESET)
      snprintf(title, sizeof(title), "OVERLAY %s", dir);
#endif
   else if (menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER)
      snprintf(title, sizeof(title), "FILTER %s", dir);
   else if (menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER)
      snprintf(title, sizeof(title), "DSP FILTER %s", dir);
   else if (menu_type == MENU_BROWSER_DIR_PATH)
      snprintf(title, sizeof(title), "BROWSER DIR %s", dir);
   else if (menu_type == MENU_CONTENT_DIR_PATH)
      snprintf(title, sizeof(title), "CONTENT DIR %s", dir);
   else if (menu_type == MENU_SCREENSHOT_DIR_PATH)
      snprintf(title, sizeof(title), "SCREENSHOT DIR %s", dir);
   else if (menu_type == MENU_AUTOCONFIG_DIR_PATH)
      snprintf(title, sizeof(title), "AUTOCONFIG DIR %s", dir);
   else if (menu_type == MENU_SHADER_DIR_PATH)
      snprintf(title, sizeof(title), "SHADER DIR %s", dir);
   else if (menu_type == MENU_FILTER_DIR_PATH)
      snprintf(title, sizeof(title), "FILTER DIR %s", dir);
   else if (menu_type == MENU_DSP_FILTER_DIR_PATH)
      snprintf(title, sizeof(title), "DSP_FILTER DIR %s", dir);
   else if (menu_type == MENU_SAVESTATE_DIR_PATH)
      snprintf(title, sizeof(title), "SAVESTATE DIR %s", dir);
#ifdef HAVE_DYNAMIC
   else if (menu_type == MENU_LIBRETRO_DIR_PATH)
      snprintf(title, sizeof(title), "LIBRETRO DIR %s", dir);
#endif
   else if (menu_type == MENU_CONFIG_DIR_PATH)
      snprintf(title, sizeof(title), "CONFIG DIR %s", dir);
   else if (menu_type == MENU_SAVEFILE_DIR_PATH)
      snprintf(title, sizeof(title), "SAVEFILE DIR %s", dir);
#ifdef HAVE_OVERLAY
   else if (menu_type == MENU_OVERLAY_DIR_PATH)
      snprintf(title, sizeof(title), "OVERLAY DIR %s", dir);
#endif
   else if (menu_type == MENU_SYSTEM_DIR_PATH)
      snprintf(title, sizeof(title), "SYSTEM DIR %s", dir);
   else if (menu_type == MENU_ASSETS_DIR_PATH)
      snprintf(title, sizeof(title), "ASSETS DIR %s", dir);
   else
   {
      if (driver.menu->defer_core)
         snprintf(title, sizeof(title), "CONTENT %s", dir);
      else
      {
         const char *core_name = driver.menu->info.library_name;
         if (!core_name)
            core_name = g_extern.system.info.library_name;
         if (!core_name)
            core_name = "No Core";
         snprintf(title, sizeof(title), "CONTENT (%s) %s", core_name, dir);
      }
   }

   mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
   XuiTextElementSetText(m_menutitle, strw_buffer);

   char title_buf[256];
   menu_ticker_line(title_buf, RXUI_TERM_WIDTH - 3, g_extern.frame_count / 15, title, true);
   blit_line(RXUI_TERM_START_X + 15, 15, title_buf, true);

   char title_msg[64];
   const char *core_name = driver.menu->info.library_name;
   if (!core_name)
      core_name = g_extern.system.info.library_name;
   if (!core_name)
      core_name = "No Core";

   const char *core_version = driver.menu->info.library_version;
   if (!core_version)
      core_version = g_extern.system.info.library_version;
   if (!core_version)
      core_version = "";

   snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION, core_name, core_version);
   blit_line(RXUI_TERM_START_X + 15, (RXUI_TERM_HEIGHT * FONT_HEIGHT_STRIDE) + RXUI_TERM_START_Y + 2, title_msg, true);

   unsigned x, y;
   size_t i;

   x = RXUI_TERM_START_X;
   y = RXUI_TERM_START_Y;

   for (i = begin; i < end; i++/*, y += FONT_HEIGHT_STRIDE */)
   {
      const char *path = 0;
      unsigned type = 0;
      file_list_get_at_offset(driver.menu->selection_buf, i, &path, &type);
      char message[256];
      char type_str[256];

      unsigned w = 19;
      if (menu_type == MENU_SETTINGS_INPUT_OPTIONS || menu_type == MENU_SETTINGS_CUSTOM_BIND)
         w = 21;
      else if (menu_type == MENU_SETTINGS_PATH_OPTIONS)
         w = 24;

      if (type >= MENU_SETTINGS_SHADER_FILTER &&
            type <= MENU_SETTINGS_SHADER_LAST)
      {
         // HACK. Work around that we're using the menu_type as dir type to propagate state correctly.
         if ((menu_type_is == MENU_SETTINGS_SHADER_OPTIONS)
               && (menu_type_is == MENU_SETTINGS_SHADER_OPTIONS))
         {
            type = MENU_FILE_DIRECTORY;
            strlcpy(type_str, "(DIR)", sizeof(type_str));
            w = 5;
         }
         else if (type == MENU_SETTINGS_SHADER_OPTIONS || type == MENU_SETTINGS_SHADER_PRESET)
            strlcpy(type_str, "...", sizeof(type_str));
         else if (type == MENU_SETTINGS_SHADER_FILTER)
            snprintf(type_str, sizeof(type_str), "%s",
                  g_settings.video.smooth ? "Linear" : "Nearest");
         else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_get_str)
            driver.menu_ctx->backend->shader_manager_get_str(driver.menu->shader, type_str, sizeof(type_str), type);
      }
      else
      // Pretty-print libretro cores from menu.
      if (menu_type == MENU_SETTINGS_CORE || menu_type == MENU_SETTINGS_DEFERRED_CORE)
      {
         if (type == MENU_FILE_PLAIN)
         {
            strlcpy(type_str, "(CORE)", sizeof(type_str));
            file_list_get_alt_at_offset(driver.menu->selection_buf, i, &path);
            w = 6;
         }
         else
         {
            strlcpy(type_str, "(DIR)", sizeof(type_str));
            type = MENU_FILE_DIRECTORY;
            w = 5;
         }
      }
      else if (menu_type == MENU_SETTINGS_CONFIG ||
#ifdef HAVE_OVERLAY
            menu_type == MENU_SETTINGS_OVERLAY_PRESET ||
#endif
            menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER ||
            menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER ||
            menu_type == MENU_SETTINGS_DISK_APPEND ||
            menu_type_is == MENU_FILE_DIRECTORY)
      {
         if (type == MENU_FILE_PLAIN)
         {
            strlcpy(type_str, "(FILE)", sizeof(type_str));
            w = 6;
         }
         else if (type == MENU_FILE_USE_DIRECTORY)
         {
            *type_str = '\0';
            w = 0;
         }
         else
         {
            strlcpy(type_str, "(DIR)", sizeof(type_str));
            type = MENU_FILE_DIRECTORY;
            w = 5;
         }
      }
      else if (menu_type == MENU_SETTINGS_OPEN_HISTORY)
      {
         *type_str = '\0';
         w = 0;
      }
      else if (type >= MENU_SETTINGS_CORE_OPTION_START)
         strlcpy(type_str,
               core_option_get_val(g_extern.system.core_options, type - MENU_SETTINGS_CORE_OPTION_START),
               sizeof(type_str));
      else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->setting_set_label)
         driver.menu_ctx->backend->setting_set_label(type_str, sizeof(type_str), &w, type);

      char entry_title_buf[256];
      char type_str_buf[64];
      bool selected = i == driver.menu->selection_ptr;

      strlcpy(entry_title_buf, path, sizeof(entry_title_buf));
      strlcpy(type_str_buf, type_str, sizeof(type_str_buf));

#if 0
      if ((type == MENU_FILE_PLAIN || type == MENU_FILE_DIRECTORY))
         menu_ticker_line(entry_title_buf, RXUI_TERM_WIDTH - (w + 1 + 2), g_extern.frame_count / 15, path, selected);
      else
         menu_ticker_line(type_str_buf, w, g_extern.frame_count / 15, type_str, selected);
#endif

      snprintf(message, sizeof(message), "%s : %s",
            entry_title_buf,
            type_str_buf);

      wchar_t msg_w[256];
      mbstowcs(msg_w, message, sizeof(msg_w) / sizeof(wchar_t));
      XuiListSetText(m_menulist, i, msg_w);
      blit_line(x, y, message, i);
   }

   if (driver.menu->keyboard.display)
   {
      char msg[1024];
      const char *str = *driver.menu->keyboard.buffer;
      if (!str)
         str = "";
      snprintf(msg, sizeof(msg), "%s\n%s", driver.menu->keyboard.label, str);
      rmenu_xui_render_messagebox(msg);
   }
}
Beispiel #11
0
static size_t menu_list_get_stack_size(menu_list_t *list, size_t idx)
{
   if (!list)
      return 0;
   return file_list_get_size(list->menu_stack[idx]);
}
static int menu_settings_iterate(unsigned action)
{
   const char *path = NULL;
   const char *dir  = NULL;
   const char *label = NULL;
   unsigned type = 0;
   unsigned menu_type = 0;

   driver.menu->frame_buf_pitch = driver.menu->width * 2;

   if (action != MENU_ACTION_REFRESH)
      file_list_get_at_offset(driver.menu->selection_buf,
            driver.menu->selection_ptr, NULL, &label, &type);

   if (!strcmp(label, "core_list"))
      dir = g_settings.libretro_directory;
   else if (!strcmp(label, "configurations"))
      dir = g_settings.menu_config_directory;
   else if (!strcmp(label, "disk_image_append"))
      dir = g_settings.menu_content_directory;

   if (driver.menu->need_refresh && action != MENU_ACTION_MESSAGE)
      action = MENU_ACTION_NOOP;

   switch (action)
   {
      case MENU_ACTION_UP:
         if (driver.menu->selection_ptr > 0)
            menu_decrement_navigation(driver.menu);
         else
            menu_set_navigation(driver.menu,
                  file_list_get_size(driver.menu->selection_buf) - 1);
         break;

      case MENU_ACTION_DOWN:
         if ((driver.menu->selection_ptr + 1) <
               file_list_get_size(driver.menu->selection_buf))
            menu_increment_navigation(driver.menu);
         else
            menu_clear_navigation(driver.menu);
         break;

      case MENU_ACTION_CANCEL:
         menu_entries_pop(driver.menu->menu_stack);
         break;
      case MENU_ACTION_SELECT:
         file_list_push(driver.menu->menu_stack, "", "info_screen",
               0, driver.menu->selection_ptr);
         break;
      case MENU_ACTION_OK:
         if (menu_setting_ok_toggle(type, dir, label, action) == 0)
            return 0;
         /* fall-through */
      case MENU_ACTION_START:
         if (menu_setting_start_toggle(type, dir, label, action) == 0)
            return 0;
         /* fall-through */
      case MENU_ACTION_LEFT:
      case MENU_ACTION_RIGHT:
         {
            int ret = menu_setting_toggle(type, dir,
                  label, action);

            if (ret)
               return ret;
         }
         break;

      case MENU_ACTION_REFRESH:
         menu_clear_navigation(driver.menu);
         driver.menu->need_refresh = true;
         break;

      case MENU_ACTION_MESSAGE:
         driver.menu->msg_force = true;
         break;

      default:
         break;
   }

   file_list_get_last(driver.menu->menu_stack, &path, &label, &menu_type);

   if (driver.menu->need_refresh && (menu_parse_check(label, menu_type) == -1))
   {
      driver.menu->need_refresh = false;
      menu_entries_push_list(driver.menu,
            driver.menu->selection_buf, path, label, menu_type);
   }

   if (driver.menu_ctx && driver.menu_ctx->render)
      driver.menu_ctx->render();

   /* Have to defer it so we let settings refresh. */
   if (driver.menu->push_start_screen)
   {
      driver.menu->push_start_screen = false;
      file_list_push(driver.menu->menu_stack, "", "help", 0, 0);
   }

   return 0;
}
static int menu_load_or_open_zip_iterate(unsigned action)
{
   char msg[PATH_MAX];
   snprintf(msg, sizeof(msg), "Opening compressed file\n"
         " \n"

         " - OK to open as Folder\n"
         " - Cancel/Back to Load \n");

   if (driver.video_data && driver.menu_ctx
         && driver.menu_ctx->render_messagebox)
   {
      if (*msg && msg[0] != '\0')
         driver.menu_ctx->render_messagebox(msg);
   }

   if (action == MENU_ACTION_OK)
   {
      char cat_path[PATH_MAX];
      const char *menu_path  = NULL;
      const char *menu_label = NULL;
      const char* path       = NULL;
      const char* label      = NULL;
      unsigned int menu_type = 0, type = 0;

      menu_entries_pop(driver.menu->menu_stack);

      file_list_get_last(driver.menu->menu_stack, &menu_path, &menu_label,
            &menu_type);

      if (file_list_get_size(driver.menu->selection_buf) == 0)
         return 0;

      file_list_get_at_offset(driver.menu->selection_buf,
            driver.menu->selection_ptr, &path, &label, &type);

      fill_pathname_join(cat_path, menu_path, path, sizeof(cat_path));
      menu_entries_push(driver.menu->menu_stack, cat_path, menu_label, type,
            driver.menu->selection_ptr);
   }
   else if (action == MENU_ACTION_CANCEL)
   {
      const char *menu_path   = NULL;
      const char *menu_label  = NULL;
      const char* path        = NULL;
      const char* label       = NULL;
      unsigned int menu_type = 0, type = 0;

      menu_entries_pop(driver.menu->menu_stack);

      file_list_get_last(driver.menu->menu_stack, &menu_path, &menu_label,
            &menu_type);

      if (file_list_get_size(driver.menu->selection_buf) == 0)
         return 0;

      file_list_get_at_offset(driver.menu->selection_buf,
            driver.menu->selection_ptr, &path, &label, &type);

      int ret = rarch_defer_core(g_extern.core_info, menu_path, path,
            driver.menu->deferred_path, sizeof(driver.menu->deferred_path));
      if (ret == -1)
      {
         rarch_main_command(RARCH_CMD_LOAD_CORE);
         menu_common_load_content();
         return -1;
      }
      else if (ret == 0)
         menu_entries_push(driver.menu->menu_stack,
               g_settings.libretro_directory, "deferred_core_list", 0,
               driver.menu->selection_ptr);

   }
   return 0;
}
Beispiel #14
0
size_t menu_list_get_size(menu_list_t *list)
{
   if (!list)
      return 0;
   return file_list_get_size(list->selection_buf);
}
Beispiel #15
0
size_t menu_list_get_stack_size(menu_list_t *list)
{
   if (!list)
      return 0;
   return file_list_get_size(list->menu_stack);
}
static int menu_action_ok(const char *menu_path,
      const char *menu_label, unsigned menu_type)
{
   const char *label = NULL;
   const char *path = NULL;
   unsigned type = 0;
   rarch_setting_t *setting_data = (rarch_setting_t *)driver.menu->list_settings;
   rarch_setting_t *setting = (rarch_setting_t*)
      setting_data_find_setting(setting_data, menu_label);

   (void)hack_shader_pass;

   if (file_list_get_size(driver.menu->selection_buf) == 0)
      return 0;

   file_list_get_at_offset(driver.menu->selection_buf,
         driver.menu->selection_ptr, &path, &label, &type);

#if 0
   RARCH_LOG("menu label: %s\n", menu_label);
   RARCH_LOG("type     : %d\n", type == MENU_FILE_USE_DIRECTORY);
   RARCH_LOG("type id  : %d\n", type);
#endif
   while (true)
   {
      switch (type)
      {
      case MENU_FILE_PLAYLIST_ENTRY:

         rarch_playlist_load_content(g_defaults.history,
               driver.menu->selection_ptr);
         menu_flush_stack_type(driver.menu->menu_stack, MENU_SETTINGS);
         return -1;

#ifdef HAVE_COMPRESSION
      case MENU_FILE_IN_CARCHIVE:
#endif
      case MENU_FILE_PLAIN:

         if (!strcmp(menu_label, "detect_core_list"))
         {
            int ret = rarch_defer_core(g_extern.core_info,
                  menu_path, path, driver.menu->deferred_path,
                  sizeof(driver.menu->deferred_path));

            if (ret == -1)
            {

               rarch_main_command(RARCH_CMD_LOAD_CORE);

               menu_common_load_content();

               return -1;
            }
            else if (ret == 0)
               menu_entries_push(driver.menu->menu_stack,
                     g_settings.libretro_directory, "deferred_core_list",
                     0, driver.menu->selection_ptr);
         }
         else if ((setting && setting->type == ST_PATH))
         {
            menu_action_setting_set_current_string_path(setting, menu_path, path);
            menu_entries_pop_stack(driver.menu->menu_stack, setting->name);
         }
         else if (!strcmp(menu_label, "disk_image_append"))
         {
            char image[PATH_MAX];

            fill_pathname_join(image, menu_path, path, sizeof(image));
            rarch_disk_control_append_image(image);

            rarch_main_command(RARCH_CMD_RESUME);

            menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS);
            return -1;
         }
         else
         {
            if (type == MENU_FILE_IN_CARCHIVE)
            {
               fill_pathname_join_delim(g_extern.fullpath, menu_path, path,
                     '#',sizeof(g_extern.fullpath));
            }
            else
            {
               fill_pathname_join(g_extern.fullpath, menu_path, path,
                     sizeof(g_extern.fullpath));
            }

            menu_common_load_content();
            rarch_main_command(RARCH_CMD_LOAD_CONTENT_PERSIST);
            menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS);
            driver.menu->msg_force = true;

            return -1;
         }

         return 0;

      case MENU_FILE_CONFIG:

         {
            char config[PATH_MAX];

            fill_pathname_join(config, menu_path, path, sizeof(config));
            menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS);
            driver.menu->msg_force = true;
            if (rarch_replace_config(config))
            {
               menu_clear_navigation(driver.menu);
               return -1;
            }
         }

         return 0;

      case MENU_FILE_FONT:
      case MENU_FILE_OVERLAY:
      case MENU_FILE_AUDIOFILTER:
      case MENU_FILE_VIDEOFILTER:

         menu_action_setting_set_current_string_path(setting, menu_path, path);
         menu_entries_pop_stack(driver.menu->menu_stack, setting->name);

         return 0;

      case MENU_FILE_SHADER_PRESET:
#ifdef HAVE_SHADER_MANAGER
         {
            char shader_path[PATH_MAX];
            fill_pathname_join(shader_path, menu_path, path, sizeof(shader_path));
            menu_shader_manager_set_preset(driver.menu->shader,
                  gfx_shader_parse_type(shader_path, RARCH_SHADER_NONE),
                  shader_path);
            menu_flush_stack_label(driver.menu->menu_stack, "Shader Options");
         }
#endif
         return 0;
      case MENU_FILE_SHADER:
#ifdef HAVE_SHADER_MANAGER
         fill_pathname_join(driver.menu->shader->pass[hack_shader_pass].source.path,
               menu_path, path,
               sizeof(driver.menu->shader->pass[hack_shader_pass].source.path));

         /* This will reset any changed parameters. */
         gfx_shader_resolve_parameters(NULL, driver.menu->shader);
         menu_flush_stack_label(driver.menu->menu_stack, "Shader Options");
#endif

         return 0;

      case MENU_FILE_CORE:

         if (!strcmp(menu_label, "deferred_core_list"))
         {
            strlcpy(g_settings.libretro, path, sizeof(g_settings.libretro));
            strlcpy(g_extern.fullpath, driver.menu->deferred_path,
                  sizeof(g_extern.fullpath));

            menu_common_load_content();

            return -1;
         }
         else if (!strcmp(menu_label, "core_list"))
         {
            fill_pathname_join(g_settings.libretro, menu_path, path,
                  sizeof(g_settings.libretro));
            rarch_main_command(RARCH_CMD_LOAD_CORE);
            menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS);
#if defined(HAVE_DYNAMIC)
            /* No content needed for this core, load core immediately. */
            if (driver.menu->load_no_content)
            {
               *g_extern.fullpath = '\0';
               menu_common_load_content();
               return -1;
            }

            /* Core selection on non-console just updates directory listing.
             * Will take effect on new content load. */
#elif defined(RARCH_CONSOLE)
            rarch_main_command(RARCH_CMD_RESTART_RETROARCH);
            return -1;
#endif
         }

         return 0;

      case MENU_FILE_USE_DIRECTORY:

         if (setting && setting->type == ST_DIR)
         {
            menu_action_setting_set_current_string(setting, menu_path);
            menu_entries_pop_stack(driver.menu->menu_stack, setting->name);
         }

         return 0;

      case MENU_FILE_DIRECTORY:
      case MENU_FILE_CARCHIVE:

         {
            char cat_path[PATH_MAX];

            if (type == MENU_FILE_CARCHIVE && !strcmp(menu_label, "detect_core_list"))
            {
               file_list_push(driver.menu->menu_stack, path, "load_open_zip",
                     0, driver.menu->selection_ptr);
               return 0;
            }

            fill_pathname_join(cat_path, menu_path, path, sizeof(cat_path));
            menu_entries_push(driver.menu->menu_stack,
                  cat_path, menu_label, type, driver.menu->selection_ptr);
         }

         return 0;

      }
      break;
   }

   if (menu_parse_check(label, type) == 0)
   {
      char cat_path[PATH_MAX];
      fill_pathname_join(cat_path, menu_path, path, sizeof(cat_path));

      menu_entries_push(driver.menu->menu_stack,
            cat_path, menu_label, type, driver.menu->selection_ptr);
   }

   return 0;
}
static int menu_common_iterate(unsigned action)
{
   int ret = 0;
   unsigned menu_type = 0;
   const char *path = NULL;
   const char *menu_label = NULL;
   unsigned scroll_speed = 0, fast_scroll_speed = 0;

   file_list_get_last(driver.menu->menu_stack, &path, &menu_label, &menu_type);

   if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
      driver.menu_ctx->set_texture(driver.menu);

   if (!strcmp(menu_label, "help"))
      return menu_start_screen_iterate(action);
   else if (!strcmp(menu_label, "message"))
      return menu_message_toggle(action);
   else if (!strcmp(menu_label, "load_open_zip"))
      return menu_load_or_open_zip_iterate(action);
   else if (!strcmp(menu_label, "info_screen"))
      return menu_info_screen_iterate(action);
   else if (menu_common_type_is(menu_label, menu_type) == MENU_SETTINGS)
      return menu_settings_iterate(action);
   else if (
         menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT ||
         !strcmp(menu_label, "custom_viewport_2")
         )
      return menu_viewport_iterate(action);
   else if (menu_type == MENU_SETTINGS_CUSTOM_BIND)
   {
      if (menu_input_bind_iterate(driver.menu))
         menu_entries_pop(driver.menu->menu_stack);
      return 0;
   }
   else if (menu_type == MENU_SETTINGS_CUSTOM_BIND_KEYBOARD)
   {
      if (menu_input_bind_iterate_keyboard(driver.menu))
         menu_entries_pop(driver.menu->menu_stack);
      return 0;
   }

   if (driver.menu->need_refresh && action != MENU_ACTION_MESSAGE)
      action = MENU_ACTION_NOOP;

   scroll_speed = (max(driver.menu->scroll_accel, 2) - 2) / 4 + 1;
   fast_scroll_speed = 4 + 4 * scroll_speed;

   switch (action)
   {
      case MENU_ACTION_UP:
         if (driver.menu->selection_ptr >= scroll_speed)
            menu_set_navigation(driver.menu,
                  driver.menu->selection_ptr - scroll_speed);
         else
            menu_set_navigation(driver.menu,
                  file_list_get_size(driver.menu->selection_buf) - 1);
         break;

      case MENU_ACTION_DOWN:
         if (driver.menu->selection_ptr + scroll_speed <
               file_list_get_size(driver.menu->selection_buf))
            menu_set_navigation(driver.menu,
                  driver.menu->selection_ptr + scroll_speed);
         else
            menu_clear_navigation(driver.menu);
         break;

      case MENU_ACTION_LEFT:
         if (driver.menu->selection_ptr > fast_scroll_speed)
            menu_set_navigation(driver.menu,
                  driver.menu->selection_ptr - fast_scroll_speed);
         else
            menu_clear_navigation(driver.menu);
         break;

      case MENU_ACTION_RIGHT:
         if (driver.menu->selection_ptr + fast_scroll_speed <
               file_list_get_size(driver.menu->selection_buf))
            menu_set_navigation(driver.menu,
                  driver.menu->selection_ptr + fast_scroll_speed);
         else
            menu_set_navigation_last(driver.menu);
         break;

      case MENU_ACTION_SCROLL_UP:
         menu_descend_alphabet(driver.menu, &driver.menu->selection_ptr);
         break;
      case MENU_ACTION_SCROLL_DOWN:
         menu_ascend_alphabet(driver.menu, &driver.menu->selection_ptr);
         break;

      case MENU_ACTION_CANCEL:
         menu_entries_pop(driver.menu->menu_stack);
         break;

      case MENU_ACTION_OK:
         ret = menu_action_ok(path, menu_label, menu_type);
         break;

      case MENU_ACTION_REFRESH:
         menu_clear_navigation(driver.menu);
         driver.menu->need_refresh = true;
         break;

      case MENU_ACTION_MESSAGE:
         driver.menu->msg_force = true;
         break;

      default:
         break;
   }

   if (driver.menu->need_refresh)
   {
      if (menu_parse_and_resolve(driver.menu->selection_buf,
               driver.menu->menu_stack) == 0)
         driver.menu->need_refresh = false;
   }

   if (driver.menu_ctx && driver.menu_ctx->iterate)
      driver.menu_ctx->iterate(driver.menu, action);

   if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render)
      driver.menu_ctx->render();

   return ret;
}
Beispiel #18
0
int menu_entries_parse_list(
      file_list_t *list, file_list_t *menu_list,
      const char *dir, const char *label, unsigned type,
      unsigned default_type_plain, const char *exts,
      rarch_setting_t *setting)
{
   size_t i, list_size;
   bool path_is_compressed, push_dir;
   int                   device = 0;
   struct string_list *str_list = NULL;
   settings_t *settings         = config_get_ptr();
   global_t *global             = global_get_ptr();

   (void)device;

   if (!list || !menu_list)
      return -1;

   menu_list_clear(list);

   if (!*dir)
   {
      menu_entries_parse_drive_list(list);
      menu_driver_populate_entries(dir, label, type);
      return 0;
   }

#if defined(GEKKO) && defined(HW_RVL)
   slock_lock(gx_device_mutex);
   device = gx_get_device_from_path(dir);

   if (device != -1 && !gx_devices[device].mounted &&
         gx_devices[device].interface->isInserted())
      fatMountSimple(gx_devices[device].name, gx_devices[device].interface);

   slock_unlock(gx_device_mutex);
#endif

   path_is_compressed = path_is_compressed_file(dir);
   push_dir           = (setting && setting->browser_selection_type == ST_DIR);

   if (path_is_compressed)
      str_list = compressed_file_list_new(dir,exts);
   else
      str_list = dir_list_new(dir,
            settings->menu.navigation.browser.filter.supported_extensions_enable 
            ? exts : NULL, true);

   if (push_dir)
      menu_list_push(list, "<Use this directory>", "",
            MENU_FILE_USE_DIRECTORY, 0);

   if (!str_list)
      return -1;

   dir_list_sort(str_list, true);


   list_size = str_list->size;
   for (i = 0; i < str_list->size; i++)
   {
      bool is_dir;
      const char *path = NULL;
      menu_file_type_t file_type = MENU_FILE_NONE;

      switch (str_list->elems[i].attr.i)
      {
         case RARCH_DIRECTORY:
            file_type = MENU_FILE_DIRECTORY;
            break;
         case RARCH_COMPRESSED_ARCHIVE:
            file_type = MENU_FILE_CARCHIVE;
            break;
         case RARCH_COMPRESSED_FILE_IN_ARCHIVE:
            file_type = MENU_FILE_IN_CARCHIVE;
            break;
         case RARCH_PLAIN_FILE:
         default:
            if (!strcmp(label, "detect_core_list"))
            {
               if (path_is_compressed_file(str_list->elems[i].data))
               {
                  /* in case of deferred_core_list we have to interpret
                   * every archive as an archive to disallow instant loading
                   */
                  file_type = MENU_FILE_CARCHIVE;
                  break;
               }
            }
            file_type = (menu_file_type_t)default_type_plain;
            break;
      }

      is_dir = (file_type == MENU_FILE_DIRECTORY);

      if (push_dir && !is_dir)
         continue;

      /* Need to preserve slash first time. */
      path = str_list->elems[i].data;

      if (*dir && !path_is_compressed)
         path = path_basename(path);


#ifdef HAVE_LIBRETRO_MANAGEMENT
#ifdef RARCH_CONSOLE
      if (!strcmp(label, "core_list") && (is_dir ||
               strcasecmp(path, SALAMANDER_FILE) == 0))
         continue;
#endif
#endif

      /* Push type further down in the chain.
       * Needed for shader manager currently. */
      if (!strcmp(label, "core_list"))
      {
         /* Compressed cores are unsupported */
         if (file_type == MENU_FILE_CARCHIVE)
            continue;

         menu_list_push(list, path, "",
               is_dir ? MENU_FILE_DIRECTORY : MENU_FILE_CORE, 0);
      }
      else
      menu_list_push(list, path, "",
            file_type, 0);
   }

   string_list_free(str_list);

   if (!strcmp(label, "core_list"))
   {
      driver_t *driver = driver_get_ptr();

      menu_list_get_last_stack(driver->menu->menu_list, &dir, NULL, NULL);
      list_size = file_list_get_size(list);

      for (i = 0; i < list_size; i++)
      {
         char core_path[PATH_MAX_LENGTH], display_name[PATH_MAX_LENGTH];
         const char *path = NULL;

         menu_list_get_at_offset(list, i, &path, NULL, &type);

         if (type != MENU_FILE_CORE)
            continue;

         fill_pathname_join(core_path, dir, path, sizeof(core_path));

         if (global->core_info &&
               core_info_list_get_display_name(global->core_info,
                  core_path, display_name, sizeof(display_name)))
            menu_list_set_alt_at_offset(list, i, display_name);
      }
      menu_list_sort_on_alt(list);
   }

   menu_list_populate_generic(list, dir, label, type);

   return 0;
}
Beispiel #19
0
static void xmb_frame(void)
{
   int i;
   char title_msg[64];
   size_t end;
   const char *dir = NULL;
   const char *label = NULL;
   unsigned menu_type = 0;
   xmb_handle_t *xmb = (xmb_handle_t*)driver.menu->userdata;

   gl_t *gl = (gl_t*)driver_video_resolve(NULL);

   if (!xmb || !gl)
      return;

   if (driver.menu->need_refresh
         && g_extern.is_menu
         && !driver.menu->msg_force)
      return;

   update_tweens(0.002);

   glViewport(0, 0, gl->win_width, gl->win_height);

   xmb_render_background();

   file_list_get_last(driver.menu->menu_stack, &dir, &label, &menu_type);

   get_title(label, dir, menu_type, xmb->title, sizeof(xmb->title));

   xmb_draw_text(xmb->title, 30, 40, 1, 1);

   const char *core_name = g_extern.menu.info.library_name;
   if (!core_name)
      core_name = g_extern.system.info.library_name;
   if (!core_name)
      core_name = "No Core";

   const char *core_version = g_extern.menu.info.library_version;
   if (!core_version)
      core_version = g_extern.system.info.library_version;
   if (!core_version)
      core_version = "";

   snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION,
         core_name, core_version);
   xmb_draw_text(title_msg, 30, gl->win_height - 30, 1, 1);

   end = file_list_get_size(driver.menu->selection_buf);

   for (i = 0; i < end; i++)
   {
      char value[PATH_MAX], path_buf[PATH_MAX];
      const char *path = NULL, *entry_label = NULL;
      unsigned type = 0, w = 0;
      xmb_node_t *node = NULL;

      file_list_get_at_offset(driver.menu->selection_buf, i, &path,
            &entry_label, &type);
      node = (xmb_node_t*)file_list_get_userdata_at_offset(
            driver.menu->selection_buf, i);
      
      disp_set_label(&w, type, i, label,
            value, sizeof(value),
            entry_label, path,
            path_buf, sizeof(path_buf));

      xmb_draw_icon(xmb->textures[XMB_TEXTURE_SETTING].id,
            xmb->margin_left + xmb->hspacing - xmb->icon_size/2.0, 
            xmb->margin_top + node->y + xmb->icon_size/2.0, 
            node->alpha, 
            0, 
            node->zoom);

      xmb_draw_text(path_buf,
            xmb->margin_left + xmb->hspacing + xmb->label_margin_left, 
            xmb->margin_top + node->y + xmb->label_margin_top, 
            1, 
            node->alpha);

      xmb_draw_text(value,
            xmb->margin_left + xmb->hspacing + 
            xmb->label_margin_left + xmb->setting_margin_left, 
            xmb->margin_top + node->y + xmb->label_margin_top, 
            1, 
            node->alpha);
   }

   xmb_draw_icon(xmb->textures[XMB_TEXTURE_SETTINGS].id, 
         xmb->margin_left + xmb->hspacing - xmb->icon_size / 2.0,
         xmb->margin_top + xmb->icon_size / 2.0, 
         1.0, 
         0, 
         1.0);

#ifdef GEKKO
   const char *message_queue;

   if (driver.menu->msg_force)
   {
      message_queue = msg_queue_pull(g_extern.msg_queue);
      driver.menu->msg_force = false;
   }
   else
      message_queue = driver.current_msg;

   xmb_render_messagebox(message_queue);
#endif

   if (driver.menu->keyboard.display)
   {
      char msg[PATH_MAX];
      const char *str = *driver.menu->keyboard.buffer;
      if (!str)
         str = "";
      snprintf(msg, sizeof(msg), "%s\n%s",
            driver.menu->keyboard.label, str);
      xmb_render_messagebox(msg);
   }

   if (xmb->box_message[0] != '\0')
   {
      xmb_render_background();
      xmb_render_messagebox(xmb->box_message);
      xmb->box_message[0] = '\0';
   }

   gl_set_viewport(gl, gl->win_width, gl->win_height, false, false);
}
Beispiel #20
0
static void rmenu_render(void)
{
    size_t begin, end;
    struct font_params font_parms;
    menu_handle_t *menu = (menu_handle_t*)driver.menu;

    if (!menu)
        return;

    if (!render_normal)
    {
        render_normal = true;
        return;
    }

    if (menu->need_refresh &&
            (g_extern.lifecycle_state & (1ULL << MODE_MENU))
            && !menu->msg_force)
        return;

    if (!menu->selection_buf)
        return;

    begin = (menu->selection_ptr >= (ENTRIES_HEIGHT / 2)) ?  (menu->selection_ptr - (ENTRIES_HEIGHT / 2)) : 0;
    end = ((menu->selection_ptr + ENTRIES_HEIGHT) <= file_list_get_size(menu->selection_buf)) ? menu->selection_ptr + ENTRIES_HEIGHT : file_list_get_size(menu->selection_buf);

    if (file_list_get_size(menu->selection_buf) <= ENTRIES_HEIGHT)
        begin = 0;

    if (end - begin > ENTRIES_HEIGHT)
        end = begin + ENTRIES_HEIGHT;

    rmenu_render_background();

    char title[256];
    const char *dir = NULL;
    unsigned menu_type = 0;
    unsigned menu_type_is = 0;
    file_list_get_last(menu->menu_stack, &dir, &menu_type);

    if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->type_is)
        menu_type_is = driver.menu_ctx->backend->type_is(menu_type);

    if (menu_type == MENU_SETTINGS_CORE)
        snprintf(title, sizeof(title), "CORE SELECTION %s", dir);
    else if (menu_type == MENU_SETTINGS_DEFERRED_CORE)
        snprintf(title, sizeof(title), "DETECTED CORES %s", dir);
    else if (menu_type == MENU_SETTINGS_CONFIG)
        snprintf(title, sizeof(title), "CONFIG %s", dir);
    else if (menu_type == MENU_SETTINGS_DISK_APPEND)
        snprintf(title, sizeof(title), "DISK APPEND %s", dir);
    else if (menu_type == MENU_SETTINGS_VIDEO_OPTIONS)
        strlcpy(title, "VIDEO OPTIONS", sizeof(title));
    else if (menu_type == MENU_SETTINGS_DRIVERS)
        strlcpy(title, "DRIVER OPTIONS", sizeof(title));
    else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS)
        strlcpy(title, "PERFORMANCE COUNTERS", sizeof(title));
    else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS_LIBRETRO)
        strlcpy(title, "CORE PERFORMANCE COUNTERS", sizeof(title));
    else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS_FRONTEND)
        strlcpy(title, "FRONTEND PERFORMANCE COUNTERS", sizeof(title));
#ifdef HAVE_SHADER_MANAGER
    else if (menu_type == MENU_SETTINGS_SHADER_OPTIONS)
        strlcpy(title, "SHADER OPTIONS", sizeof(title));
    else if (menu_type == MENU_SETTINGS_SHADER_PARAMETERS)
        strlcpy(title, "SHADER PARAMETERS (CURRENT)", sizeof(title));
    else if (menu_type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS)
        strlcpy(title, "SHADER PARAMETERS (RGUI PRESET)", sizeof(title));
#endif
    else if (menu_type == MENU_SETTINGS_AUDIO_OPTIONS)
        strlcpy(title, "AUDIO OPTIONS", sizeof(title));
    else if (menu_type == MENU_SETTINGS_OVERLAY_OPTIONS)
        strlcpy(title, "OVERLAY OPTIONS", sizeof(title));
    else if (menu_type == MENU_SETTINGS_NETPLAY_OPTIONS)
        strlcpy(title, "NETPLAY OPTIONS", sizeof(title));
    else if (menu_type == MENU_SETTINGS_FONT_OPTIONS)
        strlcpy(title, "FONT OPTIONS", sizeof(title));
    else if (menu_type == MENU_SETTINGS_GENERAL_OPTIONS)
        strlcpy(title, "GENERAL OPTIONS", sizeof(title));
    else if (menu_type == MENU_SETTINGS_PATH_OPTIONS)
        strlcpy(title, "PATH OPTIONS", sizeof(title));
    else if (menu_type == MENU_SETTINGS_OPTIONS)
        strlcpy(title, "SETTINGS", sizeof(title));
    else if (menu_type == MENU_SETTINGS_INPUT_OPTIONS)
        strlcpy(title, "INPUT OPTIONS", sizeof(title));
    else if (menu_type == MENU_SETTINGS_DISK_OPTIONS)
        strlcpy(title, "DISK OPTIONS", sizeof(title));
    else if (menu_type == MENU_SETTINGS_CORE_OPTIONS)
        strlcpy(title, "CORE OPTIONS", sizeof(title));
    else if (menu_type == MENU_SETTINGS_CORE_INFO)
        strlcpy(title, "CORE INFO", sizeof(title));
    else if (menu_type == MENU_SETTINGS_PRIVACY_OPTIONS)
        strlcpy(title, "PRIVACY OPTIONS", sizeof(title));
#ifdef HAVE_SHADER_MANAGER
    else if (menu_type_is == MENU_SETTINGS_SHADER_OPTIONS)
        snprintf(title, sizeof(title), "SHADER %s", dir);
#endif
    else if ((menu_type == MENU_SETTINGS_INPUT_OPTIONS) ||
             (menu_type == MENU_SETTINGS_PATH_OPTIONS) ||
             (menu_type == MENU_SETTINGS_OPTIONS) ||
             (menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT || menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT_2) ||
             menu_type == MENU_SETTINGS_CUSTOM_BIND ||
             menu_type == MENU_START_SCREEN ||
             menu_type == MENU_SETTINGS)
        snprintf(title, sizeof(title), "MENU %s", dir);
    else if (menu_type == MENU_SETTINGS_OPEN_HISTORY)
        strlcpy(title, "LOAD HISTORY", sizeof(title));
    else if (menu_type == MENU_INFO_SCREEN)
        strlcpy(title, "INFO", sizeof(title));
#ifdef HAVE_OVERLAY
    else if (menu_type == MENU_SETTINGS_OVERLAY_PRESET)
        snprintf(title, sizeof(title), "OVERLAY %s", dir);
#endif
    else if (menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER)
        snprintf(title, sizeof(title), "FILTER %s", dir);
    else if (menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER)
        snprintf(title, sizeof(title), "DSP FILTER %s", dir);
    else if (menu_type == MENU_BROWSER_DIR_PATH)
        snprintf(title, sizeof(title), "BROWSER DIR %s", dir);
    else if (menu_type == MENU_CONTENT_DIR_PATH)
        snprintf(title, sizeof(title), "CONTENT DIR %s", dir);
#ifdef HAVE_SCREENSHOTS
    else if (menu_type == MENU_SCREENSHOT_DIR_PATH)
        snprintf(title, sizeof(title), "SCREENSHOT DIR %s", dir);
#endif
    else if (menu_type == MENU_AUTOCONFIG_DIR_PATH)
        snprintf(title, sizeof(title), "AUTOCONFIG DIR %s", dir);
    else if (menu_type == MENU_SHADER_DIR_PATH)
        snprintf(title, sizeof(title), "SHADER DIR %s", dir);
    else if (menu_type == MENU_FILTER_DIR_PATH)
        snprintf(title, sizeof(title), "FILTER DIR %s", dir);
    else if (menu_type == MENU_DSP_FILTER_DIR_PATH)
        snprintf(title, sizeof(title), "DSP FILTER DIR %s", dir);
    else if (menu_type == MENU_SAVESTATE_DIR_PATH)
        snprintf(title, sizeof(title), "SAVESTATE DIR %s", dir);
#ifdef HAVE_DYNAMIC
    else if (menu_type == MENU_LIBRETRO_DIR_PATH)
        snprintf(title, sizeof(title), "LIBRETRO DIR %s", dir);
#endif
    else if (menu_type == MENU_CONFIG_DIR_PATH)
        snprintf(title, sizeof(title), "CONFIG DIR %s", dir);
    else if (menu_type == MENU_SAVEFILE_DIR_PATH)
        snprintf(title, sizeof(title), "SAVEFILE DIR %s", dir);
#ifdef HAVE_OVERLAY
    else if (menu_type == MENU_OVERLAY_DIR_PATH)
        snprintf(title, sizeof(title), "OVERLAY DIR %s", dir);
#endif
    else if (menu_type == MENU_SYSTEM_DIR_PATH)
        snprintf(title, sizeof(title), "SYSTEM DIR %s", dir);
    else if (menu_type == MENU_ASSETS_DIR_PATH)
        snprintf(title, sizeof(title), "ASSETS DIR %s", dir);
    else
    {
        if (menu->defer_core)
            snprintf(title, sizeof(title), "CONTENT %s", dir);
        else
        {
            const char *core_name = menu->info.library_name;
            if (!core_name)
                core_name = g_extern.system.info.library_name;
            if (!core_name)
                core_name = "No Core";
            snprintf(title, sizeof(title), "CONTENT (%s) %s", core_name, dir);
        }
    }

    char title_buf[256];
    menu_ticker_line(title_buf, RMENU_TERM_WIDTH, g_extern.frame_count / 15, title, true);

    font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET;
    font_parms.y = POSITION_EDGE_MIN + POSITION_RENDER_OFFSET - (POSITION_OFFSET*2);
    font_parms.scale = FONT_SIZE_NORMAL;
    font_parms.color = WHITE;

    if (driver.video_data && driver.video_poke && driver.video_poke->set_osd_msg)
        driver.video_poke->set_osd_msg(driver.video_data, title_buf, &font_parms);

    char title_msg[64];
    const char *core_name = menu->info.library_name;
    if (!core_name)
        core_name = g_extern.system.info.library_name;
    if (!core_name)
        core_name = "No Core";

    const char *core_version = menu->info.library_version;
    if (!core_version)
        core_version = g_extern.system.info.library_version;
    if (!core_version)
        core_version = "";

    font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET;
    font_parms.y = POSITION_EDGE_MAX - (POSITION_OFFSET*2);
    font_parms.scale = FONT_SIZE_NORMAL;
    font_parms.color = WHITE;

    snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION, core_name, core_version);

    if (driver.video_data && driver.video_poke && driver.video_poke->set_osd_msg)
        driver.video_poke->set_osd_msg(driver.video_data, title_msg, &font_parms);

    size_t i, j;

    j = 0;

    for (i = begin; i < end; i++, j++)
    {
        const char *path = 0;
        unsigned type = 0;
        file_list_get_at_offset(menu->selection_buf, i, &path, &type);
        char message[256];
        char type_str[256];

        unsigned w = 19;
        if (menu_type == MENU_SETTINGS_INPUT_OPTIONS || menu_type == MENU_SETTINGS_CUSTOM_BIND)
            w = 21;
        else if (menu_type == MENU_SETTINGS_PATH_OPTIONS)
            w = 24;

#ifdef HAVE_SHADER_MANAGER
        if (type >= MENU_SETTINGS_SHADER_FILTER &&
                type <= MENU_SETTINGS_SHADER_LAST)
        {
            // HACK. Work around that we're using the menu_type as dir type to propagate state correctly.
            if ((menu_type_is == MENU_SETTINGS_SHADER_OPTIONS)
                    && (menu_type_is == MENU_SETTINGS_SHADER_OPTIONS))
            {
                type = MENU_FILE_DIRECTORY;
                strlcpy(type_str, "(DIR)", sizeof(type_str));
                w = 5;
            }
            else if (type == MENU_SETTINGS_SHADER_OPTIONS || type == MENU_SETTINGS_SHADER_PRESET || type == MENU_SETTINGS_SHADER_PARAMETERS || type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS)
                strlcpy(type_str, "...", sizeof(type_str));
            else if (type == MENU_SETTINGS_SHADER_FILTER)
                snprintf(type_str, sizeof(type_str), "%s",
                         g_settings.video.smooth ? "Linear" : "Nearest");
            else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_get_str)
            {
                if (type >= MENU_SETTINGS_SHADER_PARAMETER_0 && type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
                    driver.menu_ctx->backend->shader_manager_get_str(menu->parameter_shader, type_str, sizeof(type_str), type);
                else
                    driver.menu_ctx->backend->shader_manager_get_str(menu->shader, type_str, sizeof(type_str), type);
            }
        }
        else
#endif
            // Pretty-print libretro cores from menu.
            if (menu_type == MENU_SETTINGS_CORE || menu_type == MENU_SETTINGS_DEFERRED_CORE)
            {
                if (type == MENU_FILE_PLAIN)
                {
                    strlcpy(type_str, "(CORE)", sizeof(type_str));
                    file_list_get_alt_at_offset(menu->selection_buf, i, &path);
                    w = 6;
                }
                else
                {
                    strlcpy(type_str, "(DIR)", sizeof(type_str));
                    type = MENU_FILE_DIRECTORY;
                    w = 5;
                }
            }
            else if (menu_type == MENU_SETTINGS_CONFIG ||
#ifdef HAVE_OVERLAY
                     menu_type == MENU_SETTINGS_OVERLAY_PRESET ||
#endif
                     menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER ||
                     menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER ||
                     menu_type == MENU_SETTINGS_DISK_APPEND ||
                     menu_type_is == MENU_FILE_DIRECTORY)
            {
                if (type == MENU_FILE_PLAIN)
                {
                    strlcpy(type_str, "(FILE)", sizeof(type_str));
                    w = 6;
                }
                else if (type == MENU_FILE_USE_DIRECTORY)
                {
                    *type_str = '\0';
                    w = 0;
                }
                else
                {
                    strlcpy(type_str, "(DIR)", sizeof(type_str));
                    type = MENU_FILE_DIRECTORY;
                    w = 5;
                }
            }
            else if (menu_type == MENU_SETTINGS_OPEN_HISTORY)
            {
                *type_str = '\0';
                w = 0;
            }
            else if (type >= MENU_SETTINGS_CORE_OPTION_START)
                strlcpy(type_str,
                        core_option_get_val(g_extern.system.core_options, type - MENU_SETTINGS_CORE_OPTION_START),
                        sizeof(type_str));
            else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->setting_set_label)
                driver.menu_ctx->backend->setting_set_label(type_str, sizeof(type_str), &w, type);

        char entry_title_buf[256];
        char type_str_buf[64];
        bool selected = i == menu->selection_ptr;

        strlcpy(entry_title_buf, path, sizeof(entry_title_buf));
        strlcpy(type_str_buf, type_str, sizeof(type_str_buf));

        if ((type == MENU_FILE_PLAIN || type == MENU_FILE_DIRECTORY))
            menu_ticker_line(entry_title_buf, RMENU_TERM_WIDTH - (w + 1 + 2), g_extern.frame_count / 15, path, selected);
        else
            menu_ticker_line(type_str_buf, w, g_extern.frame_count / 15, type_str, selected);

        snprintf(message, sizeof(message), "%c %s", selected ? '>' : ' ', entry_title_buf);

        //blit_line(menu, x, y, message, selected);
        font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET;
        font_parms.y = POSITION_EDGE_MIN + POSITION_RENDER_OFFSET + (POSITION_OFFSET * j);
        font_parms.scale = FONT_SIZE_NORMAL;
        font_parms.color = WHITE;

        if (driver.video_data && driver.video_poke && driver.video_poke->set_osd_msg)
            driver.video_poke->set_osd_msg(driver.video_data, message, &font_parms);

        font_parms.x = POSITION_EDGE_CENTER + POSITION_OFFSET;

        if (driver.video_data && driver.video_poke && driver.video_poke->set_osd_msg)
            driver.video_poke->set_osd_msg(driver.video_data, type_str_buf, &font_parms);
    }
}