From bf42d9a2689a49b6385d12cc1c0abced26860115 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Sun, 19 Apr 2009 18:33:51 +0000 Subject: [PATCH] wii sd: ioctl is done, gotta do ioctlv and cmds git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3010 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp | 18 +++++++++++++----- .../IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h | 2 ++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp index 6cde58be29..1bece37ae5 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp @@ -29,7 +29,7 @@ using namespace SDInterface; CWII_IPC_HLE_Device_sdio_slot0::CWII_IPC_HLE_Device_sdio_slot0(u32 _DeviceID, const std::string& _rDeviceName) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) { - + m_status = CARD_INSERTED; } CWII_IPC_HLE_Device_sdio_slot0::~CWII_IPC_HLE_Device_sdio_slot0() @@ -87,13 +87,19 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress) break; case IOCTL_RESETCARD: - // Let's do nothing for now...maybe clear register block? + m_status |= CARD_INITIALIZED; ERROR_LOG(WII_IPC_SD, "IOCTL_RESETCARD"); break; case IOCTL_SETCLK: + { // libogc only sets it to 1 and makes sure the return isn't negative... + // 0 = 25MHz, 1 = 50MHz?, probably shouldn't matter in any case + u32 clock = Memory::Read_U32(BufferIn); + if (clock != 1) + ERROR_LOG(WII_IPC_SD, "Setting to %i, interesting", clock); ERROR_LOG(WII_IPC_SD, "IOCTL_SETCLK"); + } break; case IOCTL_SENDCMD: @@ -103,8 +109,10 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress) break; case IOCTL_GETSTATUS: - ERROR_LOG(WII_IPC_SD, "IOCTL_GETSTATUS. Replying that SD card is inserted and initialized"); - Memory::Write_U32(CARD_INSERTED|CARD_INITIALIZED, BufferOut); + ERROR_LOG(WII_IPC_SD, "IOCTL_GETSTATUS. Replying that SD card is %s%s", + (m_status & CARD_INSERTED) ? "inserted" : "", + (m_status & CARD_INITIALIZED) ? " and initialized" : ""); + Memory::Write_U32(m_status, BufferOut); break; default: @@ -124,7 +132,7 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress) bool CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(u32 _CommandAddress) { - // SD_Read uses this + // PPC sending commands ERROR_LOG(WII_IPC_SD, "*************************************"); ERROR_LOG(WII_IPC_SD, "CWII_IPC_HLE_Device_sdio_slot0::IOCtlV"); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h index 6cf7d73a34..c877eebb95 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h @@ -80,6 +80,8 @@ private: SWITCH57 = 57, }; + u32 m_status; + u32 ExecuteCommand(u32 BufferIn, u32 BufferInSize, u32 _BufferOut, u32 BufferOutSize); };