initial
This commit is contained in:
BIN
devtools/bin/FileSystem_Stdio.dll
Normal file
BIN
devtools/bin/FileSystem_Stdio.dll
Normal file
Binary file not shown.
22
devtools/bin/buildshaderlist.pl
Normal file
22
devtools/bin/buildshaderlist.pl
Normal file
@ -0,0 +1,22 @@
|
||||
use File::DosGlob;
|
||||
@ARGV = map {
|
||||
my @g = File::DosGlob::glob($_) if /[*?]/;
|
||||
@g ? @g : $_;
|
||||
} @ARGV;
|
||||
|
||||
open FILE, ">__tmpshaderlist.txt";
|
||||
|
||||
foreach $arg (@ARGV)
|
||||
{
|
||||
if( $arg =~ m/\.fxc$/i || $arg =~ m/\.vsh$/i || $arg =~ m/\.psh$/i )
|
||||
{
|
||||
print $arg . "\n";
|
||||
print FILE $arg . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
close FILE;
|
||||
|
||||
system "buildshaders.bat __tmpshaderlist";
|
||||
|
||||
unlink "__tmpshaderlist.txt";
|
116
devtools/bin/checkshaderchecksums.pl
Normal file
116
devtools/bin/checkshaderchecksums.pl
Normal file
@ -0,0 +1,116 @@
|
||||
use String::CRC32;
|
||||
BEGIN {use File::Basename; push @INC, dirname($0); }
|
||||
require "valve_perl_helpers.pl";
|
||||
|
||||
sub GetShaderType
|
||||
{
|
||||
my $shadername = shift;
|
||||
my $shadertype;
|
||||
if( $shadername =~ m/\.vsh/i )
|
||||
{
|
||||
$shadertype = "vsh";
|
||||
}
|
||||
elsif( $shadername =~ m/\.psh/i )
|
||||
{
|
||||
$shadertype = "psh";
|
||||
}
|
||||
elsif( $shadername =~ m/\.fxc/i )
|
||||
{
|
||||
$shadertype = "fxc";
|
||||
}
|
||||
else
|
||||
{
|
||||
die;
|
||||
}
|
||||
return $shadertype;
|
||||
}
|
||||
|
||||
sub GetShaderSrc
|
||||
{
|
||||
my $shadername = shift;
|
||||
if ( $shadername =~ m/^(.*)-----/i )
|
||||
{
|
||||
return $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $shadername;
|
||||
}
|
||||
}
|
||||
|
||||
sub GetShaderType
|
||||
{
|
||||
my $shadername = shift;
|
||||
my $shadertype;
|
||||
if( $shadername =~ m/\.vsh/i )
|
||||
{
|
||||
$shadertype = "vsh";
|
||||
}
|
||||
elsif( $shadername =~ m/\.psh/i )
|
||||
{
|
||||
$shadertype = "psh";
|
||||
}
|
||||
elsif( $shadername =~ m/\.fxc/i )
|
||||
{
|
||||
$shadertype = "fxc";
|
||||
}
|
||||
else
|
||||
{
|
||||
die;
|
||||
}
|
||||
return $shadertype;
|
||||
}
|
||||
|
||||
sub GetShaderBase
|
||||
{
|
||||
my $shadername = shift;
|
||||
if ( $shadername =~ m/-----(.*)$/i )
|
||||
{
|
||||
return $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
my $shadertype = &GetShaderType( $shadername );
|
||||
$shadername =~ s/\.$shadertype//i;
|
||||
return $shadername;
|
||||
}
|
||||
}
|
||||
|
||||
$g_x360 = 0;
|
||||
$g_vcsext = ".vcs";
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
$inputbase = shift;
|
||||
|
||||
if( $inputbase =~ m/-x360/ )
|
||||
{
|
||||
$g_x360 = 1;
|
||||
$g_vcsext = ".360.vcs";
|
||||
}
|
||||
else
|
||||
{
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# rip the txt off the end if it's there.
|
||||
$inputbase =~ s/\.txt//i;
|
||||
|
||||
my @srcfiles = &LoadShaderListFile( $inputbase );
|
||||
|
||||
foreach $srcfile ( @srcfiles )
|
||||
{
|
||||
my $shadertype = &GetShaderType( $srcfile );
|
||||
my $shaderbase = &GetShaderBase( $srcfile );
|
||||
my $shadersrc = &GetShaderSrc( $srcfile );
|
||||
my $vcsFileName = "..\\..\\..\\game\\platform\\shaders\\$shadertype\\$shaderbase" . $g_vcsext;
|
||||
# print "shadersrc: $shadersrc vcsFileName: $vcsFileName\n";
|
||||
|
||||
if( $g_x360 && ( $shaderbase =~ m/_ps20$/i ) )
|
||||
{
|
||||
next; # skip _ps20 files for 360
|
||||
}
|
||||
|
||||
&CheckCRCAgainstTarget( $shadersrc, $vcsFileName, 1 );
|
||||
}
|
92
devtools/bin/copyshaderincfiles.pl
Normal file
92
devtools/bin/copyshaderincfiles.pl
Normal file
@ -0,0 +1,92 @@
|
||||
BEGIN {use File::Basename; push @INC, dirname($0); }
|
||||
require "valve_perl_helpers.pl";
|
||||
use Cwd;
|
||||
use String::CRC32;
|
||||
|
||||
my $txtfilename = shift;
|
||||
my $arg = shift;
|
||||
|
||||
my $is360 = 0;
|
||||
my $platformextension = "";
|
||||
if( $arg =~ m/-x360/i )
|
||||
{
|
||||
$is360 = 1;
|
||||
$platformextension = ".360";
|
||||
}
|
||||
|
||||
# Get the changelist number for the Shader Auto Checkout changelist. Will create the changelist if it doesn't exist.
|
||||
my $changelistnumber = `valve_p4_create_changelist.cmd ..\\..\\..\\game\\platform\\shaders \"Shader Auto Checkout VCS\"`;
|
||||
# Get rid of the newline
|
||||
$changelistnumber =~ s/\n//g;
|
||||
|
||||
my $changelistarg = "";
|
||||
if( $changelistnumber != 0 )
|
||||
{
|
||||
$changelistarg = "-c $changelistnumber"
|
||||
}
|
||||
|
||||
open TXTFILE, "<$txtfilename";
|
||||
|
||||
my $src;
|
||||
my $dst;
|
||||
while( $src = <TXTFILE> )
|
||||
{
|
||||
# get rid of comments
|
||||
$src =~ s,//.*,,g;
|
||||
|
||||
# skip blank lines
|
||||
if( $src =~ m/^\s*$/ )
|
||||
{
|
||||
next;
|
||||
}
|
||||
|
||||
# Get rid of newlines.
|
||||
$src =~ s/\n//g;
|
||||
|
||||
# Save off the shader source filename.
|
||||
my $dst = $src;
|
||||
|
||||
$dst =~ s/_tmp//gi;
|
||||
|
||||
# Does the dst exist?
|
||||
my $dstexists = -e $dst;
|
||||
my $srcexists = -e $src;
|
||||
# What are the time stamps for the src and dst?
|
||||
my $srcmodtime = ( stat $src )[9];
|
||||
my $dstmodtime = ( stat $dst )[9];
|
||||
|
||||
if( $dstexists && !$srcexists )
|
||||
{
|
||||
printf STDERR "$src doesn't exist, deleting $dst\n";
|
||||
unlink $dst;
|
||||
}
|
||||
|
||||
# Open for edit or add if different than what is in perforce already.
|
||||
if( !$dstexists || ( $srcmodtime != $dstmodtime ) )
|
||||
{
|
||||
# Make the target writable if it exists
|
||||
if( $dstexists )
|
||||
{
|
||||
MakeFileWritable( $dst );
|
||||
}
|
||||
|
||||
my $dir = $dst;
|
||||
$dir =~ s,([^/\\]*$),,; # rip the filename off the end
|
||||
my $filename = $1;
|
||||
|
||||
# create the target directory if it doesn't exist
|
||||
if( !$dstexists )
|
||||
{
|
||||
&MakeDirHier( $dir, 0777 );
|
||||
}
|
||||
|
||||
# copy the file to its targets. . . we want to see STDERR here if there is an error.
|
||||
my $cmd = "copy $src $dst > nul";
|
||||
# print STDERR "$cmd\n";
|
||||
system $cmd;
|
||||
|
||||
MakeFileReadOnly( $dst );
|
||||
}
|
||||
}
|
||||
|
||||
close TXTFILE;
|
179
devtools/bin/copyshaders.pl
Normal file
179
devtools/bin/copyshaders.pl
Normal file
@ -0,0 +1,179 @@
|
||||
BEGIN {use File::Basename; push @INC, dirname($0); }
|
||||
require "valve_perl_helpers.pl";
|
||||
use Cwd;
|
||||
use String::CRC32;
|
||||
|
||||
sub ReadInputFileWithIncludes
|
||||
{
|
||||
local( $filename ) = shift;
|
||||
|
||||
local( *INPUT );
|
||||
local( $output );
|
||||
|
||||
open INPUT, "<$filename" || die;
|
||||
|
||||
local( $line );
|
||||
local( $linenum ) = 1;
|
||||
while( $line = <INPUT> )
|
||||
{
|
||||
if( $line =~ m/\#include\s+\"(.*)\"/i )
|
||||
{
|
||||
$output.= ReadInputFileWithIncludes( $1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
$output .= $line;
|
||||
}
|
||||
}
|
||||
|
||||
close INPUT;
|
||||
return $output;
|
||||
}
|
||||
|
||||
sub PatchCRC
|
||||
{
|
||||
my $filename = shift;
|
||||
my $crc = shift;
|
||||
# print STDERR "*** PatchCRC( $filename, $crc )\n";
|
||||
local( *FP );
|
||||
open FP, "+<$filename" || die;
|
||||
binmode( FP );
|
||||
seek FP, 6 * 4, 0;
|
||||
my $uInt = "I";
|
||||
if ( ( $filename =~ m/\.ps3\./ ) || ( $filename =~ m/\.360\./ ) )
|
||||
{
|
||||
# print STDERR "*** PatchCRC found ps3 or 360\n";
|
||||
$uInt = "N";
|
||||
}
|
||||
print FP pack $uInt, $crc;
|
||||
close FP;
|
||||
}
|
||||
|
||||
my $txtfilename = shift;
|
||||
my $arg = shift;
|
||||
|
||||
my $is360 = 0;
|
||||
my $isPS3 = 0;
|
||||
my $platformextension = "";
|
||||
if( $arg =~ m/-x360/i )
|
||||
{
|
||||
$is360 = 1;
|
||||
$platformextension = ".360";
|
||||
}
|
||||
elsif( $arg =~ m/-ps3/i )
|
||||
{
|
||||
$isPS3 = 1;
|
||||
$platformextension = ".ps3";
|
||||
}
|
||||
|
||||
# Get the changelist number for the Shader Auto Checkout changelist. Will create the changelist if it doesn't exist.
|
||||
my $changelistnumber = `valve_p4_create_changelist.cmd ..\\..\\..\\game\\platform\\shaders \"Shader Auto Checkout VCS\"`;
|
||||
# Get rid of the newline
|
||||
$changelistnumber =~ s/\n//g;
|
||||
|
||||
my $changelistarg = "";
|
||||
if( $changelistnumber != 0 )
|
||||
{
|
||||
$changelistarg = "-c $changelistnumber"
|
||||
}
|
||||
|
||||
open TXTFILE, "<$txtfilename";
|
||||
|
||||
my $src;
|
||||
my $dst;
|
||||
while( $src = <TXTFILE> )
|
||||
{
|
||||
# get rid of comments
|
||||
$src =~ s,//.*,,g;
|
||||
|
||||
# skip blank lines
|
||||
if( $src =~ m/^\s*$/ )
|
||||
{
|
||||
next;
|
||||
}
|
||||
|
||||
# Get rid of newlines.
|
||||
$src =~ s/\n//g;
|
||||
|
||||
# Save off the shader source filename.
|
||||
my $shadersrcfilename = $src;
|
||||
$shadersrcfilename =~ s/-----.*$//;
|
||||
# use only target basename.
|
||||
$src =~ s/^.*-----//;
|
||||
|
||||
# where the binary vcs file is
|
||||
my $spath = "";
|
||||
|
||||
if ( $shadersrcfilename =~ m@\.fxc@i )
|
||||
{
|
||||
$spath = "shaders\\fxc\\";
|
||||
}
|
||||
if ( $shadersrcfilename =~ m@\.vsh@i )
|
||||
{
|
||||
$spath = "shaders\\vsh\\";
|
||||
}
|
||||
if ( $shadersrcfilename =~ m@\.psh@i )
|
||||
{
|
||||
$spath = "shaders\\psh\\";
|
||||
}
|
||||
|
||||
# make the source have path and extension
|
||||
$src = $spath . $src . $platformextension . ".vcs";
|
||||
|
||||
# build the dest filename.
|
||||
$dst = $src;
|
||||
|
||||
$dst =~ s/shaders\\/..\\..\\..\\game\\platform\\shaders\\/i;
|
||||
|
||||
# Does the dst exist?
|
||||
my $dstexists = -e $dst;
|
||||
my $srcexists = -e $src;
|
||||
# What are the time stamps for the src and dst?
|
||||
my $srcmodtime = ( stat $src )[9];
|
||||
my $dstmodtime = ( stat $dst )[9];
|
||||
|
||||
# Write $dst to a file so that we can do perforce stuff to it later.
|
||||
local( *VCSLIST );
|
||||
open VCSLIST, ">>vcslist.txt" || die;
|
||||
print VCSLIST $dst . "\n";
|
||||
close VCSLIST;
|
||||
|
||||
# Open for edit or add if different than what is in perforce already.
|
||||
if( !$dstexists || ( $srcmodtime != $dstmodtime ) )
|
||||
{
|
||||
if ( $srcexists && $shadersrcfilename =~ m@\.fxc@i )
|
||||
{
|
||||
# Get the CRC for the source file.
|
||||
my $srccode = ReadInputFileWithIncludes( $shadersrcfilename );
|
||||
my $crc = crc32( $srccode );
|
||||
|
||||
# Patch the source VCS file with the CRC32 of the source code used to build that file.
|
||||
PatchCRC( $src, $crc );
|
||||
}
|
||||
|
||||
# Make the target vcs writable if it exists
|
||||
if( $dstexists )
|
||||
{
|
||||
MakeFileWritable( $dst );
|
||||
}
|
||||
|
||||
my $dir = $dst;
|
||||
$dir =~ s,([^/\\]*$),,; # rip the filename off the end
|
||||
my $filename = $1;
|
||||
|
||||
# create the target directory if it doesn't exist
|
||||
if( !$dstexists )
|
||||
{
|
||||
&MakeDirHier( $dir, 0777 );
|
||||
}
|
||||
|
||||
# copy the file to its targets. . . we want to see STDERR here if there is an error.
|
||||
my $cmd = "copy $src $dst > nul";
|
||||
# print STDERR "$cmd\n";
|
||||
system $cmd;
|
||||
|
||||
MakeFileReadOnly( $dst );
|
||||
}
|
||||
}
|
||||
|
||||
close TXTFILE;
|
110
devtools/bin/fix_particle_operator_names.pl
Normal file
110
devtools/bin/fix_particle_operator_names.pl
Normal file
@ -0,0 +1,110 @@
|
||||
#!perl
|
||||
use File::Find;
|
||||
|
||||
&BuildRemapTable;
|
||||
|
||||
find(\&convert, "." );
|
||||
|
||||
|
||||
sub convert
|
||||
{
|
||||
return unless (/\.pcf$/i);
|
||||
return if (/^tmp\.pcf$/i);
|
||||
return if (/^tmp2\.pcf$/i);
|
||||
return if (/360\.pcf$/i);
|
||||
print STDERR "process ", $File::Find::name," ($_) dir=",`cd`," \n";
|
||||
my $fname=$_;
|
||||
print `p4 edit $fname`;
|
||||
print `dmxconvert -i $_ -o tmp.pcf -oe keyvalues2`;
|
||||
open(TMP, "tmp.pcf" ) || return;
|
||||
open(OUT, ">tmp2.pcf" ) || die;
|
||||
while(<TMP>)
|
||||
{
|
||||
s/[\n\r]//g;
|
||||
if ( (/^(\s*\"functionName\"\s*\"string\"\s*\")(.*)\"(.*)$/) &&
|
||||
length($map{$2}) )
|
||||
{
|
||||
$_=$1.$map{$2}.'"'.$3;
|
||||
}
|
||||
if ( (/^(\s*\"name\"\s*\"string\"\s*\")(.*)\"(.*)$/) &&
|
||||
length($map{$2}) )
|
||||
{
|
||||
$_=$1.$map{$2}.'"'.$3;
|
||||
}
|
||||
print OUT "$_\n";
|
||||
}
|
||||
close OUT;
|
||||
close TMP;
|
||||
print `dmxconvert -i tmp2.pcf -o $fname -ie keyvalues2 -oe binary`;
|
||||
unlink "tmp.pcf";
|
||||
unlink "tmp2.pcf";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sub BuildRemapTable
|
||||
{
|
||||
$map{"alpha_fade"}= "Alpha Fade and Decay";
|
||||
$map{"alpha_fade_in_random"}= "Alpha Fade In Random";
|
||||
$map{"alpha_fade_out_random"}= "Alpha Fade Out Random";
|
||||
$map{"basic_movement"}= "Movement Basic";
|
||||
$map{"color_fade"}= "Color Fade";
|
||||
$map{"controlpoint_light"}= "Color Light From Control Point";
|
||||
$map{"Dampen Movement Relative to Control Point"}= "Movement Dampen Relative to Control Point";
|
||||
$map{"Distance Between Control Points Scale"}= "Remap Distance Between Two Control Points to Scalar";
|
||||
$map{"Distance to Control Points Scale"}= "Remap Distance to Control Point to Scalar";
|
||||
$map{"lifespan_decay"}= "Lifespan Decay";
|
||||
$map{"lock to bone"}= "Movement Lock to Bone";
|
||||
$map{"postion_lock_to_controlpoint"}= "Movement Lock to Control Point";
|
||||
$map{"maintain position along path"}= "Movement Maintain Position Along Path";
|
||||
$map{"Match Particle Velocities"}= "Movement Match Particle Velocities";
|
||||
$map{"Max Velocity"}= "Movement Max Velocity";
|
||||
$map{"noise"}= "Noise Scalar";
|
||||
$map{"vector noise"}= "Noise Vector";
|
||||
$map{"oscillate_scalar"}= "Oscillate Scalar";
|
||||
$map{"oscillate_vector"}= "Oscillate Vector";
|
||||
$map{"Orient Rotation to 2D Direction"}= "Rotation Orient to 2D Direction";
|
||||
$map{"radius_scale"}= "Radius Scale";
|
||||
$map{"Random Cull"}= "Cull Random";
|
||||
$map{"remap_scalar"}= "Remap Scalar";
|
||||
$map{"rotation_movement"}= "Rotation Basic";
|
||||
$map{"rotation_spin"}= "Rotation Spin Roll";
|
||||
$map{"rotation_spin yaw"}= "Rotation Spin Yaw";
|
||||
$map{"alpha_random"}= "Alpha Random";
|
||||
$map{"color_random"}= "Color Random";
|
||||
$map{"create from parent particles"}= "Position From Parent Particles";
|
||||
$map{"Create In Hierarchy"}= "Position In CP Hierarchy";
|
||||
$map{"random position along path"}= "Position Along Path Random";
|
||||
$map{"random position on model"}= "Position on Model Random";
|
||||
$map{"sequential position along path"}= "Position Along Path Sequential";
|
||||
$map{"position_offset_random"}= "Position Modify Offset Random";
|
||||
$map{"position_warp_random"}= "Position Modify Warp Random";
|
||||
$map{"position_within_box"}= "Position Within Box Random";
|
||||
$map{"position_within_sphere"}= "Position Within Sphere Random";
|
||||
$map{"Inherit Velocity"}= "Velocity Inherit from Control Point";
|
||||
$map{"Initial Repulsion Velocity"}= "Velocity Repulse from World";
|
||||
$map{"Initial Velocity Noise"}= "Velocity Noise";
|
||||
$map{"Initial Scalar Noise"}= "Remap Noise to Scalar";
|
||||
$map{"Lifespan from distance to world"}= "Lifetime from Time to Impact";
|
||||
$map{"Pre-Age Noise"}= "Lifetime Pre-Age Noise";
|
||||
$map{"lifetime_random"}= "Lifetime Random";
|
||||
$map{"radius_random"}= "Radius Random";
|
||||
$map{"random yaw"}= "Rotation Yaw Random";
|
||||
$map{"Randomly Flip Yaw"}= "Rotation Yaw Flip Random";
|
||||
$map{"rotation_random"}= "Rotation Random";
|
||||
$map{"rotation_speed_random"}= "Rotation Speed Random";
|
||||
$map{"sequence_random"}= "Sequence Random";
|
||||
$map{"second_sequence_random"}= "Sequence Two Random";
|
||||
$map{"trail_length_random"}= "Trail Length Random";
|
||||
$map{"velocity_random"}= "Velocity Random";
|
||||
}
|
||||
|
1185
devtools/bin/fxc_prep.pl
Normal file
1185
devtools/bin/fxc_prep.pl
Normal file
File diff suppressed because it is too large
Load Diff
BIN
devtools/bin/linux/ccache
Normal file
BIN
devtools/bin/linux/ccache
Normal file
Binary file not shown.
BIN
devtools/bin/linux/dump_syms
Normal file
BIN
devtools/bin/linux/dump_syms
Normal file
Binary file not shown.
BIN
devtools/bin/linux/minidump_stackwalk
Normal file
BIN
devtools/bin/linux/minidump_stackwalk
Normal file
Binary file not shown.
BIN
devtools/bin/linux/protoc
Normal file
BIN
devtools/bin/linux/protoc
Normal file
Binary file not shown.
BIN
devtools/bin/linux/vpc
Normal file
BIN
devtools/bin/linux/vpc
Normal file
Binary file not shown.
BIN
devtools/bin/osx/vpc
Normal file
BIN
devtools/bin/osx/vpc
Normal file
Binary file not shown.
96
devtools/bin/osx32/breakpad_build_symbols.py
Normal file
96
devtools/bin/osx32/breakpad_build_symbols.py
Normal file
@ -0,0 +1,96 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import datetime
|
||||
import getopt
|
||||
import glob
|
||||
import os
|
||||
import pickle
|
||||
import shutil
|
||||
import sys
|
||||
import zipfile
|
||||
import re
|
||||
import subprocess as sp
|
||||
|
||||
import pdb
|
||||
|
||||
def ShowUsage():
|
||||
print "breakpad_build_symbols.py [options] bindirectory symboldirectory]"
|
||||
print "-f/--force Force rebuild of .sym files."
|
||||
|
||||
#
|
||||
# Set program defaults.
|
||||
#
|
||||
g_bForce = False
|
||||
|
||||
def main():
|
||||
global g_bForce
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt( sys.argv[1:], "f", [ "force" ] )
|
||||
|
||||
except getopt.GetoptError, e:
|
||||
print ""
|
||||
print "Argument error: ", e
|
||||
print ""
|
||||
ShowUsage()
|
||||
sys.exit(1)
|
||||
|
||||
for o, a in opts:
|
||||
if o in ( "-f", "--force" ):
|
||||
g_bForce = True
|
||||
|
||||
# now look for all files in the specified path
|
||||
print "building symbols for %s to %s" % ( args[ 0 ], args[ 1 ] )
|
||||
|
||||
dump_syms = os.getcwd() + "/dump_syms"
|
||||
|
||||
rebuildcount = 0
|
||||
visitcount = 0
|
||||
for root, dirs, files in os.walk(args[ 0 ]):
|
||||
for name in dirs:
|
||||
dsymdirname = os.path.join(root, name)
|
||||
#print "checking %s" % dsymdirname
|
||||
if dsymdirname[-5:] == '.dSYM':
|
||||
visitcount += 1
|
||||
dylibfiletime = os.path.getmtime( dsymdirname )
|
||||
# get the first line
|
||||
command = dump_syms + " -g " + dsymdirname
|
||||
p = sp.Popen( command, stdout=sp.PIPE, stderr=sp.PIPE, shell=True )
|
||||
firstline = p.communicate()[ 0 ];
|
||||
#line syntax
|
||||
# MODULE mac x86 59C9A56A5EB38C85A185BA60877C89610 engine.dylib
|
||||
tokens = firstline.split()
|
||||
if ( len( tokens ) != 5 ):
|
||||
continue
|
||||
rawlibname = tokens[ 4 ]
|
||||
# print "shortname %s\n" % rawlibname
|
||||
symdir = args[1] + "/" + tokens[ 4 ] + "/" + tokens[ 3 ]
|
||||
if not os.path.isdir( symdir ):
|
||||
os.makedirs( symdir )
|
||||
symfile = symdir + "/" + rawlibname + ".sym"
|
||||
if ( os.path.exists( symfile ) ):
|
||||
# check time stamp
|
||||
symfilefiletime = os.path.getmtime( symfile )
|
||||
symfilesize = os.path.getsize( symfile )
|
||||
# print " %s %d %d" % (symfile, dylibfiletime, symfilefiletime)
|
||||
if ( symfilefiletime >= dylibfiletime and not g_bForce and symfilesize > 0 ):
|
||||
continue
|
||||
|
||||
# do full processing
|
||||
command = dump_syms + " " + dsymdirname
|
||||
p = sp.Popen( command, stdout=sp.PIPE, stderr=sp.PIPE, shell=True )
|
||||
symbols = p.communicate()[ 0 ]
|
||||
print " :%s" % symfile
|
||||
# print " %s" % symbols
|
||||
fd = open( symfile, 'wb' )
|
||||
fd.write( symbols )
|
||||
fd.close()
|
||||
# force time stamp
|
||||
os.utime( symfile, ( dylibfiletime, dylibfiletime ) )
|
||||
rebuildcount += 1
|
||||
|
||||
print " rebuilt %d out of %d symbol files" % ( rebuildcount, visitcount )
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
10
devtools/bin/osx32/breakpad_makesymbols.sh
Normal file
10
devtools/bin/osx32/breakpad_makesymbols.sh
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# rm -rf /tmp/symbols/
|
||||
./breakpad_build_symbols.py ~/Perforce/perforce_1666/yahn_mac/Steam/main/src/ /tmp/symbols
|
||||
./breakpad_build_symbols.py ~/Perforce/perforce_1666/yahn_mac/Steam/main/client/osx32/ /tmp/symbols
|
||||
#./breakpad_build_symbols.py ~/Perforce/perforce_1666/yahn_mac/Steam/main/client/ /tmp/symbols
|
||||
#./breakpad_build_symbols.py ~/Perforce/perforce_1666/yahn_staging/game/ /tmp/symbols
|
||||
./breakpad_build_symbols.py ~/Perforce/perforce_1666/yahn_staging/src/ /tmp/symbols
|
||||
rsync -r /tmp/symbols/ socorro-test:./symbols
|
||||
|
BIN
devtools/bin/osx32/ccache
Normal file
BIN
devtools/bin/osx32/ccache
Normal file
Binary file not shown.
BIN
devtools/bin/osx32/dump_syms
Normal file
BIN
devtools/bin/osx32/dump_syms
Normal file
Binary file not shown.
BIN
devtools/bin/osx32/ipcclient
Normal file
BIN
devtools/bin/osx32/ipcclient
Normal file
Binary file not shown.
BIN
devtools/bin/osx32/minidump_stackwalk
Normal file
BIN
devtools/bin/osx32/minidump_stackwalk
Normal file
Binary file not shown.
BIN
devtools/bin/osx32/protoc
Normal file
BIN
devtools/bin/osx32/protoc
Normal file
Binary file not shown.
BIN
devtools/bin/osx32/protoserviceplugin
Normal file
BIN
devtools/bin/osx32/protoserviceplugin
Normal file
Binary file not shown.
3
devtools/bin/osx32/xcode_ccache_wrapper
Normal file
3
devtools/bin/osx32/xcode_ccache_wrapper
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exec $(dirname $0)/ccache ${DT_TOOLCHAIN_DIR}/usr/bin/clang -Qunused-arguments $@
|
294
devtools/bin/p4autocheckout.pl
Normal file
294
devtools/bin/p4autocheckout.pl
Normal file
@ -0,0 +1,294 @@
|
||||
#!perl
|
||||
use strict;
|
||||
|
||||
BEGIN {use File::Basename; push @INC, dirname($0); }
|
||||
require "valve_perl_helpers.pl";
|
||||
|
||||
sub PrintCleanPerforceOutput
|
||||
{
|
||||
my $line;
|
||||
while( $line = shift )
|
||||
{
|
||||
if( $line =~ m/currently opened/i )
|
||||
{
|
||||
next;
|
||||
}
|
||||
if( $line =~ m/already opened for edit/i )
|
||||
{
|
||||
next;
|
||||
}
|
||||
if( $line =~ m/also opened/i )
|
||||
{
|
||||
next;
|
||||
}
|
||||
if( $line =~ m/add of existing file/i )
|
||||
{
|
||||
next;
|
||||
}
|
||||
print $line;
|
||||
}
|
||||
}
|
||||
|
||||
# HACK!!!! Need to pass something in to do this rather than hard coding.
|
||||
sub NormalizePerforceFilename
|
||||
{
|
||||
my $line = shift;
|
||||
|
||||
# remove newlines.
|
||||
$line =~ s/\n//;
|
||||
# downcase.
|
||||
$line =~ tr/[A-Z]/[a-z]/;
|
||||
# backslash to forwardslash
|
||||
$line =~ s,\\,/,g;
|
||||
|
||||
# for inc files HACK!
|
||||
$line =~ s/^.*(fxctmp9.*)/$1/i;
|
||||
$line =~ s/^.*(vshtmp9.*)/$1/i;
|
||||
|
||||
# for vcs files. HACK!
|
||||
$line =~ s,^.*game/platform/shaders/,,i;
|
||||
|
||||
return $line;
|
||||
}
|
||||
|
||||
# COMMAND-LINE ARGUMENTS
|
||||
my $x360 = 0;
|
||||
my $ps3 = 0;
|
||||
my $filename = shift;
|
||||
if( $filename =~ m/-x360/i )
|
||||
{
|
||||
$x360 = 1;
|
||||
$filename = shift;
|
||||
}
|
||||
elsif( $filename =~ m/-ps3/i )
|
||||
{
|
||||
$ps3 = 1;
|
||||
$filename = shift;
|
||||
}
|
||||
my $changelistname = shift;
|
||||
my $perforcebasepath = shift;
|
||||
my $diffpath = join " ", @ARGV;
|
||||
|
||||
#print STDERR "\$filename: $filename\n";
|
||||
#print STDERR "\$changelistname: $changelistname\n";
|
||||
#print STDERR "\$perforcebasepath: $perforcebasepath\n";
|
||||
#print STDERR "\$diffpath: $diffpath\n";
|
||||
|
||||
# Read the input file list before changing to the perforce directory.
|
||||
open FILELIST, "<$filename";
|
||||
my @inclist = <FILELIST>;
|
||||
close FILELIST;
|
||||
|
||||
# change from the perforce directory so that our client will be correct from here out.
|
||||
#print STDERR "chdir $perforcebasepath\n";
|
||||
chdir $perforcebasepath || die "can't cd to $perforcebasepath";
|
||||
|
||||
#print "inclist before @inclist\n";
|
||||
# get rid of newlines and fix slashes
|
||||
@inclist =
|
||||
map
|
||||
{
|
||||
$_ =~ s,_tmp,,g; # remove _tmp so that we check out in the proper directory
|
||||
$_ =~ s,\\,/,g; # backslash to forwardslash
|
||||
$_ =~ s/\n//g; # remove newlines
|
||||
$_ =~ tr/[A-Z]/[a-z]/; # downcase
|
||||
# $_ =~ s,.*platform/shaders/,,i;
|
||||
# $_ =~ s,$perforcebasepath/,,i;
|
||||
$_ =~ s,../../../game/platform/shaders/,,i; # hack. . .really want something here that works generically.
|
||||
$_
|
||||
} @inclist;
|
||||
#print "inclist after @inclist\n";
|
||||
|
||||
my $prevline;
|
||||
my @outlist;
|
||||
foreach $_ ( sort( @inclist ) )
|
||||
{
|
||||
next if( defined( $prevline ) && $_ eq $prevline );
|
||||
$prevline = $_;
|
||||
push @outlist, $_;
|
||||
}
|
||||
@inclist = @outlist;
|
||||
|
||||
#print "\@inclist: @inclist\n";
|
||||
|
||||
# Get list of files on the client
|
||||
# -sl Every unopened file, along with the status of
|
||||
# 'same, 'diff', or 'missing' as compared to its
|
||||
# revision in the depot.
|
||||
my @unopenedlist = &RunCommand( "p4 diff -sl $diffpath" );
|
||||
|
||||
#print "\@unopenedlist: @unopenedlist\n";
|
||||
|
||||
my %sameunopened;
|
||||
my %diffunopened;
|
||||
my %missingunopened;
|
||||
|
||||
my $line;
|
||||
foreach $line ( @unopenedlist )
|
||||
{
|
||||
my $same = 0;
|
||||
my $diff = 0;
|
||||
my $missing = 0;
|
||||
if( $line =~ s/^same //i )
|
||||
{
|
||||
$same = 1;
|
||||
}
|
||||
elsif( $line =~ s/^diff //i )
|
||||
{
|
||||
$diff = 1;
|
||||
}
|
||||
elsif( $line =~ s/^missing //i )
|
||||
{
|
||||
$missing = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
die "checkoutincfiles.pl don't understand p4 diff -sl results: $line\n";
|
||||
}
|
||||
|
||||
# clean up the filename
|
||||
# print "before: $line\n" if $line =~ m/aftershock_vs20/i;
|
||||
$line = NormalizePerforceFilename( $line );
|
||||
# print "after: \"$line\"\n" if $line =~ m/aftershock_vs20/i;
|
||||
# if( $line =~ m/aftershock/i )
|
||||
# {
|
||||
# print "unopenedlist: $line same: $same diff: $diff missing: $missing\n";
|
||||
# }
|
||||
|
||||
# Save off the results for each line so that we can query them later.
|
||||
if( $same )
|
||||
{
|
||||
$sameunopened{$line} = 1;
|
||||
}
|
||||
elsif( $diff )
|
||||
{
|
||||
$diffunopened{$line} = 1;
|
||||
}
|
||||
elsif( $missing )
|
||||
{
|
||||
$missingunopened{$line} = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
# -sr Opened files that are the same as the revision in the
|
||||
# depot.
|
||||
my @openedbutsame = &RunCommand( "p4 diff -sr $diffpath" );
|
||||
|
||||
my %sameopened;
|
||||
|
||||
foreach $line ( @openedbutsame )
|
||||
{
|
||||
if( $line =~ m/not opened on this client/i )
|
||||
{
|
||||
next;
|
||||
}
|
||||
# clean up the filename
|
||||
# print "before: $line\n" if $line =~ m/aftershock_vs20/i;
|
||||
$line = NormalizePerforceFilename( $line );
|
||||
# print "after: $line\n" if $line =~ m/aftershock_vs20/i;
|
||||
# if( $line =~ m/aftershock/i )
|
||||
# {
|
||||
# print STDERR "sameopened: $line\n";
|
||||
# }
|
||||
$sameopened{$line} = 1;
|
||||
}
|
||||
|
||||
my @sameunopened;
|
||||
my @revert;
|
||||
my @edit;
|
||||
my @add;
|
||||
|
||||
foreach $line ( @inclist )
|
||||
{
|
||||
if( defined( $sameunopened{$line} ) )
|
||||
{
|
||||
push @sameunopened, $line;
|
||||
}
|
||||
elsif( defined( $sameopened{$line} ) )
|
||||
{
|
||||
push @revert, $line;
|
||||
}
|
||||
elsif( defined( $diffunopened{$line} ) )
|
||||
{
|
||||
push @edit, $line;
|
||||
}
|
||||
elsif( defined( $missingunopened{$line} ) )
|
||||
{
|
||||
printf STDERR "p4autocheckout.pl: $line missing\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
push @add, $line;
|
||||
}
|
||||
}
|
||||
|
||||
#print "\@sameunopened = @sameunopened\n";
|
||||
#print "\@revert = @revert\n";
|
||||
#print "\@edit = @edit\n";
|
||||
#print "\@add = @add\n";
|
||||
|
||||
# Get the changelist number for the named changelist if we are actually going to edit or add anything.
|
||||
# We don't need it for deleting.
|
||||
my $changelistarg = "";
|
||||
# Get the changelist number for the Shader Auto Checkout changelist. Will create the changelist if it doesn't exist.
|
||||
my $changelistnumber = `valve_p4_create_changelist.cmd . \"$changelistname\"`;
|
||||
# Get rid of the newline
|
||||
$changelistnumber =~ s/\n//g;
|
||||
|
||||
#print STDERR "changelistnumber: $changelistnumber\n";
|
||||
|
||||
if( $changelistnumber != 0 )
|
||||
{
|
||||
$changelistarg = "-c $changelistnumber"
|
||||
}
|
||||
|
||||
#my %sameunopened;
|
||||
#my %diffunopened;
|
||||
#my %missingunopened;
|
||||
#my %sameopened;
|
||||
|
||||
if( scalar @edit )
|
||||
{
|
||||
while( scalar @edit )
|
||||
{
|
||||
# Grab 10 files at a time so that we don't blow cmd.exe line limits.
|
||||
my @files = splice @edit, 0, 10;
|
||||
my $cmd = "p4 edit $changelistarg @files";
|
||||
# print STDERR $cmd . "\n";
|
||||
my @results = &RunCommand( $cmd );
|
||||
# print STDERR @results;
|
||||
&PrintCleanPerforceOutput( @results );
|
||||
}
|
||||
}
|
||||
|
||||
if( scalar @revert )
|
||||
{
|
||||
while( scalar @revert )
|
||||
{
|
||||
# Grab 10 files at a time so that we don't blow cmd.exe line limits.
|
||||
my @files = splice @revert, 0, 10;
|
||||
my $cmd = "p4 revert @files";
|
||||
# print STDERR $cmd . "\n";
|
||||
my @results = &RunCommand( $cmd );
|
||||
&PrintCleanPerforceOutput( @results );
|
||||
}
|
||||
}
|
||||
|
||||
if( scalar @add )
|
||||
{
|
||||
while( scalar @add )
|
||||
{
|
||||
# Grab 10 files at a time so that we don't blow cmd.exe line limits.
|
||||
my @files = splice @add, 0, 10;
|
||||
my $cmd = "p4 add $changelistarg @files";
|
||||
# print STDERR $cmd . "\n";
|
||||
my @results = &RunCommand( $cmd );
|
||||
# print STDERR "@results\n";
|
||||
&PrintCleanPerforceOutput( @results );
|
||||
}
|
||||
}
|
||||
|
129
devtools/bin/p4revertshadertargets.pl
Normal file
129
devtools/bin/p4revertshadertargets.pl
Normal file
@ -0,0 +1,129 @@
|
||||
use strict;
|
||||
|
||||
BEGIN {use File::Basename; push @INC, dirname($0); }
|
||||
require "valve_perl_helpers.pl";
|
||||
|
||||
my $dynamic_compile = defined $ENV{"dynamic_shaders"} && $ENV{"dynamic_shaders"} != 0;
|
||||
|
||||
# ----------------------------------------------
|
||||
# COMMAND-LINE ARGS
|
||||
# ----------------------------------------------
|
||||
my $g_x360 = 0;
|
||||
my $g_ps3 = 0;
|
||||
my $g_tmpfolder = "";
|
||||
my $g_vcsext = ".vcs";
|
||||
my $g_SrcDir = ".";
|
||||
my $inputbase;
|
||||
my $g_SourceDir;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
$inputbase = shift;
|
||||
|
||||
if( $inputbase =~ m/-source/ )
|
||||
{
|
||||
$g_SourceDir = shift;
|
||||
}
|
||||
elsif( $inputbase =~ m/-x360/ )
|
||||
{
|
||||
$g_x360 = 1;
|
||||
$g_tmpfolder = "_360";
|
||||
$g_vcsext = ".360.vcs";
|
||||
}
|
||||
elsif( $inputbase =~ m/-ps3/ )
|
||||
{
|
||||
$g_ps3 = 1;
|
||||
$g_tmpfolder = "_ps3";
|
||||
$g_vcsext = ".ps3.vcs";
|
||||
}
|
||||
else
|
||||
{
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------
|
||||
# Load the list of shaders that we care about.
|
||||
# ----------------------------------------------
|
||||
my @srcfiles = &LoadShaderListFile( $inputbase );
|
||||
|
||||
my %incHash;
|
||||
my %vcsHash;
|
||||
my $shader;
|
||||
foreach $shader ( @srcfiles )
|
||||
{
|
||||
my $shadertype = &LoadShaderListFile_GetShaderType( $shader );
|
||||
my $shaderbase = &LoadShaderListFile_GetShaderBase( $shader );
|
||||
my $shadersrc = &LoadShaderListFile_GetShaderSrc( $shader );
|
||||
if( $shadertype eq "fxc" || $shadertype eq "vsh" )
|
||||
{
|
||||
# We only generate inc files for fxc and vsh files.
|
||||
my $incFileName = "$shadertype" . "tmp9" . $g_tmpfolder . "/" . $shaderbase . "\.inc";
|
||||
$incFileName =~ tr/A-Z/a-z/;
|
||||
$incHash{$incFileName} = 1;
|
||||
}
|
||||
|
||||
my $vcsFileName = "$shadertype/$shaderbase" . $g_vcsext;
|
||||
$vcsFileName =~ tr/A-Z/a-z/;
|
||||
$vcsHash{$vcsFileName} = 1;
|
||||
}
|
||||
|
||||
# ----------------------------------------------
|
||||
# Get the list of inc files to consider for reverting
|
||||
# ----------------------------------------------
|
||||
sub RevertIntegratedFiles
|
||||
{
|
||||
my $path = shift;
|
||||
my $fileHashRef = shift;
|
||||
|
||||
my $cmd = "p4 fstat $path";
|
||||
my @fstat = &RunCommand( $cmd );
|
||||
|
||||
my $depotFile;
|
||||
my $action;
|
||||
my @openedforintegrate;
|
||||
|
||||
my $line;
|
||||
foreach $line ( @fstat )
|
||||
{
|
||||
if( $line =~ m,depotFile (.*)\n, )
|
||||
{
|
||||
$depotFile = &NormalizePerforceFilename( $1 );
|
||||
}
|
||||
elsif( $line =~ m,action (.*)\n, )
|
||||
{
|
||||
$action = $1;
|
||||
}
|
||||
elsif( $line =~ m,^\s*$, )
|
||||
{
|
||||
if( defined $action && defined $fileHashRef->{$depotFile} && $action =~ m/integrate/i )
|
||||
{
|
||||
push @openedforintegrate, $depotFile;
|
||||
}
|
||||
undef $depotFile;
|
||||
undef $action;
|
||||
}
|
||||
}
|
||||
|
||||
if( scalar( @openedforintegrate ) )
|
||||
{
|
||||
my $cmd = "p4 revert @openedforintegrate";
|
||||
# print "$cmd\n";
|
||||
my @revertOutput = &RunCommand( $cmd );
|
||||
&PrintCleanPerforceOutput( @revertOutput );
|
||||
}
|
||||
}
|
||||
|
||||
my $path = "vshtmp9" . $g_tmpfolder . "/... fxctmp9" . $g_tmpfolder . "/...";
|
||||
&RevertIntegratedFiles( $path, \%incHash );
|
||||
|
||||
if( !$dynamic_compile )
|
||||
{
|
||||
&MakeDirHier( "../../../game/platform/shaders" );
|
||||
|
||||
# Might be in a different client for the vcs files, so chdir to the correct place.
|
||||
chdir "../../../game/platform/shaders" || die;
|
||||
|
||||
my $path = "...";
|
||||
&RevertIntegratedFiles( $path, \%vcsHash );
|
||||
}
|
BIN
devtools/bin/protoc.exe
Normal file
BIN
devtools/bin/protoc.exe
Normal file
Binary file not shown.
333
devtools/bin/psh_prep.pl
Normal file
333
devtools/bin/psh_prep.pl
Normal file
@ -0,0 +1,333 @@
|
||||
use String::CRC32;
|
||||
BEGIN {use File::Basename; push @INC, dirname($0); }
|
||||
require "valve_perl_helpers.pl";
|
||||
|
||||
sub BuildDefineOptions
|
||||
{
|
||||
local( $output );
|
||||
local( $combo ) = shift;
|
||||
local( $i );
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
local( $val ) = ( $combo % ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) ) + $dynamicDefineMin[$i];
|
||||
$output .= "/D$dynamicDefineNames[$i]=$val ";
|
||||
$combo = $combo / ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 );
|
||||
}
|
||||
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
|
||||
{
|
||||
local( $val ) = ( $combo % ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) ) + $staticDefineMin[$i];
|
||||
$output .= "/D$staticDefineNames[$i]=$val ";
|
||||
$combo = $combo / ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 );
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
sub CalcNumCombos
|
||||
{
|
||||
local( $i, $numCombos );
|
||||
$numCombos = 1;
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
$numCombos *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
|
||||
}
|
||||
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
|
||||
{
|
||||
$numCombos *= $staticDefineMax[$i] - $staticDefineMin[$i] + 1;
|
||||
}
|
||||
return $numCombos;
|
||||
}
|
||||
|
||||
sub CalcNumDynamicCombos
|
||||
{
|
||||
local( $i, $numCombos );
|
||||
$numCombos = 1;
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
$numCombos *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
|
||||
}
|
||||
return $numCombos;
|
||||
}
|
||||
|
||||
$g_dx9 = 1;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
$psh_filename = shift;
|
||||
|
||||
if( $psh_filename =~ m/-source/ )
|
||||
{
|
||||
$g_SourceDir = shift;
|
||||
}
|
||||
elsif( $psh_filename =~ m/-x360/ )
|
||||
{
|
||||
$g_x360 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
$psh_filename =~ s/-----.*$//;
|
||||
|
||||
|
||||
# Get the shader binary version number from a header file.
|
||||
open FILE, "<$g_SourceDir\\public\\materialsystem\\shader_vcs_version.h" || die;
|
||||
while( $line = <FILE> )
|
||||
{
|
||||
if( $line =~ m/^\#define\s+SHADER_VCS_VERSION_NUMBER\s+(\d+)\s*$/ )
|
||||
{
|
||||
$shaderVersion = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
if( !defined $shaderVersion )
|
||||
{
|
||||
die "couldn't get shader version from shader_vcs_version.h";
|
||||
}
|
||||
close FILE;
|
||||
|
||||
|
||||
|
||||
local( @staticDefineNames );
|
||||
local( @staticDefineMin );
|
||||
local( @staticDefineMax );
|
||||
local( @dynamicDefineNames );
|
||||
local( @dynamicDefineMin );
|
||||
local( @dynamicDefineMax );
|
||||
|
||||
# Parse the combos.
|
||||
open PSH, "<$psh_filename";
|
||||
while( <PSH> )
|
||||
{
|
||||
last if( !m,^;, );
|
||||
s,^;\s*,,;
|
||||
if( m/\s*STATIC\s*\:\s*\"(.*)\"\s+\"(\d+)\.\.(\d+)\"/ )
|
||||
{
|
||||
local( $name, $min, $max );
|
||||
$name = $1;
|
||||
$min = $2;
|
||||
$max = $3;
|
||||
# print "\"STATIC: $name\" \"$min..$max\"\n";
|
||||
if (/\[(.*)\]/)
|
||||
{
|
||||
$platforms=$1;
|
||||
next if ( ($g_x360) && (!($platforms=~/XBOX/i)) );
|
||||
next if ( (!$g_x360) && (!($platforms=~/PC/i)) );
|
||||
}
|
||||
push @staticDefineNames, $name;
|
||||
push @staticDefineMin, $min;
|
||||
push @staticDefineMax, $max;
|
||||
}
|
||||
elsif( m/\s*DYNAMIC\s*\:\s*\"(.*)\"\s+\"(\d+)\.\.(\d+)\"/ )
|
||||
{
|
||||
local( $name, $min, $max );
|
||||
$name = $1;
|
||||
$min = $2;
|
||||
$max = $3;
|
||||
# print "\"DYNAMIC: $name\" \"$min..$max\"\n";
|
||||
if (/\[(.*)\]/)
|
||||
{
|
||||
$platforms=$1;
|
||||
next if ( ($g_x360) && (!($platforms=~/XBOX/i)) );
|
||||
next if ( (!$g_x360) && (!($platforms=~/PC/i)) );
|
||||
}
|
||||
push @dynamicDefineNames, $name;
|
||||
push @dynamicDefineMin, $min;
|
||||
push @dynamicDefineMax, $max;
|
||||
}
|
||||
}
|
||||
close PSH;
|
||||
|
||||
$numCombos = &CalcNumCombos();
|
||||
$numDynamicCombos = &CalcNumDynamicCombos();
|
||||
print "$psh_filename\n";
|
||||
#print "$numCombos combos\n";
|
||||
#print "$numDynamicCombos dynamic combos\n";
|
||||
|
||||
if( $g_x360 )
|
||||
{
|
||||
$pshtmp = "pshtmp9_360";
|
||||
}
|
||||
elsif( $g_dx9 )
|
||||
{
|
||||
$pshtmp = "pshtmp9";
|
||||
}
|
||||
else
|
||||
{
|
||||
$pshtmp = "pshtmp8";
|
||||
}
|
||||
$basename = $psh_filename;
|
||||
$basename =~ s/\.psh$//i;
|
||||
|
||||
for( $shaderCombo = 0; $shaderCombo < $numCombos; $shaderCombo++ )
|
||||
{
|
||||
my $tempFilename = "shader$shaderCombo.o";
|
||||
unlink $tempFilename;
|
||||
|
||||
if( $g_x360 )
|
||||
{
|
||||
$cmd = "psa /D_X360=1 /Foshader$shaderCombo.o /nologo " . &BuildDefineOptions( $shaderCombo ) . "$psh_filename > NIL";
|
||||
}
|
||||
else
|
||||
{
|
||||
$cmd = "$g_SourceDir\\dx9sdk\\utilities\\psa /Foshader$shaderCombo.o /nologo " . &BuildDefineOptions( $shaderCombo ) . "$psh_filename > NIL";
|
||||
}
|
||||
|
||||
if( !stat $pshtmp )
|
||||
{
|
||||
mkdir $pshtmp, 0777 || die $!;
|
||||
}
|
||||
|
||||
# print $cmd . "\n";
|
||||
system $cmd || die $!;
|
||||
|
||||
# Make sure a file got generated because sometimes the die above won't happen on compile errors.
|
||||
my $filesize = (stat $tempFilename)[7];
|
||||
if ( !$filesize )
|
||||
{
|
||||
die "Error compiling shader$shaderCombo.o";
|
||||
}
|
||||
|
||||
push @outputHeader, @hdr;
|
||||
}
|
||||
|
||||
$basename =~ s/\.fxc//gi;
|
||||
push @outputHeader, "static PrecompiledShaderByteCode_t " . $basename . "_pixel_shaders[" . $numCombos . "] = \n";
|
||||
push @outputHeader, "{\n";
|
||||
local( $j );
|
||||
for( $j = 0; $j < $numCombos; $j++ )
|
||||
{
|
||||
local( $thing ) = "pixelShader_" . $basename . "_" . $j;
|
||||
push @outputHeader, "\t{ " . "$thing, sizeof( $thing ) },\n";
|
||||
}
|
||||
push @outputHeader, "};\n";
|
||||
|
||||
push @outputHeader, "struct $basename" . "PixelShader_t : public PrecompiledShader_t\n";
|
||||
push @outputHeader, "{\n";
|
||||
push @outputHeader, "\t$basename" . "PixelShader_t()\n";
|
||||
push @outputHeader, "\t{\n";
|
||||
push @outputHeader, "\t\tm_nFlags = 0;\n";
|
||||
push @outputHeader, "\t\tm_pByteCode = " . $basename . "_pixel_shaders;\n";
|
||||
push @outputHeader, "\t\tm_nShaderCount = $numCombos;\n";
|
||||
#push @outputHeader, "\t\tm_nDynamicCombos = m_nShaderCount;\n";
|
||||
push @outputHeader, "\t\t// NOTE!!! psh_prep.pl shaders are always static combos!\n";
|
||||
push @outputHeader, "\t\tm_nDynamicCombos = 1;\n";
|
||||
push @outputHeader, "\t\tm_pName = \"$basename\";\n";
|
||||
if( $basename =~ /vs\d\d/ ) # hack
|
||||
{
|
||||
push @outputHeader, "\t\tGetShaderDLL()->InsertPrecompiledShader( PRECOMPILED_VERTEX_SHADER, this );\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
push @outputHeader, "\t\tGetShaderDLL()->InsertPrecompiledShader( PRECOMPILED_PIXEL_SHADER, this );\n";
|
||||
}
|
||||
push @outputHeader, "\t}\n";
|
||||
push @outputHeader, "\tvirtual const PrecompiledShaderByteCode_t &GetByteCode( int shaderID )\n";
|
||||
push @outputHeader, "\t{\n";
|
||||
push @outputHeader, "\t\treturn m_pByteCode[shaderID];\n";
|
||||
push @outputHeader, "\t}\n";
|
||||
push @outputHeader, "};\n";
|
||||
|
||||
push @outputHeader, "static $basename" . "PixelShader_t $basename" . "_PixelShaderInstance;\n";
|
||||
|
||||
|
||||
&MakeDirHier( "shaders/psh" );
|
||||
|
||||
my $vcsName = "";
|
||||
if( $g_x360 )
|
||||
{
|
||||
$vcsName = $basename . ".360.vcs";
|
||||
}
|
||||
else
|
||||
{
|
||||
$vcsName = $basename . ".vcs";
|
||||
}
|
||||
|
||||
open COMPILEDSHADER, ">shaders/psh/$vcsName" || die;
|
||||
binmode( COMPILEDSHADER );
|
||||
|
||||
#
|
||||
# Write out the part of the header that we know. . we'll write the rest after writing the object code.
|
||||
#
|
||||
|
||||
#print $numCombos . "\n";
|
||||
|
||||
# Pack arguments
|
||||
my $sInt = "i";
|
||||
my $uInt = "I";
|
||||
if ( $g_x360 )
|
||||
{
|
||||
# Change arguments to "big endian long"
|
||||
$sInt = "N";
|
||||
$uInt = "N";
|
||||
}
|
||||
|
||||
open PSH, "<$psh_filename";
|
||||
my $crc = crc32( *PSH );
|
||||
close PSH;
|
||||
#print STDERR "crc for $psh_filename: $crc\n";
|
||||
|
||||
# version
|
||||
print COMPILEDSHADER pack $sInt, 4;
|
||||
# totalCombos
|
||||
print COMPILEDSHADER pack $sInt, $numCombos;
|
||||
# dynamic combos
|
||||
print COMPILEDSHADER pack $sInt, $numDynamicCombos;
|
||||
# flags
|
||||
print COMPILEDSHADER pack $uInt, 0x0; # nothing here for now.
|
||||
# centroid mask
|
||||
print COMPILEDSHADER pack $uInt, 0;
|
||||
# reference size for diffs
|
||||
print COMPILEDSHADER pack $uInt, 0;
|
||||
# crc32 of the source code
|
||||
print COMPILEDSHADER pack $uInt, $crc;
|
||||
|
||||
my $beginningOfDir = tell COMPILEDSHADER;
|
||||
|
||||
# Write out a blank directionary. . we'll fill it in later.
|
||||
for( $i = 0; $i < $numCombos; $i++ )
|
||||
{
|
||||
# offset from beginning of file.
|
||||
print COMPILEDSHADER pack $sInt, 0;
|
||||
# size
|
||||
print COMPILEDSHADER pack $sInt, 0;
|
||||
}
|
||||
|
||||
my $startByteCode = tell COMPILEDSHADER;
|
||||
my @byteCodeStart;
|
||||
my @byteCodeSize;
|
||||
|
||||
# Write out the shader object code.
|
||||
for( $shaderCombo = 0; $shaderCombo < $numCombos; $shaderCombo++ )
|
||||
{
|
||||
my $filename = "shader$shaderCombo\.o";
|
||||
my $filesize = (stat $filename)[7];
|
||||
|
||||
$byteCodeStart[$shaderCombo] = tell COMPILEDSHADER;
|
||||
$byteCodeSize[$shaderCombo] = $filesize;
|
||||
open SHADERBYTECODE, "<$filename";
|
||||
binmode SHADERBYTECODE;
|
||||
|
||||
my $bin;
|
||||
my $numread = read SHADERBYTECODE, $bin, $filesize;
|
||||
# print "filename: $filename numread: $numread filesize: $filesize\n";
|
||||
close SHADERBYTECODE;
|
||||
unlink $filename;
|
||||
|
||||
print COMPILEDSHADER $bin;
|
||||
}
|
||||
|
||||
# Seek back to the directory and write it out.
|
||||
seek COMPILEDSHADER, $beginningOfDir, 0;
|
||||
for( $i = 0; $i < $numCombos; $i++ )
|
||||
{
|
||||
# offset from beginning of file.
|
||||
print COMPILEDSHADER pack $sInt, $byteCodeStart[$i];
|
||||
# size
|
||||
print COMPILEDSHADER pack $sInt, $byteCodeSize[$i];
|
||||
}
|
||||
|
||||
close COMPILEDSHADER;
|
||||
|
||||
|
BIN
devtools/bin/schemacompiler.exe
Normal file
BIN
devtools/bin/schemacompiler.exe
Normal file
Binary file not shown.
36
devtools/bin/shaderinfo.pl
Normal file
36
devtools/bin/shaderinfo.pl
Normal file
@ -0,0 +1,36 @@
|
||||
#! perl
|
||||
|
||||
my $fname=shift || die "format is shaderinfo blah.vcs";
|
||||
|
||||
open(SHADER, $fname) || die "can't open $fname";
|
||||
binmode SHADER;
|
||||
|
||||
read(SHADER,$header,20);
|
||||
($ver,$ntotal,$ndynamic,$flags,$centroidmask)=unpack("LLLLL",$header);
|
||||
|
||||
#print "Version $ver total combos=$ntotal, num dynamic combos=$ndynamic,\n flags=$flags, centroid mask=$centroidmask\n";
|
||||
|
||||
read(SHADER,$refsize,4);
|
||||
$refsize=unpack("L",$refsize);
|
||||
#print "Size of reference shader for diffing=$refsize\n";
|
||||
|
||||
seek(SHADER,$refsize,1);
|
||||
|
||||
$nskipped_combos=0;
|
||||
for(1..$ntotal)
|
||||
{
|
||||
read(SHADER,$combodata,8);
|
||||
($ofs,$combosize)=unpack("LL",$combodata);
|
||||
if ( $ofs == 0xffffffff)
|
||||
{
|
||||
$nskipped_combos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
#print "$nskipped_combos skipped, for an actual total of ",$ntotal-$nskipped_combos,"\n";
|
||||
#print "Real to skipped ratio = ",($ntotal-$nskipped_combos)/$ntotal,"\n";
|
||||
# csv output - name, real combos, virtual combos, dynamic combos
|
||||
my $real_combos=$ntotal-$nskipped_combos;
|
||||
print "$fname,$real_combos,$ntotal,$ndynamic\n";
|
54
devtools/bin/splitdiff3.pl
Normal file
54
devtools/bin/splitdiff3.pl
Normal file
@ -0,0 +1,54 @@
|
||||
$infilename = shift;
|
||||
$outfilename1 = shift;
|
||||
$outfilename2 = shift;
|
||||
open INPUT, $infilename || die;
|
||||
@input = <INPUT>;
|
||||
close INPUT;
|
||||
|
||||
open MERGEDMINE, ">$outfilename1" || die;
|
||||
open MERGEDTHEIRS, ">$outfilename2" || die;
|
||||
|
||||
for( $i = 0; $i < scalar( @input ); $i++ )
|
||||
{
|
||||
$line = $input[$i];
|
||||
|
||||
if( $line =~ m/^(.*)<<<<<<</ )
|
||||
{
|
||||
$first = 1;
|
||||
$second = 0;
|
||||
print MERGEDMINE $1;
|
||||
print MERGEDTHEIRS $1;
|
||||
next;
|
||||
}
|
||||
# Make sure that we are in a split block so that comments with ======= don't mess us up.
|
||||
if( $line =~ m/^(.*)=======$/ && $first == 1 )
|
||||
{
|
||||
$first = 0;
|
||||
$second = 1;
|
||||
print MERGEDMINE $1;
|
||||
next;
|
||||
}
|
||||
if( $line =~ m/^(.*)>>>>>>>/ )
|
||||
{
|
||||
$first = $second = 0;
|
||||
print MERGEDTHEIRS $1;
|
||||
next;
|
||||
}
|
||||
|
||||
if( $first )
|
||||
{
|
||||
print MERGEDMINE $line;
|
||||
}
|
||||
elsif( $second )
|
||||
{
|
||||
print MERGEDTHEIRS $line;
|
||||
}
|
||||
else
|
||||
{
|
||||
print MERGEDMINE $line;
|
||||
print MERGEDTHEIRS $line;
|
||||
}
|
||||
}
|
||||
|
||||
close MERGEDMINE;
|
||||
close MERGEDTHEIRS;
|
15
devtools/bin/texttoarray.pl
Normal file
15
devtools/bin/texttoarray.pl
Normal file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env perl
|
||||
open( HANDLE,shift) || die;
|
||||
undef $/;
|
||||
binmode HANDLE;
|
||||
$data=<HANDLE>;
|
||||
$ctr=0;
|
||||
$out.=sprintf("static unsigned char %s[] = {\n ", shift);
|
||||
for($i=0;$i<length($data);$i++)
|
||||
{
|
||||
$out.=sprintf("0x%02x,", unpack("C", substr($data,$i,1)) );
|
||||
$out.="\n " if ( ( $ctr % 20) == 19);
|
||||
$ctr++;
|
||||
}
|
||||
$out.="0x00\n};\n";
|
||||
print $out;
|
BIN
devtools/bin/tier0.dll
Normal file
BIN
devtools/bin/tier0.dll
Normal file
Binary file not shown.
6
devtools/bin/uniqifylist.pl
Normal file
6
devtools/bin/uniqifylist.pl
Normal file
@ -0,0 +1,6 @@
|
||||
foreach $_ (sort <> )
|
||||
{
|
||||
next if( defined( $prevline ) && $_ eq $prevline );
|
||||
$prevline = $_;
|
||||
print;
|
||||
}
|
325
devtools/bin/updateshaders.pl
Normal file
325
devtools/bin/updateshaders.pl
Normal file
@ -0,0 +1,325 @@
|
||||
use String::CRC32;
|
||||
BEGIN {use File::Basename; push @INC, dirname($0); }
|
||||
require "valve_perl_helpers.pl";
|
||||
|
||||
$dynamic_compile = defined $ENV{"dynamic_shaders"} && $ENV{"dynamic_shaders"} != 0;
|
||||
|
||||
$depnum = 0;
|
||||
$baseSourceDir = ".";
|
||||
|
||||
my %dep;
|
||||
|
||||
sub GetAsmShaderDependencies_R
|
||||
{
|
||||
local( $shadername ) = shift;
|
||||
local( *SHADER );
|
||||
|
||||
open SHADER, "<$shadername";
|
||||
while( <SHADER> )
|
||||
{
|
||||
if( m/^\s*\#\s*include\s+\"(.*)\"/ )
|
||||
{
|
||||
# make sure it isn't in there already.
|
||||
if( !defined( $dep{$1} ) )
|
||||
{
|
||||
$dep{$1} = 1;
|
||||
GetAsmShaderDependencies_R( $1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
close SHADER;
|
||||
}
|
||||
|
||||
sub GetAsmShaderDependencies
|
||||
{
|
||||
local( $shadername ) = shift;
|
||||
undef %dep;
|
||||
GetAsmShaderDependencies_R( $shadername );
|
||||
# local( $i );
|
||||
# foreach $i ( keys( %dep ) )
|
||||
# {
|
||||
# print "$shadername depends on $i\n";
|
||||
# }
|
||||
return keys( %dep );
|
||||
}
|
||||
|
||||
sub GetShaderType
|
||||
{
|
||||
my $shadername = shift;
|
||||
my $shadertype;
|
||||
if( $shadername =~ m/\.vsh/i )
|
||||
{
|
||||
$shadertype = "vsh";
|
||||
}
|
||||
elsif( $shadername =~ m/\.psh/i )
|
||||
{
|
||||
$shadertype = "psh";
|
||||
}
|
||||
elsif( $shadername =~ m/\.fxc/i )
|
||||
{
|
||||
$shadertype = "fxc";
|
||||
}
|
||||
else
|
||||
{
|
||||
die;
|
||||
}
|
||||
return $shadertype;
|
||||
}
|
||||
|
||||
sub GetShaderSrc
|
||||
{
|
||||
my $shadername = shift;
|
||||
if ( $shadername =~ m/^(.*)-----/i )
|
||||
{
|
||||
return $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $shadername;
|
||||
}
|
||||
}
|
||||
|
||||
sub GetShaderBase
|
||||
{
|
||||
my $shadername = shift;
|
||||
if ( $shadername =~ m/-----(.*)$/i )
|
||||
{
|
||||
return $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
my $shadertype = &GetShaderType( $shadername );
|
||||
$shadername =~ s/\.$shadertype//i;
|
||||
return $shadername;
|
||||
}
|
||||
}
|
||||
|
||||
sub DoAsmShader
|
||||
{
|
||||
my $argstring = shift;
|
||||
my $shadername = &GetShaderSrc( $argstring );
|
||||
my $shaderbase = &GetShaderBase( $argstring );
|
||||
my $shadertype = &GetShaderType( $argstring );
|
||||
my $incfile = "";
|
||||
if( $shadertype eq "fxc" || $shadertype eq "vsh" )
|
||||
{
|
||||
$incfile = $shadertype . "tmp9" . $g_tmpfolder . "\\$shaderbase.inc ";
|
||||
}
|
||||
|
||||
my $vcsfile = $shaderbase . $g_vcsext;
|
||||
my $bWillCompileVcs = 1;
|
||||
if( ( $shadertype eq "fxc") && $dynamic_compile )
|
||||
{
|
||||
$bWillCompileVcs = 0;
|
||||
}
|
||||
if( $shadercrcpass{$argstring} )
|
||||
{
|
||||
$bWillCompileVcs = 0;
|
||||
}
|
||||
|
||||
if( $bWillCompileVcs )
|
||||
{
|
||||
&output_makefile_line( $incfile . "shaders\\$shadertype\\$vcsfile: $shadername ..\\..\\devtools\\bin\\updateshaders.pl ..\\..\\devtools\\bin\\" . $shadertype . "_prep.pl" . " @dep\n") ;
|
||||
}
|
||||
else
|
||||
{
|
||||
# psh files don't need a rule at this point since they don't have inc files and we aren't compiling a vcs.
|
||||
if( $shadertype eq "fxc" || $shadertype eq "vsh" )
|
||||
{
|
||||
&output_makefile_line( $incfile . ": $shadername ..\\..\\devtools\\bin\\updateshaders.pl ..\\..\\devtools\\bin\\" . $shadertype . "_prep.pl" . " @dep\n") ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $x360switch = "";
|
||||
my $ps3switch = "";
|
||||
my $moreswitches = "";
|
||||
if( !$bWillCompileVcs && $shadertype eq "fxc" )
|
||||
{
|
||||
$moreswitches .= "-novcs ";
|
||||
}
|
||||
if( $g_x360 )
|
||||
{
|
||||
$x360switch = "-x360";
|
||||
|
||||
if( $bWillCompileVcs && ( $shaderbase =~ m/_ps20$/i ) )
|
||||
{
|
||||
$moreswitches .= "-novcs ";
|
||||
$bWillCompileVcs = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if( $g_ps3 )
|
||||
{
|
||||
$ps3switch = "-ps3";
|
||||
|
||||
if( $bWillCompileVcs && ( $shaderbase =~ m/_ps20$/i ) )
|
||||
{
|
||||
$moreswitches .= "-novcs ";
|
||||
$bWillCompileVcs = 0;
|
||||
}
|
||||
}
|
||||
|
||||
# if we are psh and we are compiling the vcs, we don't need this rule.
|
||||
if( !( $shadertype eq "psh" && !$bWillCompileVcs ) )
|
||||
{
|
||||
&output_makefile_line( "\tperl $g_SourceDir\\devtools\\bin\\" . $shadertype . "_prep.pl $moreswitches $x360switch $ps3switch -source \"$g_SourceDir\" $argstring\n") ;
|
||||
}
|
||||
|
||||
if( $bWillCompileVcs )
|
||||
{
|
||||
&output_makefile_line( "\techo $shadername>> filestocopy.txt\n") ;
|
||||
my $dep;
|
||||
foreach $dep( @dep )
|
||||
{
|
||||
&output_makefile_line( "\techo $dep>> filestocopy.txt\n") ;
|
||||
}
|
||||
}
|
||||
&output_makefile_line( "\n") ;
|
||||
}
|
||||
|
||||
if( scalar( @ARGV ) == 0 )
|
||||
{
|
||||
die "Usage updateshaders.pl shaderprojectbasename\n\tie: updateshaders.pl stdshaders_dx6\n";
|
||||
}
|
||||
|
||||
$g_x360 = 0;
|
||||
$g_ps3 = 0;
|
||||
$g_tmpfolder = "_tmp";
|
||||
$g_vcsext = ".vcs";
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
$inputbase = shift;
|
||||
|
||||
if( $inputbase =~ m/-source/ )
|
||||
{
|
||||
$g_SourceDir = shift;
|
||||
}
|
||||
elsif( $inputbase =~ m/-x360/ )
|
||||
{
|
||||
$g_x360 = 1;
|
||||
$g_tmpfolder = "_360_tmp";
|
||||
$g_vcsext = ".360.vcs";
|
||||
}
|
||||
elsif( $inputbase =~ m/-ps3/ )
|
||||
{
|
||||
$g_ps3 = 1;
|
||||
$g_tmpfolder = "_ps3_tmp";
|
||||
$g_vcsext = ".ps3.vcs";
|
||||
}
|
||||
elsif( $inputbase =~ m/-execute/ )
|
||||
{
|
||||
$g_execute = 1;
|
||||
}
|
||||
elsif( $inputbase =~ m/-nv3x/ )
|
||||
{
|
||||
$nv3x = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
my @srcfiles = &LoadShaderListFile( $inputbase );
|
||||
|
||||
open MAKEFILE, ">makefile\.$inputbase";
|
||||
open COPYFILE, ">makefile\.$inputbase\.copy";
|
||||
open INCLIST, ">inclist.txt";
|
||||
open VCSLIST, ">vcslist.txt";
|
||||
|
||||
# make a default dependency that depends on all of the shaders.
|
||||
&output_makefile_line( "default: ") ;
|
||||
foreach $shader ( @srcfiles )
|
||||
{
|
||||
my $shadertype = &GetShaderType( $shader );
|
||||
my $shaderbase = &GetShaderBase( $shader );
|
||||
my $shadersrc = &GetShaderSrc( $shader );
|
||||
if( $shadertype eq "fxc" || $shadertype eq "vsh" )
|
||||
{
|
||||
# We only generate inc files for fxc and vsh files.
|
||||
my $incFileName = "$shadertype" . "tmp9" . $g_tmpfolder . "\\" . $shaderbase . "\.inc";
|
||||
&output_makefile_line( " $incFileName" );
|
||||
&output_inclist_line( "$incFileName\n" );
|
||||
}
|
||||
|
||||
my $vcsfile = $shaderbase . $g_vcsext;
|
||||
|
||||
my $compilevcs = 1;
|
||||
if( $shadertype eq "fxc" && $dynamic_compile )
|
||||
{
|
||||
$compilevcs = 0;
|
||||
}
|
||||
# Do not compile ps2.0 shaders on PS3/X360
|
||||
if( ( $g_x360 || $g_ps3 ) && ( $shaderbase =~ m/_ps20$/i ) )
|
||||
{
|
||||
$compilevcs = 0;
|
||||
}
|
||||
if( $compilevcs )
|
||||
{
|
||||
my $vcsFileName = "..\\..\\..\\game\\platform\\shaders\\$shadertype\\$shaderbase" . $g_vcsext;
|
||||
# We want to check for perforce operations even if the crc matches in the event that a file has been manually reverted and needs to be checked out again.
|
||||
&output_vcslist_line( "$vcsFileName\n" );
|
||||
$shadercrcpass{$shader} = &CheckCRCAgainstTarget( $shadersrc, $vcsFileName, 0 );
|
||||
if( $shadercrcpass{$shader} )
|
||||
{
|
||||
$compilevcs = 0;
|
||||
}
|
||||
}
|
||||
if( $compilevcs )
|
||||
{
|
||||
&output_makefile_line( " shaders\\$shadertype\\$vcsfile" );
|
||||
# emit a list of vcs files to copy to the target since we want to build them.
|
||||
&output_copyfile_line( GetShaderSrc($shader) . "-----" . GetShaderBase($shader) . "\n" );
|
||||
}
|
||||
}
|
||||
&output_makefile_line( "\n\n") ;
|
||||
|
||||
# Insert all of our vertex shaders and depencencies
|
||||
$lastshader = "";
|
||||
foreach $shader ( @srcfiles )
|
||||
{
|
||||
my $currentshader = &GetShaderSrc( $shader );
|
||||
if ( $lastshader ne $currentshader )
|
||||
{
|
||||
$lastshader = $currentshader;
|
||||
@dep = &GetAsmShaderDependencies( $lastshader );
|
||||
}
|
||||
&DoAsmShader( $shader );
|
||||
}
|
||||
close VCSLIST;
|
||||
close INCLIST;
|
||||
close COPYFILE;
|
||||
close MAKEFILE;
|
||||
|
||||
# nuke the copyfile if it is zero length
|
||||
if( ( stat "makefile\.$inputbase\.copy" )[7] == 0 )
|
||||
{
|
||||
unlink "makefile\.$inputbase\.copy";
|
||||
}
|
||||
|
||||
sub output_makefile_line
|
||||
{
|
||||
local ($_)=@_;
|
||||
print MAKEFILE $_;
|
||||
}
|
||||
|
||||
sub output_copyfile_line
|
||||
{
|
||||
local ($_)=@_;
|
||||
print COPYFILE $_;
|
||||
}
|
||||
|
||||
sub output_vcslist_line
|
||||
{
|
||||
local ($_)=@_;
|
||||
print VCSLIST $_;
|
||||
}
|
||||
|
||||
sub output_inclist_line
|
||||
{
|
||||
local ($_)=@_;
|
||||
print INCLIST $_;
|
||||
}
|
||||
|
65
devtools/bin/valve_p4_create_changelist.cmd
Normal file
65
devtools/bin/valve_p4_create_changelist.cmd
Normal file
@ -0,0 +1,65 @@
|
||||
@echo off
|
||||
|
||||
:: // This will make all new env variables local to this script
|
||||
setlocal
|
||||
|
||||
:: // Make sure we have 2 args
|
||||
if .%2.==.. (
|
||||
echo *** [valve_p4_create_changelist] Error calling command! No file or changelist specified for checkout! Usage: valve_p4_create_changelist.cmd fileOrPath "Description"
|
||||
endlocal
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: // Get file info
|
||||
set valveTmpPathOnly="%~d1%~p1"
|
||||
if "%valveTmpPathOnly%"=="" (
|
||||
echo *** [valve_p4_create_changelist] Error! Can't parse file or path "%1"!
|
||||
endlocal
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: // Change directories so that the p4 set commands give use useful data
|
||||
pushd %valveTmpPathOnly%
|
||||
|
||||
:: // Find user
|
||||
for /f "tokens=2 delims== " %%A in ('p4.exe set ^| find /i "P4USER="') do set valveP4User=%%A
|
||||
if "%valveP4User%"=="" goto RegularCheckout
|
||||
rem //echo User="%valveP4User%"
|
||||
|
||||
:: // Find client
|
||||
for /f "tokens=2 delims== " %%A in ('p4.exe set ^| find /i "P4CLIENT="') do set valveP4Client=%%A
|
||||
if "%valveP4Client%"=="" goto RegularCheckout
|
||||
rem //echo Client="%valveP4Client%"
|
||||
|
||||
:: // Search for existing changelist that matches command line arg
|
||||
set valveP4ChangelistName=%2%
|
||||
set valveP4ChangelistName=%valveP4ChangelistName:~1,-1%
|
||||
for /f "tokens=2 delims= " %%A in ('p4.exe changes -u %valveP4User% -s pending -c %valveP4Client% ^| sort /r ^| find /i "'%valveP4ChangelistName%"') do set valveP4ChangelistNumber=%%A
|
||||
if NOT "%valveP4ChangelistNumber%"=="" goto HaveChangelist
|
||||
|
||||
:: // We didn't find a matching changelist but we did figure enough out to create a new changelist
|
||||
rem //echo Creating New Changelist
|
||||
for /f "tokens=2 delims= " %%A in ('^( echo Change: new ^& echo Client: %valveP4Client% ^& echo User: %valveP4User% ^& echo Status: new ^& echo Description: %valveP4ChangelistName%^&echo.^) ^| p4.exe change -i') do set valveP4ChangelistNumberJustCreated=%%A
|
||||
if "%valveP4ChangelistNumberJustCreated%"=="" goto RegularCheckout
|
||||
|
||||
:: // Now search for the changelist number even though we already have it to try to clean up after the race condition when it's hit
|
||||
:: // This way, if more than one changelist is created in parallel, this will hopefully cause them to be checked out into the same changelist and the empty one deleted
|
||||
for /f "tokens=2 delims= " %%A in ('p4.exe changes -u %valveP4User% -s pending -c %valveP4Client% ^| sort /r ^| find /i "'%valveP4ChangelistName%"') do set valveP4ChangelistNumber=%%A
|
||||
if "%valveP4ChangelistNumber%"=="" goto RegularCheckout
|
||||
|
||||
if NOT "%valveP4ChangelistNumber%"=="%valveP4ChangelistNumberJustCreated%" p4.exe change -d %valveP4ChangelistNumberJustCreated% 2>&1 >nul
|
||||
|
||||
:: // We have a changelist number
|
||||
:HaveChangelist
|
||||
echo %valveP4ChangelistNumber%
|
||||
goto End
|
||||
|
||||
:: // Can't find or create the changelist, output 0
|
||||
:RegularCheckout
|
||||
echo 0
|
||||
goto End
|
||||
|
||||
:End
|
||||
popd
|
||||
endlocal
|
||||
exit /b 0
|
93
devtools/bin/valve_p4_edit_to_changelist.cmd
Normal file
93
devtools/bin/valve_p4_edit_to_changelist.cmd
Normal file
@ -0,0 +1,93 @@
|
||||
@echo off
|
||||
|
||||
:: // This will make all new env variables local to this script
|
||||
setlocal
|
||||
|
||||
:: // If called with the start command, we need to exit, so also make sure you pass EXIT as the third param!
|
||||
:: // Also, if you modify this script, make sure that endlocal and exit are within ()'s so valveExitArg works!
|
||||
:: // Type 'help set' at a command prompt if you don't understand why.
|
||||
if NOT "%3"=="EXIT" set valveExitArg=/b
|
||||
|
||||
:: // Make sure we have 2 args
|
||||
if .%2.==.. (
|
||||
echo *** [valve_p4_edit_to_changelist] Error calling command! No file or changelist specified for checkout! Usage: valve_p4_edit_to_changelist.cmd file "Description" [EXIT]
|
||||
endlocal
|
||||
exit %valveExitArg% 1
|
||||
)
|
||||
|
||||
:: // Get file info
|
||||
set valveTmpFileName="%~n1%~x1"
|
||||
set valveTmpFullFilePath="%~f1"
|
||||
set valveTmpPathOnly="%~d1%~p1"
|
||||
|
||||
if "%valveTmpFileName%"=="" (
|
||||
echo *** [valve_p4_edit_to_changelist] Error! Can't parse filename "%1"!
|
||||
endlocal
|
||||
exit %valveExitArg% 1
|
||||
)
|
||||
|
||||
if "%valveTmpFullFilePath%"=="" (
|
||||
echo *** [valve_p4_edit_to_changelist] Error! Can't parse filename "%1"!
|
||||
endlocal
|
||||
exit %valveExitArg% 1
|
||||
)
|
||||
|
||||
if "%valveTmpPathOnly%"=="" (
|
||||
echo *** [valve_p4_edit_to_changelist] Error! Can't parse filename "%1"!
|
||||
endlocal
|
||||
exit %valveExitArg% 1
|
||||
)
|
||||
|
||||
:: // Change directories so that the p4 set commands give use useful data
|
||||
pushd %valveTmpPathOnly%
|
||||
|
||||
:: // Find user
|
||||
for /f "tokens=2 delims== " %%A in ('p4.exe set ^| find /i "P4USER="') do set valveP4User=%%A
|
||||
if "%valveP4User%"=="" goto RegularCheckout
|
||||
rem //echo User="%valveP4User%"
|
||||
|
||||
:: // Find client
|
||||
for /f "tokens=2 delims== " %%A in ('p4.exe set ^| find /i "P4CLIENT="') do set valveP4Client=%%A
|
||||
if "%valveP4Client%"=="" goto RegularCheckout
|
||||
rem //echo Client="%valveP4Client%"
|
||||
|
||||
:: // Search for existing changelist that matches command line arg
|
||||
set valveP4ChangelistName=%2%
|
||||
set valveP4ChangelistName=%valveP4ChangelistName:~1,-1%
|
||||
for /f "tokens=2 delims= " %%A in ('p4.exe changes -u %valveP4User% -s pending -c %valveP4Client% ^| sort /r ^| find /i "'%valveP4ChangelistName%"') do set valveP4ChangelistNumber=%%A
|
||||
if NOT "%valveP4ChangelistNumber%"=="" goto HaveChangelist
|
||||
|
||||
:: // We didn't find a matching changelist but we did figure enough out to create a new changelist
|
||||
rem //echo Creating New Changelist
|
||||
for /f "tokens=2 delims= " %%A in ('^( echo Change: new ^& echo Client: %valveP4Client% ^& echo User: %valveP4User% ^& echo Status: new ^& echo Description: %valveP4ChangelistName%^&echo.^) ^| p4.exe change -i') do set valveP4ChangelistNumberJustCreated=%%A
|
||||
if "%valveP4ChangelistNumberJustCreated%"=="" goto RegularCheckout
|
||||
|
||||
:: // Now search for the changelist number even though we already have it to try to clean up after the race condition when it's hit
|
||||
:: // This way, if more than one changelist is created in parallel, this will hopefully cause them to be checked out into the same changelist and the empty one deleted
|
||||
for /f "tokens=2 delims= " %%A in ('p4.exe changes -u %valveP4User% -s pending -c %valveP4Client% ^| sort /r ^| find /i "'%valveP4ChangelistName%"') do set valveP4ChangelistNumber=%%A
|
||||
if "%valveP4ChangelistNumber%"=="" goto RegularCheckout
|
||||
|
||||
if NOT "%valveP4ChangelistNumber%"=="%valveP4ChangelistNumberJustCreated%" p4.exe change -d %valveP4ChangelistNumberJustCreated% 2>&1 >nul
|
||||
|
||||
:: // We have a changelist number
|
||||
:HaveChangelist
|
||||
set valveP4ChangelistArg=-c %valveP4ChangelistNumber%
|
||||
rem //echo valveP4ChangelistArg="%valveP4ChangelistArg%"
|
||||
rem //echo ChangelistNumber="%valveP4ChangelistNumber%"
|
||||
rem //echo ChangelistName="%valveP4ChangelistName%"
|
||||
|
||||
:: // Check the file out
|
||||
:RegularCheckout
|
||||
if "%VALVE_WAIT_ON_P4%"=="" (
|
||||
p4.exe edit %valveP4ChangelistArg% %valveTmpFullFilePath% 2>&1 | find /v /i "- currently opened for edit" | find /v /i "- also opened by" | find /v /i "- file(s) not on client" | find /v /i "- can't change from"
|
||||
) ELSE (
|
||||
:: // Filter out largely benign messages unless we're explicitly waiting on p4 results a la buildbot
|
||||
p4.exe edit %valveP4ChangelistArg% %valveTmpFullFilePath% 2>&1 | find /v /i "- also opened by"
|
||||
)
|
||||
|
||||
goto End
|
||||
|
||||
:End
|
||||
popd
|
||||
( endlocal
|
||||
exit %valveExitArg% 0 )
|
554
devtools/bin/valve_perl_helpers.pl
Normal file
554
devtools/bin/valve_perl_helpers.pl
Normal file
@ -0,0 +1,554 @@
|
||||
sub BackToForwardSlash
|
||||
{
|
||||
my( $path ) = shift;
|
||||
$path =~ s,\\,/,g;
|
||||
return $path;
|
||||
}
|
||||
|
||||
sub RemoveFileName
|
||||
{
|
||||
my( $in ) = shift;
|
||||
$in = &BackToForwardSlash( $in );
|
||||
$in =~ s,/[^/]*$,,;
|
||||
return $in;
|
||||
}
|
||||
|
||||
sub RemovePath
|
||||
{
|
||||
my( $in ) = shift;
|
||||
$in = &BackToForwardSlash( $in );
|
||||
$in =~ s,^(.*)/([^/]*)$,$2,;
|
||||
return $in;
|
||||
}
|
||||
|
||||
sub MakeDirHier
|
||||
{
|
||||
my( $in ) = shift;
|
||||
# print "MakeDirHier( $in )\n";
|
||||
$in = &BackToForwardSlash( $in );
|
||||
my( @path );
|
||||
while( $in =~ m,/, ) # while $in still has a slash
|
||||
{
|
||||
my( $end ) = &RemovePath( $in );
|
||||
push @path, $end;
|
||||
# print $in . "\n";
|
||||
$in = &RemoveFileName( $in );
|
||||
}
|
||||
my( $i );
|
||||
my( $numelems ) = scalar( @path );
|
||||
my( $curpath );
|
||||
for( $i = $numelems - 1; $i >= 0; $i-- )
|
||||
{
|
||||
$curpath .= "/" . $path[$i];
|
||||
my( $dir ) = $in . $curpath;
|
||||
if( !stat $dir )
|
||||
{
|
||||
# print "mkdir $dir\n";
|
||||
mkdir $dir, 0777;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub FileExists
|
||||
{
|
||||
my $filename = shift;
|
||||
my @statresult = stat $filename;
|
||||
my $iswritable = @statresult != 0;
|
||||
return $iswritable;
|
||||
}
|
||||
|
||||
sub MakeFileWritable
|
||||
{
|
||||
my $filename = shift;
|
||||
if ( &FileExists( $filename ) )
|
||||
{
|
||||
chmod 0666, $filename || die;
|
||||
}
|
||||
}
|
||||
|
||||
sub MakeFileReadOnly
|
||||
{
|
||||
my $filename = shift;
|
||||
chmod 0444, $filename || die;
|
||||
}
|
||||
|
||||
# Run a command and get stdout and stderr to an array
|
||||
sub RunCommand
|
||||
{
|
||||
my $cmd = shift;
|
||||
# print STDERR "command: $cmd\n";
|
||||
system "$cmd > cmdout.txt 2>&1" || die;
|
||||
local( *FILE );
|
||||
open FILE, "<cmdout.txt" || die;
|
||||
my @output = <FILE>;
|
||||
# print STDERR "command output: @output\n";
|
||||
close FILE;
|
||||
unlink "cmdout.txt" || die;
|
||||
return @output;
|
||||
}
|
||||
|
||||
sub PerforceEditOrAdd
|
||||
{
|
||||
return;
|
||||
my $filename = shift;
|
||||
my $changelistarg = shift;
|
||||
|
||||
# Is the file on the client?
|
||||
my $cmd = "p4 fstat \"$filename\"";
|
||||
my @p4output = &RunCommand( $cmd );
|
||||
my $p4output = join "", @p4output;
|
||||
if( $p4output =~ m/no such file/ )
|
||||
{
|
||||
# not on client. . add
|
||||
my $cmd = "p4 add $changelistarg $filename";
|
||||
my @p4output = &RunCommand( $cmd );
|
||||
my $p4output = join "", @p4output;
|
||||
if( $p4output =~ m/opened for add/ )
|
||||
{
|
||||
print $p4output;
|
||||
return;
|
||||
}
|
||||
print "ERROR: $p4output";
|
||||
return;
|
||||
}
|
||||
|
||||
# The file is known to be on the client at this point.
|
||||
|
||||
# Is it open for edit?
|
||||
if( $p4output =~ m/action edit/ )
|
||||
{
|
||||
# Is is open for edit, let's see if it's still different.
|
||||
# check for opened files that are not different from the revision in the depot.
|
||||
my $cmd = "p4 diff -sr \"$filename\"";
|
||||
my @p4output = &RunCommand( $cmd );
|
||||
my $outputstring = join "", @p4output;
|
||||
# check for empty string
|
||||
if( !( $outputstring =~ m/^\s*$/ ) )
|
||||
{
|
||||
my $cmd = "p4 revert \"$filename\"";
|
||||
my @p4output = &RunCommand( $cmd );
|
||||
my $outputstring = join "", @p4output;
|
||||
print $outputstring;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# check for unopened files that are different from the revision in the depot.
|
||||
my $cmd = "p4 diff -se \"$filename\"";
|
||||
my @p4output = &RunCommand( $cmd );
|
||||
my $outputstring = join "", @p4output;
|
||||
# check for empty string
|
||||
if( $outputstring =~ m/^\s*$/ )
|
||||
{
|
||||
&MakeFileReadOnly( $filename );
|
||||
return;
|
||||
}
|
||||
|
||||
# We need to edit the file since it is known to be different here.
|
||||
my $cmd = "p4 edit $changelistarg \"$filename\"";
|
||||
my @p4output = &RunCommand( $cmd );
|
||||
|
||||
my $line;
|
||||
foreach $line ( @p4output )
|
||||
{
|
||||
if( $line =~ m/not on client/ )
|
||||
{
|
||||
#print "notonclient...";
|
||||
print "ERROR: @p4output\n";
|
||||
return;
|
||||
}
|
||||
if( $line =~ m/currently opened for edit/ )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( $line =~ m/opened for edit/ )
|
||||
{
|
||||
print $line;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub FileIsWritable
|
||||
{
|
||||
local( $filename ) = shift;
|
||||
local( @statresult ) = stat $filename;
|
||||
local( $mode, $iswritable );
|
||||
$mode = oct( $statresult[2] );
|
||||
$iswritable = ( $mode & 2 ) != 0;
|
||||
return $iswritable;
|
||||
}
|
||||
|
||||
sub TouchFile
|
||||
{
|
||||
my $filename = shift;
|
||||
if( !&FileExists( $filename ) )
|
||||
{
|
||||
if( !open FILE, ">$filename" )
|
||||
{
|
||||
die;
|
||||
}
|
||||
close FILE;
|
||||
}
|
||||
my $now = time;
|
||||
local( *FILE );
|
||||
utime $now, $now, $filename;
|
||||
}
|
||||
|
||||
sub FileExistsInPerforce
|
||||
{
|
||||
my $filename = shift;
|
||||
my @output = &RunCommand( "p4 fstat $filename" );
|
||||
my $line;
|
||||
foreach $line (@output)
|
||||
{
|
||||
if( $line =~ m/no such file/ )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub PerforceWriteFile
|
||||
{
|
||||
my $filename = shift;
|
||||
my $filecontents = shift;
|
||||
# my $changelistname = shift;
|
||||
|
||||
# Get the changelist number for the Shader Auto Checkout changelist. Will create the changelist if it doesn't exist.
|
||||
# my $changelistnumber = `valve_p4_create_changelist.cmd . \"$changelistname\"`;
|
||||
# Get rid of the newline
|
||||
# $changelistnumber =~ s/\n//g;
|
||||
|
||||
# my $changelistarg = "";
|
||||
# if( $changelistnumber != 0 )
|
||||
# {
|
||||
# $changelistarg = "-c $changelistnumber"
|
||||
# }
|
||||
|
||||
# Make the target vcs writable if it exists
|
||||
MakeFileWritable( $filename );
|
||||
|
||||
# Write the file.
|
||||
local( *FP );
|
||||
open FP, ">$filename";
|
||||
print FP $filecontents;
|
||||
close FP;
|
||||
|
||||
# Do whatever needs to happen with perforce for this file.
|
||||
# &PerforceEditOrAdd( $filename, $changelistarg );
|
||||
}
|
||||
|
||||
sub WriteFile
|
||||
{
|
||||
my $filename = shift;
|
||||
my $filecontents = shift;
|
||||
|
||||
# Make the target vcs writable if it exists
|
||||
MakeFileWritable( $filename );
|
||||
|
||||
# Write the file.
|
||||
local( *FP );
|
||||
open FP, ">$filename";
|
||||
print FP $filecontents;
|
||||
close FP;
|
||||
}
|
||||
|
||||
sub PrintCleanPerforceOutput
|
||||
{
|
||||
my $line;
|
||||
while( $line = shift )
|
||||
{
|
||||
if( $line =~ m/currently opened/i )
|
||||
{
|
||||
next;
|
||||
}
|
||||
if( $line =~ m/already opened for edit/i )
|
||||
{
|
||||
next;
|
||||
}
|
||||
if( $line =~ m/also opened/i )
|
||||
{
|
||||
next;
|
||||
}
|
||||
if( $line =~ m/add of existing file/i )
|
||||
{
|
||||
next;
|
||||
}
|
||||
print $line;
|
||||
}
|
||||
}
|
||||
|
||||
# HACK!!!! Need to pass something in to do this rather than hard coding.
|
||||
sub NormalizePerforceFilename
|
||||
{
|
||||
my $line = shift;
|
||||
|
||||
# remove newlines.
|
||||
$line =~ s/\n//;
|
||||
# downcase.
|
||||
$line =~ tr/[A-Z]/[a-z]/;
|
||||
# backslash to forwardslash
|
||||
$line =~ s,\\,/,g;
|
||||
|
||||
# for inc files HACK!
|
||||
$line =~ s/^.*(fxctmp9.*)/$1/i;
|
||||
$line =~ s/^.*(vshtmp9.*)/$1/i;
|
||||
|
||||
# for vcs files. HACK!
|
||||
$line =~ s,^.*game/platform/shaders/,,i;
|
||||
|
||||
return $line;
|
||||
}
|
||||
|
||||
sub MakeSureFileExists
|
||||
{
|
||||
local( $filename ) = shift;
|
||||
local( $testexists ) = shift;
|
||||
local( $testwrite ) = shift;
|
||||
|
||||
local( @statresult ) = stat $filename;
|
||||
if( !@statresult && $testexists )
|
||||
{
|
||||
die "$filename doesn't exist!\n";
|
||||
}
|
||||
local( $mode, $iswritable );
|
||||
$mode = oct( $statresult[2] );
|
||||
$iswritable = ( $mode & 2 ) != 0;
|
||||
if( !$iswritable && $testwrite )
|
||||
{
|
||||
die "$filename isn't writable!\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub LoadShaderListFile_GetShaderType
|
||||
{
|
||||
my $shadername = shift;
|
||||
my $shadertype;
|
||||
if( $shadername =~ m/\.vsh/i )
|
||||
{
|
||||
$shadertype = "vsh";
|
||||
}
|
||||
elsif( $shadername =~ m/\.psh/i )
|
||||
{
|
||||
$shadertype = "psh";
|
||||
}
|
||||
elsif( $shadername =~ m/\.fxc/i )
|
||||
{
|
||||
$shadertype = "fxc";
|
||||
}
|
||||
else
|
||||
{
|
||||
die;
|
||||
}
|
||||
return $shadertype;
|
||||
}
|
||||
|
||||
sub LoadShaderListFile_GetShaderSrc
|
||||
{
|
||||
my $shadername = shift;
|
||||
if ( $shadername =~ m/^(.*)-----/i )
|
||||
{
|
||||
return $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $shadername;
|
||||
}
|
||||
}
|
||||
|
||||
sub LoadShaderListFile_GetShaderBase
|
||||
{
|
||||
my $shadername = shift;
|
||||
if ( $shadername =~ m/-----(.*)$/i )
|
||||
{
|
||||
return $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
my $shadertype = &LoadShaderListFile_GetShaderType( $shadername );
|
||||
$shadername =~ s/\.$shadertype//i;
|
||||
return $shadername;
|
||||
}
|
||||
}
|
||||
|
||||
sub LoadShaderListFile
|
||||
{
|
||||
my $inputbase = shift;
|
||||
|
||||
my @srcfiles;
|
||||
&MakeSureFileExists( "$inputbase.txt", 1, 0 );
|
||||
|
||||
open SHADERLISTFILE, "<$inputbase.txt" || die;
|
||||
my $line;
|
||||
while( $line = <SHADERLISTFILE> )
|
||||
{
|
||||
$line =~ s/\/\/.*$//; # remove comments "//..."
|
||||
$line =~ s/^\s*//; # trim leading whitespace
|
||||
$line =~ s/\s*$//; # trim trailing whitespace
|
||||
next if( $line =~ m/^\s*$/ );
|
||||
if( $line =~ m/\.fxc/ || $line =~ m/\.vsh/ || $line =~ m/\.psh/ )
|
||||
{
|
||||
my $shaderbase = &LoadShaderListFile_GetShaderBase( $line );
|
||||
|
||||
if( $ENV{"DIRECTX_FORCE_MODEL"} =~ m/^30$/i ) # forcing all shaders to be ver. 30
|
||||
{
|
||||
my $targetbase = $shaderbase;
|
||||
$targetbase =~ s/_ps2x/_ps30/i;
|
||||
$targetbase =~ s/_ps20b/_ps30/i;
|
||||
$targetbase =~ s/_ps20/_ps30/i;
|
||||
$targetbase =~ s/_vs20/_vs30/i;
|
||||
$targetbase =~ s/_vsxx/_vs30/i;
|
||||
push @srcfiles, ( $line . "-----" . $targetbase );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( $shaderbase =~ m/_ps2x/i )
|
||||
{
|
||||
my $targetbase = $shaderbase;
|
||||
$targetbase =~ s/_ps2x/_ps20/i;
|
||||
push @srcfiles, ( $line . "-----" . $targetbase );
|
||||
|
||||
$targetbase = $shaderbase;
|
||||
$targetbase =~ s/_ps2x/_ps20b/i;
|
||||
push @srcfiles, ( $line . "-----" . $targetbase );
|
||||
}
|
||||
elsif( $shaderbase =~ m/_vsxx/i )
|
||||
{
|
||||
my $targetbase = $shaderbase;
|
||||
$targetbase =~ s/_vsxx/_vs20/i;
|
||||
push @srcfiles, ( $line . "-----" . $targetbase );
|
||||
}
|
||||
else
|
||||
{
|
||||
push @srcfiles, ( $line . "-----" . $shaderbase );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
close SHADERLISTFILE;
|
||||
return @srcfiles;
|
||||
}
|
||||
|
||||
sub ReadInputFileWithIncludes
|
||||
{
|
||||
local( $filename ) = shift;
|
||||
# print STDERR "ReadInputFileWithIncludes: $filename\n";
|
||||
|
||||
local( *INPUT );
|
||||
local( $output );
|
||||
|
||||
# print STDERR "before open\n";
|
||||
open INPUT, "<$filename" || die;
|
||||
# print STDERR "after open\n";
|
||||
|
||||
local( $line );
|
||||
while( $line = <INPUT> )
|
||||
{
|
||||
# print STDERR $line;
|
||||
if( $line =~ m/\#include\s+\"(.*)\"/i )
|
||||
{
|
||||
$output.= ReadInputFileWithIncludes( $1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
$output .= $line;
|
||||
}
|
||||
}
|
||||
|
||||
close INPUT;
|
||||
return $output;
|
||||
}
|
||||
|
||||
sub GetCRCFromSourceFile
|
||||
{
|
||||
my $filename = shift;
|
||||
my $data = &ReadInputFileWithIncludes( $filename );
|
||||
# print STDERR $data;
|
||||
$crc = crc32( $data );
|
||||
# print STDERR "GetCRCFromSourceFile: $crc\n";
|
||||
return $crc;
|
||||
}
|
||||
|
||||
sub GetCRCFromVCSFile
|
||||
{
|
||||
my $filename = shift;
|
||||
# print STDERR "GetCRCFromVCSFile $filename\n";
|
||||
local( *FP );
|
||||
open FP, "<$filename" || die "GetCRCFromVCSFile: can't open file $filename\n";
|
||||
binmode( FP );
|
||||
|
||||
# unpack arguments
|
||||
my $sInt = "i";
|
||||
my $uInt = "I";
|
||||
if ( ( $filename =~ m/\.360\./ ) || ( $filename =~ m/\.ps3\./ ) )
|
||||
{
|
||||
# Change arguments to "big endian long"
|
||||
$sInt = "N";
|
||||
$uInt = "N";
|
||||
}
|
||||
|
||||
my $header;
|
||||
read FP, $header, 7 * 4 || die "updateshaders.pl:GetCRCFromVCSFile: can't read header for $filename\n";
|
||||
my $version,$numCombos,$numDynamicCombos,$flags,$centroidMask,$refSize,$crc;
|
||||
($version,$numCombos,$numDynamicCombos,$flags,$centroidMask,$refSize,$crc) = unpack "$sInt$sInt$sInt$uInt$uInt$uInt$uInt", $header;
|
||||
unless( $version == 4 || $version == 5 || $version == 6 )
|
||||
{
|
||||
print STDERR "ERROR: GetCRCFromVCSFile: $filename is version $version\n";
|
||||
return 0;
|
||||
}
|
||||
# print STDERR "version: $version\n";
|
||||
# print STDERR "numCombos: $numCombos\n";
|
||||
# print STDERR "numDynamicCombos: $numDynamicCombos\n";
|
||||
# print STDERR "flags: $flags\n";
|
||||
# print STDERR "centroidMask: $centroidMask\n";
|
||||
# print STDERR "refSize: $refSize\n";
|
||||
# print STDERR "GetCRCFromVCSFile: $crc\n";
|
||||
close( FP );
|
||||
return $crc;
|
||||
}
|
||||
|
||||
sub CheckCRCAgainstTarget
|
||||
{
|
||||
my $srcFileName = shift;
|
||||
my $vcsFileName = shift;
|
||||
my $warn = shift;
|
||||
|
||||
# Make sure both files exist.
|
||||
# print STDERR "$srcFileName doesn't exist\n" if( !( -e $srcFileName ) );
|
||||
# print STDERR "$vcsFileName doesn't exist\n" if( !( -e $vcsFileName ) );
|
||||
if( !( -e $srcFileName ) )
|
||||
{
|
||||
if( $warn )
|
||||
{
|
||||
print "$srcFileName missing\n";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if( !( -e $vcsFileName ) )
|
||||
{
|
||||
if( $warn )
|
||||
{
|
||||
print "$vcsFileName missing\n";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
# print STDERR "CheckCRCAgainstTarget( $srcFileName, $vcsFileName );\n";
|
||||
# print STDERR "vcsFileName: $vcsFileName\n";
|
||||
# print STDERR "vcsFileName: $srcFileName\n";
|
||||
my $vcsCRC = &GetCRCFromVCSFile( $vcsFileName );
|
||||
my $srcCRC = &GetCRCFromSourceFile( $srcFileName );
|
||||
if( $warn && ( $vcsCRC != $srcCRC ) )
|
||||
{
|
||||
print "$vcsFileName checksum ($vcsCRC) != $srcFileName checksum: ($srcCRC)\n";
|
||||
}
|
||||
|
||||
# return 0; # use this to skip crc checking.
|
||||
# if( $vcsCRC == $srcCRC )
|
||||
# {
|
||||
# print STDERR "CRC passed for $srcFileName $vcsFileName $vcsCRC\n";
|
||||
# }
|
||||
return $vcsCRC == $srcCRC;
|
||||
}
|
||||
|
||||
1;
|
49
devtools/bin/vpc
Normal file
49
devtools/bin/vpc
Normal file
@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
OS=`uname`
|
||||
SCRIPTPATH=`dirname $0`
|
||||
FORCEARG=""
|
||||
|
||||
case $OS in
|
||||
"Darwin")
|
||||
BINNAME=vpc_osx
|
||||
;;
|
||||
"Linux")
|
||||
BINNAME=vpc_linux
|
||||
;;
|
||||
*)
|
||||
echo "Couldn't find appropriate VPC binary, fix the script."
|
||||
exit -1
|
||||
;;
|
||||
esac
|
||||
|
||||
CWD=`pwd`
|
||||
cd $SCRIPTPATH/../../utils/vpc/vpc
|
||||
# ask make if we need to do any work, returns 0 if we don't,
|
||||
# non zero if we do.
|
||||
make -q
|
||||
RC=$?
|
||||
if [ $RC -eq 1 ]; then
|
||||
FORCEARG="/f"
|
||||
elif [ $RC -eq 2 ]; then
|
||||
FORCEARG="/f"
|
||||
make clean
|
||||
fi
|
||||
make -j4
|
||||
if [ $? -ne 0 ]; then
|
||||
exit -1
|
||||
fi
|
||||
if [ $RC -ne 0 ]; then
|
||||
cp -vf ../../devtools/bin/$BINNAME $CWD/$SCRIPTPATH
|
||||
fi
|
||||
|
||||
cd $CWD
|
||||
|
||||
if [ $OS == "Darwin" ]; then
|
||||
$SCRIPTPATH/$BINNAME $FORCEARG $@
|
||||
elif [ $OS == "Linux" ]; then
|
||||
$SCRIPTPATH/$BINNAME $FORCEARG $@
|
||||
else
|
||||
echo "Couldn't find appropriate VPC binary, fix the script."
|
||||
exit -1
|
||||
fi
|
BIN
devtools/bin/vpc.dll
Normal file
BIN
devtools/bin/vpc.dll
Normal file
Binary file not shown.
BIN
devtools/bin/vpc.exe
Normal file
BIN
devtools/bin/vpc.exe
Normal file
Binary file not shown.
676
devtools/bin/vpc2linuxmake.pl
Normal file
676
devtools/bin/vpc2linuxmake.pl
Normal file
@ -0,0 +1,676 @@
|
||||
#!perl
|
||||
use IO::File;
|
||||
use File::Basename;
|
||||
use File::Find;
|
||||
use Cwd;
|
||||
use Cwd 'abs_path';
|
||||
|
||||
|
||||
|
||||
$nprocs=`grep vendor_id /proc/cpuinfo | wc -l `;
|
||||
$nprocs=~s/[\n\r]//g;
|
||||
print "$nprocs processors found\n";
|
||||
|
||||
#find where to include master make file from
|
||||
$srcdir=getcwd;
|
||||
die "can't determine path to src"
|
||||
unless ($srcdir=~s@/src.*$@/src@);
|
||||
|
||||
|
||||
find( { wanted=> \&handle_vpc_file } ,"$srcdir"); # search through all directories for .vpc files
|
||||
|
||||
@MAINTARGETS=("all", "clean", "objs");
|
||||
@TARGETS=("all", "clean", "objs", "tags");
|
||||
|
||||
|
||||
|
||||
# now, write a master makefile in each dir, and a master-master makefile in ~/src
|
||||
foreach $dir ( keys %dir_written )
|
||||
{
|
||||
open( MAKEOUT,">$dir/Makefile" ) || die "can't write $dir/Makefile";
|
||||
foreach $target ( @TARGETS )
|
||||
{
|
||||
print MAKEOUT ".PHONY: $target\n\n";
|
||||
print MAKEOUT "$target:\n";
|
||||
foreach $_ (split(/,/,$dir_written{$dir}) )
|
||||
{
|
||||
print MAKEOUT "\tmake -j $nprocs -f $_ $target\n" if length($_);
|
||||
}
|
||||
}
|
||||
close MAKEOUT;
|
||||
}
|
||||
|
||||
# now, write a master makefile in ~/src
|
||||
open( MAKEOUT,">$srcdir/Makefile" ) || die "can't write master makefile to $srcdir";
|
||||
foreach $target ( @MAINTARGETS )
|
||||
{
|
||||
print MAKEOUT ".PHONY: $target\n\n";
|
||||
print MAKEOUT "$target:\n";
|
||||
foreach $dir ( keys %dir_written )
|
||||
{
|
||||
if ($target ne "clean" )
|
||||
{
|
||||
print MAKEOUT "\tmake -j $nprocs -C $dir $target\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print MAKEOUT "\tmake -C $dir $target\n";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
print MAKEOUT "\n\nmakefiles:\n\tperl $srcdir/devtools/bin/vpc2linuxmake.pl\n";
|
||||
print MAKEOUT "\ntags:\n\tctags --languages=c++ -eR\n";
|
||||
|
||||
close MAKEOUT;
|
||||
|
||||
sub handle_vpc_file
|
||||
{
|
||||
# called for each file in the callers dir tree
|
||||
my $dir=$File::Find::dir;
|
||||
return if ( $dir=~/vpc_scripts/i );
|
||||
if ( /_base\.vpc$/i )
|
||||
{
|
||||
unless ( /hk_base\.vpc$/i )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
return if (/_inc\.vpc/i);
|
||||
|
||||
if (/\.vpc$/)
|
||||
{
|
||||
(%ignore_file,@DEFINES, @CPPFILES, @CXXFILES,@CFILES, @LITERAL_LIBFILES,@LIBFILES, %define_seen,%macros,%include_seen,@INCLUDEDIRS)=undef;
|
||||
undef $buildforlinux;
|
||||
undef $conf_type;
|
||||
undef $gccflags;
|
||||
$OptimizeLevel=3;
|
||||
|
||||
|
||||
# some defines to ignore in vpc files when generating linux include files
|
||||
|
||||
$define_seen{'WIN32'}=1;
|
||||
$define_seen{'_WIN32'}=1;
|
||||
$define_seen{'_WINDOWS'}=1;
|
||||
$define_seen{'_USRDLL'}=1;
|
||||
$define_seen{'DEBUG'}=1;
|
||||
$define_seen{'_DEBUG'}=1;
|
||||
$define_seen{'NDEBUG'}=1;
|
||||
$define_seen{'_CRT_SECURE_NO_DEPRECATE'}=1;
|
||||
$define_seen{'_CRT_NONSTDC_NO_DEPRECATE'}=1;
|
||||
$define_seen{'fopen'}=1;
|
||||
|
||||
# print STDERR "parsing project $pname\n";
|
||||
&ParseVPC($_);
|
||||
|
||||
$pname=lc($pname);
|
||||
$pname=~s/\s+/_/g;
|
||||
$pname=~s/[\(\)]//g;
|
||||
# if anything seen, output a makefile
|
||||
if ( $buildforlinux && ( @CPPFILES || @CXXFILES || @CFILES || @LIBFILES ) )
|
||||
{
|
||||
print STDERR "writing project $pname\n";
|
||||
$projdir=getcwd;
|
||||
$projdir=~s@/$@@;
|
||||
$dir_written{$projdir}.=",$pname.mak";
|
||||
&WriteMakefile("$projdir/$pname.mak");
|
||||
&WriteCodeBlocksProj("$projdir/$pname.cbp");
|
||||
}
|
||||
else
|
||||
{
|
||||
die "no .lib or source files found in .vpc" if ( $buildforlinux );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub WriteCodeBlocksProj
|
||||
{
|
||||
local($_)=@_;
|
||||
|
||||
open(CBPROJ,">$_") || die "can't write $_";
|
||||
|
||||
print CBPROJ <<HEADER
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="$pname" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Release">
|
||||
|
||||
</Target>
|
||||
</Build>
|
||||
HEADER
|
||||
;
|
||||
|
||||
foreach $fl (@CPPFILES)
|
||||
{
|
||||
push @cppfiles2, $fl unless ( $ignore_file{$fl} > 0 );
|
||||
}
|
||||
|
||||
foreach $fl (@CXXFILES)
|
||||
{
|
||||
push @cxxfiles2, $fl unless ( $ignore_file{$fl} > 0 );
|
||||
}
|
||||
|
||||
printf CBPROJ "\t\t<Compiler>\n";
|
||||
|
||||
foreach $_ (@DEFINES)
|
||||
{
|
||||
print CBPROJ "\t\t\t<Add option=\"-DSWDS\" />\n";
|
||||
print CBPROJ "\t\t\t<Add option=\"-D_LINUX\" />\n";
|
||||
print CBPROJ "\t\t\t<Add option=\"-fpermissive\" />\n";
|
||||
print CBPROJ "\t\t\t<Add option=\"-Dstricmp=strcasecmp\" />\n";
|
||||
print CBPROJ "\t\t\t<Add option=\"-D_stricmp=strcasecmp\" />\n";
|
||||
print CBPROJ "\t\t\t<Add option=\"-D_strnicmp=strncasecmp\" />\n";
|
||||
print CBPROJ "\t\t\t<Add option=\"-Dstrnicmp=strncasecmp\" />\n";
|
||||
print CBPROJ "\t\t\t<Add option=\"-D_snprintf=snprintf\" />\n";
|
||||
print CBPROJ "\t\t\t<Add option=\"-D_vsnprintf=vsnprintf\" />\n";
|
||||
print CBPROJ "\t\t\t<Add option=\"-D_alloca=alloca\" />\n";
|
||||
print CBPROJ "\t\t\t<Add option=\"-Dstrcmpi=strcasecmp\" />\n";
|
||||
|
||||
print CBPROJ "\t\t\t<Add option=\"-D$_\" />\n";
|
||||
}
|
||||
|
||||
foreach $_ (@INCLUDEDIRS)
|
||||
{
|
||||
print CBPROJ "\t\t\t<Add directory=\"$_\" />\n";
|
||||
}
|
||||
|
||||
printf CBPROJ "\t\t</Compiler>\n";
|
||||
|
||||
@CPPFILES = sort(@CPPFILES);
|
||||
@CXXFILES = sort(@CXXFILES);
|
||||
@CFILES = sort(@CFILES);
|
||||
|
||||
# now, output obj dependencies
|
||||
foreach $_ (@CPPFILES, @CFILES, @CXXFILES)
|
||||
{
|
||||
unless (( $ignore_file{$_} > 0 ) || ( length($_) < 2 ) )
|
||||
{
|
||||
($filename,$dir,$suffix) = fileparse($_,qr/\.[^.]*/);
|
||||
|
||||
print CBPROJ "\t\t<Unit filename=\"".$dir . $filename. ".cpp\" />\n";
|
||||
}
|
||||
}
|
||||
|
||||
print CBPROJ <<FOOTER
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
||||
FOOTER
|
||||
;
|
||||
|
||||
close CBPROJ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub WriteMakefile
|
||||
{
|
||||
local($_)=@_;
|
||||
|
||||
open(MAKEFILE,">$_") || die "can't write $_";
|
||||
print MAKEFILE "NAME=$pname\n\n";
|
||||
print MAKEFILE "SRCROOT=$srcdir\n";
|
||||
print MAKEFILE "PROJDIR=$projdir\n";
|
||||
print MAKEFILE "CONFTYPE=$conf_type\n";
|
||||
print MAKEFILE "PROJECT_SPECIFIC_GCCFLAGS = $gccflags\n";
|
||||
|
||||
if ( int($OptimizeLevel) )
|
||||
{
|
||||
print MAKEFILE "OLEVEL=-O$OptimizeLevel\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print MAKEFILE "OLEVEL=\n";
|
||||
}
|
||||
if (@DEFINES)
|
||||
{
|
||||
print MAKEFILE "DEFINES= -D",join(" -D", @DEFINES),"\n";
|
||||
}
|
||||
if (@INCLUDEDIRS)
|
||||
{
|
||||
print MAKEFILE "INCLUDEDIRS= -I",join(" -I", @INCLUDEDIRS),"\n";
|
||||
}
|
||||
undef @cppfiles2;
|
||||
undef @cxxfiles2;
|
||||
foreach $fl (@CPPFILES)
|
||||
{
|
||||
if ( length($fl) )
|
||||
{
|
||||
print "warning file $fl does not exist\n" unless( -e $fl);
|
||||
push @cppfiles2, $fl unless ( $ignore_file{$fl} > 0 );
|
||||
}
|
||||
}
|
||||
foreach $fl (@CXXFILES)
|
||||
{
|
||||
push @cxxfiles2, $fl unless ( $ignore_file{$fl} > 0 );
|
||||
}
|
||||
|
||||
if (@cppfiles2)
|
||||
{
|
||||
print MAKEFILE "CPPFILES= \\\n ", join(" \\\n ",@cppfiles2), "\n";
|
||||
}
|
||||
if (@cxxfiles2)
|
||||
{
|
||||
print MAKEFILE "CXXFILES= \\\n ", join(" \\\n ",@cxxfiles2), "\n";
|
||||
}
|
||||
if (@CFILES)
|
||||
{
|
||||
print MAKEFILE "CFILES= \\\n ", join(" \\\n ",@CFILES), "\n";
|
||||
}
|
||||
if (@LIBFILES)
|
||||
{
|
||||
undef @LIBNAMES;
|
||||
print MAKEFILE "\nLIBFILES= \\\n";
|
||||
unless( $pname=~/(tier0)|(mathlib)|(tier1)/i)
|
||||
{
|
||||
print MAKEFILE " $srcdir/lib/linux/tier1_486.a \\\n"
|
||||
}
|
||||
foreach $lib (@LIBFILES)
|
||||
{
|
||||
my @DLLNAMES=("tier0", "vstdlib", "steam_api");
|
||||
unless ( $ignore_file{$lib} > 0 )
|
||||
{
|
||||
$lib=lc($lib);
|
||||
my ($filename,$dir,$suffix) = fileparse($lib,qr/\.[^.]*/);
|
||||
my $dll=0;
|
||||
foreach $dllname (@DLLNAMES)
|
||||
{
|
||||
$dll=1 if ( $dllname eq $filename);
|
||||
}
|
||||
if ( $dll )
|
||||
{
|
||||
$lib=~s@^(.*)\.lib@$1_i486.so@i;
|
||||
$lib=~s@/lib/.*/([^/]+)@/linux/$1@g;
|
||||
}
|
||||
else
|
||||
{
|
||||
$lib=~s/\.lib/_486.a/i;
|
||||
$lib=~s@/lib/(\S+)/@/lib/linux/@g;
|
||||
}
|
||||
push @LIBNAMES, $lib;
|
||||
}
|
||||
}
|
||||
foreach $lib (@LITERAL_LIBFILES)
|
||||
{
|
||||
unless ( $ignore_file{$lib} > 0 )
|
||||
{
|
||||
$lib=~s/\\/\//g;
|
||||
$lib=~s@/linux/([a-zA-Z_0-9\.]+)$@/linux/$1@;
|
||||
$lib=~s@^.*/linux/([a-zA-Z_0-9]+)\.so$@$1.so@;
|
||||
push @LIBNAMES, $lib;
|
||||
}
|
||||
}
|
||||
# now, sort libs for link order
|
||||
foreach $lib ( sort bypriority @LIBNAMES )
|
||||
{
|
||||
print MAKEFILE " $lib \\\n";
|
||||
}
|
||||
print MAKEFILE "\n\n";
|
||||
}
|
||||
|
||||
if ( $conf_type eq "dll" )
|
||||
{
|
||||
print MAKEFILE "OUTPUT_SO_FILE=$srcdir/linux/$pname","_i486.so\n\n";
|
||||
}
|
||||
elsif ( $conf_type eq "exe" )
|
||||
{
|
||||
if ( $macros{'OUTBINNAME'} eq "" )
|
||||
{
|
||||
die "Missing OUTBINNAME macro";
|
||||
}
|
||||
|
||||
print MAKEFILE "OUTPUT_EXECUTABLE=$srcdir/linux/$macros{'OUTBINNAME'}\n\n";
|
||||
}
|
||||
|
||||
print MAKEFILE "\n\n\# include base make file\ninclude $srcdir/devtools/makefile_base_linux.mak\n";
|
||||
|
||||
# now, output obj dependencies
|
||||
foreach $_ (@CPPFILES, @CFILES)
|
||||
{
|
||||
unless (( $ignore_file{$_} > 0 ) || ( length($_) < 2 ) )
|
||||
{
|
||||
($filename) = fileparse($_,qr/\.[^.]*/);
|
||||
print MAKEFILE getcwd,"/obj/$filename.o : $_\n\t\$(DO_CC)\n";
|
||||
}
|
||||
}
|
||||
foreach $_ (@CXXFILES)
|
||||
{
|
||||
unless (( $ignore_file{$_} > 0 ) || ( length($_) < 2 ) )
|
||||
{
|
||||
($filename) = fileparse($_,qr/\.[^.]*/);
|
||||
print MAKEFILE getcwd,"/obj/$filename.oxx : $_\n\t\$(DO_CC)\n";
|
||||
}
|
||||
}
|
||||
|
||||
close MAKEFILE;
|
||||
}
|
||||
|
||||
sub bypriority
|
||||
{
|
||||
# sort libs for gcc linkgoodness
|
||||
$priority{"mathlib"}="0005";
|
||||
$priority{"tier1"}="0010";
|
||||
$priority{"tier2"}="0020";
|
||||
$priority{"tier3"}="0030";
|
||||
|
||||
my ($filenamea) = fileparse($a,qr/\.[^.]*/);
|
||||
my ($filenameb) = fileparse($b,qr/\.[^.]*/);
|
||||
$filenamea =~ s/_.86.*$//; # lose _i486
|
||||
$filenameb =~ s/_.86.*$//;
|
||||
my $pa=$priority{$filenamea} || 1000;
|
||||
my $pb=$priority{$filenameb} || 1000;
|
||||
return $pb cmp $pa;
|
||||
}
|
||||
|
||||
sub ParseVPC
|
||||
{
|
||||
local($fname)=@_;
|
||||
&startreading($fname);
|
||||
while(&nextvpcline)
|
||||
{
|
||||
# print "$_\n";
|
||||
if ( (/^\$linux/i) )
|
||||
{
|
||||
&skipblock(0,\&handlelinuxline);
|
||||
}
|
||||
if ( (/^\$configuration/i) )
|
||||
{
|
||||
&skipblock(0,\&handleconfigline);
|
||||
}
|
||||
elsif (/^\s*\$project/i)
|
||||
{
|
||||
&parseproject;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub massageline
|
||||
{
|
||||
# strip leading and trailing spaces and carriage returns and comments from vpc lines
|
||||
s/[\n\r]//g;
|
||||
s@//.*$@@g;
|
||||
s@^\s*@@g;
|
||||
s@\s*$@@g;
|
||||
}
|
||||
|
||||
sub submacros
|
||||
{
|
||||
# replace all macros within a line
|
||||
my $mac;
|
||||
foreach $mac (keys %macros)
|
||||
{
|
||||
s/\$$mac/$macros{$mac}/g;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub startreading
|
||||
{
|
||||
# initialize recursive file reader
|
||||
my( $fname)=@_;
|
||||
$curfile=IO::File->new($fname) || die "can't open $fname";
|
||||
}
|
||||
|
||||
sub nextvpcline
|
||||
{
|
||||
# get the next line from the file, handling line continuations, macro substitution, and $include
|
||||
# return 0 if out of lines
|
||||
my $ret=0;
|
||||
if ( $_ = <$curfile> )
|
||||
{
|
||||
$ret=1;
|
||||
&massageline;
|
||||
while(s@\\$@ @)
|
||||
{
|
||||
my $old=$_;
|
||||
$_=<$curfile>;
|
||||
&massageline;
|
||||
$_=$old.$_;
|
||||
}
|
||||
s@\s+@ @g;
|
||||
my $old=$_;
|
||||
&submacros;
|
||||
# now, parse
|
||||
if (/\$macro (\S+) \"(\S+)\"$/i)
|
||||
{
|
||||
$macros{$1}=$2;
|
||||
return &nextvpcline;
|
||||
}
|
||||
s/\[\$WIN32\]//g;
|
||||
return &nextvpcline if (/\[\$X360\]/);
|
||||
if ( /^\s*[\$\#]include\s+\"(.*)\"/i)
|
||||
{
|
||||
# process $include
|
||||
my $incfile=$1;
|
||||
push @filestack, $curfile;
|
||||
$incfile=~s@\\@/@g;
|
||||
if ( $curfile=IO::File->new($incfile) )
|
||||
{
|
||||
return &nextvpcline;
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "can't open include file $incfile, ignoring\n";
|
||||
$curfile=pop(@filestack);
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$curfile->close;
|
||||
if (@filestack)
|
||||
{
|
||||
$curfile=pop(@filestack);
|
||||
return &nextvpcline;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
sub skipblock
|
||||
{
|
||||
# skip a named block in the key values, handling nested {} pairs
|
||||
my($empty_ok, $callback)=@_;
|
||||
my $lnstat=&nextvpcline;
|
||||
die "parse error eof in block" if ( (! $lnstat) && ( ! $empty_ok) );
|
||||
|
||||
my $nest=0;
|
||||
if (/^\{/)
|
||||
{
|
||||
$nest++;
|
||||
}
|
||||
else
|
||||
{
|
||||
die "no start block found, $_ found instead" unless($empty_ok);
|
||||
}
|
||||
while ($nest)
|
||||
{
|
||||
die "prematur eof" unless &nextvpcline;
|
||||
&$callback($_) if ( $callback );
|
||||
$nest++ if (/^\{/);
|
||||
$nest-- if (/^\}/);
|
||||
}
|
||||
}
|
||||
|
||||
sub parseproject
|
||||
{
|
||||
# handle a project block, picking up files mentioned
|
||||
$pname="";
|
||||
if (/^\s*\$project\s*(.*)$/i)
|
||||
{
|
||||
$pname=$1;
|
||||
$pname=~s@\"@@g;
|
||||
}
|
||||
local($_);
|
||||
my $nest=0;
|
||||
&nextvpcline || die "empty project?";
|
||||
$nest++ if (/^\s*\{/);
|
||||
while($nest )
|
||||
{
|
||||
&nextvpcline || die "premature eof in project?";
|
||||
$nest++ if (/^\{/);
|
||||
$nest-- if (/^\}/);
|
||||
&CheckForFileLine($_);
|
||||
}
|
||||
}
|
||||
|
||||
sub CheckForFileLine
|
||||
{
|
||||
local($_)=@_;
|
||||
if (/^\s*\-\$File\s+(.*$)/i)
|
||||
{
|
||||
foreach $_ (split(/ /,$1))
|
||||
{
|
||||
s/\"//g;
|
||||
$ignore_file{&process_path($_)} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
elsif (/^\s*\$File\s+(.*$)/i)
|
||||
{
|
||||
foreach $_ (split(/ /,$1))
|
||||
{
|
||||
s/\"//g;
|
||||
&handlefile($_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub handlefile
|
||||
{
|
||||
# given a project file (.cpp, etc), figure out what to do with it
|
||||
local($_)=@_;
|
||||
|
||||
# hardcoded exclusions for linux
|
||||
return if (/dx9sdk/i);
|
||||
return if (/_360/i);
|
||||
return if (/xbox_console.cpp/i);
|
||||
return if (/xbox_system.cpp/i);
|
||||
return if (/xbox_win32stubs.cpp/i);
|
||||
return if (/binkw32/i || /binkxenon/i );
|
||||
|
||||
if (/\.cpp$/)
|
||||
{
|
||||
push @CPPFILES,process_path($_);
|
||||
}
|
||||
if (/\.cxx$/)
|
||||
{
|
||||
push @CXXFILES,process_path($_);
|
||||
}
|
||||
elsif (/\.c$/)
|
||||
{
|
||||
push @CFILES,process_path($_);
|
||||
}
|
||||
elsif (/\.lib$/)
|
||||
{
|
||||
push @LIBFILES,process_path($_);
|
||||
}
|
||||
elsif (/\.a$/)
|
||||
{
|
||||
push @LITERAL_LIBFILES, process_path($_);
|
||||
}
|
||||
elsif (/\.so$/)
|
||||
{
|
||||
push @LITERAL_LIBFILES, process_path($_);
|
||||
}
|
||||
}
|
||||
|
||||
sub process_path
|
||||
{
|
||||
local($_)=@_;
|
||||
s@\\@/@g;
|
||||
if ( (! -e $_) && ( -e lc($_)) )
|
||||
{
|
||||
# print STDERR "$_ does not exist try lc($_)\n";
|
||||
$_=lc($_);
|
||||
}
|
||||
my $ap=abs_path($_);
|
||||
if ( (! length($ap) ) && length($_))
|
||||
{
|
||||
# print "abs path of $_ is empty. bad dir?\n";
|
||||
}
|
||||
$_=$ap;
|
||||
s@i686@i486@g;
|
||||
if ( (! -e $_) && ( -e lc($_)) )
|
||||
{
|
||||
# print STDERR "$_ does not exist try lc($_)\n";
|
||||
$_=lc($_);
|
||||
}
|
||||
# kill ..s for prettyness
|
||||
s@/[^/]+/\.\./@/@g;
|
||||
if (! -e $_)
|
||||
{
|
||||
# print STDERR "$_ does not exist\n";
|
||||
}
|
||||
return $_;
|
||||
}
|
||||
|
||||
sub handlelinuxline
|
||||
{
|
||||
local($_)=@_;
|
||||
$buildforlinux = 1 if ( /^\s*\$buildforlinux.*1/i);
|
||||
$OptimizeLevel= $1 if (/^\s*\$OptimizerLevel\s+(\d+)/i);
|
||||
$buildforlinux = 1 if ( /^\s*\$buildforlinux.*1/i);
|
||||
$gccflags = $1 if (/^\s*\$ProjectSpecificGCCFLags\s+\"(\S+)\"/i);
|
||||
&CheckForFileLine($_); # allows linux-specific file includes and excludes
|
||||
&handleconfigline($_); # allow linux-specific #defines
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub CheckPreprocessorDefs
|
||||
{
|
||||
local($_)=@_;
|
||||
if (/^\s*\$PreprocessorDefinitions\s+\"(.*)\"/i)
|
||||
{
|
||||
foreach $_ (split(/[;,]/,$1) )
|
||||
{
|
||||
unless( /\$/ || $define_seen{$_} || /fopen/i)
|
||||
{
|
||||
push(@DEFINES,$_);
|
||||
$define_seen{$_}=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sub handleconfigline
|
||||
{
|
||||
# handle a line within a $Configuration block
|
||||
local($_)=@_; # the line
|
||||
if (/^\s*\$AdditionalIncludeDirectories\s+\"(.*)\"/i)
|
||||
{
|
||||
foreach $_ (split(/[;,]/,$1) )
|
||||
{
|
||||
unless( /\$/ || $include_seen{$_} )
|
||||
{
|
||||
push(@INCLUDEDIRS,process_path($_));
|
||||
$include_seen{$_}=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (/^\s*\$ConfigurationType\s*\"(.*)\"/)
|
||||
{
|
||||
undef $conf_type;
|
||||
$conf_type="lib" if ($1 =~ /Static Library/i);
|
||||
$conf_type="dll" if ($1 =~ /Dynamic Library/i);
|
||||
$conf_type="exe" if ($1 =~ /Application/i);
|
||||
print STDERR " unknown conf type $1\n" if (! length($conf_type) );
|
||||
|
||||
}
|
||||
|
||||
&CheckPreprocessorDefs($_);
|
||||
}
|
BIN
devtools/bin/vpccrccheck.exe
Normal file
BIN
devtools/bin/vpccrccheck.exe
Normal file
Binary file not shown.
1106
devtools/bin/vsh_prep.pl
Normal file
1106
devtools/bin/vsh_prep.pl
Normal file
File diff suppressed because it is too large
Load Diff
BIN
devtools/bin/vstdlib.dll
Normal file
BIN
devtools/bin/vstdlib.dll
Normal file
Binary file not shown.
Reference in New Issue
Block a user