[iortcw] 103/497: MP: Explicitly allow linux i386 and other native libs to be used on pure server

Simon McVittie smcv at debian.org
Fri Sep 8 10:36:33 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit c4156326fec517f1553b409b0088d99b936a2fde
Author: ZTurtleMan at gmail.com <ZTurtleMan at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date:   Sun May 4 00:05:44 2014 +0000

    MP: Explicitly allow linux i386 and other native libs to be used on pure server
    
    If server has pk3 with linux native libs, allow client to use them.
    I'm tired of getting kicked for using x86_64 libs on local pure server.
---
 MP/code/server/sv_client.c | 63 ++++++++++++++++++++++++++++++++--------------
 1 file changed, 44 insertions(+), 19 deletions(-)

diff --git a/MP/code/server/sv_client.c b/MP/code/server/sv_client.c
index 702187f..6ce2498 100644
--- a/MP/code/server/sv_client.c
+++ b/MP/code/server/sv_client.c
@@ -1243,6 +1243,25 @@ static void SV_Disconnect_f( client_t *cl ) {
 	SV_DropClient( cl, "disconnected" );
 }
 
+// Paths in pk3s to allowing using as cgame and ui VM.
+// Must be in pk3 with same checksum on server and client.
+char *sv_pureVMPaths[] = {
+	// QVM names
+	"vm/%s.mp.qvm",
+	// Files in original mp_bin.pk3
+	"%s_mp_x86.dll",
+	"%s.mp.i386.so",
+	// Other VM names used by the game which could be put in a pk3.
+	// They would be loaded by clients so it makes no sense to kick for using them.
+	"%s_mp_x86_64.dll",
+	"%s.mp.x86_64.so",
+	"%s.mp.i386.dylib",
+	"%s.mp.x86_64.dylib",
+	"%s.mp.ppc.dylib"
+};
+
+const int sv_numPureVMPaths = ARRAY_LEN( sv_pureVMPaths );
+
 /*
 =================
 SV_VerifyPaks_f
@@ -1258,32 +1277,16 @@ This routine would be a bit simpler with a goto but i abstained
 =================
 */
 static void SV_VerifyPaks_f( client_t *cl ) {
-	int nChkSum1, nChkSum2, nClientPaks, nServerPaks, i, j, nCurArg;
-	int nChkSumQvm1, nChkSumQvm2;
+	int nChkSum1, nClientPaks, nServerPaks, i, j, nCurArg;
 	int nClientChkSum[1024];
 	int nServerChkSum[1024];
 	const char *pPaks, *pArg;
 	qboolean bGood = qtrue;
-	qboolean bQvmGood = qtrue;
 
 	// if we are pure, we "expect" the client to load certain things from
 	// certain pk3 files, namely we want the client to have loaded the
 	// ui and cgame that we think should be loaded based on the pure setting
 	if ( sv_pure->integer != 0 ) {
-
-		nChkSum1 = nChkSum2 = 0;
-
-		// Only check the legacy dll for legacy clients
-		bGood = ( FS_FileIsInPAK( "cgame_mp_x86.dll", &nChkSum1 ) == 1) ;
-		if ( bGood ) {
-			bGood = ( FS_FileIsInPAK( "ui_mp_x86.dll", &nChkSum2 ) == 1) ;
-		}
-
-		bQvmGood = ( FS_FileIsInPAK( "vm/cgame.mp.qvm", &nChkSumQvm1 ) == 1) ;
-		if ( bQvmGood ) {
-			bQvmGood = ( FS_FileIsInPAK( "vm/ui.mp.qvm", &nChkSumQvm2 ) == 1) ;
-		}
-
 		nClientPaks = Cmd_Argc();
 
 		// start at arg 2 ( skip serverId cl_paks )
@@ -1315,16 +1318,38 @@ static void SV_VerifyPaks_f( client_t *cl ) {
 			}
 			// verify first to be the cgame checksum
 			pArg = Cmd_Argv( nCurArg++ );
-			if ( !pArg || *pArg == '@' || ( atoi( pArg ) != nChkSum1 && ( !bQvmGood || atoi( pArg ) != nChkSumQvm1 ) ) ) {
+			if ( !pArg || *pArg == '@' ) {
+				bGood = qfalse;
+				break;
+			}
+			// check valid cgame checksums
+			for ( i = 0; i < sv_numPureVMPaths; i++ ) {
+				if ( FS_FileIsInPAK( va( sv_pureVMPaths[i], "cgame" ), &nChkSum1 ) == 1 && atoi( pArg ) == nChkSum1 ) {
+					break;
+				}
+			}
+			if ( i == sv_numPureVMPaths ) {
 				bGood = qfalse;
 				break;
 			}
+
 			// verify the second to be the ui checksum
 			pArg = Cmd_Argv( nCurArg++ );
-			if ( !pArg || *pArg == '@' || ( atoi( pArg ) != nChkSum2 && ( !bQvmGood || atoi( pArg ) != nChkSumQvm2 ) ) ) {
+			if ( !pArg || *pArg == '@' ) {
+				bGood = qfalse;
+				break;
+			}
+			// check valid ui checksums
+			for ( i = 0; i < sv_numPureVMPaths; i++ ) {
+				if ( FS_FileIsInPAK( va( sv_pureVMPaths[i], "ui" ), &nChkSum1 ) == 1 && atoi( pArg ) == nChkSum1 ) {
+					break;
+				}
+			}
+			if ( i == sv_numPureVMPaths ) {
 				bGood = qfalse;
 				break;
 			}
+
 			// should be sitting at the delimeter now
 			pArg = Cmd_Argv( nCurArg++ );
 			if ( *pArg != '@' ) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list