Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
CARDPriv.h
Go to the documentation of this file.
1#ifndef CARDPRIV_H
2#define CARDPRIV_H
3
6#include "dolphin/dsp.h"
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#define CARD_FAT_AVAIL 0x0000u
13#define CARD_FAT_CHECKSUM 0x0000u
14#define CARD_FAT_CHECKSUMINV 0x0001u
15#define CARD_FAT_CHECKCODE 0x0002u
16#define CARD_FAT_FREEBLOCKS 0x0003u
17#define CARD_FAT_LASTSLOT 0x0004u
18
19#define CARD_PAGE_SIZE 128u
20#define CARD_SEG_SIZE 512u
21
22#define CARD_NUM_SYSTEM_BLOCK 5
23#define CARD_SYSTEM_BLOCK_SIZE (8 * 1024u)
24
25#define CARD_MAX_MOUNT_STEP (CARD_NUM_SYSTEM_BLOCK + 2)
26
27typedef struct DVDDiskID DVDDiskID;
28
29typedef struct CARDDir {
35 u32 time; // seconds since 01/01/2000 midnight
36
37 u32 iconAddr; // 0xFFFFFFFF if not used
40
46
47 u32 commentAddr; // 0xFFFFFFFF if not used
49
57
58typedef struct CARDControl {
59 /* 0x000 */ BOOL attached;
60 /* 0x004 */ s32 result;
61 /* 0x008 */ u16 size;
62 /* 0x00A */ u16 pageSize;
63 /* 0x00C */ s32 sectorSize;
64 /* 0x010 */ u16 cBlock;
65 /* 0x012 */ u16 vendorID;
66 /* 0x014 */ s32 latency;
67 /* 0x018 */ u8 id[12];
68 /* 0x024 */ int mountStep;
69 /* 0x028 */ int formatStep;
70 /* 0x02C */ u32 scramble;
71 /* 0x030 */ DSPTaskInfo task;
72 /* 0x080 */ void* workArea;
73 /* 0x084 */ CARDDir* currentDir;
74 /* 0x088 */ u16* currentFat;
76 /* 0x094 */ u8 cmd[9];
77 /* 0x0A0 */ s32 cmdlen;
78 /* 0x0A4 */ vu32 mode;
79 /* 0x0A8 */ int retry;
80 /* 0x0AC */ int repeat;
81 /* 0x0B0 */ u32 addr;
82 /* 0x0B4 */ void* buffer;
83 /* 0x0B8 */ s32 xferred;
84 /* 0x0BC */ u16 freeNo;
85 /* 0x0BE */ u16 startBlock;
86 /* 0x0C0 */ CARDFileInfo* fileInfo;
94 /* 0x0E0 */ OSAlarm alarm;
95 /* 0x108 */ u32 cid;
96 /* 0x10C */ const DVDDiskID* diskID;
98
99typedef struct CARDID {
100 u8 serial[32]; // flashID[12] + timebase[8] + counterBias[4] + language[4] + XXX[4]
103 u16 encode; // character set -- 0: S-JIS, 1: ANSI
104
105 u8 padding[512 - 32 - 5 * 2];
106
110
111void __CARDDefaultApiCallback(s32 chan, s32 result);
112s32 __CARDEraseSector(s32 chan, u32 addr, CARDCallback callback);
114void __CARDSyncCallback(s32 chan, s32 result);
116
117/* CARDBios */
126s32 __CARDStart(s32 chan, CARDCallback txCallback, CARDCallback exiCallback);
127s32 __CARDReadSegment(s32 chan, CARDCallback callback);
128s32 __CARDWritePage(s32 chan, CARDCallback callback);
130void __CARDSetDiskID(const DVDDiskID* id);
132s32 __CARDSync(s32 chan);
133
134/* CARDBlock */
135s32 __CARDAllocBlock(s32 chan, u32 cBlock, CARDCallback callback);
137
138/* CARDCheck */
139void __CARDCheckSum(void* ptr, int length, u16* checksum, u16* checksumInv);
141
142/* CARDDir */
144s32 __CARDUpdateDir(s32 chan, CARDCallback callback);
145
146/* CARDFormat */
147s32 __CARDFormatRegionAsync(s32 chan, u16 encode, CARDCallback callback);
148
149/* CARDMount */
150void __CARDMountCallback(s32 chan, s32 result);
151
152/* CARDOpen */
153BOOL __CARDCompareFileName(CARDDir* ent, const char* fileName);
157
158/* CARDRdwr */
159s32 __CARDRead(s32 chan, u32 addr, s32 length, void* dst, CARDCallback callback);
160s32 __CARDWrite(s32 chan, u32 addr, s32 length, void* dst, CARDCallback callback);
161
162/* CARDRead */
163s32 __CARDSeek(CARDFileInfo* fileInfo, s32 length, s32 offset, CARDControl** pcard);
164
165/* CARDUnlock */
166s32 __CARDUnlock(s32 chan, u8 flashID[12]);
167
168#define CARDIsValidBlockNo(card, iBlock) \
169 (CARD_NUM_SYSTEM_BLOCK <= (iBlock) && (iBlock) < (card)->cBlock)
170#define __CARDGetDirCheck(dir) ((CARDDirCheck*)&(dir)[CARD_MAX_FILE])
171
172#define TRUNC(n, a) (((u32)(n)) & ~((a)-1))
173#define OFFSET(n, a) (((u32)(n)) & ((a)-1))
174
175extern CARDControl __CARDBlock[2];
177extern u16 __CARDVendorID;
178extern u8 data_80450A72;
179
180#ifdef __cplusplus
181}
182#endif
183
184#endif /* CARDPRIV_H */
u16 __CARDGetFontEncode(void)
Definition CARDBios.c:532
s32 __CARDSeek(CARDFileInfo *fileInfo, s32 length, s32 offset, CARDControl **pcard)
Definition CARDRead.c:8
s32 __CARDReadSegment(s32 chan, CARDCallback callback)
Definition CARDBios.c:379
s32 __CARDReadVendorID(s32 chan, u16 *vendorId)
Definition CARDBios.c:169
void __CARDSetDiskID(const DVDDiskID *id)
Definition CARDBios.c:537
s32 __CARDAllocBlock(s32 chan, u32 cBlock, CARDCallback callback)
Definition CARDBlock.c:80
s32 __CARDClearStatus(s32 chan)
Definition CARDBios.c:188
s32 __CARDUpdateDir(s32 chan, CARDCallback callback)
Definition CARDDir.c:77
s32 __CARDFormatRegionAsync(s32 chan, u16 encode, CARDCallback callback)
Definition CARDFormat.c:49
void __CARDUnlockedHandler(s32 chan, OSContext *context)
Definition CARDBios.c:120
s32 __CARDEnableInterrupt(s32 chan, BOOL enable)
Definition CARDBios.c:133
s32 __CARDUpdateFatBlock(s32 chan, u16 *fat, CARDCallback callback)
Definition CARDBlock.c:130
s32 __CARDRead(s32 chan, u32 addr, s32 length, void *dst, CARDCallback callback)
Definition CARDRdwr.c:44
void __CARDCheckSum(void *ptr, int length, u16 *checksum, u16 *checksumInv)
Definition CARDCheck.c:11
void __CARDMountCallback(s32 chan, s32 result)
Definition CARDMount.c:260
BOOL __CARDCompareFileName(CARDDir *ent, const char *fileName)
Definition CARDOpen.c:7
void __CARDDefaultApiCallback(s32 chan, s32 result)
Definition CARDBios.c:14
s32 __CARDUnlock(s32 chan, u8 flashID[12])
Definition CARDUnlock.c:197
s32 __CARDWritePage(s32 chan, CARDCallback callback)
Definition CARDBios.c:414
DVDDiskID __CARDDiskNone
Definition CARDBios.c:17
s32 __CARDStart(s32 chan, CARDCallback txCallback, CARDCallback exiCallback)
s32 __CARDVerify(CARDControl *card)
Definition CARDCheck.c:172
s32 __CARDEraseSector(s32 chan, u32 addr, CARDCallback callback)
Definition CARDBios.c:453
s32 __CARDWrite(s32 chan, u32 addr, s32 length, void *dst, CARDCallback callback)
Definition CARDRdwr.c:94
u8 data_80450A72
Definition CARDNet.c:9
void __CARDExtHandler(s32 chan, OSContext *context)
Definition CARDBios.c:28
s32 __CARDReadStatus(s32 chan, u8 *status)
Definition CARDBios.c:150
void __CARDTxHandler(s32 chan, OSContext *context)
Definition CARDBios.c:103
s32 __CARDSync(s32 chan)
Definition CARDBios.c:629
u16 * __CARDGetFatBlock(CARDControl *card)
Definition CARDBlock.c:9
s32 __CARDGetControlBlock(s32 chan, struct CARDControl **pcard)
Definition CARDBios.c:543
CARDControl __CARDBlock[2]
Definition CARDBios.c:20
void __CARDExiHandler(s32 chan, OSContext *context)
Definition CARDBios.c:57
void __CARDSyncCallback(s32 chan, s32 result)
Definition CARDBios.c:23
u16 __CARDVendorID
Definition CARDNet.c:6
s32 __CARDIsWritable(CARDControl *card, CARDDir *ent)
Definition CARDOpen.c:47
CARDDir * __CARDGetDirBlock(CARDControl *card)
Definition CARDDir.c:9
s32 __CARDAccess(CARDControl *card, CARDDir *ent)
Definition CARDOpen.c:31
s32 __CARDIsReadable(CARDControl *card, CARDDir *ent)
Definition CARDOpen.c:78
s32 __CARDPutControlBlock(struct CARDControl *card, s32 result)
Definition CARDBios.c:569
static OSContext context
Definition JUTException.cpp:233
T cLib_calcTimer(T *value)
Definition c_lib.h:74
void(* CARDCallback)(s32 chan, s32 result)
Definition card.h:122
static s32 status
Definition fstload.c:6
Definition CARDPriv.h:58
const DVDDiskID * diskID
Definition CARDPriv.h:96
CARDCallback extCallback
Definition CARDPriv.h:87
void * workArea
Definition CARDPriv.h:72
CARDCallback exiCallback
Definition CARDPriv.h:89
u32 cid
Definition CARDPriv.h:95
CARDCallback eraseCallback
Definition CARDPriv.h:92
u16 vendorID
Definition CARDPriv.h:65
int formatStep
Definition CARDPriv.h:69
CARDCallback xferCallback
Definition CARDPriv.h:91
u16 startBlock
Definition CARDPriv.h:85
s32 cmdlen
Definition CARDPriv.h:77
u32 addr
Definition CARDPriv.h:81
CARDDir * currentDir
Definition CARDPriv.h:73
u16 freeNo
Definition CARDPriv.h:84
u16 cBlock
Definition CARDPriv.h:64
vu32 mode
Definition CARDPriv.h:78
s32 result
Definition CARDPriv.h:60
OSAlarm alarm
Definition CARDPriv.h:94
void * buffer
Definition CARDPriv.h:82
int mountStep
Definition CARDPriv.h:68
int retry
Definition CARDPriv.h:79
u32 scramble
Definition CARDPriv.h:70
s32 xferred
Definition CARDPriv.h:83
CARDFileInfo * fileInfo
Definition CARDPriv.h:86
u16 pageSize
Definition CARDPriv.h:62
DSPTaskInfo task
Definition CARDPriv.h:71
s32 latency
Definition CARDPriv.h:66
u16 size
Definition CARDPriv.h:61
int repeat
Definition CARDPriv.h:80
CARDCallback unlockCallback
Definition CARDPriv.h:93
u16 * currentFat
Definition CARDPriv.h:74
s32 sectorSize
Definition CARDPriv.h:63
CARDCallback txCallback
Definition CARDPriv.h:88
BOOL attached
Definition CARDPriv.h:59
OSThreadQueue threadQueue
Definition CARDPriv.h:75
u8 cmd[9]
Definition CARDPriv.h:76
CARDCallback apiCallback
Definition CARDPriv.h:90
Definition CARDPriv.h:50
s16 checkCode
Definition CARDPriv.h:53
u8 padding0[64 - 2 *4]
Definition CARDPriv.h:51
u16 checkSum
Definition CARDPriv.h:54
u16 checkSumInv
Definition CARDPriv.h:55
u16 padding1
Definition CARDPriv.h:52
Definition CARDPriv.h:29
u8 _padding1[2]
Definition CARDPriv.h:45
u8 company[2]
Definition CARDPriv.h:31
u8 _padding0
Definition CARDPriv.h:32
u16 startBlock
Definition CARDPriv.h:43
u32 time
Definition CARDPriv.h:35
u16 length
Definition CARDPriv.h:44
u16 iconFormat
Definition CARDPriv.h:38
u32 iconAddr
Definition CARDPriv.h:37
u8 fileName[CARD_FILENAME_MAX]
Definition CARDPriv.h:34
u8 gameName[4]
Definition CARDPriv.h:30
u8 bannerFormat
Definition CARDPriv.h:33
u8 permission
Definition CARDPriv.h:41
u16 iconSpeed
Definition CARDPriv.h:39
u32 commentAddr
Definition CARDPriv.h:47
u8 copyTimes
Definition CARDPriv.h:42
Definition card.h:91
Definition CARDPriv.h:99
u8 padding[512 - 32 - 5 *2]
Definition CARDPriv.h:105
u16 encode
Definition CARDPriv.h:103
u16 size
Definition CARDPriv.h:102
u16 deviceID
Definition CARDPriv.h:101
u16 checkSumInv
Definition CARDPriv.h:108
u16 checkSum
Definition CARDPriv.h:107
u8 serial[32]
Definition CARDPriv.h:100
Definition dsp.h:50
Definition dvd.h:45
Definition OSAlarm.h:19
Definition OSContext.h:137
Definition OSThread.h:41
int BOOL
Definition types.h:27
unsigned long u32
Definition types.h:10
signed short s16
Definition types.h:5
unsigned short u16
Definition types.h:9
volatile u32 vu32
Definition types.h:15
signed long s32
Definition types.h:6
unsigned char u8
Definition types.h:8