From 8ddfff64250a93bbbe9642dc86b026472ff49b3d Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Fri, 10 Feb 2012 01:59:18 -0800 Subject: [PATCH] log params to /net/wd/command --- Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp | 1 + .../Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp | 97 ++++++++++++++++++- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h | 35 +++++++ 3 files changed, 131 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp index 17a8782c7d..6194ae93e0 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp @@ -91,6 +91,7 @@ void Init() g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_kd_request(i, std::string("/dev/net/kd/request")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_kd_time(i, std::string("/dev/net/kd/time")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_ncd_manage(i, std::string("/dev/net/ncd/manage")); i++; + g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_wd_command(i, std::string("/dev/net/wd/command")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_ip_top(i, std::string("/dev/net/ip/top")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_ssl(i, std::string("/dev/net/ssl")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_usb_kbd(i, std::string("/dev/usb/kbd")); i++; 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 d5d9fec780..07d6127c88 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 @@ -201,7 +201,7 @@ CWII_IPC_HLE_Device_net_ncd_manage::~CWII_IPC_HLE_Device_net_ncd_manage() bool CWII_IPC_HLE_Device_net_ncd_manage::Open(u32 _CommandAddress, u32 _Mode) { - WARN_LOG(WII_IPC_NET, "NET_NCD_MANAGE: Open"); + INFO_LOG(WII_IPC_NET, "NET_NCD_MANAGE: Open"); Memory::Write_U32(GetDeviceID(), _CommandAddress+4); m_Active = true; return true; @@ -209,7 +209,7 @@ bool CWII_IPC_HLE_Device_net_ncd_manage::Open(u32 _CommandAddress, u32 _Mode) bool CWII_IPC_HLE_Device_net_ncd_manage::Close(u32 _CommandAddress, bool _bForce) { - WARN_LOG(WII_IPC_NET, "NET_NCD_MANAGE: Close"); + INFO_LOG(WII_IPC_NET, "NET_NCD_MANAGE: Close"); if (!_bForce) Memory::Write_U32(0, _CommandAddress + 4); m_Active = false; @@ -226,6 +226,12 @@ bool CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(u32 _CommandAddress) switch (CommandBuffer.Parameter) { + case IOCTLV_NCD_LOCKWIRELESSDRIVER: + break; + case IOCTLV_NCD_UNLOCKWIRELESSDRIVER: + //Memory::Read_U32(CommandBuffer.InBuffer.at(0).m_Address); + break; + case IOCTLV_NCD_GETCONFIG: INFO_LOG(WII_IPC_NET, "NET_NCD_MANAGE: IOCTLV_NCD_GETCONFIG"); config.WriteToMem(CommandBuffer.PayloadBuffer.at(0).m_Address); @@ -274,6 +280,93 @@ bool CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(u32 _CommandAddress) return true; } +// ********************************************************************************** +// Handle /dev/net/wd/command requests +CWII_IPC_HLE_Device_net_wd_command::CWII_IPC_HLE_Device_net_wd_command(u32 DeviceID, const std::string& DeviceName) + : IWII_IPC_HLE_Device(DeviceID, DeviceName) +{ +} + +CWII_IPC_HLE_Device_net_wd_command::~CWII_IPC_HLE_Device_net_wd_command() +{ +} + +bool CWII_IPC_HLE_Device_net_wd_command::Open(u32 CommandAddress, u32 Mode) +{ + WARN_LOG(WII_IPC_NET, "NET_WD_COMMAND: Open"); + Memory::Write_U32(GetDeviceID(), CommandAddress + 4); + m_Active = true; + return true; +} + +bool CWII_IPC_HLE_Device_net_wd_command::Close(u32 CommandAddress, bool Force) +{ + WARN_LOG(WII_IPC_NET, "NET_WD_COMMAND: Close"); + if (!Force) + Memory::Write_U32(0, CommandAddress + 4); + m_Active = false; + return true; +} + +// This is just for debugging / playing around. +// There really is no reason to implement wd unless we can bend it such that +// we can talk to the DS. +#include "StringUtil.h" +bool CWII_IPC_HLE_Device_net_wd_command::IOCtlV(u32 CommandAddress) +{ + u32 return_value = 0; + u32 common_result = 0; + u32 common_vector = 0; + + SIOCtlVBuffer CommandBuffer(CommandAddress); + + switch (CommandBuffer.Parameter) + { + case IOCTLV_WD_GET_MODE: + case IOCTLV_WD_SET_LINKSTATE: + case IOCTLV_WD_GET_LINKSTATE: + case IOCTLV_WD_SET_CONFIG: + case IOCTLV_WD_GET_CONFIG: + case IOCTLV_WD_CHANGE_BEACON: + case IOCTLV_WD_DISASSOC: + case IOCTLV_WD_MP_SEND_FRAME: + case IOCTLV_WD_SEND_FRAME: + case IOCTLV_WD_SCAN: + case IOCTLV_WD_CALL_WL: + case IOCTLV_WD_MEASURE_CHANNEL: + case IOCTLV_WD_GET_LASTERROR: + case IOCTLV_WD_GET_INFO: + case IOCTLV_WD_CHANGE_GAMEINFO: + case IOCTLV_WD_CHANGE_VTSF: + case IOCTLV_WD_RECV_FRAME: + case IOCTLV_WD_RECV_NOTIFICATION: + default: + WARN_LOG(WII_IPC_NET, "NET_WD_COMMAND IOCtlV %#x in %i out %i", + CommandBuffer.Parameter, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer); + for (int i = 0; i < CommandBuffer.NumberInBuffer; ++i) + { + WARN_LOG(WII_IPC_NET, "in %i addr %x size %i", i, + CommandBuffer.InBuffer.at(i).m_Address, CommandBuffer.InBuffer.at(i).m_Size); + WARN_LOG(WII_IPC_NET, "%s", + ArrayToString( + Memory::GetPointer(CommandBuffer.InBuffer.at(i).m_Address), + CommandBuffer.InBuffer.at(i).m_Size).c_str() + ); + } + for (int i = 0; i < CommandBuffer.NumberPayloadBuffer; ++i) + { + WARN_LOG(WII_IPC_NET, "out %i addr %x size %i", i, + CommandBuffer.PayloadBuffer.at(i).m_Address, CommandBuffer.PayloadBuffer.at(i).m_Size); + } + break; + } + + Memory::Write_U32(common_result, + CommandBuffer.PayloadBuffer.at(common_vector).m_Address); + Memory::Write_U32(return_value, CommandAddress + 4); + return true; +} + // ********************************************************************************** // 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) 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 4c2cbe024c..e33390b916 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 @@ -441,6 +441,41 @@ private: WiiNetConfig config; }; +class CWII_IPC_HLE_Device_net_wd_command : public IWII_IPC_HLE_Device +{ +public: + CWII_IPC_HLE_Device_net_wd_command(u32 DeviceID, const std::string& DeviceName); + + virtual ~CWII_IPC_HLE_Device_net_wd_command(); + + virtual bool Open(u32 CommandAddress, u32 Mode); + virtual bool Close(u32 CommandAddress, bool Force); + virtual bool IOCtlV(u32 CommandAddress); + +private: + enum + { + IOCTLV_WD_GET_MODE = 0x1001, // WD_GetMode + IOCTLV_WD_SET_LINKSTATE = 0x1002, // WD_SetLinkState + IOCTLV_WD_GET_LINKSTATE = 0x1003, // WD_GetLinkState + IOCTLV_WD_SET_CONFIG = 0x1004, // WD_SetConfig + IOCTLV_WD_GET_CONFIG = 0x1005, // WD_GetConfig + IOCTLV_WD_CHANGE_BEACON = 0x1006, // WD_ChangeBeacon + IOCTLV_WD_DISASSOC = 0x1007, // WD_DisAssoc + IOCTLV_WD_MP_SEND_FRAME = 0x1008, // WD_MpSendFrame + IOCTLV_WD_SEND_FRAME = 0x1009, // WD_SendFrame + IOCTLV_WD_SCAN = 0x100a, // WD_Scan + IOCTLV_WD_CALL_WL = 0x100c, // WD_CallWL + IOCTLV_WD_MEASURE_CHANNEL = 0x100b, // WD_MeasureChannel + IOCTLV_WD_GET_LASTERROR = 0x100d, // WD_GetLastError + IOCTLV_WD_GET_INFO = 0x100e, // WD_GetInfo + IOCTLV_WD_CHANGE_GAMEINFO = 0x100f, // WD_ChangeGameInfo + IOCTLV_WD_CHANGE_VTSF = 0x1010, // WD_ChangeVTSF + IOCTLV_WD_RECV_FRAME = 0x8000, // WD_ReceiveFrame + IOCTLV_WD_RECV_NOTIFICATION = 0x8001 // WD_ReceiveNotification + }; +}; + #ifdef _MSC_VER #pragma optimize("",on) #endif