IOS Network: Split ncd/manage code into its own source files
This commit is contained in:
parent
82734fffaa
commit
ec298d9ea9
|
@ -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
|
||||
|
|
|
@ -178,7 +178,6 @@
|
|||
<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" />
|
||||
|
@ -188,6 +187,8 @@
|
|||
<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\SDIO\SDIOSlot0.cpp" />
|
||||
<ClCompile Include="IOS\STM\STM.cpp" />
|
||||
<ClCompile Include="IOS\USB\Common.cpp" />
|
||||
|
@ -419,7 +420,6 @@
|
|||
<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" />
|
||||
|
@ -430,6 +430,8 @@
|
|||
<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\SDIO\SDIOSlot0.h" />
|
||||
<ClInclude Include="IOS\STM\STM.h" />
|
||||
<ClInclude Include="IOS\USB\Common.h" />
|
||||
|
|
|
@ -133,6 +133,9 @@
|
|||
<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\DI">
|
||||
<UniqueIdentifier>{3db8c364-1d72-4660-9179-86d1c46904b9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
|
@ -728,9 +731,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>
|
||||
|
@ -785,6 +785,12 @@
|
|||
<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\SDIO\SDIOSlot0.cpp">
|
||||
<Filter>IOS\SDIO</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1329,9 +1335,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>
|
||||
|
@ -1386,6 +1389,12 @@
|
|||
<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\SDIO\SDIOSlot0.h">
|
||||
<Filter>IOS\SDIO</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
|
@ -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)
|
||||
|
|
|
@ -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 <ws2tcpip.h>
|
||||
#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:
|
||||
|
|
Loading…
Reference in New Issue