Switch branches/tags
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


==	libdi by Team Twiizers.

libdi is a threadsafe library that allows you to access the DVD drive
in your Wii, regardless of a modchip being installed or not.


To install the lib, simply type

make install

This will install the lib into your libogc.


Usage is fairly self-explanatory, aside from DI_Init. You can set
a callback using DI_SetCallback, which will be called upon completion
of the disc initialization. This callback runs in the regular callback
context. You MUST call DI_Init as the first thing in your program, it
wreaks massive havoc on the system, as it saves the context, launches
a channel, and restores the context. This will break most libs, and
probably video inits as well.

After this initial init, you call DI_Mount to spin the drive up. There is
no need for unmounting, you can just eject the disc any time you want.
Remounting with DI_Mount is necessary however. Calling DI_Mount is also
helpful as a last resort for failing reads.

Async reads are implemented in the lib using the standard async ioctls.
You can pass an ipccallback function, of which the usrdata will be filled
with the buffer you pass. Async reads do not have the advantage of auto-retries.
You will have to check wether a read succeeds or not in your callback.

Sync reads do have auto-retry, and the lib will try up to MAX_RETRY amount
of times before it gives up. Dirty discs can need up to 10 retries
before data is actually properly read. By default MAX_RETRY is set to 16.

Most of the functions in this lib are universal and can be used on modchipped
or non-modchipped drives alike. Some exceptions are: 

DI_ReadDVDConfig	Will only work on non-modchipped drives.
DI_ReportKey		Will only work on non-modchipped drives.
DI_ReadDVDUnencrypted	Will only work on original discs.
DI_ClosePartition	Will only work on original discs.
DI_OpenPartition	Will only work on original discs.
DI_ReadDiscID		Will only work on original discs.

If you've been reading through the source, you've probably noticed by now the
peculiar function DI_KillDrive. DI_KillDrive will not actually kill your drive
as to be useless. It merely crashes it in such a way that it will not respond
to any DI commands, it will not eject your disc, and it will not take in any discs
until the next DI_Reset. DI_Mount might fail if used after this function!
I have included this function because people might have a use for it. Like it
says in the source, I am not responsible if someone's drive does actually die
from usage of this function.

Known bugs:

Currently, if you do a DI_Init(), and then return to HBC without a disc ever being inserted,
your program will hang until a disc is inserted. If anyone has a nice solution, I'd
love to hear it.