Beispiel #1
0
s32 DeviceReadTrack(u32 lsn, int mode, u8 *buffer)
{
	if (DiscInserted() == -1)  return(-1);

	if ((disctype == CDVD_TYPE_PS2DVD) || (disctype == CDVD_TYPE_DVDV))
	{
		return(DVDreadTrack(lsn, mode, buffer));
	}
	else
	{
		return(CDreadTrack(lsn, mode, buffer));
	} // ENDIF- Is this a DVD?
} // END DeviceReadTrack()
Beispiel #2
0
s32 DeviceReadTrack(u32 lsn, int mode, u8 *buffer)
{
	s32 s32result;
#ifdef VERBOSE_FUNCTION_DEVICE
	PrintLog("CDVD device: DeviceReadTrack(%i)", lsn);
#endif /* VERBOSE_FUNCTION_DEVICE */
	if (DiscInserted() == -1)  return (-1);
	// Get that data
	if ((disctype == CDVD_TYPE_PS2DVD) || (disctype == CDVD_TYPE_DVDV))
		s32result = DVDreadTrack(lsn, mode, buffer);
	else
		s32result = CDreadTrack(lsn, mode, buffer); //ENDIF- Read a DVD sector or a CD sector?
	return (s32result);
} // END DeviceReadTrack()
Beispiel #3
0
s32 DVDgetDiskType()
{
	char playstationname[] = "PLAYSTATION\0";
	int retval;
	s32 tempdisctype;
	char tempbuffer[2048];
	int i;
#ifdef VERBOSE_FUNCTION_DEVICE
	PrintLog("CDVDiso DVD: DVDgetDiskType()");
#endif /* VERBOSE_FUNCTION_DEVICE */
	retval = DVDGetStructures();
	if (retval < 0)  return (-1); // Can't get DVD structures? Not a DVD then.
	if (layer.d.EndDataSector == 0)  return (-1); // Missing info? Abort.
	retval = DVDreadTrack(16, CDVD_MODE_2048, tempbuffer);
	if (retval < 0)
		return (-1); // ENDIF- Couldn't read the ISO9660 volume track? Fail.
	tempdisctype = CDVD_TYPE_UNKNOWN;
	if (layer.d.NumberOfLayers == 0) {
#ifdef VERBOSE_DISC_INFO
		PrintLog("CDVDiso DVD:   Found Single-Sided DVD.");
#endif /* VERBOSE_DISC_INFO */
		disctype = CDVD_TYPE_DETCTDVDS;
	} else {
#ifdef VERBOSE_DISC_INFO
		PrintLog("CDVDiso DVD:   Found Dual-Sided DVD.");
#endif /* VERBOSE_DISC_INFO */
		disctype = CDVD_TYPE_DETCTDVDD;
	} // ENDIF- Are we looking at a single layer DVD? (NumberOfLayers + 1)
	i = 0;
	while ((playstationname[i] != 0) &&
	       (playstationname[i] == tempbuffer[8 + i]))  i++;
	if (playstationname[i] == 0) {
#ifdef VERBOSE_DISC_TYPE
		PrintLog("CDVDiso DVD:   Found Playstation 2 DVD.");
#endif /* VERBOSE_DISC_TYPE */
		tempdisctype = CDVD_TYPE_PS2DVD;
	} else {
#ifdef VERBOSE_DISC_TYPE
		PrintLog("CDVDiso DVD:   Guessing it's a Video DVD.");
#endif /* VERBOSE_DISC_TYPE */
		tempdisctype = CDVD_TYPE_DVDV;
	} // ENDIF- Is this a playstation disc?
	for (i = 0; i < 2048; i++)  tocbuffer[i] = 0;
	if (layer.d.NumberOfLayers == 0) {
		tocbuffer[0] = 0x04;
		tocbuffer[4] = 0x86;
		tocbuffer[5] = 0x72;
	} else {
		tocbuffer[0] = 0x24;
		tocbuffer[4] = 0x41;
		tocbuffer[5] = 0x95;
	} // ENDIF- Are we looking at a single layer DVD? (NumberOfLayers + 1)
	tocbuffer[1] = 0x02;
	tocbuffer[2] = 0xF2;
	tocbuffer[3] = 0x00;
	tocbuffer[16] = 0x00;
	tocbuffer[17] = 0x03;
	tocbuffer[18] = 0x00;
	tocbuffer[19] = 0x00;
	disctype = tempdisctype;
	return (disctype);
} // END DVDgetDiskType()
Beispiel #4
0
s32 DVDgetDiskType(s32 ioctldisktype)
{
	s32 s32result;
	int i;
	s32 tempdisctype;

	errno = 0;
	s32result = 0;
	i = 0;
	tempdisctype = CDVD_TYPE_UNKNOWN;

#ifdef VERBOSE_FUNCTION
	PrintLog("CDVD driver: DVDgetDiskType()");
#endif /* VERBOSE_FUNCTION */

	if ((ioctldisktype != CDS_DATA_1) && (ioctldisktype != CDS_MIXED))
	{
		return(-1);
	} // ENDIF- Not a data disc we know of? Abort then

	s32result = DVDreadPhysical();
	if ((s32result != 0) || (errno != 0))
	{
		return(-1);
	} // ENDIF- Error reading the DVD physical structure? Not a DVD after all.

	if (dvdphysical.physical.layer[0].end_sector >= (2048*1024))
	{
#ifdef VERBOSE_DISC_TYPE
		PrintLog("CDVD driver: DVD Found (Dual-Sided)");
#endif /* VERBOSE_DISC_TYPE */
		disctype = CDVD_TYPE_DETCTDVDD;
	}
	else
	{
#ifdef VERBOSE_DISC_TYPE
		PrintLog("CDVD driver: DVD Found (Single-Sided)");
#endif /* VERBOSE_DISC_TYPE */
		disctype = CDVD_TYPE_DETCTDVDS;
	} // ENDIF- Definitely a DVD. Size Test?

	// Read in the rest of the structures...
	DVDreadCopyright();
	DVDreadBCA();
	DVDreadManufact();

	// Test for "Playstation" header
	s32result = DVDreadTrack(16, CDVD_MODE_2048, dvdtempbuffer);
	if (s32result != 0)
	{
		return(-1);
	}
	else
	{
		i = 0;
		while ((*(playstationname + i) != 0) &&
		        (*(playstationname + i) == dvdtempbuffer[8 + i]))
		{
			i++;
		} // ENDWHILE- Checking each letter of PLAYSTATION name for a match
		if (*(playstationname + i) == 0)
		{
#ifdef VERBOSE_DISC_TYPE
			PrintLog("CDVD driver: Detected Playstation 2 DVD");
#endif /* VERBOSE_DISC_TYPE */
			tempdisctype = CDVD_TYPE_PS2DVD;
		}
		else
		{
#ifdef VERBOSE_DISC_TYPE
			PrintLog("CDVD driver: Guessing it's a Video DVD");
#endif /* VERBOSE_DISC_TYPE */
			tempdisctype = CDVD_TYPE_DVDV;
		} // ENDIF- Did we find the Playstation name?
	} // ENDIF- Error reading disc volume information? Invalidate Disc

	if (dvdphysical.physical.layer[0].end_sector >= (2048*1024))
	{
		tocbuffer[0] = 0x24; // Dual-Sided DVD
		tocbuffer[4] = 0x41;
		tocbuffer[5] = 0x95;
	}
	else
	{
		tocbuffer[0] = 0x04; // Single-Sided DVD
		tocbuffer[4] = 0x86;
		tocbuffer[5] = 0x72;
	} // ENDIF- Are there too many sectors for a single-sided disc?

	tocbuffer[1] = 0x02;
	tocbuffer[2] = 0xF2;
	tocbuffer[3] = 0x00;

	tocbuffer[16] = 0x00;
	tocbuffer[17] = 0x03;
	tocbuffer[18] = 0x00;
	tocbuffer[19] = 0x00;

	disctype = tempdisctype; // Triggers the fact the other info is available
	return(disctype);
} // END DVDgetDiskType()