From 65231b61914121cdc934543d0ee5498b2a424867 Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Tue, 11 Oct 2022 12:44:26 +0300 Subject: [PATCH] Match CMemoryCardDriver::StartCardCheck --- asm/Kyoto/DolphinCMemoryCardSys.s | 4 ++-- asm/MetroidPrime/CMemoryCardDriver.s | 2 +- include/Kyoto/CMemoryCardSys.hpp | 2 ++ src/MetroidPrime/CMemoryCardDriver.cpp | 8 +++++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/asm/Kyoto/DolphinCMemoryCardSys.s b/asm/Kyoto/DolphinCMemoryCardSys.s index 331c7f29..af85c576 100644 --- a/asm/Kyoto/DolphinCMemoryCardSys.s +++ b/asm/Kyoto/DolphinCMemoryCardSys.s @@ -792,8 +792,8 @@ Write__14CMemoryCardSysFRQ214CMemoryCardSys13CCardFileInfoPCvUlUl: /* 8034DEAC 0034AE0C 38 21 00 20 */ addi r1, r1, 0x20 /* 8034DEB0 0034AE10 4E 80 00 20 */ blr -.global CheckCard__14CMemoryCardSysFv -CheckCard__14CMemoryCardSysFv: +.global CheckCard__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPort +CheckCard__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPort: /* 8034DEB4 0034AE14 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8034DEB8 0034AE18 7C 08 02 A6 */ mflr r0 /* 8034DEBC 0034AE1C 38 80 00 00 */ li r4, 0 diff --git a/asm/MetroidPrime/CMemoryCardDriver.s b/asm/MetroidPrime/CMemoryCardDriver.s index 06e1c43f..b90512be 100644 --- a/asm/MetroidPrime/CMemoryCardDriver.s +++ b/asm/MetroidPrime/CMemoryCardDriver.s @@ -2053,7 +2053,7 @@ StartCardCheck__17CMemoryCardDriverFv: /* 8024DD84 0024ACE4 38 00 00 1B */ li r0, 0x1b /* 8024DD88 0024ACE8 90 03 00 10 */ stw r0, 0x10(r3) /* 8024DD8C 0024ACEC 80 63 00 00 */ lwz r3, 0(r3) -/* 8024DD90 0024ACF0 48 10 01 25 */ bl CheckCard__14CMemoryCardSysFv +/* 8024DD90 0024ACF0 48 10 01 25 */ bl CheckCard__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPort /* 8024DD94 0024ACF4 7C 64 1B 79 */ or. r4, r3, r3 /* 8024DD98 0024ACF8 41 82 00 0C */ beq lbl_8024DDA4 /* 8024DD9C 0024ACFC 7F E3 FB 78 */ mr r3, r31 diff --git a/include/Kyoto/CMemoryCardSys.hpp b/include/Kyoto/CMemoryCardSys.hpp index fd546468..af074bee 100644 --- a/include/Kyoto/CMemoryCardSys.hpp +++ b/include/Kyoto/CMemoryCardSys.hpp @@ -56,6 +56,8 @@ public: static ECardResult GetResultCode(int); static ECardResult MountCard(EMemoryCardPort port); + static ECardResult CheckCard(EMemoryCardPort port); + static ProbeResults IsMemoryCardInserted(EMemoryCardPort); static ECardResult GetSerialNo(EMemoryCardPort port, long long& serialOut); static void UnmountCard(EMemoryCardPort); diff --git a/src/MetroidPrime/CMemoryCardDriver.cpp b/src/MetroidPrime/CMemoryCardDriver.cpp index 87f249c3..04902594 100644 --- a/src/MetroidPrime/CMemoryCardDriver.cpp +++ b/src/MetroidPrime/CMemoryCardDriver.cpp @@ -419,7 +419,13 @@ void CMemoryCardDriver::StartMountCard() { UpdateMountCard(result); } -void CMemoryCardDriver::StartCardCheck() {} +void CMemoryCardDriver::StartCardCheck() { + x14_error = kE_OK; + x10_state = kS_CardCheck; + ECardResult result = CMemoryCardSys::CheckCard(x0_cardPort); + if (result != kCR_READY) + UpdateCardCheck(result); +} void CMemoryCardDriver::ClearError() {}