diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index a2741b1005..a87078a5d3 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -146,7 +146,6 @@ set(SRCS ActionReplay.cpp IOS/ES/Formats.cpp IOS/FS/FileIO.cpp IOS/FS/FS.cpp - IOS/Network/Config.cpp IOS/Network/ICMPLin.cpp IOS/Network/MACUtils.cpp IOS/Network/Net.cpp @@ -156,6 +155,8 @@ set(SRCS ActionReplay.cpp IOS/Network/KD/NetKDRequest.cpp IOS/Network/KD/NetKDTime.cpp IOS/Network/KD/NWC24Config.cpp + IOS/Network/NCD/Config.cpp + IOS/Network/NCD/Manage.cpp IOS/SDIO/SDIOSlot0.cpp IOS/STM/STM.cpp IOS/USB/Common.cpp diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj index 6632ee88b1..96b7b51340 100644 --- a/Source/Core/Core/Core.vcxproj +++ b/Source/Core/Core/Core.vcxproj @@ -178,7 +178,6 @@ - @@ -188,6 +187,8 @@ + + @@ -419,7 +420,6 @@ - @@ -430,6 +430,8 @@ + + diff --git a/Source/Core/Core/Core.vcxproj.filters b/Source/Core/Core/Core.vcxproj.filters index 7dc92cbd83..58b522ee06 100644 --- a/Source/Core/Core/Core.vcxproj.filters +++ b/Source/Core/Core/Core.vcxproj.filters @@ -133,6 +133,9 @@ {165768ae-ee50-4789-8051-5c5b7023fa4b} + + {a749993a-d2cf-46b6-9f7f-f76294e9ad02} + {3db8c364-1d72-4660-9179-86d1c46904b9} @@ -728,9 +731,6 @@ IOS\USB\Bluetooth - - IOS\Network - IOS @@ -785,6 +785,12 @@ IOS\Network\KD + + IOS\Network\NCD + + + IOS\Network\NCD + IOS\SDIO @@ -1329,9 +1335,6 @@ IOS\USB\Bluetooth - - IOS\Network - IOS @@ -1386,6 +1389,12 @@ IOS\Network\KD + + IOS\Network\NCD + + + IOS\Network\NCD + IOS\SDIO diff --git a/Source/Core/Core/IOS/IPC.cpp b/Source/Core/Core/IOS/IPC.cpp index 0fe641006f..3e35895a0f 100644 --- a/Source/Core/Core/IOS/IPC.cpp +++ b/Source/Core/Core/IOS/IPC.cpp @@ -47,6 +47,7 @@ #include "Core/IOS/Network/IP/Top.h" #include "Core/IOS/Network/KD/NetKDRequest.h" #include "Core/IOS/Network/KD/NetKDTime.h" +#include "Core/IOS/Network/NCD/Manage.h" #include "Core/IOS/Network/Net.h" #include "Core/IOS/Network/SSL.h" #include "Core/IOS/Network/Socket.h" diff --git a/Source/Core/Core/IOS/Network/Config.cpp b/Source/Core/Core/IOS/Network/NCD/Config.cpp similarity index 97% rename from Source/Core/Core/IOS/Network/Config.cpp rename to Source/Core/Core/IOS/Network/NCD/Config.cpp index 162d44e92b..489ba97ca9 100644 --- a/Source/Core/Core/IOS/Network/Config.cpp +++ b/Source/Core/Core/IOS/Network/NCD/Config.cpp @@ -2,7 +2,7 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. -#include "Core/IOS/Network/Config.h" +#include "Core/IOS/Network/NCD/Config.h" #include diff --git a/Source/Core/Core/IOS/Network/Config.h b/Source/Core/Core/IOS/Network/NCD/Config.h similarity index 100% rename from Source/Core/Core/IOS/Network/Config.h rename to Source/Core/Core/IOS/Network/NCD/Config.h diff --git a/Source/Core/Core/IOS/Network/NCD/Manage.cpp b/Source/Core/Core/IOS/Network/NCD/Manage.cpp new file mode 100644 index 0000000000..da6ef5978f --- /dev/null +++ b/Source/Core/Core/IOS/Network/NCD/Manage.cpp @@ -0,0 +1,93 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "Core/IOS/Network/NCD/Manage.h" + +#include + +#include "Common/CommonTypes.h" +#include "Common/Logging/Log.h" +#include "Common/Network.h" + +#include "Core/HW/Memmap.h" +#include "Core/IOS/Network/MACUtils.h" + +namespace IOS +{ +namespace HLE +{ +namespace Device +{ +NetNCDManage::NetNCDManage(u32 device_id, const std::string& device_name) + : Device(device_id, device_name) +{ +} + +IPCCommandResult NetNCDManage::IOCtlV(const IOCtlVRequest& request) +{ + s32 return_value = IPC_SUCCESS; + u32 common_result = 0; + u32 common_vector = 0; + + switch (request.request) + { + case IOCTLV_NCD_LOCKWIRELESSDRIVER: + break; + + case IOCTLV_NCD_UNLOCKWIRELESSDRIVER: + // Memory::Read_U32(request.in_vectors.at(0).address); + break; + + case IOCTLV_NCD_GETCONFIG: + INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_GETCONFIG"); + config.WriteToMem(request.io_vectors.at(0).address); + common_vector = 1; + break; + + case IOCTLV_NCD_SETCONFIG: + INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_SETCONFIG"); + config.ReadFromMem(request.in_vectors.at(0).address); + break; + + case IOCTLV_NCD_READCONFIG: + INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_READCONFIG"); + config.ReadConfig(); + config.WriteToMem(request.io_vectors.at(0).address); + break; + + case IOCTLV_NCD_WRITECONFIG: + INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_WRITECONFIG"); + config.ReadFromMem(request.in_vectors.at(0).address); + config.WriteConfig(); + break; + + case IOCTLV_NCD_GETLINKSTATUS: + INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_GETLINKSTATUS"); + // Always connected + Memory::Write_U32(Net::ConnectionSettings::LINK_WIRED, request.io_vectors.at(0).address + 4); + break; + + case IOCTLV_NCD_GETWIRELESSMACADDRESS: + INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_GETWIRELESSMACADDRESS"); + + u8 address[Common::MAC_ADDRESS_SIZE]; + IOS::Net::GetMACAddress(address); + Memory::CopyToEmu(request.io_vectors.at(1).address, address, sizeof(address)); + break; + + default: + INFO_LOG(IOS_NET, "NET_NCD_MANAGE IOCtlV: %#x", request.request); + break; + } + + Memory::Write_U32(common_result, request.io_vectors.at(common_vector).address); + if (common_vector == 1) + { + Memory::Write_U32(common_result, request.io_vectors.at(common_vector).address + 4); + } + return GetDefaultReply(return_value); +} +} // namespace Device +} // namespace HLE +} // namespace IOS diff --git a/Source/Core/Core/IOS/Network/NCD/Manage.h b/Source/Core/Core/IOS/Network/NCD/Manage.h new file mode 100644 index 0000000000..fbf5df4ac3 --- /dev/null +++ b/Source/Core/Core/IOS/Network/NCD/Manage.h @@ -0,0 +1,44 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include + +#include "Common/CommonTypes.h" +#include "Core/IOS/Device.h" +#include "Core/IOS/Network/NCD/Config.h" + +namespace IOS +{ +namespace HLE +{ +namespace Device +{ +// Interface for reading and changing network configuration (probably some other stuff as well) +class NetNCDManage : public Device +{ +public: + NetNCDManage(u32 device_id, const std::string& device_name); + + IPCCommandResult IOCtlV(const IOCtlVRequest& request) override; + +private: + enum + { + IOCTLV_NCD_LOCKWIRELESSDRIVER = 0x1, // NCDLockWirelessDriver + IOCTLV_NCD_UNLOCKWIRELESSDRIVER = 0x2, // NCDUnlockWirelessDriver + IOCTLV_NCD_GETCONFIG = 0x3, // NCDiGetConfig + IOCTLV_NCD_SETCONFIG = 0x4, // NCDiSetConfig + IOCTLV_NCD_READCONFIG = 0x5, + IOCTLV_NCD_WRITECONFIG = 0x6, + IOCTLV_NCD_GETLINKSTATUS = 0x7, // NCDGetLinkStatus + IOCTLV_NCD_GETWIRELESSMACADDRESS = 0x8, // NCDGetWirelessMacAddress + }; + + Net::WiiNetConfig config; +}; +} // namespace Device +} // namespace HLE +} // namespace IOS diff --git a/Source/Core/Core/IOS/Network/Net.cpp b/Source/Core/Core/IOS/Network/Net.cpp index 392e00d5b7..2a03d1bf64 100644 --- a/Source/Core/Core/IOS/Network/Net.cpp +++ b/Source/Core/Core/IOS/Network/Net.cpp @@ -24,79 +24,6 @@ namespace HLE { namespace Device { -// ********************************************************************************** -// Handle /dev/net/ncd/manage requests -NetNCDManage::NetNCDManage(u32 device_id, const std::string& device_name) - : Device(device_id, device_name) -{ -} - -IPCCommandResult NetNCDManage::IOCtlV(const IOCtlVRequest& request) -{ - s32 return_value = IPC_SUCCESS; - u32 common_result = 0; - u32 common_vector = 0; - - switch (request.request) - { - case IOCTLV_NCD_LOCKWIRELESSDRIVER: - break; - - case IOCTLV_NCD_UNLOCKWIRELESSDRIVER: - // Memory::Read_U32(request.in_vectors.at(0).address); - break; - - case IOCTLV_NCD_GETCONFIG: - INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_GETCONFIG"); - config.WriteToMem(request.io_vectors.at(0).address); - common_vector = 1; - break; - - case IOCTLV_NCD_SETCONFIG: - INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_SETCONFIG"); - config.ReadFromMem(request.in_vectors.at(0).address); - break; - - case IOCTLV_NCD_READCONFIG: - INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_READCONFIG"); - config.ReadConfig(); - config.WriteToMem(request.io_vectors.at(0).address); - break; - - case IOCTLV_NCD_WRITECONFIG: - INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_WRITECONFIG"); - config.ReadFromMem(request.in_vectors.at(0).address); - config.WriteConfig(); - break; - - case IOCTLV_NCD_GETLINKSTATUS: - INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_GETLINKSTATUS"); - // Always connected - Memory::Write_U32(Net::ConnectionSettings::LINK_WIRED, request.io_vectors.at(0).address + 4); - break; - - case IOCTLV_NCD_GETWIRELESSMACADDRESS: - INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_GETWIRELESSMACADDRESS"); - - u8 address[Common::MAC_ADDRESS_SIZE]; - IOS::Net::GetMACAddress(address); - Memory::CopyToEmu(request.io_vectors.at(1).address, address, sizeof(address)); - break; - - default: - INFO_LOG(IOS_NET, "NET_NCD_MANAGE IOCtlV: %#x", request.request); - break; - } - - Memory::Write_U32(common_result, request.io_vectors.at(common_vector).address); - if (common_vector == 1) - { - Memory::Write_U32(common_result, request.io_vectors.at(common_vector).address + 4); - } - return GetDefaultReply(return_value); -} - -// ********************************************************************************** // Handle /dev/net/wd/command requests NetWDCommand::NetWDCommand(u32 device_id, const std::string& device_name) : Device(device_id, device_name) diff --git a/Source/Core/Core/IOS/Network/Net.h b/Source/Core/Core/IOS/Network/Net.h index 754a82a3b3..118d765f2c 100644 --- a/Source/Core/Core/IOS/Network/Net.h +++ b/Source/Core/Core/IOS/Network/Net.h @@ -9,11 +9,6 @@ #include "Common/CommonTypes.h" #include "Core/IOS/Device.h" #include "Core/IOS/IPC.h" -#include "Core/IOS/Network/Config.h" - -#ifdef _WIN32 -#include -#endif namespace IOS { @@ -22,32 +17,6 @@ namespace HLE // TODO: split this up. namespace Device { -// ********************************************************************************** -// Interface for reading and changing network configuration (probably some other stuff as well) -class NetNCDManage : public Device -{ -public: - NetNCDManage(u32 device_id, const std::string& device_name); - - IPCCommandResult IOCtlV(const IOCtlVRequest& request) override; - -private: - enum - { - IOCTLV_NCD_LOCKWIRELESSDRIVER = 0x1, // NCDLockWirelessDriver - IOCTLV_NCD_UNLOCKWIRELESSDRIVER = 0x2, // NCDUnlockWirelessDriver - IOCTLV_NCD_GETCONFIG = 0x3, // NCDiGetConfig - IOCTLV_NCD_SETCONFIG = 0x4, // NCDiSetConfig - IOCTLV_NCD_READCONFIG = 0x5, - IOCTLV_NCD_WRITECONFIG = 0x6, - IOCTLV_NCD_GETLINKSTATUS = 0x7, // NCDGetLinkStatus - IOCTLV_NCD_GETWIRELESSMACADDRESS = 0x8, // NCDGetWirelessMacAddress - }; - - Net::WiiNetConfig config; -}; - -////////////////////////////////////////////////////////////////////////// class NetWDCommand : public Device { public: