shithub: duke3d

Download patch

ref: 10996a84469e3b0385129942fa9603f40378b7c3
parent: 0204b1e823d9e728cafdd1a9f6a1ff754e997997
author: Tanguy Fautre <[email protected]>
date: Thu Feb 27 16:57:17 EST 2020

Remove the rest of unstable/stable_network shim.

--- a/Engine/CMakeLists.txt
+++ b/Engine/CMakeLists.txt
@@ -18,9 +18,7 @@
 	src/icon.h
 	src/macos_compat.h
 	src/mmulti.c
-	src/mmulti_unstable.h
-	src/network.c
-	src/network.h
+	src/mmulti.h
 	src/platform.h
 	src/sdl_util.h
 	src/tiles.c
--- a/Engine/src/display.c
+++ b/Engine/src/display.c
@@ -17,7 +17,6 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
-#include "platform.h"
 
 #define BUILD_NOMOUSEGRAB    "BUILD_NOMOUSEGRAB"
 #define BUILD_WINDOWED       "BUILD_WINDOWED"
@@ -34,7 +33,6 @@
 #include "display.h"
 #include "fixedPoint_math.h"
 #include "engine.h"
-#include "network.h"
 #include "sdl_util.h"
 #include "icon.h"
 #include "draw.h"
--- a/Engine/src/engine.h
+++ b/Engine/src/engine.h
@@ -137,7 +137,7 @@
 #include "display.h"
 #include "fixedPoint_math.h"
 #include "tiles.h"
-#include "network.h"
+#include "mmulti.h"
     
     
 //Exported for tile module
--- a/Engine/src/mmulti.c
+++ b/Engine/src/mmulti.c
@@ -12,8 +12,7 @@
 #include <stdarg.h>
 #include <ctype.h>
 
-#include "mmulti_unstable.h"
-#include "network.h"
+#include "mmulti.h"
 
 #define MAXPLAYERS 16
 #define BAKSIZ 16384
@@ -117,13 +116,12 @@
 //PacketQueue outgoingPacketQueue;
 //outgoingPacketQueue.reserve(128);
 
-gcomtype *init_network_transport(char **ARGV, int argpos);
-void deinit_network_transport(gcomtype *gcom);
-//void unstable_callcommit(void);
-void dosendpackets(long other);
+static gcomtype *init_network_transport(char **ARGV, int argpos);
+static void deinit_network_transport(gcomtype *gcom);
+static void dosendpackets(long other);
 
 
-void unstable_initcrc(void)
+void initcrc(void)
 {
 	long i, j, k, a;
 
@@ -143,9 +141,9 @@
 }
 
 
-long unstable_getcrc(char *buffer, short bufleng)
+int32_t getcrc(uint8_t *buffer, short bufleng)
 {
-	long i, j;
+    int32_t i, j;
 
 	j = 0;
 	for(i=bufleng-1;i>=0;i--) updatecrc16(j,buffer[i]);
@@ -152,11 +150,11 @@
 	return(j&65535);
 }
 
