From 6c1239e91a84cddf8df5679db68fd8d2df0f3dc7 Mon Sep 17 00:00:00 2001 From: div0 Date: Sun, 8 Mar 2009 20:06:36 +0000 Subject: [PATCH] demotc: support client->server packets git-svn-id: svn://svn.icculus.org/nexuiz/trunk@6084 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- misc/tools/demotc.pl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/misc/tools/demotc.pl b/misc/tools/demotc.pl index c3e072db3..adff9530d 100755 --- a/misc/tools/demotc.pl +++ b/misc/tools/demotc.pl @@ -77,11 +77,26 @@ my $demo_started = 0; 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" -- 2.39.2