Move the sockopt mapping to the toplevel (needed for GETSOCKOPT too)
This commit is contained in:
parent
2c9109936c
commit
87456054d6
|
@ -609,6 +609,19 @@ static int inet_pton(const char *src, unsigned char *dst)
|
|||
return (1);
|
||||
}
|
||||
|
||||
// Maps SOCKOPT level from native to Wii
|
||||
static int opt_level_mapping[][2] = {
|
||||
{ SOL_SOCKET, 0xFFFF }
|
||||
};
|
||||
|
||||
// Maps SOCKOPT optname from native to Wii
|
||||
static int opt_name_mapping[][2] = {
|
||||
{ SO_REUSEADDR, 0x4 },
|
||||
{ SO_SNDBUF, 0x1001 },
|
||||
{ SO_RCVBUF, 0x1002 },
|
||||
{ SO_ERROR, 0x1009 }
|
||||
};
|
||||
|
||||
u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command,
|
||||
u32 _BufferIn, u32 BufferInSize,
|
||||
u32 _BufferOut, u32 BufferOutSize)
|
||||
|
@ -773,18 +786,6 @@ u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command,
|
|||
|
||||
case IOCTL_SO_SETSOCKOPT:
|
||||
{
|
||||
// Maps level from native to Wii
|
||||
int level_mapping[][2] = {
|
||||
{ SOL_SOCKET, 0xFFFF }
|
||||
};
|
||||
|
||||
// Maps optname from native to Wii
|
||||
int optname_mapping[][2] = {
|
||||
{ SO_REUSEADDR, 0x4 },
|
||||
{ SO_SNDBUF, 0x1001 },
|
||||
{ SO_RCVBUF, 0x1002 },
|
||||
};
|
||||
|
||||
u32 S = Memory::Read_U32(_BufferIn);
|
||||
u32 level = Memory::Read_U32(_BufferIn + 4);
|
||||
u32 optname = Memory::Read_U32(_BufferIn + 8);
|
||||
|
@ -804,13 +805,13 @@ u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command,
|
|||
// Do the level/optname translation
|
||||
int nat_level = -1, nat_optname = -1;
|
||||
|
||||
for (int i = 0; i < sizeof (level_mapping) / sizeof (level_mapping[0]); ++i)
|
||||
if (level == level_mapping[i][1])
|
||||
nat_level = level_mapping[i][0];
|
||||
for (int i = 0; i < sizeof (opt_level_mapping) / sizeof (opt_level_mapping[0]); ++i)
|
||||
if (level == opt_level_mapping[i][1])
|
||||
nat_level = opt_level_mapping[i][0];
|
||||
|
||||
for (int i = 0; i < sizeof (optname_mapping) / sizeof (optname_mapping[0]); ++i)
|
||||
if (optname == optname_mapping[i][1])
|
||||
nat_optname = optname_mapping[i][0];
|
||||
for (int i = 0; i < sizeof (opt_name_mapping) / sizeof (opt_name_mapping[0]); ++i)
|
||||
if (optname == opt_name_mapping[i][1])
|
||||
nat_optname = opt_name_mapping[i][0];
|
||||
|
||||
if (nat_level == -1 || nat_optname == -1)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue