mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-25 15:31:17 +01:00
The old g_want_determinism check in WiiSockMan missed a few cases. Move to net.cpp.
Specifically, things like GETHOSTBYNAME, GETHOSTID, etc. could be done without creating a socket, which is what the old check blocked. Now we check at the ioctl and ioctlv handlers. Might be possible to get a bit more realistic behavior in future by filtering individual ioctls, but it probably doesn't matter.
This commit is contained in:
parent
3173d4dcbf
commit
f6c6822f71
@ -644,6 +644,13 @@ static unsigned int opt_name_mapping[][2] = {
|
|||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
|
IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
|
||||||
{
|
{
|
||||||
|
if (Core::g_want_determinism)
|
||||||
|
{
|
||||||
|
Memory::Write_U32(-1, _CommandAddress + 4);
|
||||||
|
return IPC_DEFAULT_REPLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
u32 Command = Memory::Read_U32(_CommandAddress + 0x0C);
|
u32 Command = Memory::Read_U32(_CommandAddress + 0x0C);
|
||||||
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
|
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
|
||||||
u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
|
u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
|
||||||
@ -1222,65 +1229,68 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress)
|
|||||||
{
|
{
|
||||||
u32 address = 0;
|
u32 address = 0;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
PIP_ADAPTER_ADDRESSES AdapterAddresses = nullptr;
|
if (!Core::g_want_determinism)
|
||||||
ULONG OutBufferLength = 0;
|
|
||||||
ULONG RetVal = 0, i;
|
|
||||||
for (i = 0; i < 5; ++i)
|
|
||||||
{
|
{
|
||||||
RetVal = GetAdaptersAddresses(
|
PIP_ADAPTER_ADDRESSES AdapterAddresses = nullptr;
|
||||||
AF_INET,
|
ULONG OutBufferLength = 0;
|
||||||
0,
|
ULONG RetVal = 0, i;
|
||||||
nullptr,
|
for (i = 0; i < 5; ++i)
|
||||||
AdapterAddresses,
|
|
||||||
&OutBufferLength);
|
|
||||||
|
|
||||||
if (RetVal != ERROR_BUFFER_OVERFLOW)
|
|
||||||
{
|
{
|
||||||
break;
|
RetVal = GetAdaptersAddresses(
|
||||||
}
|
AF_INET,
|
||||||
|
0,
|
||||||
|
nullptr,
|
||||||
|
AdapterAddresses,
|
||||||
|
&OutBufferLength);
|
||||||
|
|
||||||
|
if (RetVal != ERROR_BUFFER_OVERFLOW)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AdapterAddresses != nullptr)
|
||||||
|
{
|
||||||
|
FREE(AdapterAddresses);
|
||||||
|
}
|
||||||
|
|
||||||
|
AdapterAddresses = (PIP_ADAPTER_ADDRESSES)MALLOC(OutBufferLength);
|
||||||
|
if (AdapterAddresses == nullptr)
|
||||||
|
{
|
||||||
|
RetVal = GetLastError();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (RetVal == NO_ERROR)
|
||||||
|
{
|
||||||
|
unsigned long dwBestIfIndex = 0;
|
||||||
|
IPAddr dwDestAddr = (IPAddr)0x08080808;
|
||||||
|
// If successful, output some information from the data we received
|
||||||
|
PIP_ADAPTER_ADDRESSES AdapterList = AdapterAddresses;
|
||||||
|
if (GetBestInterface(dwDestAddr, &dwBestIfIndex) == NO_ERROR)
|
||||||
|
{
|
||||||
|
while (AdapterList)
|
||||||
|
{
|
||||||
|
if (AdapterList->IfIndex == dwBestIfIndex &&
|
||||||
|
AdapterList->FirstDnsServerAddress &&
|
||||||
|
AdapterList->OperStatus == IfOperStatusUp)
|
||||||
|
{
|
||||||
|
INFO_LOG(WII_IPC_NET, "Name of valid interface: %S", AdapterList->FriendlyName);
|
||||||
|
INFO_LOG(WII_IPC_NET, "DNS: %u.%u.%u.%u",
|
||||||
|
(unsigned char)AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[2],
|
||||||
|
(unsigned char)AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[3],
|
||||||
|
(unsigned char)AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[4],
|
||||||
|
(unsigned char)AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[5]);
|
||||||
|
address = Common::swap32(*(u32*)(&AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[2]));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
AdapterList = AdapterList->Next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (AdapterAddresses != nullptr)
|
if (AdapterAddresses != nullptr)
|
||||||
{
|
{
|
||||||
FREE(AdapterAddresses);
|
FREE(AdapterAddresses);
|
||||||
}
|
}
|
||||||
|
|
||||||
AdapterAddresses = (PIP_ADAPTER_ADDRESSES)MALLOC(OutBufferLength);
|
|
||||||
if (AdapterAddresses == nullptr)
|
|
||||||
{
|
|
||||||
RetVal = GetLastError();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (RetVal == NO_ERROR)
|
|
||||||
{
|
|
||||||
unsigned long dwBestIfIndex = 0;
|
|
||||||
IPAddr dwDestAddr = (IPAddr)0x08080808;
|
|
||||||
// If successful, output some information from the data we received
|
|
||||||
PIP_ADAPTER_ADDRESSES AdapterList = AdapterAddresses;
|
|
||||||
if (GetBestInterface(dwDestAddr, &dwBestIfIndex) == NO_ERROR)
|
|
||||||
{
|
|
||||||
while (AdapterList)
|
|
||||||
{
|
|
||||||
if (AdapterList->IfIndex == dwBestIfIndex &&
|
|
||||||
AdapterList->FirstDnsServerAddress &&
|
|
||||||
AdapterList->OperStatus == IfOperStatusUp)
|
|
||||||
{
|
|
||||||
INFO_LOG(WII_IPC_NET, "Name of valid interface: %S", AdapterList->FriendlyName);
|
|
||||||
INFO_LOG(WII_IPC_NET, "DNS: %u.%u.%u.%u",
|
|
||||||
(unsigned char)AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[2],
|
|
||||||
(unsigned char)AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[3],
|
|
||||||
(unsigned char)AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[4],
|
|
||||||
(unsigned char)AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[5]);
|
|
||||||
address = Common::swap32(*(u32*)(&AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[2]));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
AdapterList = AdapterList->Next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (AdapterAddresses != nullptr)
|
|
||||||
{
|
|
||||||
FREE(AdapterAddresses);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (address == 0)
|
if (address == 0)
|
||||||
|
@ -562,11 +562,6 @@ void WiiSockMan::AddSocket(s32 fd)
|
|||||||
|
|
||||||
s32 WiiSockMan::NewSocket(s32 af, s32 type, s32 protocol)
|
s32 WiiSockMan::NewSocket(s32 af, s32 type, s32 protocol)
|
||||||
{
|
{
|
||||||
if (Core::g_want_determinism)
|
|
||||||
{
|
|
||||||
return SO_ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
s32 fd = (s32)socket(af, type, protocol);
|
s32 fd = (s32)socket(af, type, protocol);
|
||||||
s32 ret = GetNetErrorCode(fd, "NewSocket", false);
|
s32 ret = GetNetErrorCode(fd, "NewSocket", false);
|
||||||
AddSocket(ret);
|
AddSocket(ret);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user