Mercurial > repos > blastem
diff megawifi.c @ 1546:1a09422b87a5
Get Windows build working again. MegaWiFi code probably needs more work before it will actually work on Windows, but at least it doesn't break the build now
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 26 Mar 2018 21:25:40 -0700 |
parents | 2781b9551004 |
children | 6d99bdbf1e3e |
line wrap: on
line diff
--- a/megawifi.c Mon Mar 26 09:49:03 2018 -0700 +++ b/megawifi.c Mon Mar 26 21:25:40 2018 -0700 @@ -2,9 +2,15 @@ #include <stdint.h> #include <string.h> #include <sys/types.h> +#ifdef _WIN32 +#define WINVER 0x501 +#include <winsock2.h> +#include <ws2tcpip.h> +#else #include <sys/socket.h> #include <unistd.h> #include <netinet/in.h> +#endif #include <errno.h> #include <fcntl.h> #include "genesis.h" @@ -125,7 +131,10 @@ int res = accept(mw->sock_fds[channel], NULL, NULL); if (res >= 0) { close(mw->sock_fds[channel]); +#ifndef _WIN32 +//FIXME: Set nonblocking on Windows too fcntl(res, F_SETFL, O_NONBLOCK); +#endif mw->sock_fds[channel] = res; mw->channel_state[channel] = 2; mw->channel_flags |= 1 << (channel + 1); @@ -284,7 +293,10 @@ } else { mw->channel_flags |= 1 << (channel + 1); mw->channel_state[channel] = 1; +#ifndef _WIN32 +//FIXME: Set nonblocking on Windows too fcntl(mw->sock_fds[channel], F_SETFL, O_NONBLOCK); +#endif } end_reply(mw); break;