NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
dvd.h
1#ifndef RVL_SDK_DVD_H
2#define RVL_SDK_DVD_H
3#include <types.h>
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8// OS sets MSB to signal that the device code was successfully read
9#define DVD_DEVICE_CODE_READ (1 << 15)
10#define MAKE_DVD_DEVICE_CODE(x) (DVD_DEVICE_CODE_READ | (x))
11
12// Forward declarations
13typedef struct DVDCommandBlock DVDCommandBlock;
14typedef struct DVDFileInfo DVDFileInfo;
15typedef struct OSAlarm OSAlarm;
16
17typedef enum {
18 DVD_RESULT_COVER_CLOSED = -4,
19 DVD_RESULT_CANCELED,
20 DVD_RESULT_IGNORED,
21 DVD_RESULT_FATAL_ERROR,
22 DVD_RESULT_GOOD,
23} DVDResult;
24
25typedef enum {
26 DVD_STATE_FATAL = -1,
27 DVD_STATE_IDLE,
28 DVD_STATE_BUSY,
29 DVD_STATE_WAITING,
30 DVD_STATE_COVER_CLOSED,
31 DVD_STATE_NO_DISK,
32 DVD_STATE_COVER_OPENED,
33 DVD_STATE_WRONG_DISK_ID,
34 DVD_STATE_7,
35 DVD_STATE_PAUSED,
36 DVD_STATE_9,
37 DVD_STATE_CANCELED,
38 DVD_STATE_DISK_ERROR,
39 DVD_STATE_MOTOR_STOPPED,
40} DVDAsyncState;
41
42typedef enum {
43 DVD_COVER_BUSY,
44 DVD_COVER_OPENED,
45 DVD_COVER_CLOSED,
46} DVDCoverState;
47
48typedef void (*DVDAsyncCallback)(s32 result, DVDFileInfo* info);
49typedef void (*DVDCommandCallback)(s32 result, DVDCommandBlock* block);
50
51typedef struct DVDDiskID {
52 char game[4]; // at 0x0
53 char company[2]; // at 0x4
54 u8 disk; // at 0x6
55 u8 version; // at 0x7
56 u8 strmEnable; // at 0x8
57 u8 strmBufSize; // at 0x9
58 u8 padding[14]; // at 0xA
59 u32 rvlMagic; // at 0x18
60 u32 gcMagic; // at 0x1C
61} DVDDiskID;
62
63typedef struct DVDCommandBlock {
64 DVDCommandBlock* next; // at 0x0
65 DVDCommandBlock* prev; // at 0x4
66 u32 command; // at 0x8
67 volatile s32 state; // at 0xC
68 u32 offset; // at 0x10
69 u32 length; // at 0x14
70 void* addr; // at 0x18
71 u32 transferSize; // at 0x1C
72 u32 transferTotal; // at 0x20
73 DVDDiskID* id; // at 0x24
74 DVDCommandCallback callback; // at 0x28
75 void* userData; // at 0x2C
77
78typedef struct DVDDriveInfo {
79 u16 revision; // at 0x0
80 u16 deviceCode; // at 0x2
81 u32 releaseDate; // at 0x4
82 char padding[32 - 0x8];
84
85typedef struct DVDFileInfo {
86 DVDCommandBlock block; // at 0x0
87 u32 offset; // at 0x30
88 u32 size; // at 0x34
89 DVDAsyncCallback callback; // at 0x38
91
92extern volatile u32 __DVDLayoutFormat;
93
94void DVDInit(void);
95BOOL DVDReadAbsAsyncPrio(DVDCommandBlock* block, void* dst, u32 size,
96 u32 offset, DVDCommandCallback callback, s32 prio);
97BOOL DVDInquiryAsync(DVDCommandBlock* block, DVDDriveInfo* info,
98 DVDCommandCallback callback);
99s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block);
100s32 DVDGetDriveStatus(void);
101void DVDPause(void);
102void DVDResume(void);
103BOOL DVDCancelAsync(DVDCommandBlock* block, DVDCommandCallback callback);
104s32 DVDCancel(DVDCommandBlock* block);
105BOOL DVDCancelAllAsync(DVDCommandCallback callback);
106const DVDDiskID* DVDGetCurrentDiskID(void);
107u32 __DVDGetCoverStatus(void);
108void __DVDPrepareResetAsync(DVDCommandCallback callback);
109void __DVDPrepareReset(void);
110BOOL __DVDTestAlarm(const OSAlarm* alarm);
111BOOL __DVDLowBreak(void);
112BOOL __DVDStopMotorAsync(DVDCommandBlock* block, DVDCommandCallback callback);
113void __DVDRestartMotor(void);
114
115#ifdef __cplusplus
116}
117#endif
118#endif