summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/libogcfpc/src/di/di.inc
blob: b3b1d3474b380785996a0aeea9b96521c61b309a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{$IFDEF OGC_INTERFACE}
const
  DVD_IDENTIFY = $12;
  DVD_READ_DISCID = $70;
  DVD_LOW_READ = $71;
  DVD_WAITFORCOVERCLOSE = $79;
  DVD_READ_PHYSICAL = $80;
  DVD_READ_COPYRIGHT = $81;
  DVD_READ_DISCKEY = $82;
  DVD_GETCOVER = $88;
  DVD_RESET = $8A;
  DVD_OPEN_PARTITION = $8B;
  DVD_CLOSE_PARTITION = $8C;
  DVD_READ_UNENCRYPTED = $8D;
  DVD_REPORTKEY = $A4;
  DVD_READ = $D0;
  DVD_READ_CONFIG = $D1;
  DVD_READ_BCA = $DA;
  DVD_GET_ERROR = $E0;
  DVD_SET_MOTOR = $E3;
  DVD_READY = $1;
  DVD_INIT = $2;
  DVD_UNKNOWN = $4;
  DVD_NO_DISC = $8;
  DVD_IOS_ERROR = $10;
  DVD_D0 = $20;
  DVD_A8 = $40;
  DVD_COVER_DISC_INSERTED = $02;
  LIBDI_MAX_RETRIES = 16;

const
  DEVICE_TYPE_WII_DVD = (( ord('W') shl 24 ) or ( ord('D') shl 16 ) or ( ord('V') shl 8 ) or ord('D') );

type
  DI_DriveID = packed record
    rev : cuint16;
    dev_code : cuint16;
    rel_date : cuint32;
  end;
  PDI_DriveID = ^DI_DriveID;


  di_callback = function(status, error: uint32_t): cint; cdecl;
  read_func = function(par0: pointer; par1, par2: uint32_t): cint; cdecl;
  read_func_async = function(par0: pointer; par1, par2: uint32_t;
    par3: ipccallback): cint; cdecl;


var
  di_fd : cint; external;
  __io_wiidvd : DISC_INTERFACE; external;


function DI_Init: cint; cdecl; external;

procedure DI_LoadDVDX(load: cbool); cdecl; external;

procedure DI_UseCache(use: cbool); cdecl; external;

procedure DI_SetInitCallback(cb: di_callback); cdecl; external;

procedure DI_Mount; cdecl; external;

procedure DI_Close; cdecl; external;

function DI_GetStatus: cint; cdecl; external;

function DI_Identify(id: PDI_DriveID): cint; cdecl; external;
function DI_CheckDVDSupport(): cint; cdecl; external;
function DI_ReadDiscID(id: pcuint64): cint; cdecl; external;
function DI_GetError(error: Pcuint32): cint; cdecl; external;
function DI_GetCoverRegister(status: Pcuint32): cint; cdecl; external;

function DI_Reset: cint; cdecl; external;

function DI_StopMotor: cint; cdecl; external;

function DI_Eject: cint; cdecl; external;

function DI_KillDrive: cint; cdecl; external;

function DI_ReadDVD(buf: pointer; len, lba: cuint32): cint; cdecl; external;

function DI_ReadDVDAsync(buf: pointer; len, lba: cuint32; ipc_cb: ipccallback)
  : cint; cdecl; external;

function DI_Read(buf: pointer; size, offset: cuint32): cint; cdecl; external;

function DI_UnencryptedRead(buf: pointer; size, offset: cuint32): cint; cdecl; external;

function DI_ReadDVDConfig(value: Pcuint32; flag: cuint32): cint; cdecl; external;

function DI_ReadDVDCopyright(copyright: Pcuint32): cint; cdecl; external;

function DI_ReadDVDDiscKey(buf: pointer): cint; cdecl; external;

function DI_ReadDVDPhysical(buf: pointer): cint; cdecl; external;

function DI_Read_BCA(buf: pointer): cint; cdecl; external;

function DI_ReportKey(keytype: cint; lba: cuint32; buf: pointer): cint; cdecl; external;

function DI_OpenPartition(offset: cuint32): cint; cdecl; external;

function DI_ClosePartition: cint; cdecl; external;
{$ENDIF}