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
This commit is contained in:
Shawn Hoffman 2009-04-21 13:17:02 +00:00
parent cf5b6efba0
commit cb02eac791
3 changed files with 35 additions and 23 deletions

View File

@ -81,16 +81,16 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress)
u32 ReturnValue = 0; u32 ReturnValue = 0;
switch (Cmd) { switch (Cmd) {
case IOCTL_WRITEHCREG: case IOCTL_WRITEHCR:
// Store the 4th element of input array to the reg offset specified by the 0 element // 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)); 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; break;
case IOCTL_READHCREG: case IOCTL_READHCR:
// Load the specified reg into the out buffer // Load the specified reg into the out buffer
Memory::Write_U32(Memory::Read_U32(SDIO_BASE + Memory::Read_U32(BufferIn)), BufferOut); 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; break;
case IOCTL_RESETCARD: case IOCTL_RESETCARD:
@ -123,10 +123,8 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress)
break; break;
case IOCTL_GETOCR: case IOCTL_GETOCR:
DEBUG_LOG(WII_IPC_SD, "IOCTL_GETOCR"); ERROR_LOG(WII_IPC_SD, "IOCTL_GETOCR");
// Try to just say 3.3v Memory::Write_U32(0x80ff8000, BufferOut);
// Needs to be verified on real hw
Memory::Write_U32(0x40, BufferOut);
break; break;
default: default:
@ -214,15 +212,18 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
break; break;
case SEND_CSD: case SEND_CSD:
// Needs to be verified on real hw ERROR_LOG(WII_IPC_SD, "SEND_CSD");
Memory::Write_U64(0x8000025000FC0004ULL, _BufferOut); // <WntrMute> shuffle2_, OCR: 0x80ff8000 CID: 0x38a00000 0x480032d5 0x3c608030 0x8803d420
Memory::Write_U64(0x000097B55A000E01ULL, _BufferOut + 8); // CSD: 0xff928040 0xc93efbcf 0x325f5a83 0x00002600
Memory::Write_U64(0xff928040c93efbcfULL, _BufferOut);
Memory::Write_U64(0x325f5a8300002600ULL, _BufferOut + 8);
break; break;
case ALL_SEND_CID:
case SEND_CID: case SEND_CID:
// Needs to be verified on real hw ERROR_LOG(WII_IPC_SD, "(ALL_)SEND_CID");
Memory::Write_U64(0x0000000000000000ULL, _BufferOut); Memory::Write_U64(0x38a00000480032d5ULL, _BufferOut);
Memory::Write_U64(0x0000000000000001ULL, _BufferOut + 8); Memory::Write_U64(0x3c6080308803d420ULL, _BufferOut + 8);
break; break;
case SET_BLOCKLEN: case SET_BLOCKLEN:

View File

@ -45,8 +45,8 @@ private:
// IOCtl // IOCtl
enum enum
{ {
IOCTL_WRITEHCREG = 0x01, IOCTL_WRITEHCR = 0x01,
IOCTL_READHCREG = 0x02, IOCTL_READHCR = 0x02,
IOCTL_RESETCARD = 0x04, IOCTL_RESETCARD = 0x04,
IOCTL_SETCLK = 0x06, IOCTL_SETCLK = 0x06,
IOCTL_SENDCMD = 0x07, IOCTL_SENDCMD = 0x07,

View File

@ -29,6 +29,7 @@ void Initialise()
// This function initialises the attached controllers // This function initialises the attached controllers
PAD_Init(); PAD_Init();
WPAD_Init();
// Obtain the preferred video mode from the system // Obtain the preferred video mode from the system
// This will correspond to the settings in the Wii menu // This will correspond to the settings in the Wii menu
@ -92,9 +93,10 @@ void dirlist(char* path)
} }
if (sentinel == 0) if (sentinel == 0)
printf("absolutely nothing\n"); printf("empty\n");
closedir(pdir); closedir(pdir);
printf("\n");
} }
else else
{ {
@ -104,27 +106,36 @@ void dirlist(char* path)
int main() int main()
{ {
bool canList = false;
Initialise(); Initialise();
printf("\x1b[10;0H");
if(fatInitDefault()) if(fatInitDefault())
{ {
printf("fatInitDefault() OK!\n"); printf("\nPress A to list dirs\n");
dirlist("/"); canList = true;
} }
else else
printf("fatInitDefault() failure.\n"); printf("\nfatInitDefault() failure.\n");
while(1) while(1)
{ {
// Call WPAD_ScanPads each loop, this reads the latest controller states // Call WPAD_ScanPads each loop, this reads the latest controller states
PAD_ScanPads();
WPAD_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 // 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 // We return to the launcher application via exit
if (pressed & WPAD_BUTTON_HOME) if (wpressed & WPAD_BUTTON_HOME || pressed & PAD_BUTTON_START)
exit(0); exit(0);
// Wait for the next frame // Wait for the next frame