diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp index b8b3427da5..5cff7cc55c 100644 --- a/Source/Core/Common/Src/FileUtil.cpp +++ b/Source/Core/Common/Src/FileUtil.cpp @@ -100,7 +100,7 @@ bool IsDirectory(const char *filename) // Doesn't supports deleting a directory 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 // being there, not the actual delete. @@ -135,7 +135,7 @@ bool Delete(const char *filename) // Returns true if successful, or path already exists. bool CreateDir(const char *path) { - INFO_LOG(COMMON, "CreateDir: directory %s\n", path); + INFO_LOG(COMMON, "CreateDir: directory %s", path); #ifdef _WIN32 if (::CreateDirectory(path, NULL)) return true; @@ -166,10 +166,10 @@ bool CreateDir(const char *path) bool CreateFullPath(const char *fullPath) { int panicCounter = 100; - INFO_LOG(COMMON, "CreateFullPath: path %s\n", fullPath); + INFO_LOG(COMMON, "CreateFullPath: path %s", fullPath); if (File::Exists(fullPath)) { - INFO_LOG(COMMON, "CreateFullPath: path exists %s\n", fullPath); + INFO_LOG(COMMON, "CreateFullPath: path exists %s", fullPath); return true; } diff --git a/Source/Core/Core/Src/HLE/HLE.cpp b/Source/Core/Core/Src/HLE/HLE.cpp index fcc429f89e..2fc438f64b 100644 --- a/Source/Core/Core/Src/HLE/HLE.cpp +++ b/Source/Core/Core/Src/HLE/HLE.cpp @@ -63,7 +63,8 @@ static const SPatch OSPatches[] = { "vprintf", HLE_OS::HLE_GeneralDebugPrint }, { "printf", HLE_OS::HLE_GeneralDebugPrint }, { "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?) // wii only diff --git a/Source/Core/Core/Src/HLE/HLE_OS.cpp b/Source/Core/Core/Src/HLE/HLE_OS.cpp index 9ad6c6f730..7dcac00927 100644 --- a/Source/Core/Core/Src/HLE/HLE_OS.cpp +++ b/Source/Core/Core/Src/HLE/HLE_OS.cpp @@ -91,21 +91,27 @@ void GetStringVA(std::string& _rOutBuffer, u32 strReg) *pArgument++ = *pString; *pArgument = NULL; - u32 Parameter; + u64 Parameter; if (ParameterCounter > 10) { Parameter = Memory::Read_U32(GPR(1) + 0x8 + ((ParameterCounter - 11) * 4)); } 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++; switch(*pString) { case 's': - _rOutBuffer += StringFromFormat(ArgumentBuffer, (char*)Memory::GetPointer(Parameter)); + _rOutBuffer += StringFromFormat(ArgumentBuffer, (char*)Memory::GetPointer((u32)Parameter)); break; case 'd': diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp index 522ec4386b..d726ee67d9 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp @@ -16,40 +16,30 @@ // 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 -// ======================================================= -// File description -// ------------- -/* Here we handle /dev/net and /dev/net/ncd/manage requests. +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) - // ----------------------- - 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) - 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) - // ------- +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 unavailable and prevent if from looking for shared2/wc24 files (and do a PPCHalt when +it failed) */ -// ============= #ifdef _MSC_VER #pragma warning(disable : 4065) // switch statement contains 'default' but no 'case' labels @@ -72,7 +62,6 @@ extern std::queue > g_ReplyQueueLater; // ********************************************************************************** // 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) : 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() { - } 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; } - bool CWII_IPC_HLE_Device_net_kd_request::IOCtl(u32 _CommandAddress) { - u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC); - u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); - u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); - u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); - u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); + u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC); + u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); + u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); + u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); + u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); 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"); - ReturnValue = 0; break; case IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR: // NWC24iResumeForCloseLib INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR - NI"); - ReturnValue = 0; break; case IOCTL_NWC24_UNK_3: // NWC24iResumeForCloseLib INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_UNK_3 - NI"); - ReturnValue = 0; 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"); - ReturnValue = 0; break; case IOCTL_NWC24_LOCK_SOCKET: // WiiMenu INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_LOCK_SOCKET - NI"); - ReturnValue = 0; break; - case IOCTL_NWC24_UNLOCK_SOCKET: + case IOCTL_NWC24_UNLOCK_SOCKET: INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_UNLOCK_SOCKET - NI"); - ReturnValue = 0; break; case IOCTL_NWC24_REQUEST_GENERATED_USER_ID: // (Input: none, Output: 32 bytes) PanicAlert("IOCTL_NWC24_REQUEST_GENERATED_USER_ID"); - ReturnValue = 0; break; case IOCTL_NWC24_GET_SCHEDULAR_STAT: INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_GET_SCHEDULAR_STAT - NI"); - ReturnValue = 0; break; case IOCTL_NWC24_SAVE_MAIL_NOW: INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_SAVE_MAIL_NOW - NI"); - ReturnValue = 0; break; 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 ... - ReturnValue = 0; + // if ya set the IOS version to a very high value this happens ... + INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_REQUEST_SHUTDOWN - NI"); break; default: @@ -167,14 +146,13 @@ bool CWII_IPC_HLE_Device_net_kd_request::IOCtl(u32 _CommandAddress) // g_ReplyQueueLater.push(std::pair(_CommandAddress, GetDeviceName())); Memory::Write_U32(ReturnValue, _CommandAddress + 4); - + return true; } // ********************************************************************************** // 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) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) {} @@ -205,16 +183,16 @@ bool CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(u32 _CommandAddress) switch (CommandBuffer.Parameter) { // WiiMenu - case 0x07: // //NCDGetLinkStatus - case 0x03: // ??? It seems that is related to Write and Read information - case 0x04: - case 0x05: + case IOCTL_NCD_GETLINKSTATUS: // 32 Out. 5th + case IOCTL_NCD_SETIFCONFIG3: // ??? It seems that is related to Write and Read information + case IOCTL_NCD_SETIFCONFIG4: // 7004 In, 32 Out. 4th + case 0x05: // 7004 Out, 32 Out. 2nd, 3rd case 0x06: - case 0x08: + case 0x08: // 32 Out, 6 Out. 1st //break; 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; } 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 - 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) {} @@ -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) { - u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); - u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); - u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); - u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); - u32 Command = Memory::Read_U32(_CommandAddress + 0x0C); + u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); + u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); + u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); + u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); + 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); 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) { - // 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); switch (_Command) { case IOCTL_SO_STARTUP: break; + case IOCTL_SO_SOCKET: - { - u32 AF = Memory::Read_U32(_BufferIn); - u32 TYPE = Memory::Read_U32(_BufferIn + 0x04); - u32 PROT = Memory::Read_U32(_BufferIn + 0x04 * 2); - u32 Unk1 = Memory::Read_U32(_BufferIn + 0x04 * 3); - u32 Socket = (u32)socket(AF, TYPE, PROT); - return Common::swap32(Socket); // So it doesn't get mangled later on - } - break; + { + u32 AF = Memory::Read_U32(_BufferIn); + u32 TYPE = Memory::Read_U32(_BufferIn + 0x04); + u32 PROT = Memory::Read_U32(_BufferIn + 0x04 * 2); + u32 Unk1 = Memory::Read_U32(_BufferIn + 0x04 * 3); + u32 Socket = (u32)socket(AF, TYPE, PROT); + return Common::swap32(Socket); // So it doesn't get mangled later on + } + break; + case IOCTL_SO_BIND: - { - bind_params *addr = (bind_params*)Memory::GetPointer(_BufferIn); - GC_sockaddr_in addrPC; - memcpy(&addrPC, addr->name, sizeof(GC_sockaddr_in)); - sockaddr_in address; - address.sin_family = addrPC.sin_family; - address.sin_addr.s_addr = addrPC.sin_addr.s_addr_; - address.sin_port = htons(addrPC.sin_port); - int Return = bind(addr->socket, (sockaddr*)&address, sizeof(address)); - return Return; - //int bind(int s, struct sockaddr *addr, int addrlen); - } - break; + { + bind_params *addr = (bind_params*)Memory::GetPointer(_BufferIn); + GC_sockaddr_in addrPC; + memcpy(&addrPC, addr->name, sizeof(GC_sockaddr_in)); + sockaddr_in address; + address.sin_family = addrPC.sin_family; + address.sin_addr.s_addr = addrPC.sin_addr.s_addr_; + address.sin_port = htons(addrPC.sin_port); + int Return = bind(addr->socket, (sockaddr*)&address, sizeof(address)); + return Return; + //int bind(int s, struct sockaddr *addr, int addrlen); + } + break; + case IOCTL_SO_LISTEN: - { - u32 S = Memory::Read_U32(_BufferIn); - u32 BACKLOG = Memory::Read_U32(_BufferIn + 0x04); - u32 Return = listen(S, BACKLOG); - return Return; - } - break; + { + u32 S = Memory::Read_U32(_BufferIn); + u32 BACKLOG = Memory::Read_U32(_BufferIn + 0x04); + u32 Return = listen(S, BACKLOG); + return Return; + } + break; + case IOCTL_SO_ACCEPT: - { - //TODO: (Sonic)Check if this is correct - u32 S = Memory::Read_U32(_BufferIn); - socklen_t addrlen; - struct sockaddr_in address; - u32 Return = (u32)accept(S, (struct sockaddr *)&address, &addrlen); - GC_sockaddr_in *addr = (GC_sockaddr_in*)Memory::GetPointer(BufferOut); - addr->sin_family = (u8)address.sin_family; - addr->sin_addr.s_addr_ = address.sin_addr.s_addr; - addr->sin_port = address.sin_port; - socklen_t *Len = (socklen_t *)Memory::GetPointer(BufferOut + 0x04); - *Len = addrlen; - return Return; - //int accept(int s, struct sockaddr *addr, int *addrlen); - ///dev/net/ip/top::IOCtl request 0x1 (BufferIn: (000318c0, 4), BufferOut: (00058a4c, 8) - } - break; + { + //TODO: (Sonic)Check if this is correct + u32 S = Memory::Read_U32(_BufferIn); + socklen_t addrlen; + struct sockaddr_in address; + u32 Return = (u32)accept(S, (struct sockaddr *)&address, &addrlen); + GC_sockaddr_in *addr = (GC_sockaddr_in*)Memory::GetPointer(BufferOut); + addr->sin_family = (u8)address.sin_family; + addr->sin_addr.s_addr_ = address.sin_addr.s_addr; + addr->sin_port = address.sin_port; + socklen_t *Len = (socklen_t *)Memory::GetPointer(BufferOut + 0x04); + *Len = addrlen; + return Return; + //int accept(int s, struct sockaddr *addr, int *addrlen); + ///dev/net/ip/top::IOCtl request 0x1 (BufferIn: (000318c0, 4), BufferOut: (00058a4c, 8) + } + break; + case IOCTL_SO_GETHOSTID: return 127 << 24 | 1; break; @@ -359,17 +341,18 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 _CommandAddress) u32 ReturnValue = 0; SIOCtlVBuffer CommandBuffer(_CommandAddress); - switch(CommandBuffer.Parameter) + switch (CommandBuffer.Parameter) { - case 2: - case 12: - case 15: - case 16: - case 31: + case IOCTL_SO_BIND: + case IOCTLV_SO_RECVFROM: + case IOCTL_SO_SOCKET: + case IOCTL_SO_GETHOSTID: + case IOCTL_SO_STARTUP: //break; + default: INFO_LOG(WII_IPC_NET, "NET_IP_TOP IOCtlV: 0x%08X\n", CommandBuffer.Parameter); - break; + break; } Memory::Write_U32(ReturnValue, _CommandAddress+4); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h index 96714ea57a..6115fbdeae 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h @@ -20,10 +20,13 @@ #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 { public: - CWII_IPC_HLE_Device_net_kd_request(u32 _DeviceID, const std::string& _rDeviceName); virtual ~CWII_IPC_HLE_Device_net_kd_request(); @@ -33,7 +36,6 @@ public: virtual bool IOCtl(u32 _CommandAddress); private: - enum { IOCTL_NWC24_SUSPEND_SCHEDULAR = 0x01, @@ -61,15 +63,13 @@ private: }; }; -// ************************************************************************************** - +// ********************************************************************************** class CWII_IPC_HLE_Device_net_kd_time : public IWII_IPC_HLE_Device { public: - 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() {} @@ -90,11 +90,11 @@ public: virtual bool IOCtl(u32 _CommandAddress) { - u32 Parameter = Memory::Read_U32(_CommandAddress +0x0C); - u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); - u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); - u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); - u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); + u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C); + u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); + u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); + u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); + u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); switch (Parameter) { @@ -117,7 +117,8 @@ public: Memory::Write_U32(0, _CommandAddress + 0x4); return true; - + + case IOCTL_NW24_GET_TIME_DIFF: // Input: none, Output: 32 default: ERROR_LOG(WII_IPC_NET, "%s - IOCtl:\n" " Parameter: 0x%x (0x17 NWC24iSetRtcCounter) \n" @@ -135,7 +136,6 @@ public: } private: - enum { IOCTL_NW24_SET_RTC_COUNTER = 0x17, @@ -145,8 +145,7 @@ private: u8 m_RtcCounter[0x20]; }; -// ************************************************************************************** - +// ********************************************************************************** class CWII_IPC_HLE_Device_net_ip_top : public IWII_IPC_HLE_Device { public: @@ -160,50 +159,49 @@ public: virtual bool IOCtlV(u32 _CommandAddress); private: - enum { IOCTL_SO_ACCEPT = 1, - IOCTL_SO_BIND, - IOCTL_SO_CLOSE, - IOCTL_SO_CONNECT, + IOCTL_SO_BIND, + IOCTL_SO_CLOSE, + IOCTL_SO_CONNECT, IOCTL_SO_FCNTL, - IOCTL_SO_GETPEERNAME, // todo - IOCTL_SO_GETSOCKNAME, // todo - IOCTL_SO_GETSOCKOPT, // todo 8 + IOCTL_SO_GETPEERNAME, + IOCTL_SO_GETSOCKNAME, + IOCTL_SO_GETSOCKOPT, IOCTL_SO_SETSOCKOPT, IOCTL_SO_LISTEN, - IOCTL_SO_POLL, // todo b + IOCTL_SO_POLL, IOCTLV_SO_RECVFROM, IOCTLV_SO_SENDTO, - IOCTL_SO_SHUTDOWN, // todo e + IOCTL_SO_SHUTDOWN, IOCTL_SO_SOCKET, IOCTL_SO_GETHOSTID, IOCTL_SO_GETHOSTBYNAME, - IOCTL_SO_GETHOSTBYADDR,// todo - IOCTLV_SO_GETNAMEINFO, // todo 13 - IOCTL_SO_UNK14, // todo - IOCTL_SO_INETATON, // todo - IOCTL_SO_INETPTON, // todo - IOCTL_SO_INETNTOP, // todo - IOCTLV_SO_GETADDRINFO, // todo - IOCTL_SO_SOCKATMARK, // todo - IOCTLV_SO_UNK1A, // todo - IOCTLV_SO_UNK1B, // todo - IOCTLV_SO_GETINTERFACEOPT, // todo - IOCTLV_SO_SETINTERFACEOPT, // todo - IOCTL_SO_SETINTERFACE, // todo - IOCTL_SO_STARTUP, // 0x1f - IOCTL_SO_ICMPSOCKET = 0x30, // todo - IOCTLV_SO_ICMPPING, // todo - IOCTL_SO_ICMPCANCEL, // todo - IOCTL_SO_ICMPCLOSE // todo + IOCTL_SO_GETHOSTBYADDR, + IOCTLV_SO_GETNAMEINFO, + IOCTL_SO_UNK14, + IOCTL_SO_INETATON, + IOCTL_SO_INETPTON, + IOCTL_SO_INETNTOP, + IOCTLV_SO_GETADDRINFO, + IOCTL_SO_SOCKATMARK, + IOCTLV_SO_UNK1A, + IOCTLV_SO_UNK1B, + IOCTLV_SO_GETINTERFACEOPT, + IOCTLV_SO_SETINTERFACEOPT, + IOCTL_SO_SETINTERFACE, + IOCTL_SO_STARTUP, + IOCTL_SO_ICMPSOCKET = 0x30, + IOCTLV_SO_ICMPPING, + IOCTL_SO_ICMPCANCEL, + IOCTL_SO_ICMPCLOSE }; 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 { public: @@ -215,6 +213,14 @@ public: virtual bool Close(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 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 9f6eef7113..219fab46ba 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 @@ -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() { - } 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)) { - // 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); } else if ((reg == HCR_SOFTWARERESET) && val) @@ -148,7 +147,10 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress) break; 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); break; @@ -389,17 +391,20 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS Memory::Write_U32(0x900, _BufferOut); break; - case CRAZY_BIGN64: - WARN_LOG(WII_IPC_SD, "CMD64, wtf"); - - // shuffle2_: try returning -4 for cmd x'40. - Memory::Write_U32(-0x04, _BufferOut); - - _dbg_assert_msg_(WII_IPC_SD, req.arg == 2, "cmd64 odd arg value 0x%08x", req.arg); - break; + case SDHC_CAPABILITIES: + { + DEBUG_LOG(WII_IPC_SD, "SDHC_CAPABILITIES"); + // SDHC 1.0 supports only 10-63 MHz. + // So of course we reply 63MHz :) + u8 mhz_units = 1 << 7; + u16 freq = 63 << 8; + u32 caps = freq | mhz_units; + Memory::Write_U32(caps, _BufferOut); + break; + } case CRAZY_BIGN65: - ERROR_LOG(WII_IPC_SD, "CMD65, wtf"); + // Just means unmount/detach, but we don't care break; default: 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 8699e65e47..8901584750 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 @@ -94,7 +94,7 @@ private: ACMD_SENDOPCOND = 0x29, ACMD_SENDSCR = 0x33, - CRAZY_BIGN64 = 0x40, + SDHC_CAPABILITIES = 0x40, CRAZY_BIGN65 = 0x41, };