r6084 - trunk/misc/tools

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Mar 8 16:06:43 EDT 2009


Author: div0
Date: 2009-03-08 16:06:36 -0400 (Sun, 08 Mar 2009)
New Revision: 6084

Modified:
   trunk/misc/tools/demotc.pl
Log:
demotc: support client->server packets


Modified: trunk/misc/tools/demotc.pl
===================================================================
--- trunk/misc/tools/demotc.pl	2009-03-08 19:57:50 UTC (rev 6083)
+++ trunk/misc/tools/demotc.pl	2009-03-08 20:06:36 UTC (rev 6084)
@@ -77,11 +77,26 @@
 my $demo_stopped = 0;
 my $inject_buffer = "";
 
+use constant DEMOMSG_CLIENT_TO_SERVER => 0x80000000;
 for(;;)
 {
 	last
 		unless 4 == read $infh, my $length, 4;
 	$length = unpack("V", $length);
+	if($length & DEMOMSG_CLIENT_TO_SERVER)
+	{
+		# client-to-server packet
+		$length = $length & ~DEMOMSG_CLIENT_TO_SERVER;
+		die "Invalid demo packet"
+			unless 12 == read $infh, my $angles, 12;
+		die "Invalid demo packet"
+			unless $length == read $infh, my($data), $length;
+
+		next if $mode eq 'grep';
+		print $outfh pack("V", length($data) | DEMOMSG_CLIENT_TO_SERVER);
+		print $outfh $angles;
+		print $outfh $data;
+	}
 	die "Invalid demo packet"
 		unless 12 == read $infh, my $angles, 12;
 	die "Invalid demo packet"




More information about the nexuiz-commits mailing list