From 063f045fb2a1f58045eb19f259ff5ec855e5e4e8 Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Tue, 11 Oct 2022 15:19:51 +0300 Subject: [PATCH] Match CMemoryCardDriver::StartFileWrite Former-commit-id: 4cc0a1d57920b9d60edbcd2b6bcf1a3459a7fcbe --- asm/Kyoto/DolphinCMemoryCardSys.s | 4 ++-- asm/MetroidPrime/CMemoryCardDriver.s | 4 ++-- include/Kyoto/CMemoryCardSys.hpp | 1 + src/MetroidPrime/CMemoryCardDriver.cpp | 8 +++++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/asm/Kyoto/DolphinCMemoryCardSys.s b/asm/Kyoto/DolphinCMemoryCardSys.s index 9087346f..d09239a2 100644 --- a/asm/Kyoto/DolphinCMemoryCardSys.s +++ b/asm/Kyoto/DolphinCMemoryCardSys.s @@ -761,8 +761,8 @@ lbl_8034DE2C: /* 8034DE3C 0034AD9C 38 21 00 20 */ addi r1, r1, 0x20 /* 8034DE40 0034ADA0 4E 80 00 20 */ blr -.global Write__14CMemoryCardSysFRQ214CMemoryCardSys13CCardFileInfoPCvUlUl -Write__14CMemoryCardSysFRQ214CMemoryCardSys13CCardFileInfoPCvUlUl: +.global WriteFile__13CCardFileInfoFv +WriteFile__13CCardFileInfoFv: /* 8034DE44 0034ADA4 94 21 FF E0 */ stwu r1, -0x20(r1) /* 8034DE48 0034ADA8 7C 08 02 A6 */ mflr r0 /* 8034DE4C 0034ADAC 90 01 00 24 */ stw r0, 0x24(r1) diff --git a/asm/MetroidPrime/CMemoryCardDriver.s b/asm/MetroidPrime/CMemoryCardDriver.s index 52cd551e..9dc5ef89 100644 --- a/asm/MetroidPrime/CMemoryCardDriver.s +++ b/asm/MetroidPrime/CMemoryCardDriver.s @@ -1408,7 +1408,7 @@ StartFileWriteTransactional__17CMemoryCardDriverFv: /* 8024D4D8 0024A438 38 00 00 22 */ li r0, 0x22 /* 8024D4DC 0024A43C 90 03 00 10 */ stw r0, 0x10(r3) /* 8024D4E0 0024A440 80 63 01 98 */ lwz r3, 0x198(r3) -/* 8024D4E4 0024A444 48 10 09 61 */ bl Write__14CMemoryCardSysFRQ214CMemoryCardSys13CCardFileInfoPCvUlUl +/* 8024D4E4 0024A444 48 10 09 61 */ bl WriteFile__13CCardFileInfoFv /* 8024D4E8 0024A448 7C 64 1B 79 */ or. r4, r3, r3 /* 8024D4EC 0024A44C 41 82 00 0C */ beq lbl_8024D4F8 /* 8024D4F0 0024A450 7F E3 FB 78 */ mr r3, r31 @@ -1646,7 +1646,7 @@ StartFileWrite__17CMemoryCardDriverFv: /* 8024D80C 0024A76C 38 00 00 20 */ li r0, 0x20 /* 8024D810 0024A770 90 03 00 10 */ stw r0, 0x10(r3) /* 8024D814 0024A774 80 63 01 98 */ lwz r3, 0x198(r3) -/* 8024D818 0024A778 48 10 06 2D */ bl Write__14CMemoryCardSysFRQ214CMemoryCardSys13CCardFileInfoPCvUlUl +/* 8024D818 0024A778 48 10 06 2D */ bl WriteFile__13CCardFileInfoFv /* 8024D81C 0024A77C 7C 64 1B 79 */ or. r4, r3, r3 /* 8024D820 0024A780 41 82 00 0C */ beq lbl_8024D82C /* 8024D824 0024A784 7F E3 FB 78 */ mr r3, r31 diff --git a/include/Kyoto/CMemoryCardSys.hpp b/include/Kyoto/CMemoryCardSys.hpp index ee710697..673dd209 100644 --- a/include/Kyoto/CMemoryCardSys.hpp +++ b/include/Kyoto/CMemoryCardSys.hpp @@ -53,6 +53,7 @@ public: ECardResult PumpCardTransfer(); ECardResult CreateFile(); + ECardResult WriteFile(); ECardResult CloseFile(); }; diff --git a/src/MetroidPrime/CMemoryCardDriver.cpp b/src/MetroidPrime/CMemoryCardDriver.cpp index 94b5b2ba..5f701558 100644 --- a/src/MetroidPrime/CMemoryCardDriver.cpp +++ b/src/MetroidPrime/CMemoryCardDriver.cpp @@ -580,7 +580,13 @@ void CMemoryCardDriver::StartFileCreate() { UpdateFileCreate(result); } -void CMemoryCardDriver::StartFileWrite() {} +void CMemoryCardDriver::StartFileWrite() { + x14_error = kE_OK; + x10_state = kS_FileWrite; + ECardResult result = x198_fileInfo->WriteFile(); + if (result != kCR_READY) + UpdateFileWrite(result); +} void CMemoryCardDriver::StartFileCreateTransactional() {}