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:
comex 2014-11-17 13:40:59 -05:00
parent 3173d4dcbf
commit f6c6822f71
2 changed files with 62 additions and 57 deletions

View File

@ -644,6 +644,13 @@ static unsigned int opt_name_mapping[][2] = {
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 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
@ -1222,6 +1229,8 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress)
{
u32 address = 0;
#ifdef _WIN32
if (!Core::g_want_determinism)
{
PIP_ADAPTER_ADDRESSES AdapterAddresses = nullptr;
ULONG OutBufferLength = 0;
ULONG RetVal = 0, i;
@ -1282,6 +1291,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress)
{
FREE(AdapterAddresses);
}
}
#endif
if (address == 0)
address = 0x08080808;

View File

@ -562,11 +562,6 @@ void WiiSockMan::AddSocket(s32 fd)
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 ret = GetNetErrorCode(fd, "NewSocket", false);
AddSocket(ret);