diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index a2741b1005..72019ec25c 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -146,16 +146,17 @@ 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 IOS/Network/Socket.cpp IOS/Network/SSL.cpp IOS/Network/IP/Top.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/Network/WD/Command.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..b450ea3f39 100644 --- a/Source/Core/Core/Core.vcxproj +++ b/Source/Core/Core/Core.vcxproj @@ -178,16 +178,17 @@ - - + + + @@ -419,17 +420,18 @@ - - + + + diff --git a/Source/Core/Core/Core.vcxproj.filters b/Source/Core/Core/Core.vcxproj.filters index 7dc92cbd83..d4d3cc9e8f 100644 --- a/Source/Core/Core/Core.vcxproj.filters +++ b/Source/Core/Core/Core.vcxproj.filters @@ -133,6 +133,12 @@ {165768ae-ee50-4789-8051-5c5b7023fa4b} + + {a749993a-d2cf-46b6-9f7f-f76294e9ad02} + + + {fc3080d6-d99a-44c6-bdd4-140cec1c6bf0} + {3db8c364-1d72-4660-9179-86d1c46904b9} @@ -728,9 +734,6 @@ IOS\USB\Bluetooth - - IOS\Network - IOS @@ -764,9 +767,6 @@ IOS\Network - - IOS\Network - IOS\Network @@ -785,6 +785,15 @@ IOS\Network\KD + + IOS\Network\NCD + + + IOS\Network\NCD + + + IOS\Network\WD + IOS\SDIO @@ -1329,9 +1338,6 @@ IOS\USB\Bluetooth - - IOS\Network - IOS @@ -1365,9 +1371,6 @@ IOS\Network - - IOS\Network - IOS\Network @@ -1386,6 +1389,15 @@ IOS\Network\KD + + IOS\Network\NCD + + + IOS\Network\NCD + + + IOS\Network\WD + IOS\SDIO diff --git a/Source/Core/Core/IOS/IPC.cpp b/Source/Core/Core/IOS/IPC.cpp index 0fe641006f..5a334f6c82 100644 --- a/Source/Core/Core/IOS/IPC.cpp +++ b/Source/Core/Core/IOS/IPC.cpp @@ -47,9 +47,10 @@ #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/Net.h" +#include "Core/IOS/Network/NCD/Manage.h" #include "Core/IOS/Network/SSL.h" #include "Core/IOS/Network/Socket.h" +#include "Core/IOS/Network/WD/Command.h" #include "Core/IOS/SDIO/SDIOSlot0.h" #include "Core/IOS/STM/STM.h" #include "Core/IOS/USB/Bluetooth/BTEmu.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/WD/Command.cpp similarity index 52% rename from Source/Core/Core/IOS/Network/Net.cpp rename to Source/Core/Core/IOS/Network/WD/Command.cpp index 392e00d5b7..236355e32a 100644 --- a/Source/Core/Core/IOS/Network/Net.cpp +++ b/Source/Core/Core/IOS/Network/WD/Command.cpp @@ -2,21 +2,18 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. -#include "Core/IOS/Network/Net.h" +#include "Core/IOS/Network/WD/Command.h" -#include #include #include -#include #include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Common/Network.h" -#include "Core/Core.h" + #include "Core/HW/Memmap.h" #include "Core/IOS/Network/MACUtils.h" -#include "Core/IOS/Network/Socket.h" namespace IOS { @@ -24,80 +21,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/WD/Command.h similarity index 69% rename from Source/Core/Core/IOS/Network/Net.h rename to Source/Core/Core/IOS/Network/WD/Command.h index 754a82a3b3..3b0decc48a 100644 --- a/Source/Core/Core/IOS/Network/Net.h +++ b/Source/Core/Core/IOS/Network/WD/Command.h @@ -8,46 +8,13 @@ #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 { 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: