2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _DOLPHIN_DVD
|
|
|
|
#define _DOLPHIN_DVD
|
2022-09-10 20:32:26 +00:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2023-01-13 00:05:25 +00:00
|
|
|
#define DVD_MIN_TRANSFER_SIZE 32
|
|
|
|
|
|
|
|
#define DVD_STATE_FATAL_ERROR -1
|
|
|
|
#define DVD_STATE_END 0
|
|
|
|
#define DVD_STATE_BUSY 1
|
|
|
|
#define DVD_STATE_WAITING 2
|
|
|
|
#define DVD_STATE_COVER_CLOSED 3
|
|
|
|
#define DVD_STATE_NO_DISK 4
|
|
|
|
#define DVD_STATE_COVER_OPEN 5
|
|
|
|
#define DVD_STATE_WRONG_DISK 6
|
|
|
|
#define DVD_STATE_MOTOR_STOPPED 7
|
|
|
|
#define DVD_STATE_PAUSING 8
|
|
|
|
#define DVD_STATE_IGNORED 9
|
|
|
|
#define DVD_STATE_CANCELED 10
|
|
|
|
#define DVD_STATE_RETRY 11
|
|
|
|
|
|
|
|
#define DVD_FILEINFO_READY 0
|
|
|
|
#define DVD_FILEINFO_BUSY 1
|
|
|
|
|
|
|
|
#define DVD_RESULT_GOOD 0
|
|
|
|
#define DVD_RESULT_FATAL_ERROR -1
|
|
|
|
#define DVD_RESULT_IGNORED -2
|
|
|
|
#define DVD_RESULT_CANCELED -3
|
|
|
|
|
|
|
|
#define DVD_AIS_SUCCESS 0x0
|
|
|
|
|
2022-09-10 20:32:26 +00:00
|
|
|
typedef struct DVDDiskID {
|
|
|
|
char gameName[4];
|
|
|
|
char company[2];
|
|
|
|
u8 diskNumber;
|
|
|
|
u8 gameVersion;
|
|
|
|
u8 streaming;
|
|
|
|
u8 streamingBufSize; // 0 = default
|
|
|
|
u8 padding[22]; // 0's are stored
|
|
|
|
} DVDDiskID;
|
|
|
|
|
2022-09-16 01:17:42 +00:00
|
|
|
typedef struct DVDCommandBlock DVDCommandBlock;
|
|
|
|
|
|
|
|
typedef void (*DVDCBCallback)(s32 result, DVDCommandBlock* block);
|
|
|
|
|
|
|
|
struct DVDCommandBlock {
|
|
|
|
DVDCommandBlock* next;
|
|
|
|
DVDCommandBlock* prev;
|
|
|
|
u32 command;
|
|
|
|
s32 state;
|
|
|
|
u32 offset;
|
|
|
|
u32 length;
|
|
|
|
void* addr;
|
|
|
|
u32 currTransferSize;
|
|
|
|
u32 transferredSize;
|
|
|
|
DVDDiskID* id;
|
|
|
|
DVDCBCallback callback;
|
|
|
|
void* userData;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct DVDFileInfo DVDFileInfo;
|
|
|
|
|
2022-10-08 02:38:36 +00:00
|
|
|
typedef void (*DVDCallback)(s32 result, DVDFileInfo* fileInfo);
|
|
|
|
|
|
|
|
struct DVDFileInfo {
|
2023-01-13 00:05:25 +00:00
|
|
|
DVDCommandBlock cb;
|
2022-10-08 02:38:36 +00:00
|
|
|
u32 startAddr;
|
|
|
|
u32 length;
|
|
|
|
DVDCallback callback;
|
|
|
|
};
|
|
|
|
|
2023-01-13 00:05:25 +00:00
|
|
|
typedef struct {
|
|
|
|
u32 entryNum;
|
|
|
|
u32 location;
|
|
|
|
u32 next;
|
|
|
|
} DVDDir;
|
2022-12-06 04:11:13 +00:00
|
|
|
|
2023-01-13 00:05:25 +00:00
|
|
|
typedef struct {
|
|
|
|
u32 entryNum;
|
|
|
|
BOOL isDir;
|
|
|
|
char* name;
|
|
|
|
} DVDDirEntry;
|
|
|
|
|
|
|
|
void DVDInit();
|
|
|
|
BOOL DVDClose(DVDFileInfo* f);
|
2023-01-13 01:23:52 +00:00
|
|
|
BOOL DVDSetAutoFatalMessaging(BOOL);
|
2022-09-16 01:17:42 +00:00
|
|
|
void DVDReset();
|
2023-01-13 00:05:25 +00:00
|
|
|
s32 DVDCancel(DVDCommandBlock* block);
|
2023-01-29 22:16:26 +00:00
|
|
|
BOOL DVDOpen(char* fileName, DVDFileInfo* fileInfo);
|
|
|
|
BOOL DVDFastOpen(s32 entrynum, DVDFileInfo* fileInfo);
|
2023-01-30 21:21:55 +00:00
|
|
|
s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block);
|
2023-01-29 22:58:21 +00:00
|
|
|
BOOL DVDCancelAsync(DVDCommandBlock* block, DVDCBCallback callback);
|
|
|
|
s32 DVDCancel(DVDCommandBlock* block);
|
|
|
|
BOOL DVDCancelAllAsync(DVDCBCallback callback);
|
|
|
|
s32 DVDCancelAll(void);
|
2022-10-09 05:13:17 +00:00
|
|
|
BOOL DVDPrepareStreamAsync(DVDFileInfo* fInfo, u32 length, u32 offset, DVDCallback callback);
|
|
|
|
s32 DVDPrepareStream(DVDFileInfo* fInfo, u32 length, u32 offset);
|
2024-10-21 01:04:07 +00:00
|
|
|
BOOL DVDSetAutoInvalidation(BOOL autoInval);
|
2022-10-09 05:13:17 +00:00
|
|
|
BOOL DVDCancelStreamAsync(DVDCommandBlock* block, DVDCBCallback callback);
|
|
|
|
s32 DVDCancelStream(DVDCommandBlock* block);
|
2022-10-08 02:38:36 +00:00
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
BOOL DVDStopStreamAtEndAsync(DVDCommandBlock* block, DVDCBCallback callback);
|
|
|
|
s32 DVDStopStreamAtEnd(DVDCommandBlock* block);
|
2022-10-08 02:38:36 +00:00
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
BOOL DVDGetStreamErrorStatusAsync(DVDCommandBlock* block, DVDCBCallback callback);
|
|
|
|
s32 DVDGetStreamErrorStatus(DVDCommandBlock* block);
|
2022-10-08 02:38:36 +00:00
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
BOOL DVDGetStreamPlayAddrAsync(DVDCommandBlock* block, DVDCBCallback callback);
|
|
|
|
s32 DVDGetStreamPlayAddr(DVDCommandBlock* block);
|
2022-10-08 02:38:36 +00:00
|
|
|
|
2022-11-24 00:41:55 +00:00
|
|
|
s32 DVDGetDriveStatus();
|
|
|
|
|
2023-01-29 22:16:26 +00:00
|
|
|
s32 DVDConvertPathToEntrynum(char* pathPtr);
|
|
|
|
|
2023-02-01 08:13:54 +00:00
|
|
|
BOOL DVDReadAsyncPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset,
|
|
|
|
DVDCallback callback, s32 prio);
|
|
|
|
|
|
|
|
#define DVDReadAsync(fileInfo, addr, length, offset, callback) \
|
|
|
|
DVDReadAsyncPrio((fileInfo), (addr), (length), (offset), (callback), 2)
|
|
|
|
#define DVDSeekAsync(fileInfo, offset, callback) \
|
|
|
|
DVDSeekAsyncPrio((fileInfo), (offset), (callback), 2)
|
|
|
|
|
2022-09-10 20:32:26 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _DOLPHIN_DVD
|