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;
}
Пример #2
0
void menu_input_st_string_callback(void *userdata, const char *str)
{
   menu_handle_t *menu = menu_driver_get_ptr();

   if (!menu)
      return;
 
   if (str && *str)
   {
      rarch_setting_t *current_setting = NULL;
      global_t *global = global_get_ptr();

      if ((current_setting = (rarch_setting_t*)
               setting_find_setting(
                  menu->list_settings, menu->keyboard.label_setting)))
      {
         strlcpy(current_setting->value.string, str, current_setting->size);
         menu_setting_generic(current_setting);
      }
      else
      {
         if (!strcmp(menu->keyboard.label_setting, "video_shader_preset_save_as"))
            menu_shader_manager_save_preset(str, false);
         else if (!strcmp(menu->keyboard.label_setting, "remap_file_save_as"))
            input_remapping_save_file(str);
         else if (!strcmp(menu->keyboard.label_setting, "cheat_file_save_as"))
            cheat_manager_save(global->cheat, str);
      }
   }

   menu_input_key_end_line();
}
Пример #3
0
rarch_setting_t *menu_setting_find(const char *label)
{
   driver_t    *driver = driver_get_ptr();
   menu_handle_t *menu = menu_driver_get_ptr();

   if (!driver)
      return NULL;
   return (rarch_setting_t*)setting_find_setting(
         menu->list_settings, label);
}
Пример #4
0
void menu_input_st_uint_callback(void *userdata, const char *str)
{
   menu_handle_t *menu = menu_driver_get_ptr();

   if (!menu)
      return;

   if (str && *str)
   {
      rarch_setting_t *current_setting = NULL;
      if ((current_setting = (rarch_setting_t*)
               setting_find_setting(
                  menu->list_settings, menu->keyboard.label_setting)))
         *current_setting->value.unsigned_integer = strtoul(str, NULL, 0);
   }

   menu_input_key_end_line();
}
Пример #5
0
static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs,
      const char *path,
      const char *label, unsigned type, unsigned action)
{
   menu_handle_t *menu    = menu_driver_get_ptr();
   settings_t *settings   = config_get_ptr();
   driver_t *driver       = driver_get_ptr();

   if (!menu)
      return -1;

   if (!settings->menu.pointer.enable
#ifdef HAVE_OVERLAY
       || (settings->input.overlay_enable && driver && driver->overlay)
#endif
       )
      return 0;

#if defined(HAVE_XMB)
   if (driver->menu_ctx == &menu_ctx_xmb)
      return 0;
#endif

   if (menu->pointer.pressed[0])
   {
      if (menu->pointer.oldpressed[0])
      {
         if (menu->mouse.ptr <= menu_list_get_size(menu->menu_list)-1)
            menu_navigation_set(&menu->navigation, menu->mouse.ptr, false);
      }
      else
         menu->pointer.oldpressed[0] = true;
   }
   else
   {
      if (menu->pointer.oldpressed[0])
      {
         rarch_setting_t *setting = NULL;

         menu->pointer.oldpressed[0] = false;
         setting = (rarch_setting_t*)setting_find_setting
            (menu->list_settings,
             menu->menu_list->selection_buf->list[menu->navigation.selection_ptr].label);

         if (menu->mouse.ptr == menu->navigation.selection_ptr && !menu->pointer.cancel
            && cbs && cbs->action_toggle && setting &&
            (setting->type == ST_BOOL || setting->type == ST_UINT || setting->type == ST_FLOAT
             || setting->type == ST_STRING))
            return cbs->action_toggle(type, label, MENU_ACTION_RIGHT, true);
         if (menu->mouse.ptr == menu->navigation.selection_ptr && !menu->pointer.cancel
            && cbs && cbs->action_ok)
            return cbs->action_ok(path, label, type,
                  menu->navigation.selection_ptr);
         else if (menu->mouse.ptr <= menu_list_get_size(menu->menu_list) - 1)
            menu_navigation_set(&menu->navigation, menu->mouse.ptr, false);
      }
   }

   if (menu->pointer.back)
   {
      if (!menu->pointer.oldback)
      {
         menu->pointer.oldback = true;
         menu_list_pop_stack(menu->menu_list);
      }
   }
   menu->pointer.oldback = menu->pointer.back;

   return 0;
}
Пример #6
0
static int menu_input_mouse_post_iterate(menu_file_list_cbs_t *cbs,
      const char *path,
      const char *label, unsigned type, unsigned action)
{
   driver_t      *driver  = driver_get_ptr();
   menu_handle_t *menu    = menu_driver_get_ptr();
   settings_t *settings   = config_get_ptr();

   if (!menu)
      return -1;

   if (!settings->menu.mouse.enable
#ifdef HAVE_OVERLAY
       || (settings->input.overlay_enable && driver && driver->overlay)
#endif
       )
   {
      menu->mouse.wheeldown = false;
      menu->mouse.wheelup   = false;
      menu->mouse.oldleft   = false;
      menu->mouse.oldright  = false;
      return 0;
   }

   if (menu->mouse.left)
   {
      if (!menu->mouse.oldleft)
      {
         rarch_setting_t *setting =
            (rarch_setting_t*)setting_find_setting
            (menu->list_settings,
             menu->menu_list->selection_buf->list[menu->navigation.selection_ptr].label);
         menu->mouse.oldleft = true;

#if 0
         RARCH_LOG("action OK: %d\n", cbs && cbs->action_ok);
         RARCH_LOG("action toggle: %d\n", cbs && cbs->action_toggle);
         if (setting && setting->type)
            RARCH_LOG("action type: %d\n", setting->type);
#endif

         if (menu->mouse.ptr == menu->navigation.selection_ptr
            && cbs && cbs->action_toggle && setting &&
            (setting->type == ST_BOOL || setting->type == ST_UINT || setting->type == ST_FLOAT
             || setting->type == ST_STRING))
            return cbs->action_toggle(type, label, MENU_ACTION_RIGHT, true);
         if (menu->mouse.ptr == menu->navigation.selection_ptr
            && cbs && cbs->action_ok)
            return cbs->action_ok(path, label, type,
                  menu->navigation.selection_ptr);
         else if (menu->mouse.ptr <= menu_list_get_size(menu->menu_list)-1)
            menu_navigation_set(&menu->navigation, menu->mouse.ptr, false);
      }
   }
   else
      menu->mouse.oldleft = false;

   if (menu->mouse.right)
   {
      if (!menu->mouse.oldright)
      {
         menu->mouse.oldright = true;
         menu_list_pop_stack(menu->menu_list);
      }
   }
   else
      menu->mouse.oldright = false;

   if (menu->mouse.wheeldown)
      menu_navigation_increment(&menu->navigation, 1);

   if (menu->mouse.wheelup)
      menu_navigation_decrement(&menu->navigation, 1);


   return 0;
}