From cb02eac7911d1da583e2b2c3f7a05f8646804747 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Tue, 21 Apr 2009 13:17:02 +0000 Subject: [PATCH] wii sd: got some register values from real hardware. nintendo apps still don't accept it though :( git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3028 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp | 29 ++++++++++--------- .../IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h | 4 +-- .../TestSuite/WSD/source/dolphintest_wsd.cpp | 25 +++++++++++----- 3 files changed, 35 insertions(+), 23 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 8c4eeb5eb4..425332a39b 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 @@ -81,16 +81,16 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress) u32 ReturnValue = 0; switch (Cmd) { - case IOCTL_WRITEHCREG: + case IOCTL_WRITEHCR: // Store the 4th element of input array to the reg offset specified by the 0 element Memory::Write_U32(Memory::Read_U32(BufferIn + 16), SDIO_BASE + Memory::Read_U32(BufferIn)); - DEBUG_LOG(WII_IPC_SD, "IOCTL_WRITEHCREG"); + DEBUG_LOG(WII_IPC_SD, "IOCTL_WRITEHCR"); break; - case IOCTL_READHCREG: + case IOCTL_READHCR: // Load the specified reg into the out buffer Memory::Write_U32(Memory::Read_U32(SDIO_BASE + Memory::Read_U32(BufferIn)), BufferOut); - DEBUG_LOG(WII_IPC_SD, "IOCTL_READHCREG"); + DEBUG_LOG(WII_IPC_SD, "IOCTL_READHCR"); break; case IOCTL_RESETCARD: @@ -123,10 +123,8 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress) break; case IOCTL_GETOCR: - DEBUG_LOG(WII_IPC_SD, "IOCTL_GETOCR"); - // Try to just say 3.3v - // Needs to be verified on real hw - Memory::Write_U32(0x40, BufferOut); + ERROR_LOG(WII_IPC_SD, "IOCTL_GETOCR"); + Memory::Write_U32(0x80ff8000, BufferOut); break; default: @@ -214,15 +212,18 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS break; case SEND_CSD: - // Needs to be verified on real hw - Memory::Write_U64(0x8000025000FC0004ULL, _BufferOut); - Memory::Write_U64(0x000097B55A000E01ULL, _BufferOut + 8); + ERROR_LOG(WII_IPC_SD, "SEND_CSD"); + // shuffle2_, OCR: 0x80ff8000 CID: 0x38a00000 0x480032d5 0x3c608030 0x8803d420 + // CSD: 0xff928040 0xc93efbcf 0x325f5a83 0x00002600 + Memory::Write_U64(0xff928040c93efbcfULL, _BufferOut); + Memory::Write_U64(0x325f5a8300002600ULL, _BufferOut + 8); break; + case ALL_SEND_CID: case SEND_CID: - // Needs to be verified on real hw - Memory::Write_U64(0x0000000000000000ULL, _BufferOut); - Memory::Write_U64(0x0000000000000001ULL, _BufferOut + 8); + ERROR_LOG(WII_IPC_SD, "(ALL_)SEND_CID"); + Memory::Write_U64(0x38a00000480032d5ULL, _BufferOut); + Memory::Write_U64(0x3c6080308803d420ULL, _BufferOut + 8); break; case SET_BLOCKLEN: 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 4a64467c5b..fcdab96f22 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 @@ -45,8 +45,8 @@ private: // IOCtl enum { - IOCTL_WRITEHCREG = 0x01, - IOCTL_READHCREG = 0x02, + IOCTL_WRITEHCR = 0x01, + IOCTL_READHCR = 0x02, IOCTL_RESETCARD = 0x04, IOCTL_SETCLK = 0x06, IOCTL_SENDCMD = 0x07, diff --git a/Source/TestSuite/WSD/source/dolphintest_wsd.cpp b/Source/TestSuite/WSD/source/dolphintest_wsd.cpp index 5e5414d328..00bc199a1a 100644 --- a/Source/TestSuite/WSD/source/dolphintest_wsd.cpp +++ b/Source/TestSuite/WSD/source/dolphintest_wsd.cpp @@ -29,6 +29,7 @@ void Initialise() // This function initialises the attached controllers PAD_Init(); + WPAD_Init(); // Obtain the preferred video mode from the system // This will correspond to the settings in the Wii menu @@ -92,9 +93,10 @@ void dirlist(char* path) } if (sentinel == 0) - printf("absolutely nothing\n"); + printf("empty\n"); closedir(pdir); + printf("\n"); } else { @@ -104,27 +106,36 @@ void dirlist(char* path) int main() { + bool canList = false; + Initialise(); + printf("\x1b[10;0H"); + if(fatInitDefault()) { - printf("fatInitDefault() OK!\n"); - dirlist("/"); + printf("\nPress A to list dirs\n"); + canList = true; } else - printf("fatInitDefault() failure.\n"); + printf("\nfatInitDefault() failure.\n"); while(1) { // Call WPAD_ScanPads each loop, this reads the latest controller states + PAD_ScanPads(); WPAD_ScanPads(); - // WPAD_ButtonsDown tells us which buttons were pressed in this loop + // WPAD_ButtonsDown tells us which buttons were wpressed in this loop // this is a "one shot" state which will not fire again until the button has been released - u32 pressed = WPAD_ButtonsDown(0); + u32 pressed = PAD_ButtonsDown(0); + u32 wpressed = WPAD_ButtonsDown(0); + + if ((wpressed & WPAD_BUTTON_A || pressed & PAD_BUTTON_A) && canList) + dirlist("/"); // We return to the launcher application via exit - if (pressed & WPAD_BUTTON_HOME) + if (wpressed & WPAD_BUTTON_HOME || pressed & PAD_BUTTON_START) exit(0); // Wait for the next frame