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

Function __CARDSetStatusExAsync

src/dolphin/src/card/CARDStatEx.c:34–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34s32 __CARDSetStatusExAsync(s32 chan, s32 fileNo, CARDDir* dirent, CARDCallback callback)
35{
36 CARDControl* card;
37 CARDDir* dir;
38 CARDDir* ent;
39 s32 result;
40 u8* p;
41 s32 i;
42
43 if ((fileNo < 0) || (fileNo >= CARD_MAX_FILE) || ((u8)dirent->fileName[0] == 0xFF) ||
44 ((u8)dirent->fileName[0] == 0))
45 {
46 return CARD_RESULT_FATAL_ERROR;
47 }
48
49 result = __CARDGetControlBlock(chan, &card);
50 if (result < 0)
51 {
52 return result;
53 }
54
55 dir = __CARDGetDirBlock(card);
56 ent = &dir[fileNo];
57 result = __CARDIsWritable(card, ent);
58 if (result < 0)
59 {
60 return __CARDPutControlBlock(card, result);
61 }
62
63 for (p = dirent->fileName; p < (u8*)&dirent->time; p++)
64 {
65 if (*p != 0)
66 {
67 continue;
68 }
69 while ((++p) < (u8*)&dirent->time)
70 {
71 *p = 0;
72 }
73 break;
74 }
75
76 if (dirent->permission & 0x20)
77 {
78 memset(dirent->gameName, 0, sizeof(dirent->gameName));
79 memset(dirent->company, 0, sizeof(dirent->company));
80 }
81
82 if (dirent->permission & 0x40)
83 {
84 memset(dirent->gameName, 0, sizeof(dirent->gameName));
85 }
86
87 if ((memcmp(&ent->fileName, &dirent->fileName, 32) != 0) ||
88 (memcmp(ent->gameName, dirent->gameName, 4) != 0) ||
89 (memcmp(ent->company, dirent->company, 2) != 0))
90 {
91 for (i = 0; i < CARD_MAX_FILE; i++)

Callers 1

CARDSetAttributesAsyncFunction · 0.85

Calls 8

__CARDGetControlBlockFunction · 0.85
__CARDGetDirBlockFunction · 0.85
__CARDIsWritableFunction · 0.85
__CARDPutControlBlockFunction · 0.85
memsetFunction · 0.85
memcmpFunction · 0.85
memcpyFunction · 0.85
__CARDUpdateDirFunction · 0.85

Tested by

no test coverage detected