Example #1
0
void DeviceInit()
{
	devicehandle = -1;
	devicecapability = 0;
	lasttime = time(NULL);
	InitDisc();
} // END DeviceInit()
Example #2
0
void DeviceInit()
{
	devicehandle = NULL;
	waitevent.hEvent = NULL;
	waitevent.Internal = 0;
	waitevent.InternalHigh = 0;
	waitevent.Offset = 0;
	waitevent.OffsetHigh = 0;
	lasttime = 0;

	InitDisc();
} // END DeviceInit()
Example #3
0
// Called by PollLoop() and CDVDgetTrayStatus()
s32 DeviceTrayStatus()
{
	s32 s32result;
	errno = 0;
#ifdef VERBOSE_FUNCTION_DEVICE
	PrintLog("CDVD device: DeviceTrayStatus()");
#endif /* VERBOSE_FUNCTION_DEVICE */
	if (devicehandle == -1)
		return (-1); // ENDIF- Someone forget to open the device?
	if ((devicecapability & CDC_DRIVE_STATUS) != 0) {
		s32result = ioctl(devicehandle, CDROM_DRIVE_STATUS);
		if (s32result < 0) {
#ifdef VERBOSE_WARNINGS
			PrintLog("CDVD device:   Trouble reading Drive Status!");
			PrintLog("CDVD device:     Error: (%i) %i:%s", s32result, errno, strerror(errno));
#endif /* VERBOSE_WARNINGS */
			s32result = CDS_TRAY_OPEN;
		} // ENDIF- Failure to get status? Assume it's open.
		errno = 0;
	} else {
		s32result = ioctl(devicehandle, CDROM_DISC_STATUS);
		if (errno != 0) {
#ifdef VERBOSE_WARNINGS
			PrintLog("CDVD device:   Trouble detecting Disc Status presense!");
			PrintLog("CDVD device:     Error: (%i) %i:%s", s32result, errno, strerror(errno));
#endif /* VERBOSE_WARNINGS */
			s32result = CDS_TRAY_OPEN;
			errno = 0;
		} // ENDIF- Trouble?
		if (s32result == CDS_NO_DISC)
			s32result = CDS_TRAY_OPEN; // ENDIF- Is there no disc in the device? Guess the tray is open
	} // ENDIF- Can we poll the tray directly? (Or look at disc status instead?)
	if (s32result == CDS_TRAY_OPEN) {
		traystatus = CDVD_TRAY_OPEN;
		if (disctype != CDVD_TYPE_NODISC) {
			DeviceClose(); // Kind of severe way of flushing all buffers.
			DeviceOpen();
			InitDisc();
		} // ENDIF- Tray just opened... clear disc info
	} else {
		traystatus = CDVD_TRAY_CLOSE;
		if (disctype == CDVD_TYPE_NODISC)
			DeviceGetDiskType(); // ENDIF- Tray just closed? Get disc information
	} // ENDIF- Do we detect an open tray?
	return (traystatus);
} // END CDVD_getTrayStatus()
Example #4
0
// Called by DeviceTrayStatus(), CDVDclose(), and CDVDshutdown()
void DeviceClose()
{
	if (devicehandle == -1) {
#ifdef VERBOSE_FUNCTION_DEVICE
		PrintLog("CDVD device:   Device already closed");
#endif /* VERBOSE_FUNCTION_DEVICE */
		return;
	} // ENDIF- Device already closed? Ok.
#ifdef VERBOSE_FUNCTION_DEVICE
	PrintLog("CDVD device: DeviceClose()");
#endif /* VERBOSE_FUNCTION_DEVICE */
	InitDisc();
	close(devicehandle);
	devicehandle = -1;
	devicecapability = 0;
	return;
} // END CDVDclose()
Example #5
0
void Shapes::CreateShape(ShapesType type, float resolution)
{
	type_ = type;
	is_quad_ = false;

	switch (type_)
	{
	case DISC:
		InitDisc(resolution);
		break;
	case SPHERE:
		InitSphere(resolution);
		is_quad_ = true;
		break;
	case CUBE_ST:
		InitCube();
		is_quad_ = true;
		break;
	case CUBE_CT:
		InitCube(false);
		is_quad_ = true;
		break;
	case PLANE:
		InitPlane();
		is_quad_ = true;
		break;
	case PLANE_TILED:
		InitPlane(resolution);
		is_quad_ = true;
		break;
	case PLANE_BIG:
		InitBigPlane(resolution);
		is_quad_ = true;
		break;
	case SPHERE_HALF_UV:
		InitSphere(resolution);
		is_quad_ = true;
		break;
	default:
		break;
	}
}
Example #6
0
s32 CALLBACK CDVDinit() {
  errno = 0;

  InitLog();
  if(OpenLog() != 0)  return(-1);

#ifdef VERBOSE_FUNCTION
  PrintLog("CDVD interface: CDVDinit()");
#endif /* VERBOSE_FUNCTION */

  InitConf();

  devicehandle = -1;
  devicecapability = 0;
  lasttime = time(NULL);

  // Initialize DVD.c and CD.c as well
  InitDisc();
  InitDVDInfo();
  InitCDInfo();

  return(0);
} // END CDVDinit()
Example #7
0
s32 DeviceTrayStatus() {

    BOOL boolresult;



    if(devicehandle == NULL)  return(-1);

    if(devicehandle == INVALID_HANDLE_VALUE)  return(-1);



#ifdef VERBOSE_FUNCTION_DEVICE

    PrintLog("CDVDlinuz device: DeviceTrayStatus()");

#endif /* VERBOSE_FUNCTION_DEVICE */



    switch(traystatusmethod) {

    case 1:

        boolresult = DeviceTrayStatusStorage();

        break;

    case 2:

        boolresult = DeviceTrayStatusCDRom();

        break;

    case 3:

        boolresult = DeviceTrayStatusDisk();

        break;

    default:

        boolresult = FALSE;

        break;

    } // ENDSWITCH traystatusmethod- One method already working? Try it again.



    if(boolresult == FALSE) {

        traystatusmethod = 0;

        boolresult = DeviceTrayStatusStorage();

        if(boolresult == TRUE) {

            traystatusmethod = 1;

        } else {

            boolresult = DeviceTrayStatusCDRom();

            if(boolresult == TRUE) {

                traystatusmethod = 2;

            } else {

                boolresult = DeviceTrayStatusDisk();

                if(boolresult == TRUE)  traystatusmethod = 3;

            } // ENDIF- Did we succeed with CDRom?

        } // ENDIF- Did we succeed with Storage?

    } // Single call to already working test just failed? Test them all.



    if(boolresult == FALSE) {

        if(traystatus == CDVD_TRAY_CLOSE) {

#ifdef VERBOSE_FUNCTION_DEVICE

            PrintLog("CDVDlinuz device:   Tray just opened!");

#endif /* VERBOSE_FUNCTION_DEVICE */

            traystatus = CDVD_TRAY_OPEN;

            DeviceClose();

            DeviceOpen();

            InitDisc();

        } // ENDIF- Just opened? clear disc info

        return(traystatus);

    } // ENDIF- Still failed? Assume no disc in drive then.



    if(traystatus == CDVD_TRAY_OPEN) {

        traystatus = CDVD_TRAY_CLOSE;

#ifdef VERBOSE_FUNCTION_DEVICE

        PrintLog("CDVDlinuz device:   Tray just closed!");

#endif /* VERBOSE_FUNCTION_DEVICE */

        DeviceGetDiskType();

        return(traystatus);

    } // ENDIF- Just closed? Get disc information



    return(traystatus);

} // END DeviceTrayStatus()