From f86782cc2e2a69c006ff969560a64b4e51c55526 Mon Sep 17 00:00:00 2001 From: StapleButter Date: Tue, 26 Mar 2019 01:58:03 +0100 Subject: [PATCH] make it compile under Linux. it shits itself tho. --- CMakeLists.txt | 4 ++++ src/libui_sdl/LAN_PCap.cpp | 2 +- src/libui_sdl/LAN_Socket.cpp | 19 +++++++++++-------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5944545c..0dbf0432 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,9 +8,13 @@ PROJECT(${PROJECT_WX}) SET(SOURCES src/libui_sdl/main.cpp src/libui_sdl/Platform.cpp + src/libui_sdl/PlatformConfig.cpp + src/libui_sdl/LAN_Socket.cpp + src/libui_sdl/LAN_PCap.cpp src/libui_sdl/DlgAudioSettings.cpp src/libui_sdl/DlgEmuSettings.cpp src/libui_sdl/DlgInputConfig.cpp + src/libui_sdl/DlgWifiSettings.cpp src/ARM.cpp src/ARMInterpreter.cpp src/ARMInterpreter_ALU.cpp diff --git a/src/libui_sdl/LAN_PCap.cpp b/src/libui_sdl/LAN_PCap.cpp index c7f3a5a8..9d4f68c5 100644 --- a/src/libui_sdl/LAN_PCap.cpp +++ b/src/libui_sdl/LAN_PCap.cpp @@ -23,7 +23,7 @@ #include #include #include -#include "Wifi.h" +#include "../Wifi.h" #include "LAN_PCap.h" #include "PlatformConfig.h" diff --git a/src/libui_sdl/LAN_Socket.cpp b/src/libui_sdl/LAN_Socket.cpp index 3f362cae..a9f2cd7a 100644 --- a/src/libui_sdl/LAN_Socket.cpp +++ b/src/libui_sdl/LAN_Socket.cpp @@ -21,7 +21,7 @@ #include #include #include -#include "Wifi.h" +#include "../Wifi.h" #include "LAN_Socket.h" #include "../Config.h" @@ -34,8 +34,10 @@ #include #include #include + #include #include #include + #include #define socket_t int #define sockaddr_t struct sockaddr #define closesocket close @@ -82,7 +84,7 @@ typedef struct // 1: connected u8 Status; - SOCKET Backend; + socket_t Backend; } TCPSocket; @@ -92,7 +94,7 @@ typedef struct u16 SourcePort; u16 DestPort; - SOCKET Backend; + socket_t Backend; struct sockaddr_in BackendAddr; } UDPSocket; @@ -456,11 +458,12 @@ void HandleDNSFrame(u8* data, int len) while (p) { struct sockaddr_in* addr = (struct sockaddr_in*)p->ai_addr; - printf(" -> %d.%d.%d.%d", + /*printf(" -> %d.%d.%d.%d", 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); + addr->sin_addr.S_un.S_un_b.s_b3, addr->sin_addr.S_un.S_un_b.s_b4);*/ - addr_res = addr->sin_addr.S_un.S_addr; + //addr_res = addr->sin_addr.S_un.S_addr; + addr_res = *(u32*)&addr->sin_addr; p = p->ai_next; } } @@ -601,7 +604,7 @@ void HandleUDPFrame(u8* data, int len) sock->BackendAddr.sin_family = AF_INET; sock->BackendAddr.sin_port = htons(dstport); memcpy(&sock->BackendAddr.sin_addr, &ipheader[16], 4); - /*if (bind(sock->Backend, (struct sockaddr*)&sock->BackendAddr, sizeof(sock->BackendAddr)) == SOCKET_ERROR) + /*if (bind(sock->Backend, (struct sockaddr*)&sock->BackendAddr, sizeof(sock->BackendAddr)) == -1) { printf("bind() shat itself :(\n"); }*/ @@ -869,7 +872,7 @@ void HandleTCPFrame(u8* data, int len) conn_addr.sin_family = AF_INET; memcpy(&conn_addr.sin_addr, &ipheader[16], 4); conn_addr.sin_port = htons(dstport); - if (connect(sock->Backend, (sockaddr*)&conn_addr, sizeof(conn_addr)) == SOCKET_ERROR) + if (connect(sock->Backend, (sockaddr*)&conn_addr, sizeof(conn_addr)) == -1) { printf("connect() shat itself :(\n"); }