Skip to content

Commit

Permalink
Link (99% of) card library
Browse files Browse the repository at this point in the history
Just CARDBlock with a single regswap - ty Antidote + dolsdk2001 people!
  • Loading branch information
HeartPiece44 committed Dec 17, 2024
1 parent 077d468 commit 6c545aa
Show file tree
Hide file tree
Showing 16 changed files with 2,284 additions and 6,725 deletions.
26 changes: 13 additions & 13 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,20 +937,20 @@ def MatchingFor(*versions):
DolphinLib(
"card",
[
Object(NonMatching, "card/CARDBios.c"),
Object(NonMatching, "card/CARDRdwr.c"),
Object(Matching, "card/CARDBios.c"),
Object(Matching, "card/CARDRdwr.c"),
Object(NonMatching, "card/CARDBlock.c"),
Object(NonMatching, "card/CARDDir.c"),
Object(NonMatching, "card/CARDCheck.c"),
Object(NonMatching, "card/CARDMount.c"),
Object(NonMatching, "card/CARDFormat.c"),
Object(NonMatching, "card/CARDOpen.c"),
Object(NonMatching, "card/CARDCreate.c"),
Object(NonMatching, "card/CARDRead.c"),
Object(NonMatching, "card/CARDWrite.c"),
Object(NonMatching, "card/CARDDelete.c"),
Object(NonMatching, "card/CARDStat.c"),
Object(NonMatching, "card/CARDRename.c"),
Object(Matching, "card/CARDDir.c"),
Object(Matching, "card/CARDCheck.c"),
Object(Matching, "card/CARDMount.c"),
Object(Matching, "card/CARDFormat.c"),
Object(Matching, "card/CARDOpen.c"),
Object(Matching, "card/CARDCreate.c"),
Object(Matching, "card/CARDRead.c"),
Object(Matching, "card/CARDWrite.c"),
Object(Matching, "card/CARDDelete.c"),
Object(Matching, "card/CARDStat.c"),
Object(Matching, "card/CARDRename.c"),
]
),
DolphinLib(
Expand Down
28 changes: 25 additions & 3 deletions include/Dolphin/card.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ struct CARDDirCheck {
};

// Struct for CARD information (size 0x110).
// NB: we had this as CARDBlock previously.
struct CARDControl {
BOOL attached; // _00
s32 result; // _04
Expand Down Expand Up @@ -141,8 +140,8 @@ struct CARDControl {
CARDCallback eraseCallback; // _D8
CARDCallback unlockCallback; // _DC
OSAlarm alarm; // _E0, for timeout.
u32 cid; // _108
const DVDDiskID* diskID; // _10C
// u32 cid; // _108
// const DVDDiskID* diskID; // _10C
};

// CARD identification struct (size 0x200).
Expand Down Expand Up @@ -212,6 +211,7 @@ extern CARDControl __CARDBlock[2];

// Other CARD information.
extern DVDDiskID __CARDDiskNone;
extern DVDDiskID* __CARDDiskID;
extern u16 __CARDVendorID;
extern u8 __CARDPermMask;

Expand All @@ -226,7 +226,9 @@ s32 CARDCheck(s32 channel);
s32 CARDCheckExAsync(s32 channel, s32* xferBytes, CARDCallback callback);

// CARD BIOS functions.
s32 CARDGetResultCode(s32 channel);
s32 CARDFreeBlocks(s32 channel, s32* byteNotUsed, s32* filesNotUsed);
s32 CARDGetSectorSize(s32 channel, u32* size);

// CARD mounting functions.
BOOL CARDProbe(s32 channel);
Expand All @@ -236,6 +238,7 @@ s32 CARDMount(s32 channel, CARDMemoryCard* workArea, CARDCallback detachCallback
s32 CARDUnmount(s32 channel);

// CARD formatting functions.
s32 CARDFormatAsync(s32 channel, CARDCallback callback);
s32 CARDFormat(s32 channel);

// CARD open/close.
Expand All @@ -249,6 +252,15 @@ s32 CARDRead(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset);
s32 CARDReadAsync(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset, CARDCallback callback);
s32 CARDWrite(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset);
s32 CARDWriteAsync(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset, CARDCallback callback);
s32 CARDGetXferredBytes(s32 channel);

// CARD delete functions.
s32 CARDFastDeleteAsync(s32 channel, s32 fileNo, CARDCallback callback);
s32 CARDFastDelete(s32 channel, s32 fileNo);

// CARD rename functions.
s32 CARDRenameAsync(s32 channel, const char* oldName, const char* newName, CARDCallback callback);
s32 CARDRename(s32 channel, char* oldName, char* newName);

// CARD status functions.
s32 CARDGetStatus(s32 channel, s32 fileNo, CARDStat* state);
Expand All @@ -270,8 +282,10 @@ void __CARDExtHandler(s32 channel, OSContext* context);
void __CARDExiHandler(s32 channel, OSContext* context);
void __CARDTxHandler(s32 channel, OSContext* context);
void __CARDUnlockedHandler(s32 channel, OSContext* context);
void __CARDMountCallback(s32 channel, s32 result);

// Other CARD BIOS functions.
int __CARDReadNintendoID(s32 channel, u32* id);
s32 __CARDEnableInterrupt(s32 channel, BOOL enable);
s32 __CARDReadStatus(s32 channel, u8* status);
s32 __CARDClearStatus(s32 channel);
Expand All @@ -285,9 +299,17 @@ s32 __CARDGetControlBlock(s32 channel, CARDControl** card);
s32 __CARDPutControlBlock(CARDControl* card, s32 result);
s32 __CARDSync(s32 channel);
void __CARDCheckSum(void* data, int length, u16* checksum, u16* checksumInv);
s32 __CARDVerify(CARDControl* card);
s32 __CARDAccess(CARDDir* ent);
s32 __CARDIsPublic(CARDDir* ent);
BOOL __CardIsOpened(CARDControl* card, s32 fileNo);
s32 __CARDRead(s32 channel, u32 addr, s32 length, void* dst, CARDCallback callback);
s32 __CARDWrite(s32 channel, u32 addr, s32 length, void* dst, CARDCallback callback);

CARDDirectoryBlock* __CARDGetDirBlock(CARDControl* card);
s32 __CARDFreeBlock(s32 channel, u16 nBlock, CARDCallback callback);
CARDFatBlock* __CARDGetFatBlock(CARDControl* card);
s32 __CARDUpdateFatBlock(s32 channel, CARDFatBlock* fat, CARDCallback callback);

////////////////////////////////////////////

Expand Down
Loading

0 comments on commit 6c545aa

Please sign in to comment.