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

Function CARDSetStatusAsync

src/dolphin/src/card/CARDStat.c:100–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100s32 CARDSetStatusAsync(s32 chan, s32 fileNo, CARDStat* stat, CARDCallback callback) {
101 CARDControl* card;
102 CARDDir* dir;
103 CARDDir* ent;
104 s32 result;
105
106 if (fileNo < 0 || CARD_MAX_FILE <= fileNo ||
107 (stat->iconAddr != 0xffffffff && CARD_READ_SIZE <= stat->iconAddr) ||
108 (stat->commentAddr != 0xffffffff &&
109 CARD_SYSTEM_BLOCK_SIZE - CARD_COMMENT_SIZE < stat->commentAddr % CARD_SYSTEM_BLOCK_SIZE)) {
110 return CARD_RESULT_FATAL_ERROR;
111 }
112 result = __CARDGetControlBlock(chan, &card);
113 if (result < 0) {
114 return result;
115 }
116
117 dir = __CARDGetDirBlock(card);
118 ent = &dir[fileNo];
119 result = __CARDIsWritable(card, ent);
120 if (result < 0) {
121 return __CARDPutControlBlock(card, result);
122 }
123
124 ent->bannerFormat = stat->bannerFormat;
125 ent->iconAddr = stat->iconAddr;
126 ent->iconFormat = stat->iconFormat;
127 ent->iconSpeed = stat->iconSpeed;
128 ent->commentAddr = stat->commentAddr;
129 UpdateIconOffsets(ent, stat);
130
131 if (ent->iconAddr == 0xffffffff) {
132 CARDSetIconSpeed(ent, 0, CARD_STAT_SPEED_FAST);
133 }
134
135 ent->time = (u32)OSTicksToSeconds(OSGetTime());
136 result = __CARDUpdateDir(chan, callback);
137 if (result < 0) {
138 __CARDPutControlBlock(card, result);
139 }
140 return result;
141}
142
143s32 CARDSetStatus(s32 channel, s32 fileNo, CARDStat *state)
144{

Callers 1

CARDSetStatusFunction · 0.85

Calls 7

__CARDGetControlBlockFunction · 0.85
__CARDGetDirBlockFunction · 0.85
__CARDIsWritableFunction · 0.85
__CARDPutControlBlockFunction · 0.85
UpdateIconOffsetsFunction · 0.85
OSGetTimeFunction · 0.85
__CARDUpdateDirFunction · 0.85

Tested by

no test coverage detected