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

Function IsCard

src/dolphin/src/card/CARDMount.c:22–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20static void DoUnmount(s32 chan, s32 result);
21
22static BOOL IsCard(u32 id) {
23 u32 size;
24 s32 sectorSize;
25 if (id & (0xFFFF0000) && (id != 0x80000004 || __CARDVendorID == 0xFFFF)) {
26 return FALSE;
27 }
28
29 if ((id & 3) != 0) {
30 return FALSE;
31 }
32
33 size = id & 0xfc;
34 switch (size) {
35 case 4:
36 case 8:
37 case 16:
38 case 32:
39 case 64:
40 case 128:
41 break;
42 default:
43 return FALSE;
44 break;
45 }
46
47 sectorSize = SectorSizeTable[(id & 0x00003800) >> 11];
48 if (sectorSize == 0) {
49 return FALSE;
50 }
51
52 if ((size * 1024 * 1024 / 8) / sectorSize < 8) {
53 return FALSE;
54 }
55
56 return TRUE;
57}
58
59s32 CARDProbeEx(s32 chan, s32* memSize, s32* sectorSize) {
60 u32 id;

Callers 2

CARDProbeExFunction · 0.85
DoMountFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected