Ejemplo n.º 1
0
static void menu_action_setting_disp_set_label_cheat(
      file_list_t* list,
      unsigned *w, unsigned type, unsigned i,
      const char *label,
      char *s, size_t len,
      const char *entry_label,
      const char *path,
      char *s2, size_t len2)
{
   global_t *global     = global_get_ptr();
   unsigned cheat_index = type - MENU_SETTINGS_CHEAT_BEGIN;

   if (!global)
      return;

   if (cheat_index < global->cheat->buf_size)
      snprintf(s, len, "%s : (%s)",
            (global->cheat->cheats[cheat_index].code != NULL)
            ? global->cheat->cheats[cheat_index].code : 
            menu_hash_to_str(MENU_VALUE_NOT_AVAILABLE),
            global->cheat->cheats[cheat_index].state ? 
            menu_hash_to_str(MENU_VALUE_ON) :
            menu_hash_to_str(MENU_VALUE_OFF)
            );
   *w = 19;
   strlcpy(s2, path, len2);
}
Ejemplo n.º 2
0
static bool zarch_menu_init_list(void *data)
{
   int ret;
   menu_displaylist_info_t info = {0};
   file_list_t *menu_stack    = menu_entries_get_menu_stack_ptr(0);
   file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);


   strlcpy(info.label, menu_hash_to_str(MENU_VALUE_HISTORY_TAB), sizeof(info.label));

   menu_entries_push(menu_stack, info.path, info.label, info.type, info.flags, 0);

#if 0
   menu_entries_increment_menu_stack();

   strlcpy(info.label, menu_hash_to_str(MENU_VALUE_MAIN_MENU), sizeof(info.label));

   menu_stack = menu_entries_get_menu_stack_ptr(1);

   menu_entries_push(menu_stack, info.path, info.label, info.type, info.flags, 0);
#endif

   event_command(EVENT_CMD_HISTORY_INIT);

   info.list  = selection_buf;
   menu_displaylist_push_list(&info, DISPLAYLIST_HISTORY);

   info.need_push = true;

   (void)ret;

   menu_displaylist_push_list_process(&info);

   return true;
}
Ejemplo n.º 3
0
static int menu_input_set_bind_mode_common(rarch_setting_t  *setting,
      enum menu_input_bind_mode type)
{
   size_t selection;
   menu_displaylist_info_t info  = {0};
   struct retro_keybind *keybind = NULL;
   settings_t     *settings      = config_get_ptr();
   menu_list_t        *menu_list = menu_list_get_ptr();
   menu_input_t      *menu_input = menu_input_get_ptr();

   if (!setting)
      return -1;

   menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);

   switch (type)
   {
      case MENU_INPUT_BIND_NONE:
         return -1;
      case MENU_INPUT_BIND_SINGLE:
         keybind = (struct retro_keybind*)setting->value.keybind;

         if (!keybind)
            return -1;

         menu_input->binds.begin  = setting->bind_type;
         menu_input->binds.last   = setting->bind_type;
         menu_input->binds.target = keybind;
         menu_input->binds.user   = setting->index_offset;

         info.list          = menu_list->menu_stack;
         info.type          = MENU_SETTINGS_CUSTOM_BIND_KEYBOARD;
         info.directory_ptr = selection;
         strlcpy(info.label,
               menu_hash_to_str(MENU_LABEL_CUSTOM_BIND), sizeof(info.label));

         menu_displaylist_push_list(&info, DISPLAYLIST_INFO);
         break;
      case MENU_INPUT_BIND_ALL:
         menu_input->binds.target = &settings->input.binds
            [setting->index_offset][0];
         menu_input->binds.begin  = MENU_SETTINGS_BIND_BEGIN;
         menu_input->binds.last   = MENU_SETTINGS_BIND_LAST;

         info.list          = menu_list->menu_stack;
         info.type          = MENU_SETTINGS_CUSTOM_BIND_KEYBOARD;
         info.directory_ptr = selection;
         strlcpy(info.label,
               menu_hash_to_str(MENU_LABEL_CUSTOM_BIND_ALL),
               sizeof(info.label));

         menu_displaylist_push_list(&info, DISPLAYLIST_INFO);
         break;
   }
   return 0;
}
Ejemplo n.º 4
0
void menu_common_push_content_settings(void)
{
   menu_list_t *menu_list       = menu_list_get_ptr();
   menu_displaylist_info_t info = {0};

   if (!menu_list)
      return;

   info.list      = menu_list->selection_buf;
   strlcpy(info.path, menu_hash_to_str(MENU_LABEL_VALUE_CONTENT_SETTINGS), sizeof(info.path));
   strlcpy(info.label, menu_hash_to_str(MENU_LABEL_CONTENT_SETTINGS), sizeof(info.label));

   menu_list_push(menu_list->menu_stack,
         info.path, info.label, info.type, info.flags, 0);
   menu_displaylist_push_list(&info, DISPLAYLIST_CONTENT_SETTINGS);
}
Ejemplo n.º 5
0
static void menu_action_setting_disp_set_label_input_bind_mode(
      file_list_t* list,
      unsigned *w, unsigned type, unsigned i,
      const char *label,
      char *s, size_t len,
      const char *entry_label,
      const char *path,
      char *s2, size_t len2)
{
   settings_t *settings = config_get_ptr();

   *w = 19;

   switch (settings->input.bind_mode)
   {
      case 0:
         strlcpy(s, "Auto", len);
         break;
      case 1:
         strlcpy(s, "RetroKeyboard", len);
         break;
      case 2:
         strlcpy(s, "RetroPad", len);
         break;
   }

   strlcpy(s2, menu_hash_to_str(MENU_LABEL_VALUE_INPUT_BIND_MODE), len2);
}
Ejemplo n.º 6
0
static void menu_action_setting_disp_set_label_menu_video_resolution(
      file_list_t* list,
      unsigned *w, unsigned type, unsigned i,
      const char *label,
      char *s, size_t len,
      const char *entry_label,
      const char *path,
      char *s2, size_t len2)
{
   unsigned width = 0, height = 0;

   *w = 19;
   *s = '\0';

   strlcpy(s2, path, len2);

   if (video_driver_get_video_output_size(&width, &height))
   {
#ifdef GEKKO
      if (width == 0 || height == 0)
         strlcpy(s, "DEFAULT", len);
      else
#endif
         snprintf(s, len, "%ux%u", width, height);
   }
   else
      strlcpy(s, menu_hash_to_str(MENU_VALUE_NOT_AVAILABLE), len);
}
Ejemplo n.º 7
0
static void menu_action_setting_disp_set_label_shader_pass(
      file_list_t* list,
      unsigned *w, unsigned type, unsigned i,
      const char *label,
      char *s, size_t len,
      const char *entry_label,
      const char *path,
      char *s2, size_t len2)
{
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
   struct video_shader *shader = NULL;
#endif
   unsigned pass = (type - MENU_SETTINGS_SHADER_PASS_0);

   (void)pass;

   *s = '\0';
   *w = 19;
   strlcpy(s2, path, len2);
   strlcpy(s, menu_hash_to_str(MENU_VALUE_NOT_AVAILABLE), len);

#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
   menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET,
         &shader);
   if (!shader)
      return;

   if (*shader->pass[pass].source.path)
      fill_pathname_base(s,
            shader->pass[pass].source.path, len);
#endif
}
Ejemplo n.º 8
0
static int mui_get_core_title(char *s, size_t len)
{
   struct retro_system_info    *system = NULL;
   rarch_system_info_t      *info = NULL;
   settings_t *settings           = config_get_ptr();
   const char *core_name          = NULL;
   const char *core_version       = NULL;

   menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
         &system);
   
   core_name    = system->library_name;
   core_version = system->library_version;

   runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);

   if (!settings->menu.core_enable)
      return -1; 

   if (string_is_empty(core_name))
      core_name = info->info.library_name;
   if (string_is_empty(core_name))
      core_name = menu_hash_to_str(MENU_VALUE_NO_CORE);

   if (!core_version)
      core_version = info->info.library_version;
   if (!core_version)
      core_version = "";

   snprintf(s, len, "%s %s", core_name, core_version);

   return 0;
}
Ejemplo n.º 9
0
/* Sets 's' to the name of the current core 
 * (shown at the top of the UI). */
