SDIO: report actual error if writes are disabled

This commit is contained in:
Naim2000 2024-12-08 13:11:34 -05:00
parent f706bb0aff
commit ed0d33953d

View File

@ -309,7 +309,9 @@ s32 SDIOSlot0Device::ExecuteCommand(const Request& request, u32 buffer_in, u32 b
INFO_LOG_FMT(IOS_SD, "{}Write {} Block(s) from {:#010x} bsize {} to offset {:#010x}!",
req.isDMA ? "DMA " : "", req.blocks, req.addr, req.bsize, req.arg);
if (m_card && Config::Get(Config::MAIN_ALLOW_SD_WRITES))
if (m_card)
{
if (Config::Get(Config::MAIN_ALLOW_SD_WRITES))
{
const u32 size = req.bsize * req.blocks;
const u64 address = GetAddressFromRequest(req.arg);
@ -319,11 +321,16 @@ s32 SDIOSlot0Device::ExecuteCommand(const Request& request, u32 buffer_in, u32 b
if (!m_card.WriteBytes(memory.GetPointerForRange(req.addr, size), size))
{
ERROR_LOG_FMT(IOS_SD, "Write Failed - error: {}, eof: {}", std::ferror(m_card.GetHandle()),
std::feof(m_card.GetHandle()));
ERROR_LOG_FMT(IOS_SD, "Write Failed - error: {}, eof: {}",
std::ferror(m_card.GetHandle()), std::feof(m_card.GetHandle()));
ret = RET_FAIL;
}
}
else
{
ret = -10;
}
}
}
memory.Write_U32(0x900, buffer_out);
break;