-void unstable_initmultiplayers(char damultioption, char dacomrateoption, char dapriority)
+void initmultiplayers()
 {
 	long i;
 
-	unstable_initcrc();
+	initcrc();
 	for(i=0;i<MAXPLAYERS;i++)
 	{
 		incnt[i] = 0L;
@@ -209,7 +207,7 @@
 }
 
 
-void dosendpackets(long other)
+static void dosendpackets(long other)
 {
 	long i, j, k, messleng;
 	unsigned short dacrc;
@@ -281,12 +279,12 @@
 #endif
 		{ 
 			gcom->command = COMMIT_CMD_SEND; 
-			unstable_callcommit(); 
+			callcommit(); 
 		}
 }
 
 
-void unstable_sendpacket(long other, char *bufptr, long messleng)
+void sendpacket(int32_t other, const uint8_t *bufptr, int32_t messleng)
 {
 	long i = 0;
     long j = 0;
@@ -318,7 +316,7 @@
 }
 
 
-void unstable_setpackettimeout(long datimeoutcount, long daresendagaincount)
+void setpackettimeout(int32_t datimeoutcount, int32_t daresendagaincount)
 {
 	// Don't do this it keeps '/f4' from working
 	// Though /f4 feels weird on my mouse.... slugish is the word...
@@ -332,17 +330,17 @@
 }
 
 
-void unstable_uninitmultiplayers(void)
+void uninitmultiplayers(void)
 {
     deinit_network_transport(gcom);
     gcom = NULL;
 }
 
-void unstable_sendlogon(void)
+void sendlogon(void)
 {
 }
 
-void unstable_sendlogoff(void)
+void sendlogoff(void)
 {
 	long i;
 	char tempbuf[2];
@@ -354,17 +352,17 @@
 			sendpacket(i,tempbuf,2L);
 }
 
-int unstable_getoutputcirclesize(void)
+int32_t getoutputcirclesize(void)
 {
 	return(0);
 }
 
-void unstable_setsocket(short newsocket)
+void setsocket(short newsocket)
 {
 }
 
 
-short unstable_getpacket (short *other, char *bufptr)
+short getpacket (short *other, uint8_t *bufptr)
 {
 	long i, messleng;
 	unsigned short dacrc;
@@ -401,7 +399,7 @@
 	}
 
 	gcom->command = COMMIT_CMD_GET;
-	unstable_callcommit();
+	callcommit();
 
 #if (SHOWGETPACKETS)
 	if (gcom->other != -1)
@@ -505,7 +503,7 @@
 	return(messleng);
 }
 
-void unstable_flushpackets()
+void flushpackets()
 {
 #if 0
 	long i;
@@ -531,13 +529,13 @@
 #endif
 }
 
-void unstable_genericmultifunction(long other, char *bufptr, long messleng, long command)
+void genericmultifunction(int32_t other, const uint8_t *bufptr, int32_t messleng, int32_t command)
 {
 	if (numplayers < 2) return;
 
 	gcom->command = command;
 	gcom->numbytes = min(messleng,MAXPACKETSIZE);
-	memcpy(bufptr,gcom->buffer,gcom->numbytes);
+	memcpy(gcom->buffer,bufptr,gcom->numbytes);
 	gcom->other = other+1;
 	callcommit();
 	
@@ -1474,7 +1472,7 @@
 }
 
 
-gcomtype *init_network_transport(char **ARGV, int argpos)
+static gcomtype *init_network_transport(char **ARGV, int argpos)
 {
     gcomtype *retval;
 
@@ -1515,7 +1513,7 @@
 }
 
 
-void deinit_network_transport(gcomtype *gcom)
+static void deinit_network_transport(gcomtype *gcom)
 {
     printf("UDP NETWORK TRANSPORT DEINITIALIZING...\n");
 
@@ -1540,7 +1538,7 @@
 }
 
 