int menu_entries_get_core_title(char *s, size_t len)
{
   const char *core_name          = NULL;
   const char *core_version       = NULL;
   global_t *global               = global_get_ptr();
   settings_t *settings           = config_get_ptr();
   rarch_system_info_t      *info = rarch_system_info_get_ptr();

   if (!settings->menu.core_enable)
      return -1; 

   if (global)
   {
      core_name    = global->menu.info.library_name;
      core_version = global->menu.info.library_version;
   }

   if (!core_name || core_name[0] == '\0')
      core_name = info->info.library_name;
   if (!core_name || core_name[0] == '\0')
      core_name = menu_hash_to_str(MENU_VALUE_NO_CORE);

   if (!core_version)
      core_version = info->info.library_version;
   if (!core_version)
      core_version = "";

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

   return 0;
}
Ejemplo n.º 10
0
static void menu_action_setting_disp_set_label_shader_pass(
      file_list_t* list,
      unsigned *w, unsigned type, unsigned i,
      const char *label,
      char *s, size_t len,
      const char *entry_label,
      const char *path,
      char *s2, size_t len2)
{
   unsigned pass = (type - MENU_SETTINGS_SHADER_PASS_0);
   menu_handle_t *menu    = menu_driver_get_ptr();
   if (!menu)
      return;

   (void)pass;
   (void)menu;

   *s = '\0';
   *w = 19;
   strlcpy(s2, path, len2);
   strlcpy(s, menu_hash_to_str(MENU_VALUE_NOT_AVAILABLE), len);

#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
   if (!menu->shader)
      return;
   if (*menu->shader->pass[pass].source.path)
      fill_pathname_base(s,
            menu->shader->pass[pass].source.path, len);
#endif
}
static void menu_action_setting_disp_set_label_menu_disk_index(
      file_list_t* list,
      unsigned *w, unsigned type, unsigned i,
      const char *label,
      char *s, size_t len,
      const char *entry_label,
      const char *path,
      char *s2, size_t len2)
{
   unsigned images = 0, current = 0;
   global_t *global     = global_get_ptr();
   const struct retro_disk_control_callback *control =
      (const struct retro_disk_control_callback*)
      &global->system.disk_control;

   *w = 19;
   *s = '\0';
   strlcpy(s2, path, len2);
   if (!control)
      return;

   images = control->get_num_images();
   current = control->get_image_index();

   if (current >= images)
      strlcpy(s, menu_hash_to_str(MENU_VALUE_NO_DISK), len);
   else
      snprintf(s, len, "%u", current + 1);
}
Ejemplo n.º 12
0
static void menu_action_setting_disp_set_label_shader_filter_pass(
      file_list_t* list,
      unsigned *w, unsigned type, unsigned i,
      const char *label,
      char *s, size_t len,
      const char *entry_label,
      const char *path,
      char *s2, size_t len2)
{
   unsigned pass = 0;
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
   struct video_shader *shader = NULL;
#endif

   (void)pass;

   *s = '\0';
   *w = 19;
   strlcpy(s2, path, len2);

#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
   menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET,
         &shader);
   if (!shader)
      return;

  pass = (type - MENU_SETTINGS_SHADER_PASS_FILTER_0);

  switch (shader->pass[pass].filter)
  {
     case 0:
        strlcpy(s, menu_hash_to_str(MENU_VALUE_DONT_CARE),
              len);
        break;
     case 1:
        strlcpy(s, menu_hash_to_str(MENU_VALUE_LINEAR),
              len);
        break;
     case 2:
        strlcpy(s, menu_hash_to_str(MENU_VALUE_NEAREST),
              len);
        break;
  }
