Difference between revisions of "/dev/di"

From WiiBrew
Jump to navigation Jump to search
m (DVDLowUnencryptedRead first limit changed to correct numeric value 0x14000 instead of 0x1400)
Line 27: Line 27:
 
  // data block (i.e. offset and offset + len) has to been within one of the following three
 
  // data block (i.e. offset and offset + len) has to been within one of the following three
 
  // areas (bytes >> 2):
 
  // areas (bytes >> 2):
  // * 0x00000000 - 0x00001400 (limit of older IOS versions)
+
  // * 0x00000000 - 0x00014000 (limit of older IOS versions)
 
  // * 0x460a0000 - 0x460a0008
 
  // * 0x460a0000 - 0x460a0008
 
  // * 0x7ed40000 - 0x7ed40008
 
  // * 0x7ed40000 - 0x7ed40008

Revision as of 21:31, 24 September 2008

Through /dev/di you can control the DVD.

The inbuf size of all /dev/di IOS cmds must be 0x20

The first entry of the inbuf should(!) be the DI cmd, Starlet fixes it if it doesn't match.

Fleshed out into a simple API called "WDVD": http://emergent.unpy.net/01212889187


DVDLowGetCoverStatus
ios_ioctl( di_fd, 0x88, inbuf, 0x20, outbuf, 0x20);
DVDLowRequestError
((u32*)inbuf)[0x00] = 0xE0000000;
ios_ioctl( di_fd, 0xE0, inbuf, 0x20, outbuf, 0x20);
(Actual DVD error code is returned in (u32*)outbuf)[0x00])
Identical to the error codes found in yagcd section 5.7.3.5.1 (so far).
DVDLowRead (Only works after DVDOpenPartition)
((u32*)inbuf)[0x00] = 0x71000000;
((u32*)inbuf)[0x01] = size;
((u32*)inbuf)[0x02] = byte_offset >> 2;
ios_ioctl( di_fd, 0x71, inbuf, 0x20, dst, size);
DVDLowUnencryptedRead 
// Only works up to 0x0050000; in newer IOS versions (IOS30+) the whole 
// data block (i.e. offset and offset + len) has to been within one of the following three
// areas (bytes >> 2):
// * 0x00000000 - 0x00014000 (limit of older IOS versions)
// * 0x460a0000 - 0x460a0008
// * 0x7ed40000 - 0x7ed40008
((u32*)inbuf)[0x00] = 0x8D000000;
((u32*)inbuf)[0x01] = size;
((u32*)inbuf)[0x02] = byte_Offset >> 2;
ios_ioctl( di_fd, 0x8D, inbuf, 0x20, dst, size);
DVDLowStopMotor
((u32*)inbuf)[0x00] = 0xE3000000;
((u32*)inbuf)[0x01] = 0;	// optional, unknown
((u32*)inbuf)[0x02] = 0;	// optional, unknown
ios_ioctl( di_fd, 0xE3, inbuf, 0x20, outbuf, 0x20);
DVDLowReset
((u32*)inbuf)[0x00] = 0x8A000000;
((u32*)inbuf)[0x01] = 1;
ios_ioctl( di_fd, 0x8A, inbuf, 0x20, outbuf, 0x20);
DVDLowReadDiskID, read to 0x80000000
((u32*)inbuf)[0x00] = 0x70000000;
ios_ioctl( di_fd, 0x70, inbuf, 0x20, dst, 0x20);
DVDLowClosePartition
((u32*)inbuf)[0x00] = 0x8C000000;
IOS_Ioctl( di_fd, 0x8C, inbuf, 0x20, 0, 0);
DVDLowOpenPartition
((u32*)buffer)[(0x40>>2)]	=  0x8B000000;
((u32*)buffer)[(0x40>>2)+1]	=  game_partition_byte_offset>>2;

//in
((u32*)buffer)[0x00] = PHYSADDR(buffer+0x40);	//0x00
((u32*)buffer)[0x01] = 0x20;			//0x04
((u32*)buffer)[0x02] = 0;			//0x08; optional tik
((u32*)buffer)[0x03] = 0x2A4;			//0x0C 
((u32*)buffer)[0x04] = 0;			//0x10; optional cert chain
((u32*)buffer)[0x05] = 0;			//0x14

//out
((u32*)buffer)[0x06] = PHYSADDR(buffer+0x380);	//0x18; dvd cert chain
((u32*)buffer)[0x07] = 0x49E4;			//0x1C
((u32*)buffer)[0x08] = PHYSADDR(buffer+0x360);	//0x20; some kind of error buffer
((u32*)buffer)[0x09] = 0x20;			//0x24

IOS_Ioctlv( di_fd, 0x8B, 3, 2, buffer);