Exemple #1
0
static void 
dvdprobe(callout_t *co, void *aux)
{
  disc_scanner_t *ds = aux;

  callout_arm(&ds->ds_timer, dvdprobe, ds, 1);

  if(ds->ds_disc_inserted == 0) {

    DI_Mount();

    if(DI_GetStatus() == DVD_NO_DISC)
      return;

    TRACE(TRACE_INFO, "DVD", "DVD inserted");
    ds->ds_disc_inserted = 1;
    ds->ds_disc_ready = 0;

  } else {
    uint32_t s = DI_GetStatus();


    if(s == DVD_UNKNOWN) {
      ds->ds_disc_inserted = 0;
      notify_add(NOTIFY_ERROR, NULL, 5, "Unknown disc inserted, ejecting...");
      DI_Eject();
      return;
    }

    if(!(s & DVD_READY)) {
      TRACE(TRACE_DEBUG, "DVD", "Waiting for disc ready state = %x", s);
      return;
    }

    if(!ds->ds_disc_ready)
      check_disc_type(ds);

    if(DI_GetCoverRegister(&s) || !(s & DVD_COVER_DISC_INSERTED)) {
      ds->ds_disc_inserted = 0;
      TRACE(TRACE_INFO, "DVD", "DVD no longer present");
      
      if(ds->ds_service != NULL) {
	service_destroy(ds->ds_service);
	ds->ds_service = NULL;
      }
    }
  }
}
Exemple #2
0
/****************************************************************************
 * OpenDVD
 *
 * Function to load a DVD directory and display to user.
****************************************************************************/
int
OpenDVD (int method)
{
	if (!getpvd())
	{
		ShowAction((char*) "Loading DVD...");
		#ifdef HW_DOL
		DVD_Mount(); // mount the DVD unit again
		#elif WII_DVD
		u32 val;
		DI_GetCoverRegister(&val);
		if(val & 0x1)	// True if no disc inside, use (val & 0x2) for true if disc inside.
		{
			WaitPrompt((char *)"No disc inserted!");
			return 0;
		}
		DI_Mount();
		while(DI_GetStatus() & DVD_INIT);
		#endif

		if (!getpvd())
		{
			WaitPrompt ((char *)"Invalid DVD.");
			return 0; // not a ISO9660 DVD
		}
	}

	maxfiles = ParseDVDdirectory(); // load root folder

	// switch to rom folder
	SwitchDVDFolder(GCSettings.LoadFolder);

	if (maxfiles > 0)
	{
		return FileSelector (method);
	}
	else
	{
		// no entries found
		WaitPrompt ((char *)"No Files Found!");
		return 0;
	}
}