SSBM Decomp
Loading...
Searching...
No Matches
dvd.h
Go to the documentation of this file.
1#ifndef _DOLPHIN_DVD_H_
2#define _DOLPHIN_DVD_H_
3
4#include <dolphin/types.h>
5
15
16typedef struct DVDCommandBlock DVDCommandBlock;
17typedef void (*DVDCBCallback)(s32 result, DVDCommandBlock* block);
21 /*0x08*/ u32 command;
22 /*0x0C*/ s32 state;
23 /*0x10*/ u32 offset;
24 /*0x14*/ u32 length;
25 /*0x18*/ void* addr;
28 /*0x24*/ DVDDiskID* id;
30 /*0x2C*/ void* userData;
31};
32
33typedef struct DVDFileInfo DVDFileInfo;
34typedef void (*DVDCallback)(s32 result, DVDFileInfo* fileInfo);
37 /*0x30*/ u32 startAddr;
38 /*0x34*/ u32 length;
40};
41
42typedef struct {
46} DVDDir;
47
48typedef struct {
51 char* name;
53
54typedef struct DVDBB2 {
56 /* 0x04 */ u32 FSTPosition;
57 /* 0x08 */ u32 FSTLength;
58 /* 0x0C */ u32 FSTMaxLength;
59 /* 0x10 */ void* FSTAddress;
60 /* 0x14 */ u32 userPosition;
61 /* 0x18 */ u32 userLength;
62 /* 0x1C */ u32 padding0;
63} DVDBB2;
64
65typedef struct DVDDriveInfo {
66 /* 0x00 */ u16 revisionLevel;
67 /* 0x02 */ u16 deviceCode;
68 /* 0x04 */ u32 releaseDate;
69 /* 0x08 */ u8 padding[24];
71
72void DVDDumpWaitingQueue(void);
73int DVDLowRead(void* addr, unsigned long length, unsigned long offset,
74 void (*callback)(unsigned long));
75int DVDLowSeek(unsigned long offset, void (*callback)(unsigned long));
76int DVDLowWaitCoverClose(void (*callback)(unsigned long));
77int DVDLowReadDiskID(struct DVDDiskID* diskID,
78 void (*callback)(unsigned long));
79int DVDLowStopMotor(void (*callback)(unsigned long));
80int DVDLowRequestError(void (*callback)(unsigned long));
81int DVDLowInquiry(struct DVDDriveInfo* info, void (*callback)(unsigned long));
82int DVDLowAudioStream(unsigned long subcmd, unsigned long length,
83 unsigned long offset, void (*callback)(unsigned long));
84int DVDLowRequestAudioStatus(unsigned long subcmd,
85 void (*callback)(unsigned long));
86int DVDLowAudioBufferConfig(int enable, unsigned long size,
87 void (*callback)(unsigned long));
88void DVDLowReset();
89void (*DVDLowSetResetCoverCallback(void (*callback)(unsigned long)))(
90 unsigned long);
91int DVDLowBreak();
92void (*DVDLowClearCallback())(unsigned long);
93unsigned long DVDLowGetCoverStatus();
94
95// dvd.c
96void DVDInit();
97int DVDReadAbsAsyncPrio(struct DVDCommandBlock* block, void* addr, long length,
98 long offset,
99 void (*callback)(long, struct DVDCommandBlock*),
100 long prio);
101int DVDSeekAbsAsyncPrio(struct DVDCommandBlock* block, long offset,
102 void (*callback)(long, struct DVDCommandBlock*),
103 long prio);
104int DVDReadAbsAsyncForBS(struct DVDCommandBlock* block, void* addr,
105 long length, long offset,
106 void (*callback)(long, struct DVDCommandBlock*));
107int DVDReadDiskID(struct DVDCommandBlock* block, struct DVDDiskID* diskID,
108 void (*callback)(long, struct DVDCommandBlock*));
110 unsigned long length, unsigned long offset,
111 void (*callback)(long, struct DVDCommandBlock*));
112int DVDCancelStreamAsync(struct DVDCommandBlock* block,
113 void (*callback)(long, struct DVDCommandBlock*));
114long DVDCancelStream(struct DVDCommandBlock* block);
116 void (*callback)(long, struct DVDCommandBlock*));
117long DVDStopStreamAtEnd(struct DVDCommandBlock* block);
119 void (*callback)(long,
120 struct DVDCommandBlock*));
121long DVDGetStreamErrorStatus(struct DVDCommandBlock* block);
123 void (*callback)(long, struct DVDCommandBlock*));
124long DVDGetStreamPlayAddr(struct DVDCommandBlock* block);
126 void (*callback)(long,
127 struct DVDCommandBlock*));
128long DVDGetStreamStartAddr(struct DVDCommandBlock* block);
130 void (*callback)(long, struct DVDCommandBlock*));
131long DVDGetStreamLength(struct DVDCommandBlock* block);
133 void (*callback)(long, struct DVDCommandBlock*));
134int DVDChangeDiskAsync(struct DVDCommandBlock* block, struct DVDDiskID* id,
135 void (*callback)(long, struct DVDCommandBlock*));
136long DVDChangeDisk(struct DVDCommandBlock* block, struct DVDDiskID* id);
137int DVDInquiryAsync(struct DVDCommandBlock* block, struct DVDDriveInfo* info,
138 void (*callback)(long, struct DVDCommandBlock*));
139long DVDInquiry(struct DVDCommandBlock* block, struct DVDDriveInfo* info);
140void DVDReset();
141int DVDResetRequired();
142long DVDGetCommandBlockStatus(struct DVDCommandBlock* block);
143long DVDGetDriveStatus();
144int DVDSetAutoInvalidation(int autoInval);
145void DVDPause();
146void DVDResume();
147int DVDCancelAsync(struct DVDCommandBlock* block,
148 void (*callback)(long, struct DVDCommandBlock*));
149long DVDCancel(volatile struct DVDCommandBlock* block);
151long DVDCancelAll(void);
152struct DVDDiskID* DVDGetCurrentDiskID(void);
153BOOL DVDCheckDisk(void);
154
155// dvdfs.c
156s32 DVDConvertPathToEntrynum(const char* pathPtr);
157BOOL DVDFastOpen(s32 entrynum, DVDFileInfo* fileInfo);
158BOOL DVDOpen(char* fileName, DVDFileInfo* fileInfo);
159BOOL DVDClose(DVDFileInfo* fileInfo);
160BOOL DVDGetCurrentDir(char* path, u32 maxlen);
161BOOL DVDChangeDir(char* dirName);
162BOOL DVDReadAsyncPrio(DVDFileInfo* fileInfo, void* addr, s32 length,
163 s32 offset, DVDCallback callback, s32 prio);
164long DVDReadPrio(struct DVDFileInfo* fileInfo, void* addr, long length,
165 long offset, long prio);
166int DVDSeekAsyncPrio(struct DVDFileInfo* fileInfo, long offset,
167 void (*callback)(long, struct DVDFileInfo*), long prio);
168long DVDSeekPrio(struct DVDFileInfo* fileInfo, long offset, long prio);
169long DVDGetFileInfoStatus(struct DVDFileInfo* fileInfo);
170int DVDOpenDir(char* dirName, DVDDir* dir);
171int DVDReadDir(DVDDir* dir, DVDDirEntry* dirent);
172int DVDCloseDir(DVDDir* dir);
173void* DVDGetFSTLocation();
174BOOL DVDPrepareStreamAsync(DVDFileInfo* fileInfo, u32 length, u32 offset,
176s32 DVDPrepareStream(DVDFileInfo* fileInfo, u32 length, u32 offset);
178
179#define DVDReadAsync(fileInfo, addr, length, offset, callback) \
180 DVDReadAsyncPrio((fileInfo), (addr), (length), (offset), (callback), 2)
181
182#define DVD_RESULT_GOOD 0
183#define DVD_RESULT_FATAL_ERROR -1
184#define DVD_RESULT_IGNORED -2
185#define DVD_RESULT_CANCELED -6
186
187#define DVD_STATE_FATAL_ERROR -1
188#define DVD_STATE_END 0
189#define DVD_STATE_BUSY 1
190#define DVD_STATE_WAITING 2
191#define DVD_STATE_COVER_CLOSED 3
192#define DVD_STATE_NO_DISK 4
193#define DVD_STATE_COVER_OPEN 5
194#define DVD_STATE_WRONG_DISK 6
195#define DVD_STATE_MOTOR_STOPPED 7
196#define DVD_STATE_PAUSING 8
197#define DVD_STATE_IGNORED 9
198#define DVD_STATE_CANCELED 10
199#define DVD_STATE_RETRY 11
200
201#define DVD_MIN_TRANSFER_SIZE 32
202
203// could be bitfields
204#define DVD_INTTYPE_TC 1
205#define DVD_INTTYPE_DE 2
206// unk type 3
207#define DVD_INTTYPE_CVR 4
208
209// DVD Commands
210
211#define DVD_COMMAND_NONE 0
212#define DVD_COMMAND_READ 1
213#define DVD_COMMAND_SEEK 2
214#define DVD_COMMAND_CHANGE_DISK 3
215#define DVD_COMMAND_BSREAD 4
216#define DVD_COMMAND_READID 5
217#define DVD_COMMAND_INITSTREAM 6
218#define DVD_COMMAND_CANCELSTREAM 7
219#define DVD_COMMAND_STOP_STREAM_AT_END 8
220#define DVD_COMMAND_REQUEST_AUDIO_ERROR 9
221#define DVD_COMMAND_REQUEST_PLAY_ADDR 10
222#define DVD_COMMAND_REQUEST_START_ADDR 11
223#define DVD_COMMAND_REQUEST_LENGTH 12
224#define DVD_COMMAND_AUDIO_BUFFER_CONFIG 13
225#define DVD_COMMAND_INQUIRY 14
226#define DVD_COMMAND_BS_CHANGE_DISK 15
227
228// unidentified externs
229extern int DVDReadAbsAsyncForBS(struct DVDCommandBlock* block, void* addr,
230 long length, long offset,
231 void (*callback)(long,
232 struct DVDCommandBlock*));
233extern int DVDReadDiskID(struct DVDCommandBlock* block,
234 struct DVDDiskID* diskID,
235 void (*callback)(long, struct DVDCommandBlock*));
236extern void DVDReset(void);
237
239 struct DVDCommandBlock* block /* r29 */, void* addr /* r1+0xC */,
240 long length /* r1+0x10 */, long offset /* r1+0x14 */,
241 void (*callback)(long, struct DVDCommandBlock*) /* r1+0x18 */,
242 long prio /* r31 */);
244 struct DVDCommandBlock* block /* r31 */, long offset /* r28 */,
245 void (*callback)(long, struct DVDCommandBlock*) /* r1+0x10 */,
246 long prio /* r1+0x14 */);
248 struct DVDCommandBlock* block /* r31 */, unsigned long length /* r1+0xC */,
249 unsigned long offset /* r1+0x10 */,
250 void (*callback)(long, struct DVDCommandBlock*) /* r1+0x14 */);
251void __DVDStoreErrorCode(u32 error);
252
253#endif
size_t size
Definition __os.h:98
static DVDFileInfo fileinfo
Definition devcom.c:29
int DVDReadAbsAsyncPrio(struct DVDCommandBlock *block, void *addr, long length, long offset, void(*callback)(long, struct DVDCommandBlock *), long prio)
Definition dvd.c:902
void(* DVDCallback)(s32 result, DVDFileInfo *fileInfo)
Definition dvd.h:34
BOOL DVDReadAsyncPrio(DVDFileInfo *fileInfo, void *addr, s32 length, s32 offset, DVDCallback callback, s32 prio)
Definition dvdfs.c:353
int DVDGetStreamStartAddrAsync(struct DVDCommandBlock *block, void(*callback)(long, struct DVDCommandBlock *))
Definition dvd.c:1204
long DVDGetStreamStartAddr(struct DVDCommandBlock *block)
Definition dvd.c:1215
long DVDGetFileInfoStatus(struct DVDFileInfo *fileInfo)
Definition dvdfs.c:549
unsigned long DVDLowGetCoverStatus()
Definition dvdlow.c:468
long DVDSeekPrio(struct DVDFileInfo *fileInfo, long offset, long prio)
Definition dvdfs.c:500
int DVDLowSeek(unsigned long offset, void(*callback)(unsigned long))
Definition dvdlow.c:312
BOOL DVDFastOpen(s32 entrynum, DVDFileInfo *fileInfo)
Definition dvdfs.c:175
void DVDInit()
Definition dvd.c:80
void DVDReset()
Definition dvd.c:1424
void(*)(unsigned long) DVDLowSetResetCoverCallback(void(*callback)(unsigned long))
Definition dvd.h:89
int DVDReadDir(DVDDir *dir, DVDDirEntry *dirent)
Definition dvdfs.c:580
long DVDCancelAll(void)
Definition dvd.c:1681
int DVDOpenDir(char *dirName, DVDDir *dir)
Definition dvdfs.c:554
BOOL DVDClose(DVDFileInfo *fileInfo)
Definition dvdfs.c:237
long DVDGetStreamPlayAddr(struct DVDCommandBlock *block)
Definition dvd.c:1172
void DVDResume()
Definition dvd.c:1505
BOOL DVDCheckDisk(void)
Definition dvd.c:1715
void DVDLowReset()
Definition dvdlow.c:423
int DVDChangeDiskAsyncForBS(struct DVDCommandBlock *block, void(*callback)(long, struct DVDCommandBlock *))
Definition dvd.c:1303
int DVDStopStreamAtEndAsync(struct DVDCommandBlock *block, void(*callback)(long, struct DVDCommandBlock *))
Definition dvd.c:1073
int DVDCancelStreamAsync(struct DVDCommandBlock *block, void(*callback)(long, struct DVDCommandBlock *))
Definition dvd.c:1031
long DVDInquiry(struct DVDCommandBlock *block, struct DVDDriveInfo *info)
Definition dvd.c:1394
int DVDLowRequestAudioStatus(unsigned long subcmd, void(*callback)(unsigned long))
Definition dvdlow.c:396
int DVDChangeDiskAsync(struct DVDCommandBlock *block, struct DVDDiskID *id, void(*callback)(long, struct DVDCommandBlock *))
Definition dvd.c:1320
int DVDGetStreamLengthAsync(struct DVDCommandBlock *block, void(*callback)(long, struct DVDCommandBlock *))
Definition dvd.c:1247
int DVDSetAutoInvalidation(int autoInval)
Definition dvd.c:1484
BOOL DVDGetCurrentDir(char *path, u32 maxlen)
Definition dvdfs.c:318
BOOL DVDOpen(char *fileName, DVDFileInfo *fileInfo)
Definition dvdfs.c:201
int DVDCloseDir(DVDDir *dir)
Definition dvdfs.c:595
int DVDCancelAsync(struct DVDCommandBlock *block, void(*callback)(long, struct DVDCommandBlock *))
Definition dvd.c:1518
long DVDReadPrio(struct DVDFileInfo *fileInfo, void *addr, long length, long offset, long prio)
Definition dvdfs.c:403
int DVDReadAbsAsyncForBS(struct DVDCommandBlock *block, void *addr, long length, long offset, void(*callback)(long, struct DVDCommandBlock *))
Definition dvd.c:958
s32 DVDPrepareStream(DVDFileInfo *fileInfo, u32 length, u32 offset)
Definition dvdfs.c:667
void DVDPause()
Definition dvd.c:1493
int DVDPrepareStreamAbsAsync(struct DVDCommandBlock *block, unsigned long length, unsigned long offset, void(*callback)(long, struct DVDCommandBlock *))
Definition dvd.c:1017
long DVDCancel(volatile struct DVDCommandBlock *block)
Definition dvd.c:1617
int DVDLowInquiry(struct DVDDriveInfo *info, void(*callback)(unsigned long))
Definition dvdlow.c:370
BOOL DVDChangeDir(char *dirName)
Definition dvdfs.c:327
int DVDLowAudioBufferConfig(int enable, unsigned long size, void(*callback)(unsigned long))
Definition dvdlow.c:407
int DVDSeekAbsAsyncPrio(struct DVDCommandBlock *block, long offset, void(*callback)(long, struct DVDCommandBlock *), long prio)
Definition dvd.c:937
int DVDLowReadDiskID(struct DVDDiskID *diskID, void(*callback)(unsigned long))
Definition dvdlow.c:334
int DVDResetRequired()
Definition dvd.c:1433
int DVDGetStreamErrorStatusAsync(struct DVDCommandBlock *block, void(*callback)(long, struct DVDCommandBlock *))
Definition dvd.c:1116
s32 DVDConvertPathToEntrynum(const char *pathPtr)
Definition dvdfs.c:67
long DVDGetStreamLength(struct DVDCommandBlock *block)
Definition dvd.c:1258
int DVDGetStreamPlayAddrAsync(struct DVDCommandBlock *block, void(*callback)(long, struct DVDCommandBlock *))
Definition dvd.c:1161
long DVDChangeDisk(struct DVDCommandBlock *block, struct DVDDiskID *id)
Definition dvd.c:1341
struct DVDDiskID * DVDGetCurrentDiskID(void)
Definition dvd.c:1710
long DVDGetStreamErrorStatus(struct DVDCommandBlock *block)
Definition dvd.c:1128
void(*)(unsigned long) DVDLowClearCallback()
Definition dvd.h:92
s32 DVDGetTransferredSize(DVDFileInfo *fileinfo)
Definition dvdfs.c:747
void DVDDumpWaitingQueue(void)
Definition dvdqueue.c:150
long DVDStopStreamAtEnd(struct DVDCommandBlock *block)
Definition dvd.c:1084
int DVDInquiryAsync(struct DVDCommandBlock *block, struct DVDDriveInfo *info, void(*callback)(long, struct DVDCommandBlock *))
Definition dvd.c:1373
int DVDLowAudioStream(unsigned long subcmd, unsigned long length, unsigned long offset, void(*callback)(unsigned long))
Definition dvdlow.c:383
long DVDGetDriveStatus()
Definition dvd.c:1452
BOOL DVDPrepareStreamAsync(DVDFileInfo *fileInfo, u32 length, u32 offset, DVDCallback callback)
Definition dvdfs.c:608
int DVDLowRead(void *addr, unsigned long length, unsigned long offset, void(*callback)(unsigned long))
long DVDCancelStream(struct DVDCommandBlock *block)
Definition dvd.c:1042
void __DVDStoreErrorCode(u32 error)
Definition dvderror.c:48
int DVDLowRequestError(void(*callback)(unsigned long))
Definition dvdlow.c:360
int DVDLowBreak()
Definition dvdlow.c:451
int DVDLowWaitCoverClose(void(*callback)(unsigned long))
Definition dvdlow.c:325
int DVDReadDiskID(struct DVDCommandBlock *block, struct DVDDiskID *diskID, void(*callback)(long, struct DVDCommandBlock *))
Definition dvd.c:990
int DVDLowStopMotor(void(*callback)(unsigned long))
Definition dvdlow.c:350
int DVDSeekAsyncPrio(struct DVDFileInfo *fileInfo, long offset, void(*callback)(long, struct DVDFileInfo *), long prio)
Definition dvdfs.c:469
int DVDCancelAllAsync(DVDCBCallback callback)
Definition dvd.c:1657
void * DVDGetFSTLocation()
Definition dvdfs.c:600
void(* DVDCBCallback)(s32 result, DVDCommandBlock *block)
Definition dvd.h:17
long DVDGetCommandBlockStatus(struct DVDCommandBlock *block)
Definition dvd.c:1438
static void callback(HSD_GObj *gobj)
Definition ftdonkeyspeciallw.c:90
int BOOL
Definition types.h:25
signed int s32
Definition types.h:12
unsigned int u32
Definition types.h:13
unsigned short int u16
Definition types.h:7
unsigned char u8
Definition types.h:5
Definition dvd.h:54
u32 FSTMaxLength
Definition dvd.h:58
u32 FSTPosition
Definition dvd.h:56
u32 bootFilePosition
Definition dvd.h:55
void * FSTAddress
Definition dvd.h:59
u32 userLength
Definition dvd.h:61
u32 padding0
Definition dvd.h:62
u32 FSTLength
Definition dvd.h:57
u32 userPosition
Definition dvd.h:60
Definition dvd.h:18
u32 transferredSize
Definition dvd.h:27
void * addr
Definition dvd.h:25
u32 currTransferSize
Definition dvd.h:26
DVDCommandBlock * prev
Definition dvd.h:20
void * userData
Definition dvd.h:30
u32 offset
Definition dvd.h:23
DVDDiskID * id
Definition dvd.h:28
u32 command
Definition dvd.h:21
DVDCBCallback callback
Definition dvd.h:29
s32 state
Definition dvd.h:22
DVDCommandBlock * next
Definition dvd.h:19
u32 length
Definition dvd.h:24
Definition dvd.h:48
char * name
Definition dvd.h:51
BOOL isDir
Definition dvd.h:50
u32 entryNum
Definition dvd.h:49
Definition dvd.h:42
u32 next
Definition dvd.h:45
u32 location
Definition dvd.h:44
u32 entryNum
Definition dvd.h:43
Definition dvd.h:6
u8 streaming
Definition dvd.h:11
char company[2]
Definition dvd.h:8
char gameName[4]
Definition dvd.h:7
u8 gameVersion
Definition dvd.h:10
u8 diskNumber
Definition dvd.h:9
u8 streamingBufSize
Definition dvd.h:12
u8 padding[22]
Definition dvd.h:13
Definition dvd.h:65
u16 deviceCode
Definition dvd.h:67
u32 releaseDate
Definition dvd.h:68
u8 padding[24]
Definition dvd.h:69
u16 revisionLevel
Definition dvd.h:66
Definition dvd.h:35
u32 length
Definition dvd.h:38
DVDCallback callback
Definition dvd.h:39
DVDCommandBlock cb
Definition dvd.h:36
u32 startAddr
Definition dvd.h:37