From: Rudolf Polzer Date: Fri, 29 Jul 2011 10:50:31 +0000 (+0200) Subject: align output lumps X-Git-Tag: xonotic-v0.5.0~48 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c189f323fb67ff575dc45ab0395c25b4e37fb898;p=xonotic%2Fxonotic.git align output lumps --- diff --git a/misc/tools/bsptool.pl b/misc/tools/bsptool.pl index 84f23233..dd425953 100755 --- a/misc/tools/bsptool.pl +++ b/misc/tools/bsptool.pl @@ -487,18 +487,23 @@ for(@ARGV) open my $fh, ">", $outfile or die "$outfile: $!"; print $fh $header; - my $pos = 17 * 8 + tell($fh) + length $msg; + my $msgalign = [0, 3, 2, 1]->[length($msg) % 4]; + my $pos = 17 * 8 + tell($fh) + length($msg) + $msgalign; for(@bsp) { + my $align = [0, 3, 2, 1]->[length($_->[2]) % 4]; $_->[0] = $pos; $_->[1] = length $_->[2]; $pos += $_->[1]; print $fh pack "VV", $_->[0], $_->[1]; } print $fh $msg; + print $fh "\x00" x $msgalign; for(@bsp) { + my $align = [0, 3, 2, 1]->[length($_->[2]) % 4]; print $fh $_->[2]; + print $fh "\x00" x $align; } close $fh; print STDERR "Wrote $outfile\n";