remove some newlines from FileUtil logs.

add ___blank to HLE'd debug logging.
add long long support to HLE_OS::GetStringVA
take care of those annoying sdio 0x40 and 0x41 commands...not that they do much in the first place...
some cleanup on the IPC net devices

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4488 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-10-31 09:17:37 +00:00
parent b7bd9dc5d9
commit 1d666bf109
7 changed files with 188 additions and 187 deletions

View File

@ -100,7 +100,7 @@ bool IsDirectory(const char *filename)
// Doesn't supports deleting a directory // Doesn't supports deleting a directory
bool Delete(const char *filename) bool Delete(const char *filename)
{ {
INFO_LOG(COMMON, "Delete: file %s\n", filename); INFO_LOG(COMMON, "Delete: file %s", filename);
// Return true because we care about the file no // Return true because we care about the file no
// being there, not the actual delete. // being there, not the actual delete.
@ -135,7 +135,7 @@ bool Delete(const char *filename)
// Returns true if successful, or path already exists. // Returns true if successful, or path already exists.
bool CreateDir(const char *path) bool CreateDir(const char *path)
{ {
INFO_LOG(COMMON, "CreateDir: directory %s\n", path); INFO_LOG(COMMON, "CreateDir: directory %s", path);
#ifdef _WIN32 #ifdef _WIN32
if (::CreateDirectory(path, NULL)) if (::CreateDirectory(path, NULL))
return true; return true;
@ -166,10 +166,10 @@ bool CreateDir(const char *path)
bool CreateFullPath(const char *fullPath) bool CreateFullPath(const char *fullPath)
{ {
int panicCounter = 100; int panicCounter = 100;
INFO_LOG(COMMON, "CreateFullPath: path %s\n", fullPath); INFO_LOG(COMMON, "CreateFullPath: path %s", fullPath);
if (File::Exists(fullPath)) { if (File::Exists(fullPath)) {
INFO_LOG(COMMON, "CreateFullPath: path exists %s\n", fullPath); INFO_LOG(COMMON, "CreateFullPath: path exists %s", fullPath);
return true; return true;
} }

View File

@ -63,7 +63,8 @@ static const SPatch OSPatches[] =
{ "vprintf", HLE_OS::HLE_GeneralDebugPrint }, { "vprintf", HLE_OS::HLE_GeneralDebugPrint },
{ "printf", HLE_OS::HLE_GeneralDebugPrint }, { "printf", HLE_OS::HLE_GeneralDebugPrint },
{ "puts", HLE_OS::HLE_GeneralDebugPrint }, // gcc-optimized printf? { "puts", HLE_OS::HLE_GeneralDebugPrint }, // gcc-optimized printf?
{ "___blank(char *,...)", HLE_OS::HLE_GeneralDebugPrint }, // dunno, but awesome :D { "___blank(char *,...)", HLE_OS::HLE_GeneralDebugPrint }, // used for early init things (normally)
{ "___blank", HLE_OS::HLE_GeneralDebugPrint },
{ "__write_console", HLE_OS::HLE_write_console }, // used by sysmenu (+more?) { "__write_console", HLE_OS::HLE_write_console }, // used by sysmenu (+more?)
// wii only // wii only

View File

@ -91,21 +91,27 @@ void GetStringVA(std::string& _rOutBuffer, u32 strReg)
*pArgument++ = *pString; *pArgument++ = *pString;
*pArgument = NULL; *pArgument = NULL;
u32 Parameter; u64 Parameter;
if (ParameterCounter > 10) if (ParameterCounter > 10)
{ {
Parameter = Memory::Read_U32(GPR(1) + 0x8 + ((ParameterCounter - 11) * 4)); Parameter = Memory::Read_U32(GPR(1) + 0x8 + ((ParameterCounter - 11) * 4));
} }
else else
{ {
Parameter = GPR(ParameterCounter); if ((*(pString-2) == 'l') && (*(pString-1) == 'l')) // hax, just seen this on sysmenu osreport
{
Parameter = GPR(++ParameterCounter);
Parameter = (Parameter<<32)|GPR(++ParameterCounter);
}
else // normal, 32bit
Parameter = GPR(ParameterCounter);
} }
ParameterCounter++; ParameterCounter++;
switch(*pString) switch(*pString)
{ {
case 's': case 's':
_rOutBuffer += StringFromFormat(ArgumentBuffer, (char*)Memory::GetPointer(Parameter)); _rOutBuffer += StringFromFormat(ArgumentBuffer, (char*)Memory::GetPointer((u32)Parameter));
break; break;
case 'd': case 'd':

View File

@ -16,40 +16,30 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
/*
The /dev/net/kd/request requests are part of what is called WiiConnect24,
it's used by for example SSBB, Mario Kart, Metroid Prime 3
// ======================================================= 0x01 SuspendScheduler (Input: none, Output: 32 bytes)
// File description 0x02 ExecTrySuspendScheduler (Input: 32 bytes, Output: 32 bytes) // Sounds like it will
// ------------- check if it should suspend the updates scheduler or not. If I returned
/* Here we handle /dev/net and /dev/net/ncd/manage requests. (OutBuffer: 0, Ret: -1) to Metroid Prime 3 it got stuck in an endless loops of
requests, probably harmless but I changed it to (OutBuffer: 1, Ret: 0) to stop
the calls. However then it also calls 0x3 and then changes its error message
to a Wii Memory error message from just a general Error message.
0x03 ? (Input: none, Output: 32 bytes) // This is only called if 0x02
does not return -1
0x0f NWC24iRequestGenerateUserId (Input: none, Output: 32 bytes)
// ----------------------- Requests are made in this order by these games
The /dev/net/kd/request requests are part of what is called WiiConnect24, Mario Kart: 2, 1, f, 3
it's used by for example SSBB, Mario Kart, Metroid Prime 3 SSBB: 2, 3
0x01 SuspendScheduler (Input: none, Output: 32 bytes)
0x02 ExecTrySuspendScheduler (Input: 32 bytes, Output: 32 bytes) // Sounds like it will
check if it should suspend the updates scheduler or not. If I returned
(OutBuffer: 0, Ret: -1) to Metroid Prime 3 it got stuck in an endless loops of
requests, probably harmless but I changed it to (OutBuffer: 1, Ret: 0) to stop
the calls. However then it also calls 0x3 and then changes its error message
to a Wii Memory error message from just a general Error message.
0x03 ? (Input: none, Output: 32 bytes) // This is only called if 0x02
does not return -1
0x0f NWC24iRequestGenerateUserId (Input: none, Output: 32 bytes)
Requests are made in this order by these games
Mario Kart: 2, 1, f, 3
SSBB: 2, 3
For Mario Kart I had to return -1 from at least 2, f and 3 to convince it that the network
was unavaliable and prevent if from looking for shared2/wc24 files (and do a PPCHalt when
it failed)
// -------
For Mario Kart I had to return -1 from at least 2, f and 3 to convince it that the network
was unavailable and prevent if from looking for shared2/wc24 files (and do a PPCHalt when
it failed)
*/ */
// =============
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable : 4065) // switch statement contains 'default' but no 'case' labels #pragma warning(disable : 4065) // switch statement contains 'default' but no 'case' labels
@ -72,7 +62,6 @@ extern std::queue<std::pair<u32,std::string> > g_ReplyQueueLater;
// ********************************************************************************** // **********************************************************************************
// Handle /dev/net/kd/request requests // Handle /dev/net/kd/request requests
CWII_IPC_HLE_Device_net_kd_request::CWII_IPC_HLE_Device_net_kd_request(u32 _DeviceID, const std::string& _rDeviceName) CWII_IPC_HLE_Device_net_kd_request::CWII_IPC_HLE_Device_net_kd_request(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
{ {
@ -80,7 +69,6 @@ CWII_IPC_HLE_Device_net_kd_request::CWII_IPC_HLE_Device_net_kd_request(u32 _Devi
CWII_IPC_HLE_Device_net_kd_request::~CWII_IPC_HLE_Device_net_kd_request() CWII_IPC_HLE_Device_net_kd_request::~CWII_IPC_HLE_Device_net_kd_request()
{ {
} }
bool CWII_IPC_HLE_Device_net_kd_request::Open(u32 _CommandAddress, u32 _Mode) bool CWII_IPC_HLE_Device_net_kd_request::Open(u32 _CommandAddress, u32 _Mode)
@ -97,66 +85,57 @@ bool CWII_IPC_HLE_Device_net_kd_request::Close(u32 _CommandAddress)
return true; return true;
} }
bool CWII_IPC_HLE_Device_net_kd_request::IOCtl(u32 _CommandAddress) bool CWII_IPC_HLE_Device_net_kd_request::IOCtl(u32 _CommandAddress)
{ {
u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC); u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC);
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
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);
u32 ReturnValue = 0; u32 ReturnValue = 0;
switch(Parameter) switch (Parameter)
{ {
case IOCTL_NWC24_SUSPEND_SCHEDULAR: // NWC24iResumeForCloseLib from NWC24SuspendScheduler (Input: none, Output: 32 bytes) case IOCTL_NWC24_SUSPEND_SCHEDULAR:
// NWC24iResumeForCloseLib from NWC24SuspendScheduler (Input: none, Output: 32 bytes)
INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_SUSPEND_SCHEDULAR - NI"); INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_SUSPEND_SCHEDULAR - NI");
ReturnValue = 0;
break; break;
case IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR: // NWC24iResumeForCloseLib case IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR: // NWC24iResumeForCloseLib
INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR - NI"); INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR - NI");
ReturnValue = 0;
break; break;
case IOCTL_NWC24_UNK_3: // NWC24iResumeForCloseLib case IOCTL_NWC24_UNK_3: // NWC24iResumeForCloseLib
INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_UNK_3 - NI"); INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_UNK_3 - NI");
ReturnValue = 0;
break; break;
case IOCTL_NWC24_STARTUP_SOCKET: case IOCTL_NWC24_STARTUP_SOCKET: // NWC24iStartupSocket
INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_STARTUP_SOCKET - NI"); INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_STARTUP_SOCKET - NI");
ReturnValue = 0;
break; break;
case IOCTL_NWC24_LOCK_SOCKET: // WiiMenu case IOCTL_NWC24_LOCK_SOCKET: // WiiMenu
INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_LOCK_SOCKET - NI"); INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_LOCK_SOCKET - NI");
ReturnValue = 0;
break; break;
case IOCTL_NWC24_UNLOCK_SOCKET: case IOCTL_NWC24_UNLOCK_SOCKET:
INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_UNLOCK_SOCKET - NI"); INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_UNLOCK_SOCKET - NI");
ReturnValue = 0;
break; break;
case IOCTL_NWC24_REQUEST_GENERATED_USER_ID: // (Input: none, Output: 32 bytes) case IOCTL_NWC24_REQUEST_GENERATED_USER_ID: // (Input: none, Output: 32 bytes)
PanicAlert("IOCTL_NWC24_REQUEST_GENERATED_USER_ID"); PanicAlert("IOCTL_NWC24_REQUEST_GENERATED_USER_ID");
ReturnValue = 0;
break; break;
case IOCTL_NWC24_GET_SCHEDULAR_STAT: case IOCTL_NWC24_GET_SCHEDULAR_STAT:
INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_GET_SCHEDULAR_STAT - NI"); INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_GET_SCHEDULAR_STAT - NI");
ReturnValue = 0;
break; break;
case IOCTL_NWC24_SAVE_MAIL_NOW: case IOCTL_NWC24_SAVE_MAIL_NOW:
INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_SAVE_MAIL_NOW - NI"); INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_SAVE_MAIL_NOW - NI");
ReturnValue = 0;
break; break;
case IOCTL_NWC24_REQUEST_SHUTDOWN: case IOCTL_NWC24_REQUEST_SHUTDOWN:
INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_REQUEST_SHUTDOWN - NI"); // if ya set the IOS version to a very high value this happens ... // if ya set the IOS version to a very high value this happens ...
ReturnValue = 0; INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_REQUEST_SHUTDOWN - NI");
break; break;
default: default:
@ -174,7 +153,6 @@ bool CWII_IPC_HLE_Device_net_kd_request::IOCtl(u32 _CommandAddress)
// ********************************************************************************** // **********************************************************************************
// Handle /dev/net/ncd/manage requests // Handle /dev/net/ncd/manage requests
CWII_IPC_HLE_Device_net_ncd_manage::CWII_IPC_HLE_Device_net_ncd_manage(u32 _DeviceID, const std::string& _rDeviceName) CWII_IPC_HLE_Device_net_ncd_manage::CWII_IPC_HLE_Device_net_ncd_manage(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
{} {}
@ -205,16 +183,16 @@ bool CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(u32 _CommandAddress)
switch (CommandBuffer.Parameter) switch (CommandBuffer.Parameter)
{ {
// WiiMenu // WiiMenu
case 0x07: // //NCDGetLinkStatus case IOCTL_NCD_GETLINKSTATUS: // 32 Out. 5th
case 0x03: // ??? It seems that is related to Write and Read information case IOCTL_NCD_SETIFCONFIG3: // ??? It seems that is related to Write and Read information
case 0x04: case IOCTL_NCD_SETIFCONFIG4: // 7004 In, 32 Out. 4th
case 0x05: case 0x05: // 7004 Out, 32 Out. 2nd, 3rd
case 0x06: case 0x06:
case 0x08: case 0x08: // 32 Out, 6 Out. 1st
//break; //break;
default: default:
INFO_LOG(WII_IPC_NET,"NET_NCD_MANAGE IOCtlV: %i", CommandBuffer.Parameter); INFO_LOG(WII_IPC_NET, "NET_NCD_MANAGE IOCtlV: %i", CommandBuffer.Parameter);
break; break;
} }
Memory::Write_U32(ReturnValue, _CommandAddress+4); Memory::Write_U32(ReturnValue, _CommandAddress+4);
@ -224,7 +202,6 @@ bool CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(u32 _CommandAddress)
// ********************************************************************************** // **********************************************************************************
// Handle /dev/net/ip/top requests // Handle /dev/net/ip/top requests
CWII_IPC_HLE_Device_net_ip_top::CWII_IPC_HLE_Device_net_ip_top(u32 _DeviceID, const std::string& _rDeviceName) CWII_IPC_HLE_Device_net_ip_top::CWII_IPC_HLE_Device_net_ip_top(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
{} {}
@ -248,13 +225,13 @@ bool CWII_IPC_HLE_Device_net_ip_top::Close(u32 _CommandAddress)
bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress) bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
{ {
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
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);
u32 Command = Memory::Read_U32(_CommandAddress + 0x0C); u32 Command = Memory::Read_U32(_CommandAddress + 0x0C);
// INFO_LOG(WII_IPC_NET,"%s - Command(0x%08x) BufferIn(0x%08x, 0x%x) BufferOut(0x%08x, 0x%x)\n", GetDeviceName().c_str(), Command, BufferIn, BufferInSize, BufferOut, BufferOutSize); // INFO_LOG(WII_IPC_NET,"%s - Command(0x%08x) BufferIn(0x%08x, 0x%x) BufferOut(0x%08x, 0x%x)\n", GetDeviceName().c_str(), Command, BufferIn, BufferInSize, BufferOut, BufferOutSize);
u32 ReturnValue = ExecuteCommand(Command, BufferIn, BufferInSize, BufferOut, BufferOutSize); u32 ReturnValue = ExecuteCommand(Command, BufferIn, BufferInSize, BufferOut, BufferOutSize);
Memory::Write_U32(ReturnValue, _CommandAddress + 0x4); Memory::Write_U32(ReturnValue, _CommandAddress + 0x4);
@ -283,63 +260,68 @@ struct GC_sockaddr_in {
}; };
u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command, u32 _BufferIn, u32 BufferInSize, u32 BufferOut, u32 BufferOutSize) u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command, u32 _BufferIn, u32 BufferInSize, u32 BufferOut, u32 BufferOutSize)
{ {
// Clean the location of the output buffer to zeroes as a safety precaution */ // Clean the location of the output buffer to zeros as a safety precaution */
Memory::Memset(BufferOut, 0, BufferOutSize); Memory::Memset(BufferOut, 0, BufferOutSize);
switch (_Command) switch (_Command)
{ {
case IOCTL_SO_STARTUP: case IOCTL_SO_STARTUP:
break; break;
case IOCTL_SO_SOCKET: case IOCTL_SO_SOCKET:
{ {
u32 AF = Memory::Read_U32(_BufferIn); u32 AF = Memory::Read_U32(_BufferIn);
u32 TYPE = Memory::Read_U32(_BufferIn + 0x04); u32 TYPE = Memory::Read_U32(_BufferIn + 0x04);
u32 PROT = Memory::Read_U32(_BufferIn + 0x04 * 2); u32 PROT = Memory::Read_U32(_BufferIn + 0x04 * 2);
u32 Unk1 = Memory::Read_U32(_BufferIn + 0x04 * 3); u32 Unk1 = Memory::Read_U32(_BufferIn + 0x04 * 3);
u32 Socket = (u32)socket(AF, TYPE, PROT); u32 Socket = (u32)socket(AF, TYPE, PROT);
return Common::swap32(Socket); // So it doesn't get mangled later on return Common::swap32(Socket); // So it doesn't get mangled later on
} }
break; break;
case IOCTL_SO_BIND: case IOCTL_SO_BIND:
{ {
bind_params *addr = (bind_params*)Memory::GetPointer(_BufferIn); bind_params *addr = (bind_params*)Memory::GetPointer(_BufferIn);
GC_sockaddr_in addrPC; GC_sockaddr_in addrPC;
memcpy(&addrPC, addr->name, sizeof(GC_sockaddr_in)); memcpy(&addrPC, addr->name, sizeof(GC_sockaddr_in));
sockaddr_in address; sockaddr_in address;
address.sin_family = addrPC.sin_family; address.sin_family = addrPC.sin_family;
address.sin_addr.s_addr = addrPC.sin_addr.s_addr_; address.sin_addr.s_addr = addrPC.sin_addr.s_addr_;
address.sin_port = htons(addrPC.sin_port); address.sin_port = htons(addrPC.sin_port);
int Return = bind(addr->socket, (sockaddr*)&address, sizeof(address)); int Return = bind(addr->socket, (sockaddr*)&address, sizeof(address));
return Return; return Return;
//int bind(int s, struct sockaddr *addr, int addrlen); //int bind(int s, struct sockaddr *addr, int addrlen);
} }
break; break;
case IOCTL_SO_LISTEN: case IOCTL_SO_LISTEN:
{ {
u32 S = Memory::Read_U32(_BufferIn); u32 S = Memory::Read_U32(_BufferIn);
u32 BACKLOG = Memory::Read_U32(_BufferIn + 0x04); u32 BACKLOG = Memory::Read_U32(_BufferIn + 0x04);
u32 Return = listen(S, BACKLOG); u32 Return = listen(S, BACKLOG);
return Return; return Return;
} }
break; break;
case IOCTL_SO_ACCEPT: case IOCTL_SO_ACCEPT:
{ {
//TODO: (Sonic)Check if this is correct //TODO: (Sonic)Check if this is correct
u32 S = Memory::Read_U32(_BufferIn); u32 S = Memory::Read_U32(_BufferIn);
socklen_t addrlen; socklen_t addrlen;
struct sockaddr_in address; struct sockaddr_in address;
u32 Return = (u32)accept(S, (struct sockaddr *)&address, &addrlen); u32 Return = (u32)accept(S, (struct sockaddr *)&address, &addrlen);
GC_sockaddr_in *addr = (GC_sockaddr_in*)Memory::GetPointer(BufferOut); GC_sockaddr_in *addr = (GC_sockaddr_in*)Memory::GetPointer(BufferOut);
addr->sin_family = (u8)address.sin_family; addr->sin_family = (u8)address.sin_family;
addr->sin_addr.s_addr_ = address.sin_addr.s_addr; addr->sin_addr.s_addr_ = address.sin_addr.s_addr;
addr->sin_port = address.sin_port; addr->sin_port = address.sin_port;
socklen_t *Len = (socklen_t *)Memory::GetPointer(BufferOut + 0x04); socklen_t *Len = (socklen_t *)Memory::GetPointer(BufferOut + 0x04);
*Len = addrlen; *Len = addrlen;
return Return; return Return;
//int accept(int s, struct sockaddr *addr, int *addrlen); //int accept(int s, struct sockaddr *addr, int *addrlen);
///dev/net/ip/top::IOCtl request 0x1 (BufferIn: (000318c0, 4), BufferOut: (00058a4c, 8) ///dev/net/ip/top::IOCtl request 0x1 (BufferIn: (000318c0, 4), BufferOut: (00058a4c, 8)
} }
break; break;
case IOCTL_SO_GETHOSTID: case IOCTL_SO_GETHOSTID:
return 127 << 24 | 1; return 127 << 24 | 1;
break; break;
@ -359,17 +341,18 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 _CommandAddress)
u32 ReturnValue = 0; u32 ReturnValue = 0;
SIOCtlVBuffer CommandBuffer(_CommandAddress); SIOCtlVBuffer CommandBuffer(_CommandAddress);
switch(CommandBuffer.Parameter) switch (CommandBuffer.Parameter)
{ {
case 2: case IOCTL_SO_BIND:
case 12: case IOCTLV_SO_RECVFROM:
case 15: case IOCTL_SO_SOCKET:
case 16: case IOCTL_SO_GETHOSTID:
case 31: case IOCTL_SO_STARTUP:
//break; //break;
default: default:
INFO_LOG(WII_IPC_NET, "NET_IP_TOP IOCtlV: 0x%08X\n", CommandBuffer.Parameter); INFO_LOG(WII_IPC_NET, "NET_IP_TOP IOCtlV: 0x%08X\n", CommandBuffer.Parameter);
break; break;
} }
Memory::Write_U32(ReturnValue, _CommandAddress+4); Memory::Write_U32(ReturnValue, _CommandAddress+4);

View File

@ -20,10 +20,13 @@
#include "WII_IPC_HLE_Device.h" #include "WII_IPC_HLE_Device.h"
// **********************************************************************************
// KD is the IOS module responsible for implementing WiiConnect24 functionality. It
// can perform HTTPS downloads, send and receive mail via SMTP, and execute a
// JavaScript-like language while the Wii is in standby mode.
class CWII_IPC_HLE_Device_net_kd_request : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_net_kd_request : public IWII_IPC_HLE_Device
{ {
public: public:
CWII_IPC_HLE_Device_net_kd_request(u32 _DeviceID, const std::string& _rDeviceName); CWII_IPC_HLE_Device_net_kd_request(u32 _DeviceID, const std::string& _rDeviceName);
virtual ~CWII_IPC_HLE_Device_net_kd_request(); virtual ~CWII_IPC_HLE_Device_net_kd_request();
@ -33,7 +36,6 @@ public:
virtual bool IOCtl(u32 _CommandAddress); virtual bool IOCtl(u32 _CommandAddress);
private: private:
enum enum
{ {
IOCTL_NWC24_SUSPEND_SCHEDULAR = 0x01, IOCTL_NWC24_SUSPEND_SCHEDULAR = 0x01,
@ -61,15 +63,13 @@ private:
}; };
}; };
// ************************************************************************************** // **********************************************************************************
class CWII_IPC_HLE_Device_net_kd_time : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_net_kd_time : public IWII_IPC_HLE_Device
{ {
public: public:
CWII_IPC_HLE_Device_net_kd_time(u32 _DeviceID, const std::string& _rDeviceName) : CWII_IPC_HLE_Device_net_kd_time(u32 _DeviceID, const std::string& _rDeviceName) :
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
{} {}
virtual ~CWII_IPC_HLE_Device_net_kd_time() virtual ~CWII_IPC_HLE_Device_net_kd_time()
{} {}
@ -90,11 +90,11 @@ public:
virtual bool IOCtl(u32 _CommandAddress) virtual bool IOCtl(u32 _CommandAddress)
{ {
u32 Parameter = Memory::Read_U32(_CommandAddress +0x0C); u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C);
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
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);
switch (Parameter) switch (Parameter)
{ {
@ -118,6 +118,7 @@ public:
Memory::Write_U32(0, _CommandAddress + 0x4); Memory::Write_U32(0, _CommandAddress + 0x4);
return true; return true;
case IOCTL_NW24_GET_TIME_DIFF: // Input: none, Output: 32
default: default:
ERROR_LOG(WII_IPC_NET, "%s - IOCtl:\n" ERROR_LOG(WII_IPC_NET, "%s - IOCtl:\n"
" Parameter: 0x%x (0x17 NWC24iSetRtcCounter) \n" " Parameter: 0x%x (0x17 NWC24iSetRtcCounter) \n"
@ -135,7 +136,6 @@ public:
} }
private: private:
enum enum
{ {
IOCTL_NW24_SET_RTC_COUNTER = 0x17, IOCTL_NW24_SET_RTC_COUNTER = 0x17,
@ -145,8 +145,7 @@ private:
u8 m_RtcCounter[0x20]; u8 m_RtcCounter[0x20];
}; };
// ************************************************************************************** // **********************************************************************************
class CWII_IPC_HLE_Device_net_ip_top : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_net_ip_top : public IWII_IPC_HLE_Device
{ {
public: public:
@ -160,50 +159,49 @@ public:
virtual bool IOCtlV(u32 _CommandAddress); virtual bool IOCtlV(u32 _CommandAddress);
private: private:
enum { enum {
IOCTL_SO_ACCEPT = 1, IOCTL_SO_ACCEPT = 1,
IOCTL_SO_BIND, IOCTL_SO_BIND,
IOCTL_SO_CLOSE, IOCTL_SO_CLOSE,
IOCTL_SO_CONNECT, IOCTL_SO_CONNECT,
IOCTL_SO_FCNTL, IOCTL_SO_FCNTL,
IOCTL_SO_GETPEERNAME, // todo IOCTL_SO_GETPEERNAME,
IOCTL_SO_GETSOCKNAME, // todo IOCTL_SO_GETSOCKNAME,
IOCTL_SO_GETSOCKOPT, // todo 8 IOCTL_SO_GETSOCKOPT,
IOCTL_SO_SETSOCKOPT, IOCTL_SO_SETSOCKOPT,
IOCTL_SO_LISTEN, IOCTL_SO_LISTEN,
IOCTL_SO_POLL, // todo b IOCTL_SO_POLL,
IOCTLV_SO_RECVFROM, IOCTLV_SO_RECVFROM,
IOCTLV_SO_SENDTO, IOCTLV_SO_SENDTO,
IOCTL_SO_SHUTDOWN, // todo e IOCTL_SO_SHUTDOWN,
IOCTL_SO_SOCKET, IOCTL_SO_SOCKET,
IOCTL_SO_GETHOSTID, IOCTL_SO_GETHOSTID,
IOCTL_SO_GETHOSTBYNAME, IOCTL_SO_GETHOSTBYNAME,
IOCTL_SO_GETHOSTBYADDR,// todo IOCTL_SO_GETHOSTBYADDR,
IOCTLV_SO_GETNAMEINFO, // todo 13 IOCTLV_SO_GETNAMEINFO,
IOCTL_SO_UNK14, // todo IOCTL_SO_UNK14,
IOCTL_SO_INETATON, // todo IOCTL_SO_INETATON,
IOCTL_SO_INETPTON, // todo IOCTL_SO_INETPTON,
IOCTL_SO_INETNTOP, // todo IOCTL_SO_INETNTOP,
IOCTLV_SO_GETADDRINFO, // todo IOCTLV_SO_GETADDRINFO,
IOCTL_SO_SOCKATMARK, // todo IOCTL_SO_SOCKATMARK,
IOCTLV_SO_UNK1A, // todo IOCTLV_SO_UNK1A,
IOCTLV_SO_UNK1B, // todo IOCTLV_SO_UNK1B,
IOCTLV_SO_GETINTERFACEOPT, // todo IOCTLV_SO_GETINTERFACEOPT,
IOCTLV_SO_SETINTERFACEOPT, // todo IOCTLV_SO_SETINTERFACEOPT,
IOCTL_SO_SETINTERFACE, // todo IOCTL_SO_SETINTERFACE,
IOCTL_SO_STARTUP, // 0x1f IOCTL_SO_STARTUP,
IOCTL_SO_ICMPSOCKET = 0x30, // todo IOCTL_SO_ICMPSOCKET = 0x30,
IOCTLV_SO_ICMPPING, // todo IOCTLV_SO_ICMPPING,
IOCTL_SO_ICMPCANCEL, // todo IOCTL_SO_ICMPCANCEL,
IOCTL_SO_ICMPCLOSE // todo IOCTL_SO_ICMPCLOSE
}; };
u32 ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize); u32 ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize);
}; };
// ************************************************************************************** // **********************************************************************************
// Seems like just wireless stuff?
class CWII_IPC_HLE_Device_net_ncd_manage : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_net_ncd_manage : public IWII_IPC_HLE_Device
{ {
public: public:
@ -215,6 +213,14 @@ public:
virtual bool Close(u32 _CommandAddress); virtual bool Close(u32 _CommandAddress);
virtual bool IOCtlV(u32 _CommandAddress); virtual bool IOCtlV(u32 _CommandAddress);
private:
enum {
IOCTL_NCD_UNK1 = 1, // NCDLockWirelessDriver
IOCTL_NCD_UNK2 = 2, // NCDUnlockWirelessDriver
IOCTL_NCD_SETIFCONFIG3 = 3,
IOCTL_NCD_SETIFCONFIG4 = 4, // NCDGetWirelessMacAddress
IOCTL_NCD_GETLINKSTATUS = 7 // NCDGetLinkStatus
};
}; };
#endif #endif

View File

@ -38,7 +38,6 @@ CWII_IPC_HLE_Device_sdio_slot0::CWII_IPC_HLE_Device_sdio_slot0(u32 _DeviceID, co
CWII_IPC_HLE_Device_sdio_slot0::~CWII_IPC_HLE_Device_sdio_slot0() CWII_IPC_HLE_Device_sdio_slot0::~CWII_IPC_HLE_Device_sdio_slot0()
{ {
} }
bool CWII_IPC_HLE_Device_sdio_slot0::Open(u32 _CommandAddress, u32 _Mode) bool CWII_IPC_HLE_Device_sdio_slot0::Open(u32 _CommandAddress, u32 _Mode)
@ -101,7 +100,7 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress)
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 oscillate, enable bit 1 to say it's stable
Memory::Write_U32(val | 2, SDIO_BASE + reg); Memory::Write_U32(val | 2, SDIO_BASE + reg);
} }
else if ((reg == HCR_SOFTWARERESET) && val) else if ((reg == HCR_SOFTWARERESET) && val)
@ -148,7 +147,10 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress)
break; break;
case IOCTL_SENDCMD: case IOCTL_SENDCMD:
INFO_LOG(WII_IPC_SD, "IOCTL_SENDCMD 0x%08x", Memory::Read_U32(BufferIn)); if (Memory::Read_U32(BufferIn) != SDHC_CAPABILITIES)
{
INFO_LOG(WII_IPC_SD, "IOCTL_SENDCMD 0x%08x", Memory::Read_U32(BufferIn));
}
ReturnValue = ExecuteCommand(BufferIn, BufferInSize, 0, 0, BufferOut, BufferOutSize); ReturnValue = ExecuteCommand(BufferIn, BufferInSize, 0, 0, BufferOut, BufferOutSize);
break; break;
@ -389,17 +391,20 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
Memory::Write_U32(0x900, _BufferOut); Memory::Write_U32(0x900, _BufferOut);
break; break;
case CRAZY_BIGN64: case SDHC_CAPABILITIES:
WARN_LOG(WII_IPC_SD, "CMD64, wtf"); {
DEBUG_LOG(WII_IPC_SD, "SDHC_CAPABILITIES");
// <svpe> shuffle2_: try returning -4 for cmd x'40. // SDHC 1.0 supports only 10-63 MHz.
Memory::Write_U32(-0x04, _BufferOut); // So of course we reply 63MHz :)
u8 mhz_units = 1 << 7;
_dbg_assert_msg_(WII_IPC_SD, req.arg == 2, "cmd64 odd arg value 0x%08x", req.arg); u16 freq = 63 << 8;
break; u32 caps = freq | mhz_units;
Memory::Write_U32(caps, _BufferOut);
break;
}
case CRAZY_BIGN65: case CRAZY_BIGN65:
ERROR_LOG(WII_IPC_SD, "CMD65, wtf"); // Just means unmount/detach, but we don't care
break; break;
default: default:

View File

@ -94,7 +94,7 @@ private:
ACMD_SENDOPCOND = 0x29, ACMD_SENDOPCOND = 0x29,
ACMD_SENDSCR = 0x33, ACMD_SENDSCR = 0x33,
CRAZY_BIGN64 = 0x40, SDHC_CAPABILITIES = 0x40,
CRAZY_BIGN65 = 0x41, CRAZY_BIGN65 = 0x41,
}; };