From 172d5efc916ab7d51846daf59014c43f3a70bc98 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sat, 10 Sep 2022 14:32:57 -0700 Subject: [PATCH] Minor cleanup --- include/dolphin/CARDPriv.h | 1 + src/Dolphin/card/CARDRdwr.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/dolphin/CARDPriv.h b/include/dolphin/CARDPriv.h index 0b94a1a3..5e146361 100644 --- a/include/dolphin/CARDPriv.h +++ b/include/dolphin/CARDPriv.h @@ -11,6 +11,7 @@ extern "C" { #define CARD_FAT_FREEBLOCKS 0x0003u #define CARD_FAT_LASTSLOT 0x0004u +#define CARD_PAGE_SIZE 128u #define CARD_SEG_SIZE 512u #define CARD_NUM_SYSTEM_BLOCK 5 diff --git a/src/Dolphin/card/CARDRdwr.c b/src/Dolphin/card/CARDRdwr.c index 737d94d8..2f41be75 100644 --- a/src/Dolphin/card/CARDRdwr.c +++ b/src/Dolphin/card/CARDRdwr.c @@ -14,10 +14,10 @@ static void BlockReadCallback(s32 chan, s32 result) { goto error; } - card->xferred += 0x200; + card->xferred += CARD_SEG_SIZE; - card->addr += 0x200; - (u8*)card->buffer += 0x200; + card->addr += CARD_SEG_SIZE; + (u8*)card->buffer += CARD_SEG_SIZE; if (--card->repeat <= 0) { goto error; } @@ -63,10 +63,10 @@ static void BlockWriteCallback(s32 chan, s32 result) { goto error; } - card->xferred += 128; + card->xferred += CARD_PAGE_SIZE; - card->addr += 128; - (u8*)card->buffer += 128; + card->addr += CARD_PAGE_SIZE; + (u8*)card->buffer += CARD_PAGE_SIZE; if (--card->repeat <= 0) { goto error; } @@ -96,7 +96,7 @@ s32 __CARDWrite(s32 chan, u32 addr, s32 length, void* dst, CARDCallback callback } card->xferCallback = callback; - card->repeat = (int)(length / 128u); + card->repeat = (int)(length / CARD_PAGE_SIZE); card->addr = addr; card->buffer = dst;