Add CMemoryCardDriver::UpdateCardCheck

This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-11 02:08:19 +03:00
parent 4b98d8c3ae
commit 9fe421822a
No known key found for this signature in database
GPG Key ID: E224F951761145F8
5 changed files with 22 additions and 5 deletions

View File

@ -333,8 +333,8 @@ lbl_8034D85C:
/* 8034D884 0034A7E4 38 21 00 80 */ addi r1, r1, 0x80 /* 8034D884 0034A7E4 38 21 00 80 */ addi r1, r1, 0x80
/* 8034D888 0034A7E8 4E 80 00 20 */ blr /* 8034D888 0034A7E8 4E 80 00 20 */ blr
.global GetSerialNo__14CMemoryCardSysFiRx .global GetSerialNo__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPortRx
GetSerialNo__14CMemoryCardSysFiRx: GetSerialNo__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPortRx:
/* 8034D88C 0034A7EC 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8034D88C 0034A7EC 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 8034D890 0034A7F0 7C 08 02 A6 */ mflr r0 /* 8034D890 0034A7F0 7C 08 02 A6 */ mflr r0
/* 8034D894 0034A7F4 90 01 00 14 */ stw r0, 0x14(r1) /* 8034D894 0034A7F4 90 01 00 14 */ stw r0, 0x14(r1)

View File

@ -2612,7 +2612,7 @@ UpdateCardCheck__17CMemoryCardDriverF11ECardResult:
/* 8024E4E4 0024B444 41 82 00 48 */ beq lbl_8024E52C /* 8024E4E4 0024B444 41 82 00 48 */ beq lbl_8024E52C
/* 8024E4E8 0024B448 80 7F 00 00 */ lwz r3, 0(r31) /* 8024E4E8 0024B448 80 7F 00 00 */ lwz r3, 0(r31)
/* 8024E4EC 0024B44C 38 9F 00 28 */ addi r4, r31, 0x28 /* 8024E4EC 0024B44C 38 9F 00 28 */ addi r4, r31, 0x28
/* 8024E4F0 0024B450 48 0F F3 9D */ bl GetSerialNo__14CMemoryCardSysFiRx /* 8024E4F0 0024B450 48 0F F3 9D */ bl GetSerialNo__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPortRx
/* 8024E4F4 0024B454 2C 03 00 00 */ cmpwi r3, 0 /* 8024E4F4 0024B454 2C 03 00 00 */ cmpwi r3, 0
/* 8024E4F8 0024B458 41 82 00 34 */ beq lbl_8024E52C /* 8024E4F8 0024B458 41 82 00 34 */ beq lbl_8024E52C
/* 8024E4FC 0024B45C 7F E3 FB 78 */ mr r3, r31 /* 8024E4FC 0024B45C 7F E3 FB 78 */ mr r3, r31

View File

@ -53,6 +53,7 @@ public:
static ECardResult GetResultCode(int); static ECardResult GetResultCode(int);
static ProbeResults IsMemoryCardInserted(EMemoryCardPort); static ProbeResults IsMemoryCardInserted(EMemoryCardPort);
static ECardResult GetSerialNo(EMemoryCardPort port, long long& serialOut);
void Initialize(); void Initialize();

View File

@ -113,7 +113,7 @@ private:
int x18_cardFreeBytes; int x18_cardFreeBytes;
int x1c_cardFreeFiles; int x1c_cardFreeFiles;
uint x20_fileTime; uint x20_fileTime;
u64 x28_cardSerial; long long x28_cardSerial;
rstl::reserved_vector< u8, 174 > x30_systemData; rstl::reserved_vector< u8, 174 > x30_systemData;
rstl::reserved_vector< rstl::auto_ptr< SGameFileSlot >, 3 > xe4_fileSlots; rstl::reserved_vector< rstl::auto_ptr< SGameFileSlot >, 3 > xe4_fileSlots;
rstl::reserved_vector< rstl::pair< EFileState, SMemoryCardFileInfo >, 2 > x100_mcFileInfos; rstl::reserved_vector< rstl::pair< EFileState, SMemoryCardFileInfo >, 2 > x100_mcFileInfos;

View File

@ -143,7 +143,23 @@ void CMemoryCardDriver::UpdateMountCard(ECardResult result) {
} }
} }
void CMemoryCardDriver::UpdateCardCheck(ECardResult) {} void CMemoryCardDriver::UpdateCardCheck(ECardResult result) {
if (result == kCR_READY) {
x10_state = kS_CardCheckDone;
if (!GetCardFreeBytes())
return;
if (CMemoryCardSys::GetSerialNo(x0_cardPort, x28_cardSerial) == kCR_READY)
return;
NoCardFound();
} else if (result == kCR_BROKEN) {
x10_state = kS_CardCheckFailed;
x14_error = kE_CardBroken;
} else {
HandleCardError(result, kS_CardCheckFailed);
}
}
void CMemoryCardDriver::UpdateFileRead(ECardResult) {} void CMemoryCardDriver::UpdateFileRead(ECardResult) {}