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 07d6127c88..b2435dfe82 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 @@ -315,13 +315,36 @@ bool CWII_IPC_HLE_Device_net_wd_command::Close(u32 CommandAddress, bool Force) 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_SCAN: + { + // Gives parameters detailing type of scan and what to match + ScanInfo *scan = (ScanInfo *)Memory::GetPointer(CommandBuffer.InBuffer.at(0).m_Address); + + u16 *results = (u16 *)Memory::GetPointer(CommandBuffer.PayloadBuffer.at(0).m_Address); + // first u16 indicates number of BSSInfo following + results[0] = Common::swap16(1); + + BSSInfo *bss = (BSSInfo *)&results[1]; + memset(bss, 0, sizeof(BSSInfo)); + + bss->length = Common::swap16(sizeof(BSSInfo)); + bss->rssi = Common::swap16(0xffff); + + for (int i = 0; i < BSSID_SIZE; ++i) + bss->bssid[i] = i; + + const char *ssid = "dolphin-emu"; + strcpy((char *)bss->ssid, ssid); + bss->ssid_length = Common::swap16(strlen(ssid)); + } + break; + + case IOCTLV_WD_GET_INFO: case IOCTLV_WD_GET_MODE: case IOCTLV_WD_SET_LINKSTATE: case IOCTLV_WD_GET_LINKSTATE: @@ -331,11 +354,9 @@ bool CWII_IPC_HLE_Device_net_wd_command::IOCtlV(u32 CommandAddress) 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: @@ -361,8 +382,6 @@ bool CWII_IPC_HLE_Device_net_wd_command::IOCtlV(u32 CommandAddress) break; } - Memory::Write_U32(common_result, - CommandBuffer.PayloadBuffer.at(common_vector).m_Address); Memory::Write_U32(return_value, CommandAddress + 4); return true; } 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 e33390b916..608eb1a7fc 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,7 @@ private: WiiNetConfig config; }; +////////////////////////////////////////////////////////////////////////// class CWII_IPC_HLE_Device_net_wd_command : public IWII_IPC_HLE_Device { public: @@ -474,6 +475,53 @@ private: IOCTLV_WD_RECV_FRAME = 0x8000, // WD_ReceiveFrame IOCTLV_WD_RECV_NOTIFICATION = 0x8001 // WD_ReceiveNotification }; + + enum + { + BSSID_SIZE = 6, + SSID_SIZE = 32 + }; + + enum + { + SCAN_ACTIVE, + SCAN_PASSIVE + }; + + #pragma pack(push, 1) + struct ScanInfo + { + u16 channel_bitmap; + u16 max_channel_time; + u8 bssid[BSSID_SIZE]; + u16 scan_type; + u16 ssid_length; + u8 ssid[SSID_SIZE]; + u8 ssid_match_mask[SSID_SIZE]; + }; + + struct BSSInfo + { + u16 length; + u16 rssi; + u8 bssid[BSSID_SIZE]; + u16 ssid_length; + u8 ssid[SSID_SIZE]; + u16 capabilities; + struct rate + { + u16 basic; + u16 support; + }; + u16 beacon_period; + u16 DTIM_period; + u16 channel; + u16 CF_period; + u16 CF_max_duration; + u16 element_info_length; + u16 element_info[1]; + }; + #pragma pack(pop) }; #ifdef _MSC_VER