summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2012-02-19 19:30:37 +0100
committerPierre Bourdon <delroth@gmail.com>2012-02-19 19:37:56 +0100
commit81d7eefd6ab070854b42e48dafaf726642b010d2 (patch)
treede95b7241325f7979aea621c90aa3c9439fd84bb /Source/Core
parent87456054d6fe82f92137e22ab9043f712d0cea5f (diff)
Correctly map Wii/native socket level and optname for GETSOCKOPT
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp
index a0c78e4a65..74a343e4d5 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp
@@ -561,17 +561,6 @@ static int getNetErrorCode(int ret, std::string caller, bool isRW)
#undef EITHER
}
-static int convertWiiSockOpt(int level, int optname)
-{
- switch (optname)
- {
- case 0x1009:
- return 0x1007; //SO_ERROR
- default:
- return optname;
- }
-}
-
static int inet_pton(const char *src, unsigned char *dst)
{
static const char digits[] = "0123456789";
@@ -764,12 +753,21 @@ u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command,
sock, level, optname,
_BufferIn, BufferInSize, _BufferOut, BufferOutSize);
- optname = convertWiiSockOpt(level,optname);
+ // Do the level/optname translation
+ int nat_level = -1, nat_optname = -1;
+
+ 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 (opt_name_mapping) / sizeof (opt_name_mapping[0]); ++i)
+ if (optname == opt_name_mapping[i][1])
+ nat_optname = opt_name_mapping[i][0];
u8 optval[20];
u32 optlen = 4;
- int ret = getsockopt (sock, level, optname, (char *) &optval, (socklen_t*)&optlen);
+ int ret = getsockopt (sock, nat_level, nat_optname, (char *) &optval, (socklen_t*)&optlen);
ret = getNetErrorCode(ret, "SO_GETSOCKOPT", false);