#endif
}
Ejemplo n.º 13
0
static void menu_action_setting_disp_set_label_shader_filter_pass(
      file_list_t* list,
      unsigned *w, unsigned type, unsigned i,
      const char *label,
      char *s, size_t len,
      const char *entry_label,
      const char *path,
      char *s2, size_t len2)
{
   unsigned pass = 0;
   menu_handle_t *menu    = menu_driver_get_ptr();
   if (!menu)
      return;

   (void)pass;
   (void)menu;

   *s = '\0';
   *w = 19;
   strlcpy(s2, path, len2);

#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
   if (!menu || !menu->shader)
      return;

  pass = (type - MENU_SETTINGS_SHADER_PASS_FILTER_0);

  switch (menu->shader->pass[pass].filter)
  {
     case 0:
        strlcpy(s, menu_hash_to_str(MENU_VALUE_DONT_CARE),
              len);
        break;
     case 1:
        strlcpy(s, menu_hash_to_str(MENU_VALUE_LINEAR),
              len);
        break;
     case 2:
        strlcpy(s, menu_hash_to_str(MENU_VALUE_NEAREST),
              len);
        break;
  }
#endif
}
Ejemplo n.º 14
0
static int archive_load(void)
{
   int ret = 0;
   menu_displaylist_info_t info = {0};
   const char *menu_path  = NULL;
   const char *menu_label = NULL;
   const char* path       = NULL;
   size_t entry_idx       = 0;
   settings_t *settings   = config_get_ptr();
   global_t      *global  = global_get_ptr();
   size_t selected        = menu_navigation_get_current_selection();
   menu_handle_t *menu    = menu_driver_get_ptr();
   menu_list_t *menu_list = menu_list_get_ptr();

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

   menu_list_pop_stack(menu_list);

   menu_list_get_last_stack(menu_list, &menu_path, &menu_label, NULL, NULL);

   if (menu_list_get_size(menu_list) == 0)
      return 0;

   menu_list_get_at_offset(menu_list->selection_buf,
         selected, &path, NULL, NULL, &entry_idx);

   ret = rarch_defer_core(global->core_info, menu_path, path, menu_label,
         menu->deferred_path, sizeof(menu->deferred_path));

   fill_pathname_join(detect_content_path, menu_path, path,
         sizeof(detect_content_path));

   switch (ret)
   {
      case -1:
         event_command(EVENT_CMD_LOAD_CORE);
         menu_common_load_content(false, CORE_TYPE_PLAIN);
         break;
      case 0:
         info.list          = menu_list->menu_stack;
         info.type          = 0;
         info.directory_ptr = selected;
         strlcpy(info.path, settings->libretro_directory, sizeof(info.path));
         strlcpy(info.label,
               menu_hash_to_str(MENU_LABEL_DEFERRED_CORE_LIST), sizeof(info.label));

         ret = menu_displaylist_push_list(&info, DISPLAYLIST_GENERIC);
         break;
   }

   return ret;
}
Ejemplo n.º 15
0
void menu_input_search_start(void)
{
   menu_handle_t      *menu = menu_driver_get_ptr();
   menu_input_t *menu_input = menu_input_get_ptr();
   if (!menu || !menu_input)
      return;

   menu_input->keyboard.display = true;
   menu_input->keyboard.label   = menu_hash_to_str(MENU_VALUE_SEARCH);
   menu_input->keyboard.buffer  =
      input_keyboard_start_line(menu, menu_input_search_callback);
}
Ejemplo n.º 16
0
static void mui_preswitch_tabs(mui_handle_t *mui, unsigned action)
{
   size_t idx              = 0;
   size_t stack_size       = 0;
   file_list_t *menu_stack = NULL;

   if (!mui)
      return;

   menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);

   menu_stack = menu_entries_get_menu_stack_ptr(0);
   stack_size = menu_stack->size;

   if (menu_stack->list[stack_size - 1].label)
      free(menu_stack->list[stack_size - 1].label);
   menu_stack->list[stack_size - 1].label = NULL;

   switch (mui->categories.selection_ptr)
   {
      case MUI_SYSTEM_TAB_MAIN:
         menu_stack->list[stack_size - 1].label = 
            strdup(menu_hash_to_str(MENU_VALUE_MAIN_MENU));
         menu_stack->list[stack_size - 1].type = 
            MENU_SETTINGS;
         break;
      case MUI_SYSTEM_TAB_PLAYLISTS:
         menu_stack->list[stack_size - 1].label = 
            strdup(menu_hash_to_str(MENU_VALUE_PLAYLISTS_TAB));
         menu_stack->list[stack_size - 1].type = 
            MENU_PLAYLISTS_TAB;
         break;
      case MUI_SYSTEM_TAB_SETTINGS:
         menu_stack->list[stack_size - 1].label = 
            strdup(menu_hash_to_str(MENU_VALUE_SETTINGS_TAB));
         menu_stack->list[stack_size - 1].type = 
            MENU_SETTINGS;
         break;
   }
}
Ejemplo n.º 17
0
static int action_left_shader_filter_default(unsigned type, const char *label,
      bool wraparound)
{
#ifdef HAVE_SHADER_MANAGER
   rarch_setting_t *setting = menu_setting_find(menu_hash_to_str(MENU_LABEL_VIDEO_SMOOTH));
   if (!setting)
      return menu_cbs_exit();
   return menu_action_handle_setting(setting,
         menu_setting_get_type(setting), MENU_ACTION_LEFT, wraparound);
#else
   return 0;
#endif
}
Ejemplo n.º 18
0
static void menu_action_setting_disp_set_label_cheat(
      file_list_t* list,
      unsigned *w, unsigned type, unsigned i,
      const char *label,
      char *s, size_t len,
      const char *entry_label,
      const char *path,
      char *s2, size_t len2)
{
   unsigned cheat_index = type - MENU_SETTINGS_CHEAT_BEGIN;

   if (cheat_index < cheat_manager_get_buf_size())
      snprintf(s, len, "%s : (%s)",
            (cheat_manager_get_code(cheat_index) != NULL)
            ? cheat_manager_get_code(cheat_index) : 
            menu_hash_to_str(MENU_VALUE_NOT_AVAILABLE),
            cheat_manager_get_code_state(cheat_index) ? 
            menu_hash_to_str(MENU_VALUE_ON) :
            menu_hash_to_str(MENU_VALUE_OFF)
            );
   *w = 19;
   strlcpy(s2, path, len2);
}
Ejemplo n.º 19
0
static void menu_action_setting_disp_set_label_shader_default_filter(

      file_list_t* list,
      unsigned *w, unsigned type, unsigned i,
      const char *label,
      char *s, size_t len,
      const char *entry_label,
      const char *path,
      char *s2, size_t len2)
{
   settings_t *settings = config_get_ptr();

   *s = '\0';
   *w = 19;

   if (!settings)
      return;

   if (settings->video.smooth)
      strlcpy(s, menu_hash_to_str(MENU_VALUE_LINEAR), len); 
   else
      strlcpy(s, menu_hash_to_str(MENU_VALUE_NEAREST), len);
}
Ejemplo n.º 20
0
int menu_input_bind_iterate(char *s, size_t len)
{
   struct menu_bind_state binds;
   menu_input_t *menu_input     = menu_input_get_ptr();
   driver_t *driver             = driver_get_ptr();
   global_t *global             = global_get_ptr();
   bool bind_mode_kb            = global ? global->menu.bind_mode_keyboard : false;
   int64_t current              = rarch_get_time_usec();
   int timeout                  = (menu_input->binds.timeout_end - current) / 1000000;

   if (bind_mode_kb)
   {
      snprintf(s, len,
            "[%s]\npress keyboard\n(timeout %d %s)",
            input_config_bind_map[
            menu_input->binds.begin - MENU_SETTINGS_BIND_BEGIN].desc,
            timeout,
            menu_hash_to_str(MENU_VALUE_SECONDS));
      return menu_input_bind_iterate_keyboard(current, timeout);
   }
   else
      snprintf(s, len,
            "[%s]\npress joypad\n(RETURN to skip)",
            input_config_bind_map[
            menu_input->binds.begin - MENU_SETTINGS_BIND_BEGIN].desc);

   binds = menu_input->binds;

   input_driver_keyboard_mapping_set_block(true);
   menu_input_poll_bind_state(&binds, bind_port);

   if ((binds.skip && !menu_input->binds.skip) ||
         menu_input_poll_find_trigger(&menu_input->binds, &binds))
   {
      input_driver_keyboard_mapping_set_block(false);

      /* Avoid new binds triggering things right away. */
      driver->flushing_input = true;

      binds.begin++;

      if (binds.begin > binds.last)
         return 1;

      binds.target++;
   }
   menu_input->binds = binds;

   return 0;
}
Ejemplo n.º 21
0
bool generic_menu_init_list(void *data)
{
   menu_displaylist_info_t info = {0};
   file_list_t *menu_stack    = menu_entries_get_menu_stack_ptr();
   file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();

   info.list  = selection_buf;
   info.type  = MENU_SETTINGS;
   info.flags = SL_FLAG_MAIN_MENU | SL_FLAG_SETTINGS;
   strlcpy(info.label, menu_hash_to_str(MENU_VALUE_MAIN_MENU), sizeof(info.label));

   menu_entries_push(menu_stack, info.path, info.label, info.type, info.flags, 0);
   menu_displaylist_push_list(&info, DISPLAYLIST_MAIN_MENU);

   return true;
}
Ejemplo n.º 22
0
static int action_info_default(unsigned type, const char *label)
{
   menu_displaylist_info_t info = {0};
   menu_navigation_t *nav       = menu_navigation_get_ptr();
   menu_list_t *menu_list       = menu_list_get_ptr();

   if (!menu_list)
      return 0;

   info.list          = menu_list->menu_stack;
   info.directory_ptr = nav->selection_ptr;
   strlcpy(info.label,
         menu_hash_to_str(MENU_LABEL_INFO_SCREEN),
        sizeof(info.label));

   return menu_displaylist_push_list(&info, DISPLAYLIST_HELP);
}
Ejemplo n.º 23
0
static int action_info_default(unsigned type, const char *label)
{
   size_t selection             = 0;
   menu_displaylist_info_t info = {0};
   menu_list_t *menu_list       = menu_list_get_ptr();

   if (!menu_list)
      return 0;
   if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
      return 0;

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

   return menu_displaylist_push_list(&info, DISPLAYLIST_HELP);
}
Ejemplo n.º 24
0
static void menu_action_setting_disp_set_label_configurations(
      file_list_t* list,
      unsigned *w, unsigned type, unsigned i,
      const char *label,
      char *s, size_t len,
      const char *entry_label,
      const char *path,
      char *s2, size_t len2)
{
   global_t *global = global_get_ptr();

   *w = 19;
   strlcpy(s2, path, len2);
   if (global && *global->path.config)
      fill_pathname_base(s, global->path.config,
            len);
   else
      strlcpy(s, menu_hash_to_str(MENU_VALUE_DIRECTORY_DEFAULT), len);
}
Ejemplo n.º 25
0
static void menu_action_setting_disp_set_label_filter(
      file_list_t* list,
      unsigned *w, unsigned type, unsigned i,
      const char *label,
      char *s, size_t len,
      const char *entry_label,
      const char *path,
      char *s2, size_t len2)
{
   settings_t *settings = config_get_ptr();

   *s = '\0';
   *w = 19;
   strlcpy(s2, path, len2);
   strlcpy(s, menu_hash_to_str(MENU_VALUE_NOT_AVAILABLE), len);

   if (settings && *settings->video.softfilter_plugin)
      fill_short_pathname_representation(s,
            settings->video.softfilter_plugin, len);
}
Ejemplo n.º 26
0
static void menu_action_setting_disp_set_label_menu_disk_index(
      file_list_t* list,
      unsigned *w, unsigned type, unsigned i,
      const char *label,
      char *s, size_t len,
      const char *entry_label,
      const char *path,
      char *s2, size_t len2)
{
   unsigned images = 0, current                = 0;
   rarch_system_info_t *system                 = NULL;
   struct retro_disk_control_callback *control = NULL;

   runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
   if (!system)
      return;

   control = &system->disk_control;

   if (!control)
      return;

   *w = 19;
   *s = '\0';
   strlcpy(s2, path, len2);

   if (!control->get_num_images)
      return;
   if (!control->get_image_index)
      return;

   images  = control->get_num_images();
   current = control->get_image_index();

   if (current >= images)
      strlcpy(s, menu_hash_to_str(MENU_VALUE_NO_DISK), len);
   else
      snprintf(s, len, "%u", current + 1);
}
Ejemplo n.º 27
0
static void menu_action_setting_disp_set_label_shader_scale_pass(
      file_list_t* list,
      unsigned *w, unsigned type, unsigned i,
      const char *label,
      char *s, size_t len,
      const char *entry_label,
      const char *path,
      char *s2, size_t len2)
{
   unsigned pass               = 0;
   unsigned scale_value        = 0;
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
   struct video_shader *shader = NULL;
#endif

   *s = '\0';
   *w = 19;
   strlcpy(s2, path, len2);

   (void)pass;
   (void)scale_value;

#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
   menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET,
         &shader);
   if (!shader)
      return;

   pass        = (type - MENU_SETTINGS_SHADER_PASS_SCALE_0);
   scale_value = shader->pass[pass].fbo.scale_x;

   if (!scale_value)
      strlcpy(s, menu_hash_to_str(MENU_VALUE_DONT_CARE), len);
   else
      snprintf(s, len, "%ux", scale_value);
#endif
}
Ejemplo n.º 28
0
static bool nk_menu_init_list(void *data)
{
   menu_displaylist_info_t info = {0};
   file_list_t *menu_stack    = menu_entries_get_menu_stack_ptr(0);
   file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);

   strlcpy(info.label,
         menu_hash_to_str(MENU_VALUE_HISTORY_TAB), sizeof(info.label));

   menu_entries_add(menu_stack,
         info.path, info.label, info.type, info.flags, 0);

   command_event(CMD_EVENT_HISTORY_INIT, NULL);

   info.list  = selection_buf;

   if (menu_displaylist_ctl(DISPLAYLIST_HISTORY, &info))
   {
      info.need_push = true;
      return menu_displaylist_ctl(DISPLAYLIST_PROCESS, &info);
   }

   return false;
}
Ejemplo n.º 29
0
static int mui_list_push(void *data, void *userdata,
      menu_displaylist_info_t *info, unsigned type)
{
   int ret                = -1;
   core_info_list_t *list = NULL;
   menu_handle_t *menu    = (menu_handle_t*)data;

   (void)userdata;

   switch (type)
   {
      case DISPLAYLIST_LOAD_CONTENT_LIST:
         menu_entries_clear(info->list);
         menu_entries_push(info->list,
               menu_hash_to_str(MENU_LABEL_VALUE_LOAD_CONTENT),
               menu_hash_to_str(MENU_LABEL_LOAD_CONTENT),
               MENU_SETTING_ACTION, 0, 0);

         runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
         if (core_info_list_num_info_files(list))
         {
            menu_entries_push(info->list,
                  menu_hash_to_str(MENU_LABEL_VALUE_DETECT_CORE_LIST),
                  menu_hash_to_str(MENU_LABEL_DETECT_CORE_LIST),
                  MENU_SETTING_ACTION, 0, 0);

            menu_entries_push(info->list,
                  menu_hash_to_str(MENU_LABEL_VALUE_DOWNLOADED_FILE_DETECT_CORE_LIST),
                  menu_hash_to_str(MENU_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST),
                  MENU_SETTING_ACTION, 0, 0);
         }

         info->need_push    = true;
         info->need_refresh = true;
         ret = 0;
         break;
      case DISPLAYLIST_MAIN_MENU:
         menu_entries_clear(info->list);

         if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
         {
            menu_displaylist_parse_settings(menu, info,
                  menu_hash_to_str(MENU_LABEL_CONTENT_SETTINGS), PARSE_ACTION, false);
         }

         menu_displaylist_parse_settings(menu, info,
               menu_hash_to_str(MENU_LABEL_START_CORE), PARSE_ACTION, false);

#if defined(HAVE_DYNAMIC) || defined(HAVE_LIBRETRO_MANAGEMENT)
         menu_displaylist_parse_settings(menu, info,
               menu_hash_to_str(MENU_LABEL_CORE_LIST), PARSE_ACTION, false);
#endif
         menu_displaylist_parse_settings(menu, info,
               menu_hash_to_str(MENU_LABEL_LOAD_CONTENT_LIST), PARSE_ACTION, false);
         menu_displaylist_parse_settings(menu, info,
               menu_hash_to_str(MENU_LABEL_LOAD_CONTENT_HISTORY), PARSE_ACTION, false);
#if defined(HAVE_NETWORKING)
#if defined(HAVE_LIBRETRODB)
         menu_displaylist_parse_settings(menu, info,
               menu_hash_to_str(MENU_LABEL_ADD_CONTENT_LIST), PARSE_ACTION, false);
#endif
         menu_displaylist_parse_settings(menu, info,
               menu_hash_to_str(MENU_LABEL_ONLINE_UPDATER), PARSE_ACTION, false);
#endif
         menu_displaylist_parse_settings(menu, info,
               menu_hash_to_str(MENU_LABEL_INFORMATION_LIST), PARSE_ACTION, false);
#ifndef HAVE_DYNAMIC
         menu_displaylist_parse_settings(menu, info,
               menu_hash_to_str(MENU_LABEL_RESTART_RETROARCH), PARSE_ACTION, false);
#endif
         menu_displaylist_parse_settings(menu, info,
               menu_hash_to_str(MENU_LABEL_CONFIGURATIONS), PARSE_ACTION, false);
         menu_displaylist_parse_settings(menu, info,
               menu_hash_to_str(MENU_LABEL_SAVE_CURRENT_CONFIG), PARSE_ACTION, false);
         menu_displaylist_parse_settings(menu, info,
               menu_hash_to_str(MENU_LABEL_SAVE_NEW_CONFIG), PARSE_ACTION, false);
         menu_displaylist_parse_settings(menu, info,
               menu_hash_to_str(MENU_LABEL_HELP_LIST), PARSE_ACTION, false);
#if !defined(IOS)
         menu_displaylist_parse_settings(menu, info,
               menu_hash_to_str(MENU_LABEL_QUIT_RETROARCH), PARSE_ACTION, false);
#endif
#if defined(HAVE_LAKKA)
         menu_displaylist_parse_settings(menu, info,
               menu_hash_to_str(MENU_LABEL_SHUTDOWN), PARSE_ACTION, false);
#endif
         info->need_push    = true;
         ret = 0;
         break;
   }
   return ret;
}
Ejemplo n.º 30
0
int menu_input_key_bind_iterate(char *s, size_t len)
{
   struct menu_bind_state binds;
   bool               timed_out = false;
   menu_input_t *menu_input     = menu_input_get_ptr();
   driver_t *driver             = driver_get_ptr();
   int64_t current              = retro_get_time_usec();
   int timeout                  = (menu_input->binds.timeout_end - current) / 1000000;

   if (timeout <= 0)
   {
      input_driver_keyboard_mapping_set_block(false);

      menu_input->binds.begin++;
      menu_input->binds.target++;
      menu_input->binds.timeout_end = retro_get_time_usec() +
         MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000;
      timed_out = true;
   }

   snprintf(s, len,
         "[%s]\npress keyboard or joypad\n(timeout %d %s)",
         input_config_bind_map[
         menu_input->binds.begin - MENU_SETTINGS_BIND_BEGIN].desc,
         timeout,
         menu_hash_to_str(MENU_VALUE_SECONDS));

   /* binds.begin is updated in keyboard_press callback. */
   if (menu_input->binds.begin > menu_input->binds.last)
   {
      /* Avoid new binds triggering things right away. */
      driver->flushing_input = true;

      /* We won't be getting any key events, so just cancel early. */
      if (timed_out)
         input_keyboard_wait_keys_cancel();

      return 1;
   }

   binds = menu_input->binds;

   input_driver_keyboard_mapping_set_block(true);
   menu_input_key_bind_poll_bind_state(&binds, bind_port, timed_out);

   if ((binds.skip && !menu_input->binds.skip) ||
         menu_input_key_bind_poll_find_trigger(&menu_input->binds, &binds))
   {
      input_driver_keyboard_mapping_set_block(false);

      /* Avoid new binds triggering things right away. */
      driver->flushing_input = true;

      binds.begin++;

      if (binds.begin > binds.last)
         return 1;

      binds.target++;
      binds.timeout_end = retro_get_time_usec() +
         MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000;
   }
   menu_input->binds = binds;

   return 0;
}