-void unstable_callcommit(void)
+static void callcommit(void)
 {
     int ip, i, rc;
     short port;
--- /dev/null
+++ b/Engine/src/mmulti.h
@@ -1,0 +1,21 @@
+#ifndef _MMULTI_UNSTABLE_H_
+#define _MMULTI_UNSTABLE_H_
+
+#include <stdint.h>
+
+void callcommit(void);
+void initcrc(void);
+int32_t getcrc(uint8_t* buffer, short bufleng);
+void initmultiplayers();
+void sendpacket(int32_t other, const uint8_t* bufptr, int32_t messleng);
+void setpackettimeout(int32_t datimeoutcount, int32_t daresendagaincount);
+void uninitmultiplayers(void);
+void sendlogon(void);
+void sendlogoff(void);
+int32_t  getoutputcirclesize(void);
+void setsocket(short newsocket);
+short getpacket(short* other, uint8_t* bufptr);
+void flushpackets(void);
+void genericmultifunction(int32_t other, const uint8_t* bufptr, int32_t messleng, int32_t command);
+
+#endif
\ No newline at end of file
--- a/Engine/src/mmulti_unstable.h
+++ /dev/null
@@ -1,19 +1,0 @@
-#ifndef _MMULTI_UNSTABLE_H_
-#define _MMULTI_UNSTABLE_H_
-
-void unstable_callcommit(void);
-void unstable_initcrc(void);
-long unstable_getcrc(char *buffer, short bufleng);
-void unstable_initmultiplayers(char damultioption, char dacomrateoption, char dapriority);
-void unstable_sendpacket(long other, char *bufptr, long messleng);
-void unstable_setpackettimeout(long datimeoutcount, long daresendagaincount);
-void unstable_uninitmultiplayers(void);
-void unstable_sendlogon(void);
-void unstable_sendlogoff(void);
-int  unstable_getoutputcirclesize(void);
-void unstable_setsocket(short newsocket);
-short unstable_getpacket(short *other, char *bufptr);
-void unstable_flushpackets(void);
-void unstable_genericmultifunction(long other, char *bufptr, long messleng, long command);
-
-#endif
\ No newline at end of file
--- a/Engine/src/network.c
+++ /dev/null
@@ -1,80 +1,0 @@
-//
-//  network.c
-//  Duke3D
-//
-//  Created by fabien sanglard on 12-12-22.
-//  Copyright (c) 2012 fabien sanglard. All rights reserved.
-//
-
-#include "network.h"
-#include "mmulti_unstable.h"
-
-void callcommit(void)
-{
-    unstable_callcommit();
-}
-
-void initcrc(void)
-{
-	unstable_initcrc();
-}
-
-int32_t getcrc(uint8_t  *buffer, short bufleng)
-{
-	return unstable_getcrc(buffer, bufleng);
-}
-
-void initmultiplayers(uint8_t  damultioption, uint8_t  dacomrateoption, uint8_t  dapriority)
-{
-	unstable_initmultiplayers(damultioption, dacomrateoption, dapriority);
-}
-
-void sendpacket(int32_t other, uint8_t  *bufptr, int32_t messleng)
-{
-	unstable_sendpacket(other, bufptr, messleng);
-}
-
-void setpackettimeout(int32_t datimeoutcount, int32_t daresendagaincount)
-{
-	unstable_setpackettimeout(datimeoutcount, daresendagaincount);
-}
-
-void uninitmultiplayers(void)
-{
-	unstable_uninitmultiplayers();
-}
-
-void sendlogon(void)
-{
-	unstable_sendlogon();
-}
-
-void sendlogoff(void)
-{
-	unstable_sendlogoff();
-}
-
-int  getoutputcirclesize(void)
-{
-	return unstable_getoutputcirclesize();
-}
-
-void setsocket(short newsocket)
-{
-	unstable_setsocket(newsocket);
-}
-
-short getpacket(short *other, uint8_t  *bufptr)
-{
-	return unstable_getpacket(other, bufptr);
-}
-
-void flushpackets(void)
-{
-	unstable_flushpackets();
-}
-
-void genericmultifunction(int32_t other, char  *bufptr, int32_t messleng, int32_t command)
-{
-	unstable_genericmultifunction(other, bufptr, messleng, command);
-}
\ No newline at end of file
--- a/Engine/src/network.h
+++ /dev/null
@@ -1,30 +1,0 @@
-//
-//  network.h
-//  Duke3D
-//
-//  Created by fabien sanglard on 12-12-22.
-//  Copyright (c) 2012 fabien sanglard. All rights reserved.
-//
-
-#ifndef Duke3D_network_h
-#define Duke3D_network_h
-
-#include "platform.h"
-
-void callcommit(void);
-void initcrc(void);
-int32_t getcrc(uint8_t  *buffer, short bufleng);
-void initmultiplayers(uint8_t  damultioption, uint8_t  dacomrateoption, uint8_t  dapriority);
-void sendpacket(int32_t other, uint8_t  *bufptr, int32_t messleng);
-void setpackettimeout(int32_t datimeoutcount, int32_t daresendagaincount);
-void uninitmultiplayers(void);
-void sendlogon(void);
-void sendlogoff(void);
-int  getoutputcirclesize(void);
-void setsocket(short newsocket);
-short getpacket(short *other, uint8_t  *bufptr);
-void flushpackets(void);
-void genericmultifunction(int32_t other, char  *bufptr, int32_t messleng, int32_t command);
-
-
-#endif