From db146fb35e31af3417d2bb3fd74269c10b84ee90 Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Tue, 11 Oct 2022 15:29:57 +0300 Subject: [PATCH] Match CMemoryCardDriver::StartFileDeleteAltTransactional Former-commit-id: bab26cf95f3be59d519faa110caa828a048faa5c --- asm/Kyoto/DolphinCMemoryCardSys.s | 4 ++-- asm/MetroidPrime/CMemoryCardDriver.s | 2 +- include/Kyoto/CMemoryCardSys.hpp | 1 + src/MetroidPrime/CMemoryCardDriver.cpp | 9 ++++++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/asm/Kyoto/DolphinCMemoryCardSys.s b/asm/Kyoto/DolphinCMemoryCardSys.s index d09239a2..a2c7790f 100644 --- a/asm/Kyoto/DolphinCMemoryCardSys.s +++ b/asm/Kyoto/DolphinCMemoryCardSys.s @@ -870,8 +870,8 @@ FastDeleteFile__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPorti: /* 8034DFA8 0034AF08 38 21 00 10 */ addi r1, r1, 0x10 /* 8034DFAC 0034AF0C 4E 80 00 20 */ blr -.global DeleteFile__14CMemoryCardSysFiPCc -DeleteFile__14CMemoryCardSysFiPCc: +.global "DeleteFile__14CMemoryCardSysF15EMemoryCardPortRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>" +"DeleteFile__14CMemoryCardSysF15EMemoryCardPortRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>": /* 8034DFB0 0034AF10 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8034DFB4 0034AF14 7C 08 02 A6 */ mflr r0 /* 8034DFB8 0034AF18 38 A0 00 00 */ li r5, 0 diff --git a/asm/MetroidPrime/CMemoryCardDriver.s b/asm/MetroidPrime/CMemoryCardDriver.s index 9dc5ef89..6191ed6c 100644 --- a/asm/MetroidPrime/CMemoryCardDriver.s +++ b/asm/MetroidPrime/CMemoryCardDriver.s @@ -1378,7 +1378,7 @@ StartFileDeleteAltTransactional__17CMemoryCardDriverFv: /* 8024D470 0024A3D0 4B DB 78 49 */ bl string_l__4rstlFPCc /* 8024D474 0024A3D4 80 7E 00 00 */ lwz r3, 0(r30) /* 8024D478 0024A3D8 38 81 00 08 */ addi r4, r1, 8 -/* 8024D47C 0024A3DC 48 10 0B 35 */ bl DeleteFile__14CMemoryCardSysFiPCc +/* 8024D47C 0024A3DC 48 10 0B 35 */ bl "DeleteFile__14CMemoryCardSysF15EMemoryCardPortRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>" /* 8024D480 0024A3E0 7C 60 1B 78 */ mr r0, r3 /* 8024D484 0024A3E4 38 61 00 08 */ addi r3, r1, 8 /* 8024D488 0024A3E8 7C 1F 03 78 */ mr r31, r0 diff --git a/include/Kyoto/CMemoryCardSys.hpp b/include/Kyoto/CMemoryCardSys.hpp index 673dd209..b0c6ede5 100644 --- a/include/Kyoto/CMemoryCardSys.hpp +++ b/include/Kyoto/CMemoryCardSys.hpp @@ -73,6 +73,7 @@ public: static ECardResult MountCard(EMemoryCardPort port); static ECardResult CheckCard(EMemoryCardPort port); static ECardResult GetStatus(EMemoryCardPort port, int fileNo, CardStat& statOut); + static ECardResult DeleteFile(EMemoryCardPort port, const rstl::string& name); static ECardResult FastDeleteFile(EMemoryCardPort port, int fileNo); static ProbeResults IsMemoryCardInserted(EMemoryCardPort); diff --git a/src/MetroidPrime/CMemoryCardDriver.cpp b/src/MetroidPrime/CMemoryCardDriver.cpp index 49daca7c..c1d7dff7 100644 --- a/src/MetroidPrime/CMemoryCardDriver.cpp +++ b/src/MetroidPrime/CMemoryCardDriver.cpp @@ -621,7 +621,14 @@ void CMemoryCardDriver::StartFileWriteTransactional() { UpdateFileWriteTransactional(result); } -void CMemoryCardDriver::StartFileDeleteAltTransactional() {} +void CMemoryCardDriver::StartFileDeleteAltTransactional() { + x14_error = kE_OK; + x10_state = kS_FileAltDeleteTransactional; + int bidx = x194_fileIdx == 0 ? 1 : 0; + ECardResult result = CMemoryCardSys::DeleteFile(x0_cardPort, rstl::string_l(skSaveFileNames[bidx])); + if (result != kCR_READY) + UpdateFileAltDeleteTransactional(result); +} void CMemoryCardDriver::StartCardFormat() {}