Exemplo n.º 1
0
void Graphics::DrawSelector(void)
{
	ClearSelector();
	for (int i=0; i < tileAmount; ++i)
		DrawSurface(tiles[i][currentPal][0], MainScreen->surface, selXMin + 8*(i%selectorWidth), 8*(i/selectorWidth - selTileYOffset));
	//SDL_Flip(screen);
	MainScreen->ProcessDisplay();
}
Exemplo n.º 2
0
/****************************************************************************
 * OpenDir
 *
 * Function to open a directory and load ROM file list.
 ****************************************************************************/ 
int OpenDirectory(int device, int type)
{
  int max = 0;

  if (device == TYPE_RECENT)
  {
    /* fetch history list */
    int i;
    for(i=0; i < NUM_HISTORY_ENTRIES; i++)
    {
      if(history.entries[i].filepath[0] > 0)
      {
        filelist[i].flags = 0;
        strncpy(filelist[i].filename,history.entries[i].filename, MAXJOLIET-1);
        filelist[i].filename[MAXJOLIET-1] = '\0';
        max++;
      }
      else
      {
        /* Found the end of the list. */
        break;
      }
    }
  }
  else
  {
    /* only DVD hot swap is supported */
    if (device == TYPE_DVD)
    {
      /* try to access root directory */
      DIR *dir = opendir(rootdir[TYPE_DVD]);
      if (dir == NULL)
      {
        /* mount DVD */
        if (!MountDVD()) return 0;
        deviceType = -1;
      }
      else
      {
        closedir(dir);
      }
    }

    /* parse last directory */
    fileDir = config.lastdir[type][device];
    max = ParseDirectory();
    if (max <= 0)
    {
      /* parse root directory */
      strcpy(fileDir, rootdir[device]);
      max = ParseDirectory();
      if (max < 0)
      {
        GUI_WaitPrompt("Error","Unable to open directory !");
        return 0;
      }
      deviceType = -1;
    }
  }

  if (max == 0)
  {
    GUI_WaitPrompt("Error","No files found !");
    return 0;
  }

  /* check if device or file type has changed */
  if ((device != deviceType) || (type != fileType))
  {
    /* reset current types */
    deviceType = device;
    fileType = type;

    /* reset File selector */
    ClearSelector(max);
  }

  return 1;
}
Exemplo n.º 3
0
/****************************************************************************
 * OpenFAT
 *
 * Function to load a FAT directory and display to user.
 ****************************************************************************/ 
int FAT_Open(int type)
{
  int max = 0;
  char root[10] = "";

  /* FAT header */
#ifdef HW_RVL
  if (type == TYPE_SD) sprintf (root, "sd:");
  else if (type == TYPE_USB) sprintf (root, "usb:");
#endif

  /* if FAT device type changed, reload filelist */
  if (fat_type != type) 
  {
    fat_type = type;
    haveFATdir = 0;
  }

  /* update filelist */
  if (haveFATdir == 0)
  {
    useHistory = 0;
    if (type == TYPE_RECENT)
    {
      /* fetch history list */
      useHistory = 1;
      int i;
      for(i=0; i < NUM_HISTORY_ENTRIES; i++)
      {
        if(history.entries[i].filepath[0] > 0)
        {
          filelist[i].offset = 0;
          filelist[i].length = 0;
          filelist[i].flags = 0;
          strncpy(filelist[i].filename, history.entries[i].filename, MAXJOLIET-1);
          filelist[i].filename[MAXJOLIET-1] = '\0';
          max++;
        }
        else
        {
          /* Found the end of the list. */
          break;
        }
      }
    }
    else
    {
      /* reset root directory */
      sprintf (fatdir, "%s%s/roms/", root, DEFAULT_PATH);

      /* if directory doesn't exist, use root as default */
      DIR_ITER *dir = diropen(fatdir);
      if (dir == NULL) sprintf (fatdir, "%s/", root);
      else dirclose(dir);

      /* parse root directory */
      max = FAT_ParseDirectory ();
    }

    if (max > 0)
    {
      /* FAT is default */
      haveFATdir = 1;
      DVD_ClearDirectory();

      /* reset File selector */
      ClearSelector(max);
      return 1;
    }
    else
    {
      /* no entries found */
      if (max == 0) GUI_WaitPrompt("Error","No files found !");
      return 0;
    }
  }

  return 1;
}