wii sd: reply with the correct response for cmd64

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3046 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-04-22 20:31:49 +00:00
parent 89178f411c
commit 9e9abba9f8
1 changed files with 19 additions and 14 deletions

View File

@ -85,9 +85,6 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress)
u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
// INFO_LOG(WII_IPC_SD, "BufferIn(0x%08x, 0x%x) BufferOut(0x%08x, 0x%x)",
// BufferIn, BufferInSize, BufferOut, BufferOutSize);
// As a safety precaution we fill the out buffer with zeros to avoid // As a safety precaution we fill the out buffer with zeros to avoid
// returning nonsense values // returning nonsense values
@ -97,11 +94,11 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress)
switch (Cmd) { switch (Cmd) {
case IOCTL_WRITEHCR: case IOCTL_WRITEHCR:
{ {
DEBUG_LOG(WII_IPC_SD, "IOCTL_WRITEHCR");
// Bleh, this might not be as simple as I thought at first...
u32 reg = Memory::Read_U32(BufferIn); u32 reg = Memory::Read_U32(BufferIn);
u32 val = Memory::Read_U32(BufferIn + 16); u32 val = Memory::Read_U32(BufferIn + 16);
DEBUG_LOG(WII_IPC_SD, "IOCTL_WRITEHCR 0x%08x - 0x%08x", reg, val);
if ((reg == HCR_CLOCKCONTROL) && (val & 1)) if ((reg == HCR_CLOCKCONTROL) && (val & 1))
{ {
// Clock is set to oscilliate, enable bit 1 to say it's stable // Clock is set to oscilliate, enable bit 1 to say it's stable
@ -121,9 +118,14 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress)
break; break;
case IOCTL_READHCR: case IOCTL_READHCR:
DEBUG_LOG(WII_IPC_SD, "IOCTL_READHCR"); {
// Load the specified reg into the out buffer u32 reg = Memory::Read_U32(BufferIn);
Memory::Write_U32(Memory::Read_U32(SDIO_BASE + Memory::Read_U32(BufferIn)), BufferOut); u32 val = Memory::Read_U32(SDIO_BASE + reg);
DEBUG_LOG(WII_IPC_SD, "IOCTL_READHCR 0x%08x - 0x%08x", reg, val);
// Just reading the register
Memory::Write_U32(val, BufferOut);
}
break; break;
case IOCTL_RESETCARD: case IOCTL_RESETCARD:
@ -206,7 +208,7 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(u32 _CommandAddress)
break; break;
} }
DumpAsync(CommandBuffer.BufferVector, _CommandAddress, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer, LogTypes::WII_IPC_SD); //DumpAsync(CommandBuffer.BufferVector, _CommandAddress, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer, LogTypes::WII_IPC_SD);
Memory::Write_U32(ReturnValue, _CommandAddress + 0x4); Memory::Write_U32(ReturnValue, _CommandAddress + 0x4);
@ -214,7 +216,7 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(u32 _CommandAddress)
} }
u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize,
u32 _BufferIn2, u32 _BufferInSize2, u32 _rwBuffer, u32 _rwBufferSize,
u32 _BufferOut, u32 _BufferOutSize) u32 _BufferOut, u32 _BufferOutSize)
{ {
// The game will send us a SendCMD with this information. To be able to read and write // The game will send us a SendCMD with this information. To be able to read and write
@ -241,6 +243,9 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
req.isDMA = Memory::Read_U32(_BufferIn + 28); req.isDMA = Memory::Read_U32(_BufferIn + 28);
req.pad0 = Memory::Read_U32(_BufferIn + 32); req.pad0 = Memory::Read_U32(_BufferIn + 32);
// Note: req.addr is the virtual address of _rwBuffer
u32 rwSuccess = 0; u32 rwSuccess = 0;
switch (req.command) switch (req.command)
@ -334,7 +339,7 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
{ {
Memory::Write_U8((u8)buffer[i], req.addr++); Memory::Write_U8((u8)buffer[i], req.addr++);
} }
DEBUG_LOG(WII_IPC_SD, "outbuffer size %i got %i", _BufferInSize2, i); DEBUG_LOG(WII_IPC_SD, "outbuffer size %i got %i", _rwBufferSize, i);
rwSuccess = 1; rwSuccess = 1;
} }
else else
@ -373,7 +378,7 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
size_t nWritten = fwrite(buffer, req.bsize, req.blocks, m_Card); size_t nWritten = fwrite(buffer, req.bsize, req.blocks, m_Card);
if (nWritten == req.blocks) if (nWritten == req.blocks)
{ {
ArrayToString(buffer, size); ERROR_LOG(WII_IPC_SD, "%s", ArrayToString(buffer, size).c_str());
rwSuccess = 1; rwSuccess = 1;
} }
else else
@ -390,8 +395,8 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
case CRAZY_BIGN: case CRAZY_BIGN:
DEBUG_LOG(WII_IPC_SD, "CMD64, wtf"); DEBUG_LOG(WII_IPC_SD, "CMD64, wtf");
// <svpe> shuffle2_: afaict it just sets some internal values in the // <svpe> shuffle2_: try returning -4 for cmd x'40.
// SDI module. you can probably safely ignore it Memory::Write_U32(-0x4, _BufferOut);
break; break;
default: default: