Merge pull request #4926 from lioncash/net
IOS Network: Split ncd/manage code and wd/command code into their own source files
This commit is contained in:
commit
5814d23fd9
|
@ -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
|
||||
|
|
|
@ -178,16 +178,17 @@
|
|||
<ClCompile Include="IOS\ES\Formats.cpp" />
|
||||
<ClCompile Include="IOS\FS\FileIO.cpp" />
|
||||
<ClCompile Include="IOS\FS\FS.cpp" />
|
||||
<ClCompile Include="IOS\Network\Config.cpp" />
|
||||
<ClCompile Include="IOS\Network\ICMPLin.cpp" />
|
||||
<ClCompile Include="IOS\Network\MACUtils.cpp" />
|
||||
<ClCompile Include="IOS\Network\Net.cpp" />
|
||||
<ClCompile Include="IOS\Network\Socket.cpp" />
|
||||
<ClCompile Include="IOS\Network\SSL.cpp" />
|
||||
<ClCompile Include="IOS\Network\IP\Top.cpp" />
|
||||
<ClCompile Include="IOS\Network\KD\NetKDRequest.cpp" />
|
||||
<ClCompile Include="IOS\Network\KD\NetKDTime.cpp" />
|
||||
<ClCompile Include="IOS\Network\KD\NWC24Config.cpp" />
|
||||
<ClCompile Include="IOS\Network\NCD\Config.cpp" />
|
||||
<ClCompile Include="IOS\Network\NCD\Manage.cpp" />
|
||||
<ClCompile Include="IOS\Network\WD\Command.cpp" />
|
||||
<ClCompile Include="IOS\SDIO\SDIOSlot0.cpp" />
|
||||
<ClCompile Include="IOS\STM\STM.cpp" />
|
||||
<ClCompile Include="IOS\USB\Common.cpp" />
|
||||
|
@ -419,17 +420,18 @@
|
|||
<ClInclude Include="IOS\ES\Formats.h" />
|
||||
<ClInclude Include="IOS\FS\FileIO.h" />
|
||||
<ClInclude Include="IOS\FS\FS.h" />
|
||||
<ClInclude Include="IOS\Network\Config.h" />
|
||||
<ClInclude Include="IOS\Network\ICMPLin.h" />
|
||||
<ClInclude Include="IOS\Network\ICMP.h" />
|
||||
<ClInclude Include="IOS\Network\MACUtils.h" />
|
||||
<ClInclude Include="IOS\Network\Net.h" />
|
||||
<ClInclude Include="IOS\Network\Socket.h" />
|
||||
<ClInclude Include="IOS\Network\SSL.h" />
|
||||
<ClInclude Include="IOS\Network\IP\Top.h" />
|
||||
<ClInclude Include="IOS\Network\KD\NetKDRequest.h" />
|
||||
<ClInclude Include="IOS\Network\KD\NetKDTime.h" />
|
||||
<ClInclude Include="IOS\Network\KD\NWC24Config.h" />
|
||||
<ClInclude Include="IOS\Network\NCD\Config.h" />
|
||||
<ClInclude Include="IOS\Network\NCD\Manage.h" />
|
||||
<ClInclude Include="IOS\Network\WD\Command.h" />
|
||||
<ClInclude Include="IOS\SDIO\SDIOSlot0.h" />
|
||||
<ClInclude Include="IOS\STM\STM.h" />
|
||||
<ClInclude Include="IOS\USB\Common.h" />
|
||||
|
|
|
@ -133,6 +133,12 @@
|
|||
<Filter Include="IOS\Network\KD">
|
||||
<UniqueIdentifier>{165768ae-ee50-4789-8051-5c5b7023fa4b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="IOS\Network\NCD">
|
||||
<UniqueIdentifier>{a749993a-d2cf-46b6-9f7f-f76294e9ad02}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="IOS\Network\WD">
|
||||
<UniqueIdentifier>{fc3080d6-d99a-44c6-bdd4-140cec1c6bf0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="IOS\DI">
|
||||
<UniqueIdentifier>{3db8c364-1d72-4660-9179-86d1c46904b9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
|
@ -728,9 +734,6 @@
|
|||
<ClCompile Include="IOS\USB\Bluetooth\BTStub.cpp">
|
||||
<Filter>IOS\USB\Bluetooth</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IOS\Network\Config.cpp">
|
||||
<Filter>IOS\Network</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IOS\Device.cpp">
|
||||
<Filter>IOS</Filter>
|
||||
</ClCompile>
|
||||
|
@ -764,9 +767,6 @@
|
|||
<ClCompile Include="IOS\Network\MACUtils.cpp">
|
||||
<Filter>IOS\Network</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IOS\Network\Net.cpp">
|
||||
<Filter>IOS\Network</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IOS\Network\Socket.cpp">
|
||||
<Filter>IOS\Network</Filter>
|
||||
</ClCompile>
|
||||
|
@ -785,6 +785,15 @@
|
|||
<ClCompile Include="IOS\Network\KD\NWC24Config.cpp">
|
||||
<Filter>IOS\Network\KD</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IOS\Network\NCD\Config.cpp">
|
||||
<Filter>IOS\Network\NCD</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IOS\Network\NCD\Manage.cpp">
|
||||
<Filter>IOS\Network\NCD</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IOS\Network\WD\Command.cpp">
|
||||
<Filter>IOS\Network\WD</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IOS\SDIO\SDIOSlot0.cpp">
|
||||
<Filter>IOS\SDIO</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1329,9 +1338,6 @@
|
|||
<ClInclude Include="IOS\USB\Bluetooth\BTStub.h">
|
||||
<Filter>IOS\USB\Bluetooth</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IOS\Network\Config.h">
|
||||
<Filter>IOS\Network</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IOS\DeviceStub.h">
|
||||
<Filter>IOS</Filter>
|
||||
</ClInclude>
|
||||
|
@ -1365,9 +1371,6 @@
|
|||
<ClInclude Include="IOS\Network\MACUtils.h">
|
||||
<Filter>IOS\Network</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IOS\Network\Net.h">
|
||||
<Filter>IOS\Network</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IOS\Network\Socket.h">
|
||||
<Filter>IOS\Network</Filter>
|
||||
</ClInclude>
|
||||
|
@ -1386,6 +1389,15 @@
|
|||
<ClInclude Include="IOS\Network\KD\NWC24Config.h">
|
||||
<Filter>IOS\Network\KD</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IOS\Network\NCD\Config.h">
|
||||
<Filter>IOS\Network\NCD</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IOS\Network\NCD\Manage.h">
|
||||
<Filter>IOS\Network\NCD</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IOS\Network\WD\Command.h">
|
||||
<Filter>IOS\Network\WD</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IOS\SDIO\SDIOSlot0.h">
|
||||
<Filter>IOS\SDIO</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 <cstring>
|
||||
|
|
@ -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 <string>
|
||||
|
||||
#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
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright 2017 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#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
|
|
@ -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 <cstddef>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#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)
|
||||
{
|
|
@ -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 <ws2tcpip.h>
|
||||
#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:
|
Loading…
Reference in New Issue