コード例 #1
0
static int playlist_association_right(unsigned type, const char *label,
      bool wraparound)
{
   char core_path[PATH_MAX_LENGTH];
   char new_playlist_cores[PATH_MAX_LENGTH];
   size_t i, next, found, current   = 0;
   core_info_t *info                = NULL;
   struct string_list *stnames      = NULL;
   struct string_list *stcores      = NULL;
   core_info_list_t           *list = NULL;
   settings_t *settings             = config_get_ptr();
   const char *path                 = path_basename(label);

   core_info_get_list(&list);
   if (!list)
      return menu_cbs_exit();

   core_path[0] = new_playlist_cores[0] = '\0';

   stnames = string_split(settings->arrays.playlist_names, ";");
   stcores = string_split(settings->arrays.playlist_cores, ";");

   if (!menu_content_playlist_find_associated_core(path, core_path, sizeof(core_path)))
         strlcpy(core_path,
               file_path_str(FILE_PATH_DETECT), sizeof(core_path));

   for (i = 0; i < list->count; i++)
   {
      core_info_t *info = core_info_get(list, i);
      if (string_is_equal(info->path, core_path))
         current = i;
   }

   next = current + 1;
   if (next >= list->count)
   {
      if (wraparound)
         next = 0;
      else
         next = list->count-1;
   }

   info = core_info_get(list, next);

   found = string_list_find_elem(stnames, path);
   if (found && info)
      string_list_set(stcores, (unsigned)(found-1), info->path);

   string_list_join_concat(new_playlist_cores,
         sizeof(new_playlist_cores), stcores, ";");

   strlcpy(settings->arrays.playlist_cores,
         new_playlist_cores, sizeof(settings->arrays.playlist_cores));

   string_list_free(stnames);
   string_list_free(stcores);
   return 0;
}
コード例 #2
0
ファイル: menu_cbs_left.c プロジェクト: AlexFolland/RetroArch
static int playlist_association_left(unsigned type, const char *label,
      bool wraparound)
{
   unsigned i;
   int next, found, current = 0;
   core_info_t *info                = NULL;
   struct string_list *stnames      = NULL;
   struct string_list *stcores      = NULL;
   char core_path[PATH_MAX_LENGTH]  = {0};
   char new_playlist_cores[PATH_MAX_LENGTH] = {0};
   settings_t *settings             = config_get_ptr();
   const char *path                 = path_basename(label);
   core_info_list_t           *list = NULL;
   
   core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);

   if (!list)
      return menu_cbs_exit();

   stnames = string_split(settings->playlist_names, ";");
   stcores = string_split(settings->playlist_cores, ";");

   if (!menu_playlist_find_associated_core(path, core_path, sizeof(core_path)))
         strlcpy(core_path, "DETECT", sizeof(core_path));

   for (i = 0; i < list->count; i++)
   {
      core_info_t *info = core_info_get(list, i);
      if (string_is_equal(info->path, core_path))
         current = i;
   }

   next = current - 1;
   if (next < 0)
   {
      if (wraparound)
         next = list->count;
      else
         next = 0;
   }

   info  = core_info_get(list, next);
   found = string_list_find_elem(stnames, path);
   if (found)
      string_list_set(stcores, found-1, info->path);

   string_list_join_concat(new_playlist_cores, sizeof(new_playlist_cores), stcores, ";");

   strlcpy(settings->playlist_cores, new_playlist_cores, sizeof(settings->playlist_cores));

   return 0;
}
コード例 #3
0
ファイル: core_info.c プロジェクト: Monroe88/RetroArch
static core_info_t *core_info_find_internal(
      core_info_list_t *list,
      const char *core)
{
   size_t i;

   for (i = 0; i < list->count; i++)
   {
      core_info_t *info = core_info_get(list, i);

      if (!info || !info->path)
         continue;
      if (string_is_equal(info->path, core))
         return info;
   }

   return NULL;
}
コード例 #4
0
void LoadCoreWindow::initCoreList(const QStringList &extensionFilters)
{
   core_info_list_t *cores = NULL;
   QStringList horizontal_header_labels;
   QDesktopWidget *desktop = qApp->desktop();
   QRect desktopRect = desktop->availableGeometry();
   unsigned i = 0;
   int j = 0;

   horizontal_header_labels << msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NAME);
   horizontal_header_labels << msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CORE_VERSION);

   core_info_get_list(&cores);

   m_table->clear();
   m_table->setColumnCount(0);
   m_table->setRowCount(0);
   m_table->setSelectionBehavior(QAbstractItemView::SelectRows);
   m_table->setSelectionMode(QAbstractItemView::SingleSelection);
   m_table->setSortingEnabled(false);
   m_table->setRowCount(cores->count);
   m_table->setColumnCount(2);
   m_table->setHorizontalHeaderLabels(horizontal_header_labels);

   for (i = 0; i < cores->count; i++)
   {
      core_info_t *core = core_info_get(cores, i);
      QTableWidgetItem *name_item = NULL;
      QTableWidgetItem *version_item = new QTableWidgetItem(core->display_version);
      QVariantHash hash;
      const char *name = core->display_name;

      if (string_is_empty(name))
         name = path_basename(core->path);

      name_item = new QTableWidgetItem(name);

      hash["path"] = core->path;
      hash["extensions"] = QString(core->supported_extensions).split("|");

      name_item->setData(Qt::UserRole, hash);
      name_item->setFlags(name_item->flags() & ~Qt::ItemIsEditable);
      version_item->setFlags(version_item->flags() & ~Qt::ItemIsEditable);

      m_table->setItem(i, CORE_NAME_COLUMN, name_item);
      m_table->setItem(i, CORE_VERSION_COLUMN, version_item);
   }

   if (!extensionFilters.isEmpty())
   {
      QVector<int> rowsToHide;

      for (j = 0; j < m_table->rowCount(); j++)
      {
         bool found = false;
         QTableWidgetItem *item = m_table->item(j, CORE_NAME_COLUMN);
         QVariantHash hash;
         QStringList extensions;
         int k = 0;

         if (!item)
            continue;

         hash = item->data(Qt::UserRole).toHash();
         extensions = hash["extensions"].toStringList();

         if (!extensions.isEmpty())
         {
            for (k = 0; k < extensions.size(); k++)
            {
               QString ext = extensions.at(k).toLower();

               if (extensionFilters.contains(ext, Qt::CaseInsensitive))
               {
                  found = true;
                  break;
               }
            }

            if (!found)
               rowsToHide.append(j);
         }
      }

      if (rowsToHide.size() != m_table->rowCount())
      {
         foreach (const int &row, rowsToHide)
         {
            m_table->setRowHidden(row, true);
         }