MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / CARDFastOpen

Function CARDFastOpen

src/dolphin/src/card/CARDOpen.c:120–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120s32 CARDFastOpen(s32 chan, s32 fileno, CARDFileInfo *fileinfo)
121{
122 CARDControl *card;
123 CARDDir *dir;
124 CARDDir *ent;
125 s32 result;
126
127 if (fileno < 0 || fileno >= 127)
128 {
129 return CARD_RESULT_FATAL_ERROR;
130 }
131 fileinfo->chan = -1;
132 result = __CARDGetControlBlock(chan, &card);
133 if (result < 0)
134 {
135 return result;
136 }
137
138 dir = __CARDGetDirBlock(card);
139 ent = &dir[fileno];
140 result = __CARDIsReadable(card, ent);
141
142 if (0 <= result)
143 {
144 if (!CARDIsValidBlockNo(card, ent->startBlock))
145 {
146 result = CARD_RESULT_BROKEN;
147 }
148 else
149 {
150 fileinfo->chan = chan;
151 fileinfo->fileNo = fileno;
152 fileinfo->offset = 0;
153 fileinfo->iBlock = ent->startBlock;
154 }
155
156 }
157 return __CARDPutControlBlock(card, result);
158}
159
160s32 CARDOpen(s32 chan, const char *fileName, CARDFileInfo *fileInfo)
161{

Callers 2

iSGTgtHaveRoomFunction · 0.85
iSGTgtHaveRoomStartupFunction · 0.85

Calls 4

__CARDGetControlBlockFunction · 0.85
__CARDGetDirBlockFunction · 0.85
__CARDIsReadableFunction · 0.85
__CARDPutControlBlockFunction · 0.85

Tested by

no test coverage detected