static int action_ok_core_deferred_set(const char *path,
      const char *label, unsigned type, size_t idx)
{
   char core_display_name[PATH_MAX_LENGTH];
   menu_handle_t *menu = menu_driver_get_ptr();
   if (!menu)
      return -1;

   if (menu->playlist)
      content_playlist_free(menu->playlist);

   menu->playlist = content_playlist_init(menu->db_playlist_file, 1000);

   core_info_get_name(path, core_display_name, sizeof(core_display_name));

   idx = rdb_entry_start_game_selection_ptr;

   content_playlist_update(menu->playlist, idx,
         menu->playlist->entries[idx].path, menu->playlist->entries[idx].label,
         path , core_display_name,
         menu->playlist->entries[idx].crc32);

   content_playlist_free(menu->playlist);
   menu->playlist = NULL;

   menu_list_flush_stack(menu->menu_list, NULL, MENU_SETTINGS);

   return -1;
}
static int action_ok_shader_pass_load(const char *path,
      const char *label, unsigned type, size_t idx)
{
   const char *menu_path = NULL;
   menu_handle_t *menu = menu_driver_get_ptr();
   if (!menu)
      return -1;

   (void)menu_path;

#ifdef HAVE_SHADER_MANAGER
   menu_list_get_last_stack(menu->menu_list, &menu_path, NULL,
         NULL);

   fill_pathname_join(menu->shader->pass[hack_shader_pass].source.path,
         menu_path, path,
         sizeof(menu->shader->pass[hack_shader_pass].source.path));

   /* This will reset any changed parameters. */
   video_shader_resolve_parameters(NULL, menu->shader);
   menu_list_flush_stack(menu->menu_list, "shader_options", 0);
   return 0;
#else
   return -1;
#endif
}
Beispiel #3
0
void menu_common_load_content(bool persist, enum rarch_core_type type)
{
   menu_display_t *disp         = menu_display_get_ptr();
   menu_list_t *menu_list       = menu_list_get_ptr();
   if (!menu_list)
      return;

   switch (type)
   {
      case CORE_TYPE_PLAIN:
      case CORE_TYPE_DUMMY:
         event_command(persist ? EVENT_CMD_LOAD_CONTENT_PERSIST : EVENT_CMD_LOAD_CONTENT);
         break;
#ifdef HAVE_FFMPEG
      case CORE_TYPE_FFMPEG:
         event_command(EVENT_CMD_LOAD_CONTENT_FFMPEG);
         break;
#endif
      case CORE_TYPE_IMAGEVIEWER:
#ifdef HAVE_IMAGEVIEWER
         event_command(EVENT_CMD_LOAD_CONTENT_IMAGEVIEWER);
#endif
         break;
   }

   menu_list_flush_stack(menu_list, NULL, MENU_SETTINGS);
   disp->msg_force = true;

   menu_common_push_content_settings();
}
static int action_ok_cheat_file_load(const char *path,
      const char *label, unsigned type, size_t idx)
{
   const char *menu_path = NULL;
   char cheat_path[PATH_MAX_LENGTH];
   menu_handle_t *menu    = menu_driver_get_ptr();
   global_t *global       = global_get_ptr();
   if (!menu)
      return -1;

   (void)cheat_path;
   (void)menu_path;
   menu_list_get_last_stack(menu->menu_list, &menu_path, NULL,
         NULL);

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

   if (global->cheat)
      cheat_manager_free(global->cheat);

   global->cheat = cheat_manager_load(cheat_path);

   if (!global->cheat)
      return -1;

   menu_list_flush_stack(menu->menu_list, "core_cheat_options", 0);

   return 0;
}
static int action_ok_shader_preset_load(const char *path,
      const char *label, unsigned type, size_t idx)
{
   const char *menu_path = NULL;
   char shader_path[PATH_MAX_LENGTH];
   menu_handle_t *menu = menu_driver_get_ptr();
   if (!menu)
      return -1;

   (void)shader_path;
   (void)menu_path;
#ifdef HAVE_SHADER_MANAGER
   menu_list_get_last_stack(menu->menu_list, &menu_path, NULL,
         NULL);

   fill_pathname_join(shader_path, menu_path, path, sizeof(shader_path));
   menu_shader_manager_set_preset(menu->shader,
         video_shader_parse_type(shader_path, RARCH_SHADER_NONE),
         shader_path);
   menu_list_flush_stack(menu->menu_list, "shader_options", 0);
   return 0;
#else
   return -1;
#endif
}
static int action_ok_video_filter_file_load(const char *path,
      const char *label, unsigned type, size_t idx)
{
   char filter_path[PATH_MAX_LENGTH];
   const char *menu_path    = NULL;
   menu_handle_t *menu      = menu_driver_get_ptr();
   settings_t *settings     = config_get_ptr();

   if (!menu)
      return -1;

   (void)filter_path;
   (void)menu_path;

   menu_list_get_last_stack(menu->menu_list, &menu_path, NULL,
         NULL);

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

   strlcpy(settings->video.softfilter_plugin, filter_path,
         sizeof(settings->video.softfilter_plugin));

   event_command(EVENT_CMD_REINIT);

   menu_list_flush_stack(menu->menu_list, "video_options", 0);

   return 0;
}
Beispiel #7
0
void menu_entries_flush_stack(const char *needle, unsigned final_type)
{
   menu_list_t *menu_list         = NULL;
   menu_entries_ctl(MENU_ENTRIES_CTL_LIST_GET, &menu_list);
   if (menu_list)
      menu_list_flush_stack(menu_list, 0, needle, final_type);
}
void menu_entries_common_load_content(bool persist)
{
   menu_handle_t *menu = menu_driver_resolve();
   if (!menu)
      return;

   rarch_main_command(persist ? RARCH_CMD_LOAD_CONTENT_PERSIST : RARCH_CMD_LOAD_CONTENT);

   menu_list_flush_stack(menu->menu_list, MENU_SETTINGS);
   menu->msg_force = true;
}
Beispiel #9
0
void menu_entries_common_load_content(bool persist)
{
   menu_handle_t *menu = menu_driver_get_ptr();
   if (!menu)
      return;

   event_command(persist ? EVENT_CMD_LOAD_CONTENT_PERSIST : EVENT_CMD_LOAD_CONTENT);

   menu_list_flush_stack(menu->menu_list, MENU_SETTINGS);
   menu->msg_force = true;
}
Beispiel #10
0
void menu_common_load_content(bool persist)
{
   menu_display_t *disp   = menu_display_get_ptr();
   menu_list_t *menu_list = menu_list_get_ptr();
   if (!menu_list)
      return;

   event_command(persist ? EVENT_CMD_LOAD_CONTENT_PERSIST : EVENT_CMD_LOAD_CONTENT);

   menu_list_flush_stack(menu_list, NULL, MENU_SETTINGS);
   disp->msg_force = true;
}
Beispiel #11
0
static int action_ok_playlist_entry(const char *path,
      const char *label, unsigned type, size_t idx)
{
   menu_handle_t *menu = menu_driver_get_ptr();
   if (!menu)
      return -1;

   rarch_playlist_load_content(g_defaults.history,
         menu->navigation.selection_ptr);
   menu_list_flush_stack(menu->menu_list, MENU_SETTINGS);
   return -1;
}
Beispiel #12
0
int menu_common_load_content(
      const char *core_path, const char *fullpath,
      bool persist, enum rarch_core_type type)
{
   settings_t *settings         = config_get_ptr();
   global_t *global             = global_get_ptr();
   menu_display_t *disp         = menu_display_get_ptr();
   menu_list_t *menu_list       = menu_list_get_ptr();
   enum event_command cmd       = EVENT_CMD_NONE;

   if (core_path)
   {
      strlcpy(settings->libretro, core_path, sizeof(settings->libretro));
      event_command(EVENT_CMD_LOAD_CORE);
   }

   if (fullpath)
   {
      strlcpy(global->path.fullpath, fullpath, sizeof(global->path.fullpath));
   }

   switch (type)
   {
      case CORE_TYPE_PLAIN:
      case CORE_TYPE_DUMMY:
         cmd = persist ? EVENT_CMD_LOAD_CONTENT_PERSIST : EVENT_CMD_LOAD_CONTENT;
         break;
#ifdef HAVE_FFMPEG
      case CORE_TYPE_FFMPEG:
         cmd = EVENT_CMD_LOAD_CONTENT_FFMPEG;
         break;
#endif
      case CORE_TYPE_IMAGEVIEWER:
#ifdef HAVE_IMAGEVIEWER
         cmd = EVENT_CMD_LOAD_CONTENT_IMAGEVIEWER;
#endif
         break;
   }

   if (cmd != EVENT_CMD_NONE)
      event_command(cmd);

   menu_list_flush_stack(menu_list, NULL, MENU_SETTINGS);
   disp->msg_force = true;

   generic_action_ok_displaylist_push("",
         "", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS);

   return -1;
}
static int action_ok_playlist_entry(const char *path,
      const char *label, unsigned type, size_t idx)
{
   const char *entry_path  = NULL;
   const char *entry_label = NULL;
   const char *core_path   = NULL;
   const char *core_name   = NULL;
   size_t selection_ptr = 0;
   content_playlist_t *playlist = g_defaults.history;
   menu_handle_t *menu = menu_driver_get_ptr();
   if (!menu)
      return -1;

   if (!strcmp(label, "collection") ||
         !strcmp(label, "rdb_entry_start_game"))
   {
      if (!menu->playlist)
      {
         menu->playlist = content_playlist_init(menu->db_playlist_file, 1000);

         if (!menu->playlist)
            return -1;
      }

      playlist = menu->playlist;
   }

   selection_ptr = menu->navigation.selection_ptr;

   if (!strcmp(label, "rdb_entry_start_game"))
      selection_ptr = rdb_entry_start_game_selection_ptr;

   content_playlist_get_index(playlist, idx,
         &entry_path, &entry_label, &core_path, &core_name, NULL); 

#if 1
   RARCH_LOG("path: %s, label: %s, core path: %s, core name: %s\n", entry_path, entry_label,
         core_path, core_name);
#endif

   if (core_path && core_path[0] != '\0' && core_name &&
         core_name[0] != '\0' && !strcmp(core_path, "DETECT") && !strcmp(core_name, "DETECT"))
      return action_ok_file_load_with_detect_core(entry_path, label, type, idx);


   rarch_playlist_load_content(playlist, selection_ptr);

   menu_list_flush_stack(menu->menu_list, NULL, MENU_SETTINGS);
   return -1;
}
static int action_ok_record_configfile_load(const char *path,
      const char *label, unsigned type, size_t idx)
{
   const char *menu_path = NULL;
   global_t     *global = global_get_ptr();
   menu_handle_t *menu  = menu_driver_get_ptr();
   if (!menu || !global)
      return -1;

   menu_list_get_last_stack(menu->menu_list, &menu_path, NULL,
         NULL);

   fill_pathname_join(global->record.config, menu_path, path, sizeof(global->record.config));

   menu_list_flush_stack(menu->menu_list, "Recording Settings", 0);
   return 0;
}
Beispiel #15
0
static int action_ok_disk_image_append(const char *path,
      const char *label, unsigned type, size_t idx)
{
   char image[PATH_MAX_LENGTH];
   const char *menu_path    = NULL;
   menu_handle_t *menu = menu_driver_get_ptr();

   if (!menu)
      return -1;

   menu_list_get_last_stack(menu->menu_list,
         &menu_path, NULL, NULL);

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

   event_command(EVENT_CMD_RESUME);

   menu_list_flush_stack(menu->menu_list, MENU_SETTINGS);
   return -1;
}
static int action_ok_remap_file_load(const char *path,
      const char *label, unsigned type, size_t idx)
{
   const char *menu_path = NULL;
   char remap_path[PATH_MAX_LENGTH];
   menu_handle_t *menu = menu_driver_get_ptr();
   if (!menu)
      return -1;

   (void)remap_path;
   (void)menu_path;

   menu_list_get_last_stack(menu->menu_list, &menu_path, NULL,
         NULL);

   fill_pathname_join(remap_path, menu_path, path, sizeof(remap_path));
   input_remapping_load_file(remap_path);

   menu_list_flush_stack(menu->menu_list, "core_input_remapping_options", 0);

   return 0;
}
static int action_ok_core_load(const char *path,
      const char *label, unsigned type, size_t idx)
{
   const char *menu_path    = NULL;
   menu_handle_t *menu      = menu_driver_get_ptr();
   settings_t *settings     = config_get_ptr();
   global_t *global         = global_get_ptr();

   if (!menu)
      return -1;

   (void)global;

   menu_list_get_last_stack(menu->menu_list,
         &menu_path, NULL, NULL);

   fill_pathname_join(settings->libretro, menu_path, path,
         sizeof(settings->libretro));
   event_command(EVENT_CMD_LOAD_CORE);
   menu_list_flush_stack(menu->menu_list, NULL, MENU_SETTINGS);
#if defined(HAVE_DYNAMIC)
   /* No content needed for this core, load core immediately. */

   if (menu->load_no_content && settings->core.set_supports_no_game_enable)
   {
      *global->fullpath = '\0';

      menu_entries_common_load_content(false);
      return -1;
   }

   return 0;
   /* Core selection on non-console just updates directory listing.
    * Will take effect on new content load. */
#elif defined(RARCH_CONSOLE)
   event_command(EVENT_CMD_RESTART_RETROARCH);
   return -1;
#endif
}
Beispiel #18
0
static int action_ok_config_load(const char *path,
      const char *label, unsigned type, size_t idx)
{
   const char *menu_path  = NULL;
   char config[PATH_MAX_LENGTH];
   menu_handle_t *menu = menu_driver_get_ptr();

   if (!menu)
      return -1;

   menu_list_get_last_stack(menu->menu_list,
         &menu_path, NULL, NULL);

   fill_pathname_join(config, menu_path, path, sizeof(config));
   menu_list_flush_stack(menu->menu_list, MENU_SETTINGS);
   menu->msg_force = true;
   if (rarch_replace_config(config))
   {
      menu_navigation_clear(&menu->navigation, false);
      return -1;
   }

   return 0;
}
static int action_iterate_menu_viewport(char *s, size_t len,
      const char *label, unsigned action, uint32_t hash)
{
   int stride_x = 1, stride_y = 1;
   menu_displaylist_info_t info     = {0};
   struct retro_game_geometry *geom = NULL;
   const char *base_msg             = NULL;
   unsigned type                    = 0;
   video_viewport_t *custom         = video_viewport_get_custom();
   menu_display_t *disp             = menu_display_get_ptr();
   menu_navigation_t *nav           = menu_navigation_get_ptr();
   menu_list_t *menu_list           = menu_list_get_ptr();
   settings_t *settings             = config_get_ptr();
   struct retro_system_av_info *av_info = video_viewport_get_system_av_info();

   if (!menu_list)
      return -1;

   menu_list_get_last_stack(menu_list, NULL, NULL, &type, NULL);

   geom = (struct retro_game_geometry*)&av_info->geometry;

   if (settings->video.scale_integer)
   {
      stride_x = geom->base_width;
      stride_y = geom->base_height;
   }

   switch (action)
   {
      case MENU_ACTION_UP:
         if (type == MENU_SETTINGS_CUSTOM_VIEWPORT)
         {
            custom->y      -= stride_y;
            custom->height += stride_y;
         }
         else if (custom->height >= (unsigned)stride_y)
            custom->height -= stride_y;

         event_command(EVENT_CMD_VIDEO_APPLY_STATE_CHANGES);
         break;

      case MENU_ACTION_DOWN:
         if (type == MENU_SETTINGS_CUSTOM_VIEWPORT)
         {
            custom->y += stride_y;
            if (custom->height >= (unsigned)stride_y)
               custom->height -= stride_y;
         }
         else
            custom->height += stride_y;

         event_command(EVENT_CMD_VIDEO_APPLY_STATE_CHANGES);
         break;

      case MENU_ACTION_LEFT:
         if (type == MENU_SETTINGS_CUSTOM_VIEWPORT)
         {
            custom->x     -= stride_x;
            custom->width += stride_x;
         }
         else if (custom->width >= (unsigned)stride_x)
            custom->width -= stride_x;

         event_command(EVENT_CMD_VIDEO_APPLY_STATE_CHANGES);
         break;

      case MENU_ACTION_RIGHT:
         if (type == MENU_SETTINGS_CUSTOM_VIEWPORT)
         {
            custom->x += stride_x;
            if (custom->width >= (unsigned)stride_x)
               custom->width -= stride_x;
         }
         else
            custom->width += stride_x;

         event_command(EVENT_CMD_VIDEO_APPLY_STATE_CHANGES);
         break;

      case MENU_ACTION_CANCEL:
         menu_entry_go_back();

         if (hash == MENU_LABEL_CUSTOM_VIEWPORT_2)
         {
            info.list          = menu_list->menu_stack;
            info.type          = MENU_SETTINGS_CUSTOM_VIEWPORT;
            info.directory_ptr = nav->selection_ptr;

            menu_displaylist_push_list(&info, DISPLAYLIST_INFO);
         }
         break;

      case MENU_ACTION_OK:
         menu_list_flush_stack(menu_list, NULL, 49);

         if (type == MENU_SETTINGS_CUSTOM_VIEWPORT
               && !settings->video.scale_integer)
         {
            info.list          = menu_list->menu_stack;
            strlcpy(info.label,
                  menu_hash_to_str(MENU_LABEL_CUSTOM_VIEWPORT_2),
                  sizeof(info.label));
            info.type          = 0;
            info.directory_ptr = nav->selection_ptr;

            menu_displaylist_push_list(&info, DISPLAYLIST_INFO);
         }
         break;

      case MENU_ACTION_START:
         if (!settings->video.scale_integer)
         {
            video_viewport_t vp;
            video_driver_viewport_info(&vp);

            if (type == MENU_SETTINGS_CUSTOM_VIEWPORT)
            {
               custom->width  += custom->x;
               custom->height += custom->y;
               custom->x       = 0;
               custom->y       = 0;
            }
            else
            {
               custom->width   = vp.full_width - custom->x;
               custom->height  = vp.full_height - custom->y;
            }

            event_command(EVENT_CMD_VIDEO_APPLY_STATE_CHANGES);
         }
         break;

      case MENU_ACTION_MESSAGE:
         if (disp)
            disp->msg_force = true;
         break;

      default:
         break;
   }

   menu_list_get_last_stack(menu_list, NULL, &label, &type, NULL);

   if (settings->video.scale_integer)
   {
      custom->x     = 0;
      custom->y     = 0;
      custom->width = ((custom->width + geom->base_width - 1) /
            geom->base_width) * geom->base_width;
      custom->height = ((custom->height + geom->base_height - 1) /
            geom->base_height) * geom->base_height;
      base_msg       = "Set scale";
       
      snprintf(s, len, "%s (%4ux%4u, %u x %u scale)",
            base_msg,
            custom->width, custom->height,
            custom->width / geom->base_width,
            custom->height / geom->base_height);
   }
   else
   {
      if (type == MENU_SETTINGS_CUSTOM_VIEWPORT)
         base_msg = menu_hash_to_str(MENU_LABEL_VALUE_CUSTOM_VIEWPORT_1);
      else if (hash == MENU_LABEL_CUSTOM_VIEWPORT_2)
         base_msg = menu_hash_to_str(MENU_LABEL_VALUE_CUSTOM_VIEWPORT_2);

      snprintf(s, len, "%s (%d, %d : %4ux%4u)",
            base_msg, custom->x, custom->y, custom->width, custom->height);
   }

   if (!custom->width)
      custom->width = stride_x;
   if (!custom->height)
      custom->height = stride_y;

   aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
      (float)custom->width / custom->height;

   event_command(EVENT_CMD_VIDEO_APPLY_STATE_CHANGES);

   return 0;
}
Beispiel #20
0
void menu_entries_flush_stack(const char *needle, unsigned final_type)
{
   menu_list_t *menu_list         = menu_list_get_ptr();
   if (menu_list)
      menu_list_flush_stack(menu_list, 0, needle, final_type);
}
Beispiel #21
0
static void menu_common_load_content(void)
{
   rarch_main_command(RARCH_CMD_LOAD_CONTENT);
   menu_list_flush_stack(driver.menu->menu_list, MENU_SETTINGS);
   driver.menu->msg_force = true;
}