shithub: duke3d

Download patch

ref: 61afb65d1e3cf0733b9fc1e1d185c269cc07ebc9
parent: ffc983f648b2d64e3b983370667329b3f79ace87
author: Jacob Moody <[email protected]>
date: Sun Feb 5 21:06:59 EST 2023

hacky ifdef disable of network

--- a/Engine/src/mkfile
+++ b/Engine/src/mkfile
@@ -10,7 +10,7 @@
 	engine.$O \
 	filesystem.$O \
 	fixedPoint_math.$O \
-#TODO	mmulti.$O \
+	mmulti.$O \
 	tiles.$O \
 	
 HFILES=\
--- a/Engine/src/mmulti.c
+++ b/Engine/src/mmulti.c
@@ -261,7 +261,7 @@
 
 	}
 
-	dacrc = getcrc(gcom->buffer,(short)k);
+	dacrc = getcrc((uchar*)gcom->buffer,(short)k);
 	gcom->buffer[k++] = (dacrc&255);
 	gcom->buffer[k++] = (dacrc>>8);
 
@@ -350,7 +350,7 @@
 	tempbuf[1] = myconnectindex;
 	for(i=connecthead;i>=0;i=connectpoint2[i])
 		if (i != myconnectindex)
-			sendpacket(i,tempbuf,2L);
+			sendpacket(i,(uchar*)tempbuf,2L);
 }
 
 int32_t getoutputcirclesize(void)
@@ -413,7 +413,7 @@
 
 	dacrc = ((unsigned short)gcom->buffer[messleng-2]);
 	dacrc += (((unsigned short)gcom->buffer[messleng-1])<<8);
-	if (dacrc != getcrc(gcom->buffer,(short)(messleng-2)))        /* CRC check */
+	if (dacrc != getcrc((uchar*)gcom->buffer,(short)(messleng-2)))        /* CRC check */
 	{
 #if (PRINTERRORS)
 		printf("\n%ld CRC",gcom->buffer[0]);
@@ -452,7 +452,7 @@
 				{
 								 /* GOOD! Take second half of double packet */
 #if (PRINTERRORS)
-					printf("\n%ld-%ld .� ",gcom->buffer[0],(gcom->buffer[0]+1)&255);
+					printf("\n%ld-%ld .� ",gcom->buffer[0],(gcom->buffer[0]+1)&255);
 #endif
 					messleng = ((long)gcom->buffer[3]) + (((long)gcom->buffer[4])<<8);
 					lastpacketleng = gcom->numbytes-7-messleng;
@@ -472,7 +472,7 @@
 	if ((gcom->buffer[1]&128) == 0)           /* Single packet */
 	{
 #if (PRINTERRORS)
-		printf("\n%ld �  ",gcom->buffer[0]);
+		printf("\n%ld �  ",gcom->buffer[0]);
 #endif
 
 		messleng = gcom->numbytes-5;
@@ -485,7 +485,7 @@
 
 														 /* Double packet */
 #if (PRINTERRORS)
-	printf("\n%ld-%ld �� ",gcom->buffer[0],(gcom->buffer[0]+1)&255);
+	printf("\n%ld-%ld �� ",gcom->buffer[0],(gcom->buffer[0]+1)&255);
 #endif
 
 	messleng = ((long)gcom->buffer[3]) + (((long)gcom->buffer[4])<<8);
@@ -547,6 +547,14 @@
 #  define neterrno() WSAGetLastError()
 #  define sockettype SOCKET
 #  define socketclose(x) closesocket(x)
+#elif defined(__plan9__)
+#  define sockettype int
+#  define neterrno() (0)
+#  define socketclose(x) close(x)
+#  define socklen_t long
+struct sockaddr_in {
+	int x;
+};
 #else
 #  include <arpa/inet.h>
 #  include <netinet/in.h>
@@ -659,6 +667,10 @@
 
 static int send_udp_packet(int ip, short port, void *pkt, size_t pktsize)
 {
+
+#ifdef __plan9__
+    return 0;
+#else
     /* !!! FIXME: See if this would ever block. */
     /* !!! FIXME: See if this would send a partial packet. */
     struct sockaddr_in addr;
@@ -682,6 +694,7 @@
 /*printf("Sent %d byte packet to %s:%d\n", (int) pktsize, static_ipstring(ip), (int) port);*/
 
     return(1);
+#endif
 }
 
 
@@ -700,6 +713,10 @@
     int valid = 0;
     int i;
 
+#ifdef __plan9__
+    return -1;
+#else
+
     /* FIXME: Will this ever receive a partial packet? */
     int rc = recvfrom(udpsocket, pkt, pktsize, 0,
                       (struct sockaddr *) &addr, (int *)&fromlen);
@@ -811,6 +828,7 @@
 //else printf("Got %d byte packet from %s:%d\n", (int) rc, static_ipstring(*ip), (int) port);
 	//printf( "IP from client %d", *ip);
     return(rc);
+#endif
 }
 
 
@@ -880,6 +898,10 @@
     unsigned long flags;
     int rc = 0;
 
+#ifdef __plan9__
+    return -1;
+#else
+
     /* set socket to be (non-)blocking. */
 
 #if WIN32
@@ -904,6 +926,7 @@
     }
 
     return(rc);
+#endif
 }
 
 
@@ -912,6 +935,10 @@
     int f = (onOrOff) ? 1 : 0;
     int rc;
 
+#ifdef __plan9__
+    return 1;
+#else
+
     /* give socket clearance to broadcast. */
     rc = setsockopt(udpsocket, SOL_SOCKET, SO_BROADCAST, (char *)(&f), sizeof (f)) == 0;
     if (!rc)
@@ -921,6 +948,7 @@
     }
 
     return(rc);
+#endif
 }
 
 
@@ -931,6 +959,10 @@
     printf("Setting up UDP interface %s:%d...\n", static_ipstring(ip), port);
 	printf("Stun is currently %s\n", (g_bStun) ? "Enabled":"Disabled");
 
+#ifdef __plan9__
+    return 0;
+#else
+
     udpsocket = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
 
 #if WIN32
@@ -965,6 +997,7 @@
     }
 
     return(1);
+#endif
 }
 
 /* server init. */
@@ -1472,6 +1505,11 @@
 {
     gcomtype *retval;
 
+#ifdef __plan9__
+    printf("NETWORK TRANSIT: PORT ME!\n");
+    return nil;
+#else
+
     printf("UDP NETWORK TRANSPORT INITIALIZING...\n");
 
     ctrlc_pressed = 0;
@@ -1506,6 +1544,7 @@
     }
 
     return(retval);
+#endif
 }