diff options
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/libui_sdl/LAN_PCap.cpp | 2 | ||||
-rw-r--r-- | src/libui_sdl/LAN_Socket.cpp | 19 |
3 files changed, 16 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5944545..0dbf043 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 c7f3a5a..9d4f68c 100644 --- a/src/libui_sdl/LAN_PCap.cpp +++ b/src/libui_sdl/LAN_PCap.cpp @@ -23,7 +23,7 @@ #include <string.h> #include <SDL2/SDL.h> #include <pcap/pcap.h> -#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 3f362ca..a9f2cd7 100644 --- a/src/libui_sdl/LAN_Socket.cpp +++ b/src/libui_sdl/LAN_Socket.cpp @@ -21,7 +21,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "Wifi.h" +#include "../Wifi.h" #include "LAN_Socket.h" #include "../Config.h" @@ -34,8 +34,10 @@ #include <unistd.h> #include <arpa/inet.h> #include <netinet/in.h> + #include <sys/types.h> #include <sys/select.h> #include <sys/socket.h> + #include <netdb.h> #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"); } |