Fix Linux build

This commit is contained in:
Pierre Bourdon 2012-02-18 09:46:58 +01:00
parent ede0889e3d
commit 40e6e9b9fa
5 changed files with 44 additions and 4 deletions

View File

@ -331,6 +331,8 @@ if(OPROFILING)
endif()
endif()
include(FindOpenSSL REQUIRED)
########################################
# Setup include directories (and make sure they are preferred over the Externals)
#

View File

@ -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

View File

@ -1,10 +1,15 @@
#pragma once
#ifndef _ICMP_H_
#define _ICMP_H_
#ifdef _WIN32
#include <winsock2.h>
#else
#include <netinet/in.h>
#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

View File

@ -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;
}

View File

@ -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;
}