diff options
author | Vencislav Atanasov <user890104@freemyipod.org> | 2019-07-28 23:31:50 +0300 |
---|---|---|
committer | Vencislav Atanasov <user890104@freemyipod.org> | 2019-07-29 01:59:40 +0300 |
commit | 183e45e8d0b4425bbd41fab37f2a4dc143e1e27c (patch) | |
tree | 5e25c211f6a3bd46dc594123451af00c1bf7ef9c /apps/plugins/sdl/progs/duke3d/Engine/src/mmulti.c | |
parent | e19857e712ff54cec08d5a6342a32dae2788cb50 (diff) | |
download | rockbox-183e45e8d0b4425bbd41fab37f2a4dc143e1e27c.tar.gz rockbox-183e45e8d0b4425bbd41fab37f2a4dc143e1e27c.zip |
sdl: Remove platform-specific code
Also nuke the Makefiles of Duke Nukem 3D (pun intended).
Change-Id: If2707cf079bfb9299347f9c5f980780134b6ecda
Diffstat (limited to 'apps/plugins/sdl/progs/duke3d/Engine/src/mmulti.c')
-rw-r--r-- | apps/plugins/sdl/progs/duke3d/Engine/src/mmulti.c | 118 |
1 files changed, 0 insertions, 118 deletions
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/mmulti.c b/apps/plugins/sdl/progs/duke3d/Engine/src/mmulti.c index dea2b7d35c..9d2afe9d33 100644 --- a/apps/plugins/sdl/progs/duke3d/Engine/src/mmulti.c +++ b/apps/plugins/sdl/progs/duke3d/Engine/src/mmulti.c | |||
@@ -557,49 +557,8 @@ void deinit_network_transport(gcomtype *gcom) | |||
557 | 557 | ||
558 | void unstable_callcommit(void){} | 558 | void unstable_callcommit(void){} |
559 | 559 | ||
560 | #elif (defined PLATFORM_DOS) | ||
561 | gcomtype *init_network_transport(char **ARGV, int argpos) | ||
562 | { | ||
563 | /* | ||
564 | * How to talk to COMMIT is passed as a pointer to a block of memory | ||
565 | * that COMMIT.EXE configures... | ||
566 | */ | ||
567 | return((gcomtype *)atol(ARGV[argpos])); /* UGH! --ryan. */ | ||
568 | } /* init_network_transport */ | ||
569 | |||
570 | static union REGS regs; | ||
571 | |||
572 | #pragma aux longcall =\ | ||
573 | "call eax",\ | ||
574 | parm [eax] | ||
575 | |||
576 | void callcommit(void) | ||
577 | { | ||
578 | if (gcom->intnum&0xff00) | ||
579 | longcall(gcom->longcalladdress); | ||
580 | else | ||
581 | int386(gcom->intnum,®s,®s); | ||
582 | } | ||
583 | |||
584 | void deinit_network_transport(gcomtype *gcom) | ||
585 | { | ||
586 | /* no-op, apparently. */ | ||
587 | } | ||
588 | |||
589 | |||
590 | #elif UDP_NETWORKING | 560 | #elif UDP_NETWORKING |
591 | 561 | ||
592 | #if PLATFORM_WIN32 | ||
593 | # include <winsock.h> | ||
594 | # define EAGAIN WSAEWOULDBLOCK | ||
595 | # define EWOULDBLOCK WSAEWOULDBLOCK | ||
596 | # define ECONNREFUSED WSAECONNRESET | ||
597 | # define socklen_t size_t | ||
598 | # define netstrerror() win32netstrerror() | ||
599 | # define neterrno() WSAGetLastError() | ||
600 | # define sockettype SOCKET | ||
601 | # define socketclose(x) closesocket(x) | ||
602 | #else | ||
603 | # include <sys/types.h> | 562 | # include <sys/types.h> |
604 | # include <sys/socket.h> | 563 | # include <sys/socket.h> |
605 | # include <netinet/in.h> | 564 | # include <netinet/in.h> |
@@ -618,7 +577,6 @@ void deinit_network_transport(gcomtype *gcom) | |||
618 | # ifndef MSG_ERRQUEUE /* legacy glibc header workaround... */ | 577 | # ifndef MSG_ERRQUEUE /* legacy glibc header workaround... */ |
619 | # define MSG_ERRQUEUE 0x2000 | 578 | # define MSG_ERRQUEUE 0x2000 |
620 | # endif | 579 | # endif |
621 | #endif | ||
622 | 580 | ||
623 | #define SOCKET_SHUTDOWN_BOTH 2 | 581 | #define SOCKET_SHUTDOWN_BOTH 2 |
624 | 582 | ||
@@ -650,47 +608,6 @@ static void siginthandler(int sigint) | |||
650 | ctrlc_pressed = 1; | 608 | ctrlc_pressed = 1; |
651 | } | 609 | } |
652 | 610 | ||
653 | #if PLATFORM_WIN32 | ||
654 | /* | ||
655 | * Figure out what the last failing Win32 API call was, and | ||
656 | * generate a human-readable string for the error message. | ||
657 | * | ||
658 | * The return value is a static buffer that is overwritten with | ||
659 | * each call to this function. | ||
660 | * | ||
661 | * Code lifted from PhysicsFS: http://icculus.org/physfs/ | ||
662 | */ | ||
663 | static const char *win32netstrerror(void) | ||
664 | { | ||
665 | static TCHAR msgbuf[255]; | ||
666 | TCHAR *ptr = msgbuf; | ||
667 | |||
668 | FormatMessage( | ||
669 | FORMAT_MESSAGE_FROM_SYSTEM | | ||
670 | FORMAT_MESSAGE_IGNORE_INSERTS, | ||
671 | NULL, | ||
672 | WSAGetLastError(), /*GetLastError(),*/ | ||
673 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ | ||
674 | msgbuf, | ||
675 | sizeof (msgbuf) / sizeof (TCHAR), | ||
676 | NULL | ||
677 | ); | ||
678 | |||
679 | /* chop off newlines. */ | ||
680 | for (ptr = msgbuf; *ptr; ptr++) | ||
681 | { | ||
682 | if ((*ptr == '\n') || (*ptr == '\r')) | ||
683 | { | ||
684 | *ptr = ' '; | ||
685 | break; | ||
686 | } /* if */ | ||
687 | } /* for */ | ||
688 | |||
689 | return((const char *) msgbuf); | ||
690 | } /* win32strerror */ | ||
691 | #endif | ||
692 | |||
693 | |||
694 | typedef enum | 611 | typedef enum |
695 | { | 612 | { |
696 | udpmode_peer, | 613 | udpmode_peer, |
@@ -758,7 +675,6 @@ static int get_udp_packet(int *ip, short *_port, void *pkt, size_t pktsize) | |||
758 | if (rc == -1) | 675 | if (rc == -1) |
759 | err = neterrno(); | 676 | err = neterrno(); |
760 | 677 | ||
761 | #if !PLATFORM_WIN32 | ||
762 | /* !!! FIXME: Linux specific? */ | 678 | /* !!! FIXME: Linux specific? */ |
763 | if (rc == -1) /* fill in the addr structure on error... */ | 679 | if (rc == -1) /* fill in the addr structure on error... */ |
764 | { | 680 | { |
@@ -766,7 +682,6 @@ static int get_udp_packet(int *ip, short *_port, void *pkt, size_t pktsize) | |||
766 | recvfrom(udpsocket, NULL, 0, MSG_ERRQUEUE, | 682 | recvfrom(udpsocket, NULL, 0, MSG_ERRQUEUE, |
767 | (struct sockaddr *) &addr, &l); | 683 | (struct sockaddr *) &addr, &l); |
768 | } | 684 | } |
769 | #endif | ||
770 | 685 | ||
771 | *ip = ntohl(addr.sin_addr.s_addr); | 686 | *ip = ntohl(addr.sin_addr.s_addr); |
772 | port = ntohs(addr.sin_port); | 687 | port = ntohs(addr.sin_port); |
@@ -933,10 +848,6 @@ static int set_socket_blockmode(int onOrOff) | |||
933 | 848 | ||
934 | /* set socket to be (non-)blocking. */ | 849 | /* set socket to be (non-)blocking. */ |
935 | 850 | ||
936 | #if PLATFORM_WIN32 | ||
937 | flags = (onOrOff) ? 0 : 1; | ||
938 | rc = (ioctlsocket(udpsocket, FIONBIO, &flags) == 0); | ||
939 | #else | ||
940 | flags = fcntl(udpsocket, F_GETFL, 0); | 851 | flags = fcntl(udpsocket, F_GETFL, 0); |
941 | if (flags != -1) | 852 | if (flags != -1) |
942 | { | 853 | { |
@@ -946,7 +857,6 @@ static int set_socket_blockmode(int onOrOff) | |||
946 | flags |= O_NONBLOCK; | 857 | flags |= O_NONBLOCK; |
947 | rc = (fcntl(udpsocket, F_SETFL, flags) == 0); | 858 | rc = (fcntl(udpsocket, F_SETFL, flags) == 0); |
948 | } | 859 | } |
949 | #endif | ||
950 | 860 | ||
951 | if (!rc) | 861 | if (!rc) |
952 | { | 862 | { |
@@ -992,13 +902,11 @@ static int open_udp_socket(int ip, int port) | |||
992 | if (!set_socket_blockmode(0)) | 902 | if (!set_socket_blockmode(0)) |
993 | return(0); | 903 | return(0); |
994 | 904 | ||
995 | #if !PLATFORM_WIN32 | ||
996 | { | 905 | { |
997 | /* !!! FIXME: Might be Linux (not Unix, not BSD, not WinSock) specific. */ | 906 | /* !!! FIXME: Might be Linux (not Unix, not BSD, not WinSock) specific. */ |
998 | int flags = 1; | 907 | int flags = 1; |
999 | setsockopt(udpsocket, SOL_IP, IP_RECVERR, &flags, sizeof (flags)); | 908 | setsockopt(udpsocket, SOL_IP, IP_RECVERR, &flags, sizeof (flags)); |
1000 | } | 909 | } |
1001 | #endif | ||
1002 | 910 | ||
1003 | memset(&addr, '\0', sizeof (addr)); | 911 | memset(&addr, '\0', sizeof (addr)); |
1004 | addr.sin_family = AF_INET; | 912 | addr.sin_family = AF_INET; |
@@ -1376,37 +1284,11 @@ static int parse_interface(char *str, int *ip, short *udpport) | |||
1376 | 1284 | ||
1377 | static int initialize_sockets(void) | 1285 | static int initialize_sockets(void) |
1378 | { | 1286 | { |
1379 | #if PLATFORM_WIN32 | ||
1380 | int rc; | ||
1381 | WSADATA data; | ||
1382 | printf("initializing WinSock...\n"); | ||
1383 | rc = WSAStartup(0x0101, &data); | ||
1384 | if (rc != 0) | ||
1385 | { | ||
1386 | printf("WinSock failed to initialize! [err==%d].\n", rc); | ||
1387 | return(0); | ||
1388 | } | ||
1389 | else | ||
1390 | { | ||
1391 | printf("WinSock initialized.\n"); | ||
1392 | printf(" - Caller uses version %d.%d, highest supported is %d.%d.\n", | ||
1393 | data.wVersion >> 8, data.wVersion & 0xFF, | ||
1394 | data.wHighVersion >> 8, data.wHighVersion & 0xFF); | ||
1395 | printf(" - Implementation description: [%s].\n", data.szDescription); | ||
1396 | printf(" - System status: [%s].\n", data.szSystemStatus); | ||
1397 | printf(" - Max sockets: %d.\n", data.iMaxSockets); | ||
1398 | printf(" - Max UDP datagram size: %d.\n", data.iMaxUdpDg); | ||
1399 | } | ||
1400 | #endif | ||
1401 | |||
1402 | return(1); | 1287 | return(1); |
1403 | } | 1288 | } |
1404 | 1289 | ||
1405 | static void deinitialize_sockets(void) | 1290 | static void deinitialize_sockets(void) |
1406 | { | 1291 | { |
1407 | #if PLATFORM_WIN32 | ||
1408 | WSACleanup(); | ||
1409 | #endif | ||
1410 | } | 1292 | } |
1411 | 1293 | ||
1412 | static int parse_udp_config(const char *cfgfile, gcomtype *gcom) | 1294 | static int parse_udp_config(const char *cfgfile, gcomtype *gcom) |