From 40e6e9b9fae6939d92a6c5949f97dd072d30e80a Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sat, 18 Feb 2012 09:46:58 +0100 Subject: [PATCH] Fix Linux build --- CMakeLists.txt | 2 ++ Source/Core/Core/CMakeLists.txt | 4 ++-- Source/Core/Core/Src/IPC_HLE/ICMP.h | 7 ++++++- Source/Core/Core/Src/IPC_HLE/ICMPLin.cpp | 16 ++++++++++++++++ .../Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp | 19 ++++++++++++++++++- 5 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 Source/Core/Core/Src/IPC_HLE/ICMPLin.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 80584b2555..40dba79f61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -331,6 +331,8 @@ if(OPROFILING) endif() endif() +include(FindOpenSSL REQUIRED) + ######################################## # Setup include directories (and make sure they are preferred over the Externals) # diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 2d3e457034..c85de85e19 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -26,7 +26,6 @@ set(SRCS Src/ActionReplay.cpp Src/Boot/Boot_ELF.cpp Src/Boot/Boot_WiiWAD.cpp Src/Boot/ElfReader.cpp - Src/Boot/SettingsHandler.cpp Src/Debugger/Debugger_SymbolMap.cpp Src/Debugger/Dump.cpp Src/Debugger/PPCDebugInterface.cpp @@ -134,6 +133,7 @@ set(SRCS Src/ActionReplay.cpp Src/HW/WiimoteEmu/Encryption.cpp Src/HW/WiimoteEmu/Speaker.cpp Src/HW/WiimoteReal/WiimoteReal.cpp + Src/IPC_HLE/ICMPLin.cpp Src/IPC_HLE/WII_IPC_HLE.cpp Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp @@ -194,7 +194,7 @@ set(SRCS Src/ActionReplay.cpp Src/PowerPC/JitCommon/JitCache.cpp Src/PowerPC/JitCommon/Jit_Util.cpp) -set(LIBS bdisasm inputcommon videoogl videosoftware sfml-network ssl) +set(LIBS bdisasm inputcommon videoogl videosoftware sfml-network ${OPENSSL_LIBRARIES}) if(WIN32) set(SRCS ${SRCS} Src/HW/BBA-TAP/TAP_Win32.cpp Src/stdafx.cpp diff --git a/Source/Core/Core/Src/IPC_HLE/ICMP.h b/Source/Core/Core/Src/IPC_HLE/ICMP.h index c04e74ae0c..b446c63336 100644 --- a/Source/Core/Core/Src/IPC_HLE/ICMP.h +++ b/Source/Core/Core/Src/IPC_HLE/ICMP.h @@ -1,10 +1,15 @@ -#pragma once +#ifndef _ICMP_H_ +#define _ICMP_H_ #ifdef _WIN32 #include +#else +#include #endif #include "Common.h" int icmp_echo_req(const u32 s, const sockaddr_in *addr, const u8 *data, const u32 data_length); int icmp_echo_rep(const u32 s, sockaddr_in *addr, const u32 timeout, const u32 data_length); + +#endif diff --git a/Source/Core/Core/Src/IPC_HLE/ICMPLin.cpp b/Source/Core/Core/Src/IPC_HLE/ICMPLin.cpp new file mode 100644 index 0000000000..5e5430deaa --- /dev/null +++ b/Source/Core/Core/Src/IPC_HLE/ICMPLin.cpp @@ -0,0 +1,16 @@ +#include "ICMP.h" + +// Currently stubbed. AFAIK (delroth) there is no way to send ICMP echo +// requests without being root on current Linux versions. + +int icmp_echo_req(const u32 s, const sockaddr_in *addr, const u8 *data, const u32 data_length) +{ + // TODO + return -1; +} + +int icmp_echo_rep(const u32 s, sockaddr_in *addr, const u32 timeout, const u32 data_length) +{ + // TODO + return -1; +} 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 1d2af7946a..a87adb61e9 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 @@ -1011,7 +1011,11 @@ u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command, case IOCTL_SO_ICMPCLOSE: { u32 sock = Memory::Read_U32(_BufferIn); +#ifdef _WIN32 u32 ret = closesocket(sock); +#else + u32 ret = close(sock); +#endif DEBUG_LOG(WII_IPC_NET, "IOCTL_SO_ICMPCLOSE(%x) %x", sock, ret); return getNetErrorCode(ret, "IOCTL_SO_ICMPCLOSE", false); } @@ -1242,10 +1246,17 @@ u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommandV(SIOCtlVBuffer& CommandBuffer "IOCTLV_SO_SENDTO = %d Socket: %08x, BufferIn: (%08x, %i), BufferIn2: (%08x, %i), %u.%u.%u.%u", ret, Common::swap32(params.socket), _BufferIn, BufferInSize, _BufferIn2, BufferInSize2, +#ifdef _WIN32 addr->sin_addr.S_un.S_un_b.s_b1, addr->sin_addr.S_un.S_un_b.s_b2, addr->sin_addr.S_un.S_un_b.s_b3, addr->sin_addr.S_un.S_un_b.s_b4 +#else + addr->sin_addr.s_addr & 0xFF, + (addr->sin_addr.s_addr >> 8) & 0xFF, + (addr->sin_addr.s_addr >> 16) & 0xFF, + (addr->sin_addr.s_addr >> 24) & 0xFF +#endif ); return getNetErrorCode(ret, "SO_SENDTO", true); @@ -1432,7 +1443,11 @@ u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommandV(SIOCtlVBuffer& CommandBuffer sockaddr_in addr; addr.sin_family = AF_INET; +#ifdef _WIN32 addr.sin_addr.S_un.S_addr = Common::swap32(ip_info.ip); +#else + addr.sin_addr.s_addr = Common::swap32(ip_info.ip); +#endif memset(addr.sin_zero, 0, 8); u8 data[0x20]; @@ -1487,7 +1502,9 @@ u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommandV(SIOCtlVBuffer& CommandBuffer bool CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress) { - u32 return_value = ExecuteCommandV(SIOCtlVBuffer(CommandAddress)); + SIOCtlVBuffer buf(CommandAddress); + + u32 return_value = ExecuteCommandV(buf); Memory::Write_U32(return_value, CommandAddress + 4); return true; }