From 5f0e119e344cd42fc95e765927aa6342714c6807 Mon Sep 17 00:00:00 2001 From: Arisotura Date: Fri, 23 Apr 2021 23:04:55 +0200 Subject: [PATCH] SD/MMC: don't assume space/data is available when a SD read/write command is issued. fixes bug where unlaunch would corrupt the NAND when saving settings. this finally fixes #956 I guess --- src/DSi_SD.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/DSi_SD.cpp b/src/DSi_SD.cpp index c5ccc730..01b64428 100644 --- a/src/DSi_SD.cpp +++ b/src/DSi_SD.cpp @@ -855,8 +855,7 @@ void DSi_MMCStorage::SendCMD(u8 cmd, u32 param) } RWCommand = 18; Host->SendResponse(CSR, true); - ReadBlock(RWAddress); - RWAddress += BlockSize; + RWAddress += ReadBlock(RWAddress); SetState(0x05); return; @@ -870,8 +869,7 @@ void DSi_MMCStorage::SendCMD(u8 cmd, u32 param) } RWCommand = 25; Host->SendResponse(CSR, true); - WriteBlock(RWAddress); - RWAddress += BlockSize; + RWAddress += WriteBlock(RWAddress); SetState(0x04); return;