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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
#ifndef DVD_H
#define DVD_H
#include "dolphin/types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum DVDState {
DVD_STATE_END = 0x0,
DVD_STATE_BUSY = 0x1,
DVD_STATE_WAITING = 0x2,
DVD_STATE_COVER_CLOSED = 0x3,
DVD_STATE_NO_DISK = 0x4,
DVD_STATE_COVER_OPEN = 0x5,
DVD_STATE_WRONG_DISK = 0x6,
DVD_STATE_MOTOR_STOPPED = 0x7,
DVD_STATE_IGNORED = 0x8,
DVD_STATE_CANCELED = 0xa, // lmao they skipped 9
DVD_STATE_RETRY = 0xb,
DVD_STATE_FATAL_ERROR = -1,
} DVDState;
typedef enum DVDResult {
DVD_RESULT_GOOD = 0,
DVD_RESULT_FATAL_ERROR = -1,
DVD_RESULT_IGNORED = -2,
DVD_RESULT_CANCELED = -3,
} DVDResult;
typedef struct DVDDirectory {
/* 0x0 */ u32 entry_number;
/* 0x4 */ u32 location;
/* 0x8 */ u32 next;
} DVDDirectory;
typedef struct DVDDirectoryEntry {
/* 0x0 */ u32 entry_number;
/* 0x4 */ BOOL is_directory;
/* 0x8 */ char* name;
} DVDDirectoryEntry;
typedef struct DVDDiskID {
/* 0x00 */ char game_name[4];
/* 0x04 */ char company[2];
/* 0x06 */ u8 disk_number;
/* 0x07 */ u8 game_version;
/* 0x08 */ u8 is_streaming;
/* 0x09 */ u8 streaming_buffer_size;
/* 0x0A */ u8 padding[22];
} DVDDiskID;
struct DVDFileInfo;
struct DVDCommandBlock;
typedef void (*DVDCBCallback)(s32 result, struct DVDCommandBlock* block);
typedef void (*DVDCallback)(s32 result, struct DVDFileInfo* info);
typedef struct DVDCommandBlock {
/* 0x00 */ struct DVDCommandBlock* next;
/* 0x04 */ struct DVDCommandBlock* prev;
/* 0x08 */ u32 command;
/* 0x0C */ s32 state;
/* 0x10 */ u32 offset;
/* 0x14 */ u32 length;
/* 0x18 */ void* buffer;
/* 0x1C */ u32 current_transfer_size;
/* 0x20 */ u32 transferred_size;
/* 0x24 */ DVDDiskID* disk_id;
/* 0x28 */ DVDCBCallback callback;
/* 0x2C */ void* user_data;
} DVDCommandBlock;
typedef struct DVDFileInfo {
/* 0x00 */ DVDCommandBlock block;
/* 0x30 */ u32 start_address;
/* 0x34 */ u32 length;
/* 0x38 */ DVDCallback callback;
} DVDFileInfo;
typedef struct DVDDriveInfo {
/* 0x00 */ u16 revision_level;
/* 0x02 */ u16 device_code;
/* 0x04 */ u32 release_date;
/* 0x08 */ u8 padding[24];
} DVDDriveInfo;
typedef struct DVDBB1 {
u32 appLoaderLength;
void* appLoaderFunc1;
void* appLoaderFunc2;
void* appLoaderFunc3;
} DVDBB1;
typedef struct DVDBB2 {
u32 bootFilePosition;
u32 FSTPosition;
u32 FSTLength;
u32 FSTMaxLength;
void* FSTAddress;
u32 userPosition;
u32 userLength;
u32 padding0;
} DVDBB2;
#define DVD_MIN_TRANSFER_SIZE 32
typedef void (*DVDOptionalCommandChecker)(DVDCommandBlock* block, void (*cb)(u32 intType));
void DVDInit(void);
BOOL DVDOpen(const char* filename, DVDFileInfo* fileinfo);
BOOL DVDClose(DVDFileInfo* fileinfo);
BOOL DVDReadPrio(DVDFileInfo* fileinfo, void*, s32, s32, s32);
DVDDiskID* DVDGetCurrentDiskID(void);
BOOL DVDFastOpen(long, DVDFileInfo* fileinfo);
s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block);
BOOL DVDReadAsyncPrio(DVDFileInfo* fileinfo, void*, long, long, DVDCallback, long);
int DVDConvertPathToEntrynum(const char*);
s32 DVDGetDriveStatus(void);
BOOL DVDCheckDisk(void);
BOOL DVDChangeDir(const char* dirname);
BOOL DVDCloseDir(DVDDirectory* dir);
BOOL DVDOpenDir(const char*, DVDDirectory* dir);
BOOL DVDReadDir(DVDDirectory* dir, DVDDirectoryEntry* entry);
BOOL DVDReadAbsAsyncPrio(DVDCommandBlock* block, void* addr, s32 length, s32 offset,
DVDCBCallback callback, s32 prio);
BOOL DVDReadAbsAsyncForBS(DVDCommandBlock* block, void* addr, s32 length, s32 offset,
DVDCBCallback callback);
BOOL DVDReadDiskID(DVDCommandBlock* block, DVDDiskID* diskID, DVDCBCallback callback);
BOOL DVDCancelStreamAsync(DVDCommandBlock* block, DVDCBCallback callback);
BOOL DVDInquiryAsync(DVDCommandBlock* block, DVDDriveInfo* info, DVDCBCallback callback);
void DVDReset(void);
BOOL DVDSetAutoInvalidation(BOOL autoInval);
void DVDResume(void);
static BOOL DVDCancelAsync(DVDCommandBlock* block, DVDCBCallback callback);
s32 DVDCancel(DVDCommandBlock* block);
void __DVDPrepareResetAsync(DVDCBCallback callbac);
BOOL DVDCompareDiskID(DVDDiskID* id1, DVDDiskID* id2);
DVDCommandBlock* __DVDPopWaitingQueue(void);
#ifdef __cplusplus
};
#endif
#endif /* DVD_H */
|