Example #1
0
void menu_list_pop_stack_by_needle(menu_list_t *list,
      const char *needle)
{
   uint32_t needle_hash, label_hash;
   const char *path       = NULL;
   const char *label      = NULL;
   unsigned type          = 0;
   size_t entry_idx       = 0;
   menu_navigation_t *nav = menu_navigation_get_ptr();

   if (!list)
      return;

   menu_entries_set_refresh(false);
   menu_list_get_last(list->menu_stack, &path, &label, &type, &entry_idx);
   needle_hash            = menu_hash_calculate(needle);
   label_hash             = menu_hash_calculate(label);

   while (needle_hash == label_hash)
   {
      menu_list_pop(list->menu_stack, &nav->selection_ptr);
      menu_list_get_last(list->menu_stack, &path, &label, &type, &entry_idx);
      label_hash             = menu_hash_calculate(label);
      needle_hash            = menu_hash_calculate(needle);
   }
}
Example #2
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;
}
Example #3
0
void menu_list_pop_stack(menu_list_t *list)
{
   menu_navigation_t *nav = menu_navigation_get_ptr();
   if (!list)
      return;

   if (menu_list_get_stack_size(list) <= 1)
      return;

   menu_driver_list_cache(MENU_LIST_PLAIN, 0);

   menu_list_pop(list->menu_stack, &nav->selection_ptr);
   menu_entries_set_refresh(false);
}
static int action_iterate_info(const char *label, unsigned action)
{
   char msg[PATH_MAX_LENGTH];
   char needle[PATH_MAX_LENGTH];
   unsigned info_type               = 0;
   rarch_setting_t *current_setting = NULL;
   file_list_t *list                = NULL;
   menu_handle_t *menu              = menu_driver_get_ptr();
   if (!menu)
      return 0;

   list = (file_list_t*)menu->menu_list->selection_buf;

   menu_driver_render();

   current_setting = (rarch_setting_t*)setting_find_setting(
         menu->list_settings,
         list->list[menu->navigation.selection_ptr].label);

   if (current_setting)
      strlcpy(needle, current_setting->name, sizeof(needle));
   else if ((current_setting = (rarch_setting_t*)setting_find_setting(
               menu->list_settings,
               list->list[menu->navigation.selection_ptr].label)))
   {
      if (current_setting)
         strlcpy(needle, current_setting->name, sizeof(needle));
   }
   else
   {
      const char *lbl = NULL;
      menu_list_get_at_offset(list,
            menu->navigation.selection_ptr, NULL, &lbl,
            &info_type);

      if (lbl)
         strlcpy(needle, lbl, sizeof(needle));
   }

   setting_get_description(needle, msg, sizeof(msg));

   menu_driver_render_messagebox(msg);

   if (action == MENU_ACTION_OK)
      menu_list_pop(menu->menu_list->menu_stack, &menu->navigation.selection_ptr);

   return 0;
}
Example #5
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;
   }
}
Example #6
0
void menu_list_pop_stack_by_needle(menu_list_t *list,
      const char *needle)
{
   const char *path = NULL;
   const char *label = NULL;
   unsigned type = 0;

   if (!driver.menu || !list)
      return;

   driver.menu->need_refresh = true;
   file_list_get_last(list->menu_stack, &path, &label, &type);
   while (strcmp(needle, label) == 0)
   {
      menu_list_pop(list->menu_stack, &driver.menu->selection_ptr);
      file_list_get_last(list->menu_stack, &path, &label, &type);
   }
}
Example #7
0
void menu_list_flush_stack(menu_list_t *list,
      unsigned final_type)
{
   const char *path = NULL;
   const char *label = NULL;
   unsigned type = 0;

   if (!driver.menu || !list)
      return;

   driver.menu->need_refresh = true;
   file_list_get_last(list->menu_stack, &path, &label, &type);
   while (type != final_type)
   {
      menu_list_pop(list->menu_stack, &driver.menu->selection_ptr);
      file_list_get_last(list->menu_stack, &path, &label, &type);
   }
}
Example #8
0
void menu_list_flush_stack_by_needle(menu_list_t *list,
      const char *needle)
{
   const char *path = NULL;
   const char *label = NULL;
   unsigned type = 0;
   menu_handle_t *menu = menu_driver_get_ptr();
   if (!menu || !list)
      return;

   menu->need_refresh = true;
   file_list_get_last(list->menu_stack, &path, &label, &type);

   while (strcmp(needle, label) != 0)
   {
      menu_list_pop(list->menu_stack, &menu->navigation.selection_ptr);
      file_list_get_last(list->menu_stack, &path, &label, &type);
   }
}
Example #9
0
void menu_list_flush_stack(menu_list_t *list,
      const char *needle, unsigned final_type)
{
   const char *path       = NULL;
   const char *label      = NULL;
   unsigned type          = 0;
   size_t entry_idx       = 0;
   menu_navigation_t *nav = menu_navigation_get_ptr();
   if (!list)
      return;

   menu_entries_set_refresh(false);
   menu_list_get_last(list->menu_stack,
         &path, &label, &type, &entry_idx);

   while (menu_list_flush_stack_type(
            needle, label, type, final_type) != 0)
   {
      menu_list_pop(list->menu_stack, &nav->selection_ptr);
      menu_list_get_last(list->menu_stack,
            &path, &label, &type, &entry_idx);
   }
}
static int action_iterate_help(const char *label, unsigned action)
{
   unsigned i;
   static const unsigned binds[] = {
      RETRO_DEVICE_ID_JOYPAD_UP,
      RETRO_DEVICE_ID_JOYPAD_DOWN,
      RETRO_DEVICE_ID_JOYPAD_A,
      RETRO_DEVICE_ID_JOYPAD_B,
      RETRO_DEVICE_ID_JOYPAD_SELECT,
      RARCH_MENU_TOGGLE,
      RARCH_QUIT_KEY,
      RETRO_DEVICE_ID_JOYPAD_X,
   };
   char desc[ARRAY_SIZE(binds)][64];
   char msg[PATH_MAX_LENGTH];
   menu_handle_t *menu    = menu_driver_get_ptr();
   settings_t *settings   = config_get_ptr();

   if (!menu)
      return 0;

   menu_driver_render();

   for (i = 0; i < ARRAY_SIZE(binds); i++)
   {
      const struct retro_keybind *keybind = (const struct retro_keybind*)
         &settings->input.binds[0][binds[i]];
      const struct retro_keybind *auto_bind = (const struct retro_keybind*)
         input_get_auto_bind(0, binds[i]);

      input_get_bind_string(desc[i], keybind, auto_bind, sizeof(desc[i]));
   }

   snprintf(msg, sizeof(msg),
         "-- Welcome to RetroArch --\n"
         " \n" // strtok_r doesn't split empty strings.

         "Basic Menu controls:\n"
         "    Scroll (Up): %-20s\n"
         "  Scroll (Down): %-20s\n"
         "      Accept/OK: %-20s\n"
         "           Back: %-20s\n"
         "           Info: %-20s\n"
         "Enter/Exit Menu: %-20s\n"
         " Exit RetroArch: %-20s\n"
         "Toggle Keyboard: %-20s\n"
         " \n"

         "To run content:\n"
         "Load a libretro core (Core).\n"
         "Load a content file (Load Content).     \n"
         " \n"
         "See Path Settings to set directories for faster access to files.\n"
         " \n"

         "Press Accept/OK to continue.",
      desc[0], desc[1], desc[2], desc[3], desc[4], desc[5], desc[6], desc[7]);

   menu_driver_render_messagebox(msg);

   if (action == MENU_ACTION_OK)
      menu_list_pop(menu->menu_list->menu_stack, NULL);

   return 0;
}
Example #11
0
static int action_iterate_main(const char *label, unsigned action)
{
   menu_entry_t entry;
   static bool did_messagebox = false;
   char msg[PATH_MAX_LENGTH]      = {0};
   enum action_iterate_type iterate_type;
   size_t selected;
   size_t *pop_selected      = NULL;
   bool do_messagebox        = false;
   bool do_pop_stack         = false;
   bool do_post_iterate      = false;
   bool do_render            = false;
   int ret                   = 0;
   menu_handle_t *menu       = menu_driver_get_ptr();
   menu_navigation_t *nav    = menu_navigation_get_ptr();
   menu_display_t *disp      = menu_display_get_ptr();
   menu_list_t *menu_list    = menu_list_get_ptr();
   uint32_t hash             = menu_hash_calculate(label);
   if (!menu || !menu_list)
      return 0;
   
   iterate_type              = action_iterate_type(hash);

   switch (iterate_type)
   {
      case ITERATE_TYPE_HELP:
         ret = action_iterate_help(msg, sizeof(msg), label);
         pop_selected    = NULL;
         do_messagebox   = true;
         do_pop_stack    = true;
         do_post_iterate = true;
         if (ret == 1)
            action = MENU_ACTION_OK;
         break;
      case ITERATE_TYPE_BIND:
         if (menu_input_bind_iterate())
            menu_list_pop_stack(menu_list);
         break;
      case ITERATE_TYPE_VIEWPORT:
         ret = action_iterate_menu_viewport(msg, sizeof(msg), label, action, hash);
         break;
      case ITERATE_TYPE_INFO:
         ret = action_iterate_info(msg, sizeof(msg), label);
         pop_selected    = &nav->selection_ptr;
         do_messagebox   = true;
         do_pop_stack    = true;
         do_post_iterate = true;
         break;
      case ITERATE_TYPE_MESSAGE:
         strlcpy(msg, disp->message_contents, sizeof(msg));
         pop_selected    = &nav->selection_ptr;
         do_messagebox   = true;
         do_pop_stack    = true;
         break;
      case ITERATE_TYPE_DEFAULT:
         selected = menu_navigation_get_current_selection();
         /* FIXME: selected > selection_buf->list->size, i don't know why. */
         selected = max(min(selected, menu_list_get_size(menu_list)-1), 0);

         menu_entry_get(&entry,    selected, NULL, false);
         ret = menu_entry_action(&entry, selected, (enum menu_action)action);

         if (ret)
            return ret;

         do_post_iterate = true;
         do_render       = true;

         /* Have to defer it so we let settings refresh. */
         if (menu->push_help_screen)
         {
            menu_displaylist_info_t info = {0};

            info.list = menu_list->menu_stack;
            strlcpy(info.label,
                  menu_hash_to_str(MENU_LABEL_HELP),
                  sizeof(info.label));

            menu_displaylist_push_list(&info, DISPLAYLIST_HELP);
         }
         break;
   }

   did_messagebox = did_messagebox != do_messagebox;

   if (did_messagebox)
      menu_display_fb_set_dirty();

   if (do_messagebox)
      menu_driver_render_messagebox(msg);

   if (do_pop_stack && action == MENU_ACTION_OK)
      menu_list_pop(menu_list->menu_stack, pop_selected);
   
   if (do_post_iterate)
      menu_input_post_iterate(&ret, action);

   if (do_render)
      menu_driver_render();

   return ret;
}