diff options
author | StapleButter <thetotalworm@gmail.com> | 2017-09-21 04:42:31 +0200 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2017-09-21 04:42:31 +0200 |
commit | 65b332b15299b58d6cd036ae3e71dff5e1599276 (patch) | |
tree | 89885cca8bceafe5d1a90b600b764cbf3271c2c1 | |
parent | 2eea801d261bbcf1a44c2fd4857832b7b74104fb (diff) |
reenable wifi socket code
-rw-r--r-- | src/libui_sdl/Platform.cpp | 30 | ||||
-rw-r--r-- | src/libui_sdl/main.cpp | 1 |
2 files changed, 15 insertions, 16 deletions
diff --git a/src/libui_sdl/Platform.cpp b/src/libui_sdl/Platform.cpp index 67f136c..cebc74d 100644 --- a/src/libui_sdl/Platform.cpp +++ b/src/libui_sdl/Platform.cpp @@ -23,7 +23,7 @@ #include "../Platform.h" #include "../Config.h" -/*#ifdef __WXMSW__ +#ifdef __WIN32__ #include <winsock2.h> #include <ws2tcpip.h> #define socket_t SOCKET @@ -37,7 +37,7 @@ #define sockaddr_t struct sockaddr #define closesocket close #define pcap_dev_name name -#endif*/ +#endif #ifndef INVALID_SOCKET #define INVALID_SOCKET (socket_t)-1 @@ -66,11 +66,11 @@ int ThreadEntry(void* data) } -/*socket_t MPSocket; +socket_t MPSocket; sockaddr_t MPSendAddr; u8 PacketBuffer[2048]; -#define NIFI_VER 1*/ +#define NIFI_VER 1 void StopEmu() @@ -126,10 +126,10 @@ void Semaphore_Post(void* sema) bool MP_Init() { - /*int opt_true = 1; + int opt_true = 1; int res; -#ifdef __WXMSW__ +#ifdef __WIN32__ WSADATA wsadata; if (WSAStartup(MAKEWORD(2, 2), &wsadata) != 0) { @@ -173,24 +173,24 @@ bool MP_Init() MPSendAddr.sa_family = AF_INET; *(u32*)&MPSendAddr.sa_data[2] = htonl(INADDR_BROADCAST); - *(u16*)&MPSendAddr.sa_data[0] = htons(7064);*/ + *(u16*)&MPSendAddr.sa_data[0] = htons(7064); return true; } void MP_DeInit() { - /*if (MPSocket >= 0) + if (MPSocket >= 0) closesocket(MPSocket); -#ifdef __WXMSW__ +#ifdef __WIN32__ WSACleanup(); -#endif // __WXMSW__*/ +#endif // __WXMSW__ } int MP_SendPacket(u8* data, int len) { - /*if (MPSocket < 0) + if (MPSocket < 0) return 0; if (len > 2048-8) @@ -207,13 +207,12 @@ int MP_SendPacket(u8* data, int len) int slen = sendto(MPSocket, (const char*)PacketBuffer, len+8, 0, &MPSendAddr, sizeof(sockaddr_t)); if (slen < 8) return 0; - return slen - 8;*/ - return 0; + return slen - 8; } int MP_RecvPacket(u8* data, bool block) { - /*if (MPSocket < 0) + if (MPSocket < 0) return 0; fd_set fd; @@ -254,8 +253,7 @@ int MP_RecvPacket(u8* data, bool block) } memcpy(data, &PacketBuffer[8], rlen); - return rlen;*/ - return 0; + return rlen; } diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index 16fe070..48c5987 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -423,6 +423,7 @@ int main(int argc, char** argv) uiMenuItemDisable(MenuItem_Pause); uiMenuItemDisable(MenuItem_Reset); + uiMenuItemDisable(MenuItem_Stop); uiAreaHandler areahandler; |