This commit is contained in:
FluorescentCIAAfricanAmerican
2020-04-22 12:56:21 -04:00
commit 3bf9df6b27
15370 changed files with 5489726 additions and 0 deletions
+116
View File
@@ -0,0 +1,116 @@
# Assuming all functions begin with ')' followed by '{', just find the matching brace and
# add a line with 'g_pVCR->SyncToken("<random string here>");'
import dlexer
import sys
class BlankStruct:
pass
def MatchParensBack( list, iStart ):
parenCount = -1
for i in range( 0, iStart ):
if list[iStart-i].id == __TOKEN_OPENPAREN:
parenCount += 1
elif list[iStart-i].id == __TOKEN_CLOSEPAREN:
parenCount -= 1
if parenCount == 0:
return iStart - i
return -1
if len( sys.argv ) >= 2:
# Setup the parser.
parser = dlexer.DLexer( 0 )
__TOKEN_NEWLINE = parser.AddToken( '\n' )
__TOKEN_WHITESPACE = parser.AddToken( '[ \\t\\f\\v]+' )
__TOKEN_OPENBRACE = parser.AddToken( '{' )
__TOKEN_CLOSEBRACE = parser.AddToken( '}' )
__TOKEN_OPENPAREN = parser.AddToken( '\(' )
__TOKEN_CLOSEPAREN = parser.AddToken( '\)' )
__TOKEN_COMMENT = parser.AddToken( r"\/\/.*" )
__TOKEN_CONST = parser.AddToken( "const" )
__TOKEN_IF = parser.AddToken( "if" )
__TOKEN_WHILE = parser.AddToken( "while" )
__TOKEN_FOR = parser.AddToken( "for" )
__TOKEN_SWITCH = parser.AddToken( "switch" )
validChars = r"\~\@\#\$\%\^\&\!\,\w\.-/\[\]\<\>\""
__TOKEN_IDENT = parser.AddToken( '[' + validChars + ']+' )
__TOKEN_OPERATOR = parser.AddToken( "\=|\+" )
__TOKEN_SCOPE_OPERATOR = parser.AddToken( "::" )
__TOKEN_IGNORE = parser.AddToken( r"\#|\;|\:|\||\?|\'|\\|\*|\-|\`" )
head = None
# First, read all the tokens into a list.
list = []
parser.BeginReadFile( sys.argv[1] )
while 1:
m = parser.GetToken()
if m:
list.append( m )
else:
break
# Make a list of all the non-whitespace ones.
nw = []
for token in list:
if token.id == __TOKEN_NEWLINE or token.id == __TOKEN_WHITESPACE:
token.iNonWhitespace = -2222
else:
token.iNonWhitespace = len( nw )
nw.append( token )
# Get ready to output sync tokens.
file = open( sys.argv[1], 'r' )
fileLines = file.readlines()
file.close()
curLine = 1
iCur = 0
file = open( sys.argv[1], 'w' )
# Now, search for the patterns we're interested in.
# Look for <ident>::<ident> '(' <idents...> ')' followed by a '{'. This would be a function.
for token in list:
file.write( token.val )
if token.id == __TOKEN_NEWLINE:
curLine += 1
if token.id == __TOKEN_OPENBRACE:
i = token.iNonWhitespace
if i >= 6:
if nw[i-1].id == __TOKEN_CLOSEPAREN:
pos = MatchParensBack( nw, i-2 )
if pos != -1:
if nw[pos-1].id == __TOKEN_IDENT:
#ADD PROLOGUE CODE HERE
#file.write( "\n\tg_pVCR->SyncToken( \"%d_%s\" ); // AUTO-GENERATED SYNC TOKEN\n" % (iCur, nw[pos-1].val) )
iCur += 1
# TEST CODE TO PRINT OUT FUNCTION NAMES
#if nw[pos-2].id == __TOKEN_SCOPE_OPERATOR:
# print "%d: %s::%s" % ( curLine, nw[pos-3].val, nw[pos-1].val )
#else:
# print "%d: %s" % ( curLine, nw[pos-1].val )
file.close()
else:
print "VCRMode_AddSyncTokens <filename>"
+153
View File
@@ -0,0 +1,153 @@
import WildcardSearch
import sys
import re
import os
curProps = {}
modelsContentFallbackDir = "c:\\hl2\\hl2\\models"
modelsContentDir = "c:\\hl2\\cstrike\\models"
materialsFallbackDir = "c:\\hl2\\hl2\\materials"
materialsDir = "c:\\hl2\\cstrike\\materials"
mapsDir = "c:\\hl2\\cstrike\\maps"
exeDir = "c:\\hl2\\bin"
# RE to look for '$surfaceProp blah'
surfacePropRE = re.compile( r'\"?\$surfaceprop\"?\s+\"?(?P<propname>[^\"]+)\"?', re.IGNORECASE )
# ------------------------------------------------------------------------------------------- #
# Helper functions.
# ------------------------------------------------------------------------------------------- #
def FileExists(f):
try:
file = open(f)
except IOError:
exists = 0
else:
exists = 1
file.close()
return exists
def PrintFilename( filename ):
print filename
def SearchFile( filename ):
f = open( filename, "rt" )
PrintFilename( filename )
fileData = f.read()
match = surfacePropRE.search( fileData )
if match:
propName = match.group( 1 ).upper()
curProps[propName] = 1
f.close()
# ------------------------------------------------------------------------------------------- #
# Search all the map files for texture names and model files.
# ------------------------------------------------------------------------------------------- #
usedVMTFiles = {}
modelFiles = {}
# RE to look for 'material blah'
materialRE = re.compile( r'\"?\material\"?\s+\"?(?P<matname>[^\"]+)\"?', re.IGNORECASE )
# Look for a model name referenced in the VMF file.
modelRE = re.compile( r'\"models\/(?P<modelname>.+)\.mdl\"', re.IGNORECASE )
files = WildcardSearch.WildcardSearch( mapsDir + "\\*.vmf", 1 )
for filename in files:
f = open( filename, "rt" )
fileData = f.read()
f.close()
PrintFilename( filename )
# Get all the model names.
allMatches = modelRE.findall( fileData )
for match in allMatches:
modelFiles[match.upper()] = 1
# Get all the texture names.
allMatches = materialRE.findall( fileData )
for match in allMatches:
vmtName = match
usedVMTFiles[vmtName] = 1
# ------------------------------------------------------------------------------------------- #
# Search all the model files for surface props.
# ------------------------------------------------------------------------------------------- #
# Make sure we look at ALL models in the CStrike folder.
for filename in WildcardSearch.WildcardSearch( modelsContentDir + "\\*.mdl", 1 ):
modelFiles[filename.upper()] = 1
for iModel in modelFiles.keys():
iModel = iModel.replace( "/", "\\" )
filename = modelsContentDir + "\\" + iModel + ".mdl"
if not FileExists( filename ):
filename = modelsContentFallbackDir + "\\" + iModel + ".mdl"
if FileExists( filename ):
PrintFilename( filename )
cmd = exeDir + "\\studiomdl.exe -PrintSurfaceProps " + filename
f = os.popen( cmd )
if f:
output = f.readlines()
returnValue = f.close()
if returnValue == None:
for line in output:
curProps[line.upper().strip()] = 1
# ------------------------------------------------------------------------------------------- #
# Search all the texture files for surface props.
# ------------------------------------------------------------------------------------------- #
for iFile in usedVMTFiles.keys():
filename = materialsDir + "\\" + iFile + ".vmt"
if not FileExists( filename ):
filename = materialsFallbackDir + "\\" + iFile + ".vmt"
if FileExists( filename ):
SearchFile( filename )
# ------------------------------------------------------------------------------------------- #
# Output the results.
# ------------------------------------------------------------------------------------------- #
print "\n"
print "---------------------------------"
print "- Surface types found"
print "---------------------------------\n"
sortedList = [x for x in curProps.keys()]
sortedList.sort()
for x in sortedList:
print x
+7
View File
@@ -0,0 +1,7 @@
@echo Created per the instructions at https://intranet.valvesoftware.com/wiki/index.php/AppVerifier_for_finding_memory_bugs_and_other_problems
@echo Disabling AppVerifier for TF2
@echo This must be run with administrator privileges
reg delete "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\hl2.exe" /f
@rem Delete from the Wow64 node as well, just to be sure.
reg delete "HKLM\Software\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\hl2.exe" /f
+7
View File
@@ -0,0 +1,7 @@
@echo Created per the instructions at https://intranet.valvesoftware.com/wiki/index.php/AppVerifier_for_finding_memory_bugs_and_other_problems
@echo Disabling AppVerifier for srcds
@echo This must be run with administrator privileges
reg delete "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\srcds.exe" /f
@rem Delete from the Wow64 node as well, just to be sure.
reg delete "HKLM\Software\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\srcds.exe" /f
+12
View File
@@ -0,0 +1,12 @@
@echo Created per the instructions at https://intranet.valvesoftware.com/wiki/index.php/AppVerifier_for_finding_memory_bugs_and_other_problems
@echo Enabling AppVerifier with reasonable settings for TF2
@echo This must be run with administrator privileges
@rem The settings are created using the App Verifier UI and can be exported to the .reg file
@rem with this command:
@rem REG EXPORT "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\hl2.exe" tf2AppVerifierSettings.reg /y
@rem Import the App Verifier settings
reg import %~dp0tf2AppVerifierSettings.reg
@rem Increase the size of the database of alloc/free stacks from 8 MB (too small) to 100 MB.
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\hl2.exe" /v StackTraceDatabaseSizeInMB /t REG_DWORD /d 100 /f
+12
View File
@@ -0,0 +1,12 @@
@echo Created per the instructions at https://intranet.valvesoftware.com/wiki/index.php/AppVerifier_for_finding_memory_bugs_and_other_problems
@echo Enabling AppVerifier with reasonable settings for srcds
@echo This must be run with administrator privileges
@rem The settings are created using the App Verifier UI and can be exported to the .reg file
@rem with this command:
@rem REG EXPORT "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\srcds.exe" srcdsAppVerifierSettings.reg /y
@rem Import the App Verifier settings
reg import %~dp0srcdsAppVerifierSettings.reg
@rem Increase the size of the database of alloc/free stacks from 8 MB (too small) to 100 MB.
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\srcds.exe" /v StackTraceDatabaseSizeInMB /t REG_DWORD /d 100 /f
+97
View File
@@ -0,0 +1,97 @@
# Assuming all functions begin with ')' followed by '{', just find the matching brace and
# add a line with 'g_pVCR->SyncToken("<random string here>");'
import dlexer
import sys
import WildcardSearch
class BlankStruct:
pass
def MatchParensBack( list, iStart ):
parenCount = -1
for i in range( 0, iStart ):
if list[iStart-i].id == __TOKEN_OPENPAREN:
parenCount += 1
elif list[iStart-i].id == __TOKEN_CLOSEPAREN:
parenCount -= 1
if parenCount == 0:
return iStart - i
return -1
# Setup the parser.
parser = dlexer.DLexer( 0 )
__TOKEN_NEWLINE = parser.AddToken( '\n' )
__TOKEN_WHITESPACE = parser.AddToken( '[ \\t\\f\\v]+' )
__TOKEN_OPENBRACE = parser.AddToken( '{' )
__TOKEN_CLOSEBRACE = parser.AddToken( '}' )
__TOKEN_OPENPAREN = parser.AddToken( '\(' )
__TOKEN_CLOSEPAREN = parser.AddToken( '\)' )
__TOKEN_COMMENT = parser.AddToken( r"\/\/.*" )
__TOKEN_CONST = parser.AddToken( "const" )
__TOKEN_IF = parser.AddToken( "if" )
__TOKEN_WHILE = parser.AddToken( "while" )
__TOKEN_FOR = parser.AddToken( "for" )
__TOKEN_SWITCH = parser.AddToken( "switch" )
__TOKEN_CLASS = parser.AddToken( "class" )
__TOKEN_PUBLIC = parser.AddToken( "public" )
__TOKEN_TYPEDEF = parser.AddToken( "typedef" )
__TOKEN_BASECLASS = parser.AddToken( "BaseClass" )
validChars = r"\~\@\#\$\%\^\&\!\w\.-/\[\]\<\>\""
__TOKEN_IDENT = parser.AddToken( '[' + validChars + ']+' )
__TOKEN_OPERATOR = parser.AddToken( "\=|\+" )
__TOKEN_SCOPE_OPERATOR = parser.AddToken( "::" )
__TOKEN_COLON = parser.AddToken( ":" )
__TOKEN_IGNORE = parser.AddToken( r"\#|\;|\:|\||\?|\'|\\|\*|\-|\`|\," )
for i in range( 1, len( sys.argv ) ):
for filename in WildcardSearch.WildcardSearch( sys.argv[i] ):
head = None
# First, read all the tokens into a list.
list = []
parser.BeginReadFile( filename )
while 1:
m = parser.GetToken()
if m:
list.append( m )
else:
break
# Make a list of all the non-whitespace ones.
nw = []
for token in list:
if token.id == __TOKEN_NEWLINE or token.id == __TOKEN_WHITESPACE:
token.iNonWhitespace = -2222
else:
token.iNonWhitespace = len( nw )
nw.append( token )
curLine = 1
# Now, search for the patterns we're interested in.
# Look for 'class <ident> : public <ident> {
curClassName = ""
curBaseClassName = ""
for token in list:
if token.id == __TOKEN_NEWLINE:
curLine += 1
elif token.id == __TOKEN_CLASS:
i = token.iNonWhitespace
if nw[i+1].id == __TOKEN_IDENT and nw[i+2].id == __TOKEN_COLON and nw[i+3].id == __TOKEN_PUBLIC and nw[i+4].id == __TOKEN_IDENT:
curClassName = nw[i+1].val
curBaseClassName = nw[i+4].val
print "class %s : public %s" % (curClassName, curBaseClassName)
Binary file not shown.
BIN
View File
Binary file not shown.
+206
View File
@@ -0,0 +1,206 @@
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<p align="center"><b><font size="5">PMELib 1.0</font></b></p>
<h2>Introduction</h2>
<p><font size="3">&nbsp;&nbsp;&nbsp; This library is an interface to the Performance Monitoring
Events (PME) that are available in the Pentium P5, P6 and P4 processors.&nbsp;
There are 18 counters that let you gather information about what the processor is
going during execution.&nbsp; They are described in these manuals:</font></p>
<blockquote>
<p><a href="http://developer.intel.com/design/pentium4/manuals/253665.htm"><font color="#008000" size="3">IA-32
Intel Architecture Software Developer's Manual Volume 1: Basic Architecture</font></a></p>
<p><a href="http://developer.intel.com/design/pentium4/manuals/253666.htm"><font color="#008000" size="3">IA-32
Intel Architecture Software Developer's Manual Volume 2A: Instruction Set
Reference, A-M</font></a></p>
<p><a href="http://developer.intel.com/design/pentium4/manuals/253667.htm"><font color="#008000" size="3">IA-32
Intel Architecture Software Developer's Manual Volume 2B: Instruction Set
Reference, N-Z</font></a></p>
<p><a href="http://developer.intel.com/design/pentium4/manuals/253668.htm"><font color="#008000" size="3">IA-32
Intel Architecture Software Developer's Manual Volume 3: System Programming
Guide</font></a></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;<font color="#008000" size="3">&nbsp;&nbsp;&nbsp;&nbsp; </font><font size="3" color="#000000">See
chapter 15, Appendix A and Appendix B</font></font></p>
</blockquote>
<p><font size="3">Pentium 4 documentation is available <a href="http://developer.intel.com/design/Pentium4/documentation.htm">here</a></font></p>
<p><font size="3">This library&nbsp; is an extension to the utilities from the Game Developer's
Magazine <a href="http://www.gamasutra.com/features/wyatts_world/19990528/pentium3_08.htm">article</a>
by Robert Wyatt in May 1998.&nbsp; The library is now in a class and included
the Pentium 4 processor.&nbsp; Only Intel is currently supported and
tested.&nbsp;&nbsp;</font></p>
<p>&nbsp;</p>
<p><font size="3">Send feedback to <a href="mailto:doug@nvidia.com">doug@nvidia.com</a></font></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h2><b>Installation</b></h2>
<p><font size="3">&nbsp;&nbsp;&nbsp; Window NT and Windows XP are supported and tested.&nbsp;
Win98 may work, however.</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp; You need to install a driver, set some registry settings
and reboot.&nbsp; If you installed the GDPerf.sys from the GD magazine article,
you can skip the installation step. It uses the same driver.&nbsp; Let me know
if you have problems.</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In the <i>Installation</i>
directory</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; copy
GDPerf.sys to the window driver directory</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
copy GDPerf.sys <a href="file:///C:/windows/system32/drivers">C:\windows\system32\drivers</a></font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
there is a batch file as an example</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Run the
PMELib.reg file to set the registry settings</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Reboot</font></p>
<p>&nbsp;</p>
<h2><b>Configuring PMELib</b><font size="3">&nbsp;</font></h2>
<p><font size="3">For P5 and P6 processors (anything before Pentium 4), You use the same
interfaces that are described in the Game Developer article.&nbsp; They have
just been incorporated in to the PMELib as is.</font></p>
<p><font size="3"><font color="#000000">In the Pentium 4, are 18 performance
monitoring counters and more than 40 Events Modes that can be captured.&nbsp;
Each Mode has a bit mask that indicates which tests to perform.&nbsp; These are
described in Appendix A of </font><font color="#008000" size="3"><a href="http://developer.intel.com/design/pentium4/manuals/253668.htm">IA-32
Intel Architecture Software Developer's Manual Volume 3: System Programming
Guide</a>&nbsp;&nbsp;</font><font size="3" color="#000000"> Each of these event
mode has a class dedicated to it.&nbsp; The event modes are listed below.</font></font></p>
<blockquote>
<p><font size="3">Set PerfTest2 for an example.</font></p>
<p><font size="3"><b>Step 1) Choose an Event Mode class</b></font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp; Example:</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Event_branch_retired event;</font></p>
<p>&nbsp;</p>
<p><font size="3"><b>Step 2)&nbsp; Set the Event Mask for the selected Event
Mode</b></font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp; Example:</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; event.eventMask-&gt;MMNP = 1;</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; event.eventMask-&gt;MMTP = 1;</font></p>
<p>&nbsp;</p>
<p><b><font size="3">Step 3)&nbsp; Set the privilege level to capture data
from with the <i>SetCaptureMode</i> method</font></b></p>
<blockquote>
<p><font size="3">OS_Only, <font COLOR="#008000">// ring 0, driver&nbsp;
level only
</font></font></p>
<p><font size="3">USR_Only, <font COLOR="#008000">// app level, privilege
levels&nbsp; 1 2 and 3
</font></font></p>
<p><font size="3">OS_and_USR, <font COLOR="#008000">// all levels 0, 1, 2
and 3
</font>
</font></p>
</blockquote>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Optionally, you
can enable tagging in the <i>SetCaptureMode</i> method.</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Example:</font></p>
<p><font size="3"><font COLOR="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</font>SetCaptureMode(OS_and_USR, TagEnable, 34);</font></p>
<p>&nbsp;</p>
<p><font size="3"><b>Step 4) Optional Configuration</b></font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;<b>&nbsp;&nbsp;&nbsp;&nbsp; </b>At this
point you can configure Tagging, Filtering, Overflow and Cascading
options.&nbsp; You can also select one of the legal counters for the selected
Event Mode.</font></p>
<p><font size="3"><b>Step 5) Set the process priority to high</b></font></p>
<blockquote>
<p><font size="3">This reduces the noise from other processes interfering.&nbsp; If you
have an infinite loop in you code and you have these set, you may hang and
need to reboot</font></p>
<p><font size="3">Example:</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp; PME * pme = PME::Instance();</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp; pme-&gt;SetProcessPriority(ProcessPriorityHigh);</font></p>
<font SIZE="2">
<p>&nbsp;</p>
</blockquote>
</font>
<p><font size="3"><b>Step 6) Start using the counters</b></font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Each Event Mode
counter has the follow ability:</font></p>
<blockquote>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Stop</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Start</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Clear - set to
0</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Read</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write - write a
64 bit counter value</font></p>
</blockquote>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></p>
<p><font size="3"><b>Step 7) Set the process priority to normal</b></font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pme-&gt;SetProcessPriority(ProcessPriorityNormal);</font></p>
<h2>&nbsp;</h2>
</blockquote>
<h2><font size="3"><b>Event Modes:</b></font></h2>
<blockquote>
<blockquote>
<p><font size="3">Event_TC_deliver_mode</font></p>
<p><font size="3">Event_BPU_fetch_request</font></p>
<p><font size="3">Event_ITLB_reference</font></p>
<p><font size="3">Event_memory_cancel</font></p>
<p><font size="3">Event_memory_complete</font></p>
<p><font size="3">Event_load_port_replay</font></p>
<p><font size="3">Event_store_port_replay</font></p>
<p><font size="3">Event_MOB_load_replay</font></p>
<p><font size="3">Event_page_walk_type</font></p>
<p><font size="3">Event_BSQ_cache_reference</font></p>
<p><font size="3">Event_IOQ_allocation</font></p>
<p><font size="3">Event_IOQ_active_entries</font></p>
<p><font size="3">Event_FSB_data_activity</font></p>
<p><font size="3">Event_BSQ_allocation</font></p>
<p><font size="3">Event_BSQ_active_entries</font></p>
<p><font size="3">Event_SSE_input_assist</font></p>
<p><font size="3">Event_packed_SP_uop</font></p>
<p><font size="3">Event_packed_DP_uop</font></p>
<p><font size="3">Event_scalar_SP_uop</font></p>
<p><font size="3">Event_scalar_DP_uop</font></p>
<p><font size="3">Event_64bit_MMX_uop</font></p>
<p><font size="3">Event_128bit_MMX_uop</font></p>
<p><font size="3">Event_x87_FP_uop</font></p>
<p><font size="3">Event_x87_SIMD_moves_uop</font></p>
<p><font size="3">Event_TC_misc</font></p>
<p><font size="3">Event_global_power_events</font></p>
<p><font size="3">Event_tc_ms_xfer</font></p>
<p><font size="3">Event_uop_queue_writes</font></p>
<p><font size="3">Event_retired_mispred_branch_type</font></p>
<p><font size="3">Event_retired_branch_type</font></p>
<p><font size="3">Event_resource_stall</font></p>
<p><font size="3">Event_WC_Buffer</font></p>
<p><font size="3">Event_b2b_cycles</font></p>
<p><font size="3">Event_bnr</font></p>
<p><font size="3">Event_snoop</font></p>
<p><font size="3">Event_response</font></p>
<p><font size="3">Event_front_end_event</font></p>
<p><font size="3">Event_execution_event</font></p>
<p><font size="3">Event_replay_event</font></p>
<p><font size="3">Event_instr_retired</font></p>
<p><font size="3">Event_uops_retired</font></p>
<p><font size="3">Event_uop_type</font></p>
<p><font size="3">Event_branch_retired</font></p>
<p><font size="3">Event_mispred_branch_retired</font></p>
<p><font size="3">Event_x87_assist</font></p>
<p><font size="3">Event_machine_clear</font></p>
</blockquote>
</blockquote>
<h2><b>Credits</b></h2>
<p><a href="http://www.gamasutra.com/features/wyatts_world/19990528/pentium3_08.htm"><font color="#008000" size="3">http://www.gamasutra.com/features/wyatts_world/19990528/pentium3_08.htm</font></a></p>
<p><font color="#008000" size="3">Used some tables from <a href="http://user.it.uu.se/~mikpe/">Mikael Pettersson's</a>&nbsp;
<a href="http://user.it.uu.se/~mikpe/linux/perfctr/">pertctf</a>
</font>
</p>
<p align="left"><font color="#008000" size="3">Used the detect code from<a href="http://yotov.org">
Kamen Yotov's</a>&nbsp; <a href="http://iss.cs.cornell.edu/ia32.htm">ia32lib library</a></font></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>
+61
View File
@@ -0,0 +1,61 @@
from __future__ import generators
import os
import re
import stat
# This takes a DOS filename wildcard like *abc.t?t and returns a regex string that will match it.
def GetRegExForDOSWildcard( wildcard ):
# First find the base directory name.
iLast = wildcard.rfind( "/" )
if iLast == -1:
iLast = wildcard.rfind( "\\" )
if iLast == -1:
dirName = "."
dosStyleWildcard = wildcard
else:
dirName = wildcard[0:iLast]
dosStyleWildcard = wildcard[iLast+1:]
# Now generate a regular expression for the search.
# DOS -> RE
# * -> .*
# . -> \.
# ? -> .
reString = dosStyleWildcard.replace( ".", r"\." ).replace( "*", ".*" ).replace( "?", "." )
return reString
#
# Useful function to return a list of files in a directory based on a dos-style wildcard like "*.txt"
#
# for name in WildcardSearch( "d:/hl2/src4/dt*.cpp", 1 ):
# print name
#
def WildcardSearch( wildcard, bRecurse=0 ):
reString = GetRegExForDOSWildcard( wildcard )
matcher = re.compile( reString, re.IGNORECASE )
return __GetFiles_R( matcher, dirName, bRecurse )
def __GetFiles_R( matcher, dirName, bRecurse ):
fileList = []
# For each file, see if we can find the regular expression.
files = os.listdir( dirName )
for baseName in files:
filename = dirName + "/" + baseName
mode = os.stat( filename )[stat.ST_MODE]
if stat.S_ISREG( mode ):
# Make sure the file matches the search string.
if matcher.match( baseName ):
fileList.append( filename )
elif bRecurse and stat.S_ISDIR( mode ):
fileList += __GetFiles_R( matcher, filename, bRecurse )
return fileList
@@ -0,0 +1,217 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Checks to see if the user has completely viewed the EULA before activing the accept/decline radio buttons
//
//=============================================================================//
#include < windows.h >
#include < msi.h >
#include < msiquery.h >
#include <tchar.h>
#include <stdarg.h>
#include <stdio.h>
#include <commctrl.h>
#define CHILD_WINDOW_OF_LICENSE "vHackLicenseWindowSibling092304"
#define WINDOW_CLASS_OF_EULA_WINDOW "RichEdit20W"
#define ALLOWABLE_POS_FROM_BOTTOM 5
//-----------------------------------------------------------------------------
// Purpose: Call back function for EnumChildWindows
// Input : hwnd -
// lParam -
// Output : BOOL CALLBACK
//-----------------------------------------------------------------------------
BOOL CALLBACK EnumChildProc(HWND hwnd,LPARAM lParam)
{
TCHAR buf[100];
GetClassName( hwnd, (LPTSTR)&buf, 100 );
if ( _tcscmp( buf, _T( WINDOW_CLASS_OF_EULA_WINDOW ) ) == 0 )
{
*(HWND*)lParam = hwnd;
return FALSE;
}
return TRUE;
}
//-----------------------------------------------------------------------------
// Purpose: Context for searching sub windows...
//-----------------------------------------------------------------------------
struct FindParams_t
{
HWND wnd;
char searchtext[ 512 ];
};
//-----------------------------------------------------------------------------
// Purpose:
// Input : hwnd -
// lParam -
// Output : BOOL CALLBACK
//-----------------------------------------------------------------------------
BOOL CALLBACK EnumChildrenLookingForSpecialControl(HWND hwnd,LPARAM lParam)
{
FindParams_t *p = ( FindParams_t *)lParam;
char buf[ 512 ];
GetWindowText( hwnd, buf, sizeof( buf ) );
if ( !stricmp( buf, p->searchtext ) )
{
p->wnd = hwnd;
return FALSE;
}
return TRUE;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : hwnd -
// lParam -
// Output : BOOL CALLBACK
//-----------------------------------------------------------------------------
BOOL CALLBACK EnumChildWindowsProc(HWND hwnd, LPARAM lParam)
{
// Now search for the special hidden text control inside a top level window
FindParams_t *p = ( FindParams_t *)lParam;
FindParams_t special;
memset( &special, 0, sizeof( special ) );
strcpy( special.searchtext, p->searchtext );
EnumChildWindows( hwnd, EnumChildrenLookingForSpecialControl, (LPARAM)&special );
if ( special.wnd != NULL )
{
p->wnd = hwnd;
return FALSE;
}
return TRUE;
}
//-----------------------------------------------------------------------------
// Purpose: Finds given a root window, finds a child window which itself has a special child window with the specified text string as the window title.
// e.g.:
// if root == NULL (desktop), then you can search the top level dialogs (Half-Life 2 Setup,e.g.) for a subwindow with "vHackxxx" as the text, this would
// return the appropriate top level dialog.
// Input : root -
// *text -
// Output : HWND
//-----------------------------------------------------------------------------
HWND FindWindowHavingChildWithSpecifiedText( HWND root, char const *text )
{
FindParams_t params;
memset( &params, 0, sizeof( params ) );
strncpy( params.searchtext, text, sizeof( params.searchtext ) - 1 );
EnumChildWindows( root, EnumChildWindowsProc, (LPARAM)&params );
return params.wnd;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *text -
// Output : HWND
//-----------------------------------------------------------------------------
HWND FindTopLevelWindowHavingChildWithSpecifiedText( char const *text )
{
return FindWindowHavingChildWithSpecifiedText( GetDesktopWindow(), text );
}
//***********************************************************
//** Custom action to check if the license is completly
//** viewed.
//**---------------------------------------------------------
//** Return values:
//** (1) Always returns success
//** (2) Sets the private property LicenseViewed when
//** the text is scrolled to near end.
//**---------------------------------------------------------
//** Usage:
//** (1) Find installer window by looking for child with specified text. Can't
//** just use window title because it's translated into foreign languages
//** (2) In the license agreement dialog, on the scrollable
//** text control event, call the custom action
//** CheckLicenseViewed using a DoAction
//** (3) For the Next button, modify the Enable
//** ControlCondition to include the property
//** LicenseViewed
//**---------------------------------------------------------
//***********************************************************
// Needs to be exported as non-__stdcall with C name mangling (no mangling)
extern "C" __declspec( dllexport ) UINT CheckLicenseViewed(MSIHANDLE hMSI)
{
HWND hWnd;
HWND hWndChild=NULL;
if (MsiEvaluateCondition(hMSI,"LicenseViewed")==MSICONDITION_FALSE)
{
hWnd = FindTopLevelWindowHavingChildWithSpecifiedText(CHILD_WINDOW_OF_LICENSE );
if (hWnd)
{
EnumChildWindows( hWnd, EnumChildProc, (LPARAM)&hWndChild );
if ( hWndChild )
{
SCROLLINFO sinfo;
memset( &sinfo, 0, sizeof( sinfo ) );
sinfo.cbSize=sizeof(sinfo);
sinfo.fMask=SIF_TRACKPOS | SIF_RANGE | SIF_POS | SIF_PAGE;
GetScrollInfo(hWndChild, SB_VERT, &sinfo);
//max range depends on page size
UINT MaxScrollPos = sinfo.nMax - ( sinfo.nPage - 1 );
//max less, say ALLOWABLE_POS_FROM_BOTTOM - an allowable max.
MaxScrollPos = MaxScrollPos - ALLOWABLE_POS_FROM_BOTTOM;
// THIS IS A HACK, but the RichEdit20W control has a bug where while the thumb is being dragged, the position doesn't
// get updated. In fact, it doesn't get updated until the next time
UINT nScrollPos = ::SendMessage(hWndChild, EM_GETTHUMB, 0, 0);
bool trackedPastEnd = false; // (UINT)sinfo.nTrackPos >= MaxScrollPos ? true : false;
bool positionedPastEnd = nScrollPos >= MaxScrollPos ? true : false;
// Note above, this method doesn't always work... but maybe it will work in win98 and the other won't, etc. etc.
bool positionedPastEnd2 = (UINT)sinfo.nPos >= MaxScrollPos ? true : false;
/*
HDC dc = GetDC( GetDesktopWindow() );
COLORREF oldColor = SetTextColor( dc, RGB( 255, 0, 0 ) );
char sz[ 256 ];
_snprintf( sz, sizeof( sz ), "max %i page %i msp %i track %u pos %u pos2 %u",
sinfo.nMax,
sinfo.nPage,
MaxScrollPos,
sinfo.nTrackPos,
sinfo.nPos,
nScrollPos );
RECT rc;
rc.left = 0;
rc.right = 1000;
rc.top = 20;
rc.bottom = 50;
DrawText( dc, sz, -1, &rc, DT_NOPREFIX );
SetTextColor( dc, oldColor );
ReleaseDC( GetDesktopWindow(), dc );
*/
if ( trackedPastEnd || positionedPastEnd || positionedPastEnd2 )
{
MsiSetProperty(hMSI, TEXT("LicenseViewed"), TEXT("1"));
}
else
{
MsiSetProperty(hMSI, TEXT("LicenseViewed"), NULL);
}
}
}
}
return ERROR_SUCCESS;
}
@@ -0,0 +1,31 @@
//-----------------------------------------------------------------------------
// LICENSEVIEWED.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Macro SRCDIR "..\.."
$Macro OUTBINDIR "$SRCDIR\..\game\bin"
$Include "$SRCDIR\vpc_scripts\source_dll_base.vpc"
$Configuration
{
$Compiler
{
$PreprocessorDefinitions "$BASE;LicenseViewed_EXPORTS"
}
$Linker
{
$AdditionalDependencies "$BASE msi.lib odbc32.lib odbccp32.lib"
}
}
$Project "LicenseViewed"
{
$Folder "Source Files"
{
$File "LicenseViewed.cpp"
}
}
@@ -0,0 +1,460 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: A simple app which looks for the HL2 wise installer and ticks the progress bar due
// to a bug with installing more than 2GB of data using the current ver of the windows installer
//
//=============================================================================//
#include <windows.h>
#include <stdarg.h>
#include <stdio.h>
#include <commctrl.h>
#include <stdlib.h>
#define FIND_WINDOW_TEXT_PROGRESSDIALOG "vHackWiseProgressDialog092304"
#define FIND_WINDOW_TEXT_CHANGEDISKDIALOG "vHackWiseProgressDialogChangeCD092304"
#define FIND_WINDOW_TEXT_CANCELDIALOG "vHackWiseProgressDialogCancel092304"
static char szAppName[] = "vWiseProgressBarHackWndClass";
// The full bar is this many ticks (which are about 100 msec apart, so 30 seconds to walk bar
#define PROGRESS_TICKS 75
#define PROGRESS_WAIT_TICKS 20
// After this long, if we didn't find the setup dialog, exit the application
#define SEARCH_TIMEOUT_SECONDS 60
#define WISE_PROGRESS_BAR_WINDOW_CLASS "msctls_progress32"
//-----------------------------------------------------------------------------
// Purpose: Globals
//-----------------------------------------------------------------------------
struct Globals_t
{
DWORD m_nLastThink;
DWORD m_nStartTick;
bool m_bFoundWindow;
HWND m_hProgressBar;
HWND m_hDialog;
UINT m_nTickCounter;
};
static Globals_t g;
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
struct FindParams_t
{
HWND wnd;
char searchtext[ 512 ];
};
//-----------------------------------------------------------------------------
// Purpose:
// Input : hwnd -
// lParam -
// Output : BOOL CALLBACK
//-----------------------------------------------------------------------------
BOOL CALLBACK EnumChildrenLookingForSpecialControl(HWND hwnd,LPARAM lParam)
{
FindParams_t *p = ( FindParams_t *)lParam;
char buf[ 512 ];
GetWindowText( hwnd, buf, sizeof( buf ) );
if ( !stricmp( buf, p->searchtext ) )
{
p->wnd = hwnd;
return FALSE;
}
return TRUE;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : hwnd -
// lParam -
// Output : BOOL CALLBACK
//-----------------------------------------------------------------------------
BOOL CALLBACK EnumChildWindowsProc(HWND hwnd, LPARAM lParam)
{
// Now search for the special hidden text control inside a top level window
FindParams_t *p = ( FindParams_t *)lParam;
FindParams_t special;
memset( &special, 0, sizeof( special ) );
strcpy( special.searchtext, p->searchtext );
EnumChildWindows( hwnd, EnumChildrenLookingForSpecialControl, (LPARAM)&special );
if ( special.wnd != NULL )
{
p->wnd = hwnd;
return FALSE;
}
return TRUE;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : root -
// *text -
// Output : HWND
//-----------------------------------------------------------------------------
HWND FindWindowHavingChildWithSpecifiedText( HWND root, char const *text )
{
FindParams_t params;
memset( &params, 0, sizeof( params ) );
strncpy( params.searchtext, text, sizeof( params.searchtext ) - 1 );
EnumChildWindows( root, EnumChildWindowsProc, (LPARAM)&params );
return params.wnd;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *text -
// Output : HWND
//-----------------------------------------------------------------------------
HWND FindTopLevelWindowHavingChildWithSpecifiedText( char const *text )
{
return FindWindowHavingChildWithSpecifiedText( GetDesktopWindow(), text );
}
//-----------------------------------------------------------------------------
// Purpose: Search for window of class WISE_PROGRESS_BAR_WINDOW_CLASS
// Input : hwnd -
// lParam -
// Output : BOOL CALLBACK
//-----------------------------------------------------------------------------
BOOL CALLBACK EnumFindProgressBarInDialog( HWND hwnd,LPARAM lParam )
{
char buf[100];
GetClassName( hwnd, buf, sizeof( buf ) );
if ( !stricmp( buf, WISE_PROGRESS_BAR_WINDOW_CLASS ) )
{
*(HWND*)lParam = hwnd;
return FALSE;
}
return TRUE;
}
//-----------------------------------------------------------------------------
// Purpose: Hides the window
// Input : visible -
//-----------------------------------------------------------------------------
void ShowProgressBar( bool visible )
{
if ( !g.m_hProgressBar )
return;
DWORD style = GetWindowLong( g.m_hProgressBar, GWL_STYLE );
if ( visible )
{
style |= WS_VISIBLE;
}
else
{
style &= ~WS_VISIBLE;
}
SetWindowLong( g.m_hProgressBar, GWL_STYLE, style );
InvalidateRect( g.m_hDialog, NULL, TRUE );
}
//-----------------------------------------------------------------------------
// Purpose: Search for the progress dialog
//-----------------------------------------------------------------------------
void SearchForWindow()
{
HWND hProgressDialog = FindTopLevelWindowHavingChildWithSpecifiedText( FIND_WINDOW_TEXT_PROGRESSDIALOG );
if ( !hProgressDialog )
{
return;
}
HWND hWndChild = NULL;
EnumChildWindows( hProgressDialog, EnumFindProgressBarInDialog, (LPARAM)&hWndChild );
if ( !hWndChild )
return;
g.m_bFoundWindow = true;
g.m_hProgressBar = hWndChild;
g.m_hDialog = hProgressDialog;
// Hide the progress bar on the dialog since we'll be drawing our own
ShowProgressBar( false );
}
void DrawProgressBar( HDC dc, bool showTicks, float frac )
{
// Get progress bar rectangle
RECT rc;
GetClientRect( g.m_hProgressBar, &rc );
//InflateRect( &rc, 2, 2 );
int w = rc.right - rc.left;
int h = rc.bottom - rc.top;
HDC dcMemory = CreateCompatibleDC( dc );
HBITMAP bmMemory = CreateCompatibleBitmap( dc, w, h );
HBITMAP bmOld = (HBITMAP)SelectObject( dcMemory, bmMemory );
{
HBRUSH clearColor = CreateSolidBrush( GetSysColor( COLOR_BTNFACE ) );
FillRect( dcMemory, &rc, clearColor );
// Create blue tick brush
HBRUSH br = CreateSolidBrush( RGB( 2, 62, 134 ) );
// Create background brush of same color as dialog background
HBRUSH bg = CreateSolidBrush( RGB( 153, 175, 199) );
// Create a black / shadow colored pen to frame the progress bar
HPEN blackpen;
blackpen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) );
// Select items into dcMemory
HPEN oldPen = (HPEN)SelectObject( dcMemory, blackpen );
HBRUSH oldBrush = (HBRUSH)SelectObject( dcMemory, bg );
rc.bottom = rc.top + 15;
RoundRect( dcMemory, rc.left, rc.top, rc.right, rc.bottom, 5, 5 );
// Inset by one unit
InflateRect( &rc, -1, -1 );
if ( showTicks )
{
HRGN clipRegion = (HRGN)CreateRectRgn( rc.left+1, rc.top, rc.right-1, rc.bottom );;
SelectClipRgn( dcMemory, clipRegion );
int numblocks = 8;
int blockwidth = 6;
int blockgap = 2;
int size = numblocks * ( blockwidth + blockgap );
// Determine width of progress bar work area
int width = rc.right - rc.left + 2 * size;
// Compute right edge of progress bar
RECT rcProgress = rc;
rcProgress.right = rcProgress.left - size + ( int )( frac * width + 0.5f );
rcProgress.left = rcProgress.right - size;
for ( int block = 0; block < numblocks; ++block )
{
RECT rcBlock;
rcBlock.left = rcProgress.left + block * ( blockwidth + blockgap );
rcBlock.right = rcBlock.left + blockwidth;
rcBlock.top = rcProgress.top + 1;
rcBlock.bottom = rcProgress.bottom - 1;
// Fill in progress bar
FillRect( dcMemory, &rcBlock, br );
}
SelectClipRgn( dcMemory, NULL );
DeleteObject( clipRegion );
}
// Restore GDI states
SelectObject( dcMemory, oldBrush );
SelectObject( dcMemory, oldPen );
DeleteObject( blackpen );
DeleteObject( bg );
DeleteObject( br );
DeleteObject( clearColor );
}
POINT pt;
pt.x = pt.y = 0;
// Convert top left of progress bar to screen space
ClientToScreen( g.m_hProgressBar, &pt );
// and then back to dialog relative space
ScreenToClient( g.m_hDialog, &pt );
// Offset the progress bar rect to the right position in the dialog
OffsetRect( &rc, pt.x, pt.y );
BitBlt( dc, rc.left, rc.top, w, h, dcMemory, 0, 0, SRCCOPY );
SelectObject( dcMemory, bmOld );
DeleteObject( bmMemory );
DeleteObject( dcMemory );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void UpdateProgress()
{
// If the "Insert next CD" or "Exit Setup" dialogs are showing, stop advancing the progress bar
HWND hSwapDiskDialog = FindWindowHavingChildWithSpecifiedText( GetDesktopWindow(), FIND_WINDOW_TEXT_CHANGEDISKDIALOG );
HWND hCancelDialog = FindWindowHavingChildWithSpecifiedText( GetDesktopWindow(), FIND_WINDOW_TEXT_CANCELDIALOG );
if ( !hSwapDiskDialog && !hCancelDialog )
{
g.m_nTickCounter++;
}
if ( !g.m_hProgressBar || !g.m_hDialog )
return;
int remainder = ( g.m_nTickCounter % PROGRESS_TICKS );
bool showTicks = ( remainder <= PROGRESS_WAIT_TICKS ) ? false : true;
int currentTick = max( 0, remainder - PROGRESS_WAIT_TICKS );
int totalTicks = PROGRESS_TICKS - PROGRESS_WAIT_TICKS;
float frac = ( float )( currentTick % totalTicks ) / ( float )( totalTicks - 1 );
HDC dc = GetDC( g.m_hDialog );
{
// Draw the progress bar
DrawProgressBar( dc, showTicks, frac );
}
ReleaseDC( g.m_hDialog, dc );
}
//-----------------------------------------------------------------------------
// Purpose: Either searches for window or updates progress
// The app will quit if the dialog is found and then goes away
// The app wil also quit if the dialog was not found after waiting 60 seconds
//-----------------------------------------------------------------------------
void Think()
{
// Only think once every 100 msec
DWORD curTick = GetTickCount();
if ( curTick - g.m_nLastThink < 50 )
{
return;
}
g.m_nLastThink = curTick;
// Haven't found window yet, keep searching
if ( !g.m_bFoundWindow )
{
SearchForWindow();
// Wise never got going..., abort this app...
if ( ( curTick - g.m_nStartTick ) > ( SEARCH_TIMEOUT_SECONDS * 1000 ) )
{
PostQuitMessage( 0 );
}
}
else
{
// Only redraw progress once every 100 msec
UpdateProgress();
// If the progress dialog does away, exit this app immediately
if ( !IsWindow( g.m_hDialog ) )
{
PostQuitMessage( 0 );
}
}
}
//-----------------------------------------------------------------------------
// Purpose: Main entry point
// Input : hInstance -
// hPrevInstance -
// nCmdShow -
// Output : int APIENTRY
//-----------------------------------------------------------------------------
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HWND hwnd ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = DefWindowProc;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = NULL;
wndclass.hCursor = NULL;
wndclass.hbrBackground = NULL;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
if ( !RegisterClass (&wndclass) )
{
return 0 ;
}
hwnd = CreateWindow
(
szAppName,
TEXT (""),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL
);
if (!hwnd)
return 0 ;
ShowWindow( hwnd, SW_HIDE ) ;
// Remember when we started
g.m_nStartTick = GetTickCount();
bool done = false;
while ( 1 )
{
MSG msg;
while ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{
if ( msg.message == WM_QUIT )
{
done = true;
break;
}
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
if ( done )
break;
Think();
Sleep( 20 );
}
// Restore progress bar as needed
ShowProgressBar( true );
return 0;
}
@@ -0,0 +1,18 @@
//-----------------------------------------------------------------------------
// UPDATEPROGRESS.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Macro SRCDIR "..\..\.."
$Macro OUTBINDIR "$SRCDIR\devtools\bin"
$Include "$SRCDIR\vpc_scripts\source_exe_win_win32_base.vpc"
$Project "UpdateProgress"
{
$Folder "Source Files"
{
$File "UpdateProgress.cpp"
}
}
+133
View File
@@ -0,0 +1,133 @@
"""
This file exists to mark this directory as being a Python package,
and to contain project specific configurations for parse_analyze_errors.py.
See http://www.python.org/doc/essays/packages.html for details.
Other Python scripts could be put into this directory and would be
imported as analyzeconfig.scriptname.
"""
"""
The VC++ 2012 compiler had a crashing bug when you use /analyze. Depending on the frequency
of this crash (which varies per project) we can either ignore it or try to proceed. If abortOnCompilerCrash
is true then parsing stops when a compiler crash is detected, no warnings are reported, and the
last-known-good is left unchanged so that the next build will give correct diffs.
"""
abortOnCompilerCrash = True
"""
Normally the last-known-good report is updated whenever a build passes with no fatal warnings. However if
the compiler keeps crashing then this means that the last-known-good will keep changing, leading to false
reports of new warnings. Also, a project may decide that they don't want any new warnings. This setting
controls updating of the last-known-good file.
"""
updateLastKnownGood = True
"""
Some warnings occur in Microsoft header files. We need to ignore these. Substring
matching is done on these.
"""
ignorePaths = [
r"microsoft visual studio 10.0\vc",
r"microsoft visual studio 11.0\vc",
r"microsoft sdks\windows\v7.0a",
r"microsoft xbox 360 sdk\include",
r"windows kits\8.0\include",
r"thirdparty\dxsdk\include",
r"thirdparty\physx301\physxsdk",
]
"""
This list contains warnings which /analyze can identify with (ideally) 100%
accuracy and which the team believes should always be fixed. This typically
includes varargs mismatches of all kinds.
The layout is designed to match the warningsToText array to make it easy to
copy between them.
This array should probably be empty when /analyze is first run on a project
but should be filled in as much as practical in order to avoid regressions.
"""
alwaysFatalWarnings = {
4189 : "Local variable is initialized but not referenced",
4789 : "Destination of memory copy is too small",
6053 : "Call to <function> may not zero-terminate string",
6057 : "Buffer overrun due to number of characters/number of bytes mismatch",
6059 : "Incorrect length parameter",
6063 : "Missing string argument",
6064 : "Missing integer argument",
6066 : "Non-pointer passed as parameter when pointer is required",
6067 : "Parameter in call must be the address of the string",
6209 : "Using sizeof when a character count might be needed. Annotate with OUT_Z_CAP or its relatives",
6269 : "Possible incorrect order of operations: dereference ignored",
6270 : "Missing float argument to varargs function",
6271 : "Extra argument passed: parameter is not used by the format string",
6272 : "Non-float passed as argument <number> when float is required",
6273 : "Non-integer passed as a parameter when integer is required",
6274 : "Non-character passed as parameter '5' when character is required",
6278 : "Buffer is allocated with array new [], but deleted with scalar delete. Destructors will not be called",
6281 : "Incorrect order of operations: relational operators have higher precedence than bitwise operators",
6282 : "Incorrect operator: assignment of constant in Boolean context",
6283 : "Buffer is allocated with array new [], but deleted with scalar delete",
6284 : "Object passed as a parameter when string is required",
6290 : "Bitwise operation on logical result: ! has higher precedence than &. Use && or (!(x & y)) instead",
6293 : "Ill-defined for-loop: counts down from minimum.",
#6298 : "Using a read-only string <pointer> as a writable string argument",
6302 : "Format string mismatch: character string passed as parameter when wide character string is required",
6306 : "Incorrect call to 'fprintf*': consider using 'vfprintf*' which accepts a va_list as an argument",
# This warning seems to show up in some template code so it can't be a fatal warning.
#6313 : "Incorrect operator: zero-valued flag cannot be tested with bitwise-and. Use an equality test to check for zero-valued flags",
6314 : "Incorrect order of operations: bitwise-or has higher precedence than the conditional-expression operator",
6315 : "Incorrect order of operations: bitwise-and has higher precedence than bitwise-or",
6316 : "Incorrect operator: tested expression is constant and non-zero. Use bitwise-and to determine whether bits are set.",
6317 : "Incorrect operator: logical-not (!) is not interchangeable with ones-complement (~)",
6328 : "Wrong parameter type passed",
6334 : "Sizeof operator applied to an expression with an operator might yield unexpected results",
6336 : "Arithmetic operator has precedence over question operator, use parentheses to clarify intent",
6522 : "Invalid size specification: expression must be of integral type",
6523 : "Invalid size specification: parameter 'size' not found",
28252 : "Inconsistent annotation",
28253 : "Inconsistent annotation",
}
"""
This list contains warnings which /analyze can identify with (ideally) 100%
accuracy and which the team wishes to avoid introducing new instances of.
This could include variable shadowing, alloca in a loop, or other bugs
which are problematic to fix all legacy instances of.
"""
fatalWhenNewWarnings = {
# Having variable shadowing be fatal on new warnings would be great, but it's best to see if
# that is what the team wants.
#6244 : "Local declaration shadows declaration of same name in global scope",
#6246 : "Local declaration shadows declaration of same name in outer scope",
6263 : "Using _alloca in a loop: this can quickly overflow stack",
}
# The paths on the build machines are very long and make reading the results cumbersome.
# Remap them down to something more compact.
remaps = {
r"c:\buildslave_source\dota_staging_analyzebuild_win32\build\src" : r"D:\dota\staging\src",
r"c:\buildslave_source2\buildbot\source2_analyzebuild_win32\build\src" : r"D:\source2\src",
r"c:\buildslave_steam\steam_main_analyze_win32\build\src" : r"D:\clients\steam_main\src",
}
# Some warnings are only kept on so that we can see the statistics they give us.
# They shouldn't count towards the total warning count.
# 6262: Excessive stack usage in function
# 28159: Consider using 'GetTickCount64' instead of 'GetTickCount'
# 6244: Local declaration shadows declaration of same name in global scope
# 6246: Local declaration shadows declaration of same name in outer scope
informationalWarnings = ["6262", "28159", "6244", "6246"]
+40
View File
@@ -0,0 +1,40 @@
ALWAYS_SEARCH_USER_PATHS = YES
HEADER_SEARCH_PATHS = $(HEADER_SEARCH_PATHS) $(SDKROOT)/usr/include/malloc
ARCHS = i386
ONLY_ACTIVE_ARCH = NO
COPY_PHASE_STRIP = NO
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
DEAD_CODE_STRIPPING = YES
PRESERVE_DEAD_CODE_INITS_AND_TERMS = YES
GCC_C_LANGUAGE_STANDARD = gnu99
GCC_ENABLE_OBJC_EXCEPTIONS = YES
GCC_SYMBOLS_PRIVATE_EXTERN = YES
GCC_INLINES_ARE_PRIVATE_EXTERN = YES
GCC_REUSE_STRINGS = YES
CLANG_CXX_LIBRARY = libc++
GCC_PREPROCESSOR_DEFINITIONS = _DLL_EXT=.dylib VPROF_LEVEL=1 NO_HOOK_MALLOC=1 PNG_NO_PEDANTIC_WARNINGS
BASE_CFLAGS= -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE -ftemplate-depth=512
GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO
WARNING_CFLAGS = -Wno-deprecated-writable-strings -Wno-switch-enum -Wno-switch -Wno-unused-value -Wno-parentheses -Wno-logical-op-parentheses -Wno-c++11-narrowing -Wno-inconsistent-missing-override
// CLANG - and use the ccache wrapper
GCC_VERSION = com.apple.compilers.llvm.clang.1_0
CC = $(SOURCE_ROOT)/devtools/bin/osx32/xcode_ccache_wrapper
LDPLUSPLUS = $(DT_TOOLCHAIN_DIR)/usr/bin/clang++
//CLANG_WARN_CXX0X_EXTENSIONS = NO
CLANG_CXX_LANGUAGE_STANDARD = c++11
// include <memory.h> gets confused, 'cause ivp has one, and the system has one, and only one
// gets into the header map, so sacrifice speed for corectness.
USE_HEADERMAP = NO
SDKROOT = macosx10.10
MACOSX_DEPLOYMENT_TARGET = 10.7
GCC_FAST_MATH = YES
CLANG_LINK_OBJC_RUNTIME = false
+77
View File
@@ -0,0 +1,77 @@
@echo off
:: Use this batch file to integrate steam client binaries directly from
:: //steam/rel/client. This only really affects the binaries that gameservers
:: use. (The client should use the binaries from the steam client that is
:: running.) We do this when we want some feature or bugfix in the steam
:: binaries, but don't want to integarte a whole new SDK.
::
:: Set source paths
::
SET VRP4Path=%1
SET IntegDate=%2
set BINS_ONLY=0
if !%IntegDate%!==!/bins! (
SET IntegDate=
SET BINS_ONLY=1
)
if !%VRP4Path%!==!! (
echo Usage: %0 VRP4Path
echo.
echo VRP4Path should be the perforce server path to the branch you want to integrate from,
echo e.g. "//vr/steamvr/sdk_release/"
goto :end
)
:: Use this when copying from official distribution.
SET DestRoot=..\..\..
set P4Root=%VRP4Path%
set SRCDIR_HEADERS=headers/...
set SRCDIR_DLL=bin
set SRCDIR_LIB=lib
::
:: Copy files
::
:: Client Win32 binaries
call :CopyOneFile %SRCDIR_DLL%/win32 openvr_api.dll game\bin
call :CopyOneFile %SRCDIR_LIB%/win32 openvr_api.lib src\lib\public
:: Client Linux binaries
call :CopyOneFile %SRCDIR_DLL%/linux32 libopenvr_api.so game\bin
call :CopyOneFile %SRCDIR_LIB%/linux32 libopenvr_api.so src\lib\public\linux32
:: Client Mac binaries. Note that there's no dedicated server on the Mac,
:: so we can ship a smaller set
call :CopyOneFile %SRCDIR_DLL%/osx32 libopenvr_api.dylib game\bin
call :CopyOneFile %SRCDIR_LIB%/osx32 libopenvr_api.dylib src\lib\public\osx32
if !%BINS_ONLY%!==!1! (
goto :end
)
:: Headers
ECHO ---------------------------------------------
ECHO Integrating Steam Headers from %P4Root%/%SRCDIR_HEADERS%
ECHO to %DestRoot%\src\public\steam\...
p4 integrate -d -i %P4Root%/%SRCDIR_HEADERS%%IntegDate% %DestRoot%\src\public\openvr\...
p4 resolve -at %DestRoot%\src\public\openvr\...
goto :end
:CopyOneFile
ECHO ---------------------------------------------
ECHO Integrating %P4Root%/%1/%2
ECHO to %DestRoot%\%3\%2
P4 integrate -d -i %P4Root%/%1/%2%IntegDate% %DestRoot%\%3\%2
P4 resolve -at %DestRoot%\%3\%2
echo.
:end
+85
View File
@@ -0,0 +1,85 @@
@echo off
:: Use this batch file to integrate panorama and associated libs from //Steam/main/
::
:: Set source paths
::
SET SteamP4Path=%1
if !%SteamP4Path%!==!! (
echo Usage: %0 SteamP4Path
echo.
echo SteamP4Path should be the perforce server path to the branch you want to integrate from,
echo e.g. "//Steam/rel/client" or "//Steam/main"
goto :end
)
set ThirdPartyPath=//thirdpartycode/nonredist
set V8Path=%ThirdPartyPath%/v8
set V8Bin=%V8Path%/out/ia32.release
set V8Headers=%V8Path%/include
set DestRoot=../../..
set DestLibs=%DestRoot%/src/lib/common/linux32/release
set DestHeaders=%DestRoot%/src/public/panorama
set DestSrc=%DestRoot%/src/panorama/...
set DestV8Headers=%DestRoot%/src/external/v8/include
set SrcHeaders=src/public/panorama
set SrcMain=src/panorama/...
::
:: Copy files
::
:: Client Linux binaries
call :CopyOneFile %V8Bin% libicudata.a %DestLibs%
call :CopyOneFile %V8Bin% libv8_libplatform.a %DestLibs%
call :CopyOneFile %V8Bin%/lib.target libicui18n.so %DestLibs%
call :CopyOneFile %V8Bin%/lib.target libv8.so %DestLibs%
call :CopyOneFile %V8Bin%/lib.target libicuuc.so %DestLibs%
:: Client Win32 binaries
:: TODO
:: Client Mac binaries. Note that there's no dedicated server on the Mac,
:: so we can ship a smaller set
:: TODO
:: V8 Headers
ECHO ---------------------------------------------
ECHO Integrating V8 Headers from %V8Headers%/...
ECHO to %DestV8Headers%/...
p4 integrate -d -i %V8Headers%/... %DestV8Headers%/...
p4 resolve -at %DestV8Headers%/...
:: Headers
ECHO ---------------------------------------------
ECHO Integrating Panorama Headers from %SteamP4Path%/%SrcHeaders%/...
ECHO to %DestHeaders%/...
p4 integrate -d -i %SteamP4Path%/%SrcHeaders%/... %DestHeaders%/...
p4 resolve -at %DestHeaders%/...
:: Src
ECHO ---------------------------------------------
ECHO Integrating Panorama Sources from %SteamP4Path%/%SrcMain%/...
ECHO to %DestSrc%/...
p4 integrate -d -i %SteamP4Path%/%SrcMain%/... %DestSrc%/...
p4 resolve -at %DestSrc%/...
goto :end
:CopyOneFile
ECHO ---------------------------------------------
ECHO Integrating %1/%2
ECHO to %3
P4 integrate -d -i %1/%2 %3/%2
P4 resolve -at %3/%2
echo.
:end
@@ -0,0 +1,34 @@
SET SRC=//Steam/sdr_public
SET DEST=../../..
:: 32 bit windows
p4 copy %SRC%/bin/win32/steamnetworkingsockets.lib %DEST%/src/lib/public/steamnetworkingsockets.lib
p4 copy %SRC%/bin/win32/steamnetworkingsockets.dll %DEST%/game/bin/steamnetworkingsockets.dll
:: 64-bit windows
::p4 copy %SRC%/bin/win64/steamnetworkingsockets.lib %DEST%/src/lib/public/x64/steamnetworkingsockets.lib
::p4 copy %SRC%/bin/win64/steamnetworkingsockets.dll %DEST%/game/bin/x64/steamnetworkingsockets.dll
:: GC. TF doesn't use SDR for actual connectivity, so we don't need to generate any tickets
::p4 copy %SRC%/bin/win64/steamdatagram_ticketgen.lib %DEST%/src/lib/public/x64/steamdatagram_ticketgen.lib
::p4 copy %SRC%/bin/win64/steamdatagram_ticketgen.dll %DEST%/game/csgo/bin/gc/x64/steamdatagram_ticketgen.dll
::p4 copy %SRC%/bin/win32/steamdatagram_ticketgen.lib %DEST%/src/lib/public/steamdatagram_ticketgen.lib
::p4 copy %SRC%/bin/win32/steamdatagram_ticketgen.dll %DEST%/game/csgo/bin/gc/steamdatagram_ticketgen.dll
:: 32-bit Linux, older toolchain. That should work just fine for the linux client.
p4 copy %SRC%/bin/linux32/libsteamnetworkingsockets.so %DEST%/game/bin/libsteamnetworkingsockets.so
p4 copy %SRC%/bin/linux32/libsteamnetworkingsockets.so %DEST%/src/lib/public/linux32/libsteamnetworkingsockets.so
:: 64-bit Linux, depends on Steam runtime
::p4 copy %SRC%/bin/ubuntu12_64/libsteamnetworkingsockets.so %DEST%/game/bin/linux64/libsteamnetworkingsockets.so
::p4 copy %SRC%/bin/ubuntu12_64/libsteamnetworkingsockets.so %DEST%/src/lib/public/linux64/libsteamnetworkingsockets.so
:: OSX (32- and 64-bit fat binaries)
p4 copy %SRC%/client/Steam.AppBundle/Steam/Contents/MacOS/libsteamnetworkingsockets.dylib %DEST%/game/bin/libsteamnetworkingsockets.dylib
p4 copy %SRC%/client/Steam.AppBundle/Steam/Contents/MacOS/libsteamnetworkingsockets.dylib %DEST%/src/lib/public/osx32/libsteamnetworkingsockets.dylib
:: Tool
::p4 copy %SRC%/bin/win64/steamdatagram_certtool.exe %DEST%/src/devtools/bin/steamdatagram_certtool.exe
p4 integrate %SRC%/src/public/steamnetworkingsockets/... %DEST%/src/public/steamnetworkingsockets/...
p4 resolve -as
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
from vsdotnetxmlparser import *
WriteSeparateVCProj( LoadVCProj( 'cl_dll\\client.vcproj' ), ["Debug SDK|Win32", "Release SDK|Win32"], 'cl_dll\\client_sdk.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'cl_dll\\client.vcproj' ), ["Debug HL2|Win32", "Release HL2|Win32"], 'cl_dll\\client_sdk_hl2.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'cl_dll\\client.vcproj' ), ["Debug HL2MP|Win32", "Release HL2MP|Win32"], 'cl_dll\\client_sdk_hl2mp.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'dlls\\hl.vcproj' ), ["Debug SDK|Win32", "Release SDK|Win32"], 'dlls\\hl_sdk.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'dlls\\hl.vcproj' ), ["Debug HL2|Win32", "Release HL2|Win32"], 'dlls\\hl_sdk_hl2.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'dlls\\hl.vcproj' ), ["Debug HL2MP|Win32", "Release HL2MP|Win32"], 'dlls\\hl_sdk_hl2mp.vcproj' )
+22
View 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";
+83
View File
@@ -0,0 +1,83 @@
use strict;
sub DoBuild
{
my @output;
my $buildtype = shift;
if( $buildtype eq "release" )
{
open BUILD, "dev_build_all.bat|";
}
elsif( $buildtype eq "debug" )
{
open BUILD, "dev_build_all.bat debug|";
}
else
{
die;
}
my $buildfailed = 0;
while( <BUILD> )
{
if( /Build Errors\!/ )
{
$buildfailed = 1;
}
print;
push @output, $_;
}
close build;
if( $buildfailed )
{
open CHANGES, "p4 changes -m 10 -s submitted //ValveGames/main/src/...|";
my @changes = <CHANGES>;
close CHANGES;
open EMAIL, ">email.txt";
print EMAIL "LAST 10 SUBMITS TO MAIN:\n";
print EMAIL @changes;
print EMAIL "\n";
my $line;
foreach $line ( @output )
{
if( $line =~ m/error/i )
{
print EMAIL $line;
}
}
print EMAIL "--------------------------------------------\n\n\n\n";
print EMAIL @output;
close EMAIL;
system "devtools\\bin\\smtpmail.exe -to srcdev\@valvesoftware.com -from srcdev\@valvesoftware.com -subject \"FIX THE BUILD\! ($buildtype)\" -verbose email.txt";
# system "devtools\\bin\\smtpmail.exe -to gary\@valvesoftware.com -from srcdev\@valvesoftware.com -subject \"FIX THE BUILD\! ($buildtype)\" -verbose email.txt";
}
}
while( 1 )
{
$ENV{"USE_INCREDIBUILD"} = "1";
system "p4 sync > sync.txt 2>&1";
my $hasChange = 1;
my $line;
open SYNC, "<sync.txt";
while( <SYNC> )
{
if( m/File\(s\) up-to-date/ )
{
$hasChange = 0;
}
print;
}
close SYNC;
if( $hasChange )
{
print "changes checked in\n";
&DoBuild( "release" );
&DoBuild( "debug" );
}
else
{
print "no changes checked in\n";
sleep 30;
}
}
+23
View File
@@ -0,0 +1,23 @@
#! perl
# scan all .o files for illegal instructions from passing aggregates to varargs functions.
use File::Find;
find( \&CheckFile, "." );
sub CheckFile
{
return unless (/\.o$/ );
open( DIS, "objdump --disassemble -C $_|" ) || die "can't process $_";
while( <DIS> )
{
$symbol = $1 if ( /^[0-9]+ \<(.*)\>:/ );
if ( /\s+ud2a/ )
{
print "Illegal instruction in $symbol in ", $File::Find::name, "\n";
}
}
}
+660
View File
@@ -0,0 +1,660 @@
use strict;
###################################################
# CONFIG VARS
###################################################
# FIXME: load these from a separate file so that each user can have their own config without editingthis file.
my $g_P4UserName = "gary";
my $g_LocalBaseDir = "u:\\hl2";
my $g_LocalBranchSubdir = "src5";
my $g_LocalBranchName = "gary_src5";
my $g_LocalBranchClient = "gary_work_src5";
my $g_MainCopyBaseDir = "u:\\hl2";
my $g_LocalBranchMainCopySubdir = "src5_main";
my $g_LocalBranchMainCopyName = "gary_src5_main";
#my $g_LocalBranchMainCopyClient = "gary_work_src5_main";
my $g_MainBaseDir = "u:\\hl2_main";
my $g_MainBranchSubdir = "src_main";
#my $g_MainBranchName = "gary_src_main";
#my $g_MainBranchClient = "gary_work_src_main";
my $g_UseIncredibuildForMain = 1;
# FIXME: need to make this work for those that don't work on HL2.
my $g_LocalBranchHasHL1Port = 0;
my $g_LocalBranchHasCSPort = 0;
my $g_LocalBranchHasTF2 = 0;
my $g_CheckinFileStampTimes = "c:\\checkin_filetimes.txt";
# either use VSS directly via the command-line, or use Tom's tool.
my $g_UseVSS = 0;
###################################################
# Helper vars made up of config vars
###################################################
my $g_LocalBranchDir = "$g_LocalBaseDir\\$g_LocalBranchSubdir";
my $g_LocalBranchMainCopyDir = "$g_MainCopyBaseDir\\$g_LocalBranchMainCopySubdir";
my $g_MainBranchDir = "$g_MainBaseDir\\$g_MainBranchSubdir";
###################################################
my $g_DebugStub = 0;
my $stage = shift;
if( $stage != 1 &&
$stage != 2 &&
$stage != 3 &&
$stage ne "syncmain" &&
$stage ne "syncmainsrc" &&
$stage ne "synclocal" &&
$stage ne "synclocalrelease" &&
$stage ne "synclocaldebug" &&
$stage ne "synclocalsrc" &&
$stage ne "synclocalsrcrelease" &&
$stage ne "sync" &&
$stage ne "syncmaincontent" )
{
print "checkin.pl 1 : to get started with a checkin\n";
print "checkin.pl 2 : second stage of checkin\n";
print "checkin.pl 3 : third stage of checkin\n";
print "checkin.pl syncmain : sync main source and content, then build\n";
print "checkin.pl syncmainsrc : sync main source then build\n";
print "checkin.pl syncmaincontent : sync main content only\n";
print "checkin.pl synclocal : merge personal branch, sync content,\n";
print " then build.\n";
print "checkin.pl synclocalrelease : merge personal branch, sync content,\n";
print " then build (release only).\n";
print "checkin.pl synclocaldebug : merge personal branch, sync content,\n";
print " then build (debug only).\n";
print "checkin.pl synclocalsrc : merge personal branch, then build.\n";
print "checkin.pl synclocalsrcrelease : merge personal branch, then build\n";
print " (release only).\n";
print "checkin.pl sync : merge personal branch, sync main src,\n";
print " sync content for both, and then build\n";
print " the whole thing.\n";
die;
}
sub RunCmd
{
my $cmd = shift;
print $cmd . "\n";
if( !$g_DebugStub )
{
return system $cmd;
}
}
sub CD
{
my $dir = shift;
print "cd $dir\n";
if( !$g_DebugStub )
{
chdir $dir;
}
}
sub SSGet
{
my $vssdir = shift;
my $localdir = shift;
&CD( $localdir );
&RunCmd( "ss WorkFold $vssdir $localdir" );
print "\n";
my $cmd = "ss get $vssdir -R";
local( *SS );
open SS, "$cmd|";
my $workingdir;
while( <SS> )
{
# FIXME: clean up this output.
$_ =~ s/\n//;
if( m/^\$/ )
{
$workingdir = $_;
# print "WORKING DIR: $_\n";
}
elsif( m/^getting/i )
{
print "GETTING: $workingdir $_\n";
}
elsif( m/^replacing local file/i )
{
print "REPLACING: $workingdir $_\n";
}
elsif( m/^File/ )
{
print "ALREADY EXISTS: $workingdir $_\n";
}
else
{
# print "WTF: $_\n";
}
}
close SS;
}
sub FastSSGet
{
my $localdir = shift;
my $option = shift;
&RunCmd( "\\\\hl2vss\\hl2vss\\win32\\syncfrommirror.bat $option $localdir" );
}
sub FileIsWritable
{
my $file = shift;
my @statresult = stat $file;
die if !@statresult;
my $perms = oct( $statresult[2] );
if( $perms & 2 )
{
return 1;
}
else
{
return 0;
}
}
sub CompareDirs
{
my $filesThatHaveChanged = shift;
my $filesThatHaveNotChanged = shift;
my @out = `robocopy $g_MainBaseDir\\checkinbins\\. $g_MainBaseDir\\. /S /L /V`;
my $line;
my $cwd;
foreach $line ( @out )
{
next if( $line =~ /\*EXTRA Dir/ );
next if( $line =~ /\*EXTRA Dir/ );
next if( $line =~ /\*EXTRA File/ );
if( $line =~ m/\s*\d+\s+(\S+\\)/ )
{
$cwd = $1;
next;
}
if( $line =~ m/\s+Older\s+\d+\s+(\S+)/ )
{
my $testfilename = $cwd . $1;
my $filename = $testfilename;
$filename =~ s/\\checkinbins//i;
my $diffresult = system "diff $testfilename $filename > nil";
if( $diffresult != 0 )
{
push @{$filesThatHaveChanged}, $filename;
}
else
{
if( &FileIsWritable( $filename ) )
{
push @{$filesThatHaveNotChanged}, $filename;
}
}
next;
}
elsif( $line =~ m/\s+same\s+\d+\s+(\S+)/ )
{
my $filename = $cwd . $1;
$filename =~ s/\\checkinbins//i;
if( &FileIsWritable( $filename ) )
{
push @{$filesThatHaveNotChanged}, $filename;
}
next;
}
if( $line =~ m/\s+New File\s+\d+\s+(\S+)/ )
{
die "$cwd $1 didn't build!\n";
}
print "DEBUG: unhandled line: $line\n";
}
}
sub CheckoutFile
{
my $file = shift;
print "-----------------\nchecking out $file\n";
if( $file =~ /src_main/i )
{
# need to use p4 to check this one out.
my $dir = $file;
$dir =~ s/\\([^\\]*)$//;
&CD( $dir );
&RunCmd( "p4 edit $1" );
}
else
{
my $dir = $file;
$dir =~ s/\\([^\\]*)$//;
&CD( $dir );
$file =~ s,\\,/,g;
if( $file =~ m/cstrike/i || $file =~ m/hl1/i )
{
$file =~ s,u:/hl2_main/,\$/hl1ports/release/dev/,gi;
&RunCmd( "ss WorkFold \$/hl1ports/release/dev $g_MainBaseDir" );
}
elsif( $file =~ m/\/tf2/i )
{
$file =~ s,u:/hl2_main/,\$/tf2/release/dev/,gi;
&RunCmd( "ss WorkFold \$/tf2/release/dev $g_MainBaseDir" );
}
else
{
$file =~ s,u:/hl2_main/,\$/hl2/release/dev/,gi;
&RunCmd( "ss WorkFold \$/hl2/release/dev $g_MainBaseDir" );
}
print "\n";
&RunCmd( "ss Checkout -G- $file" );
}
}
sub RevertFile
{
my $file = shift;
print "-----------------\nreverting $file\n";
if( $file =~ /src_main/i )
{
# need to use p4 to revert this one
my $dir = $file;
$dir =~ s/\\([^\\]*)$//;
&CD( $dir );
&RunCmd( "p4 sync -f $1" );
}
else
{
my $dir = $file;
$dir =~ s/\\([^\\]*)$//;
&CD( $dir );
$file =~ s,\\,/,g;
my $vssfile = $file;
if( $file =~ m/cstrike/i || $file =~ m/hl1/i )
{
$vssfile =~ s,u:/hl2_main/,\$/hl1ports/release/dev/,gi;
&RunCmd( "ss WorkFold \$/hl1ports/release/dev $g_MainBaseDir" );
}
elsif( $file =~ m/\/tf2/i )
{
$vssfile =~ s,u:/hl2_main/,\$/tf2/release/dev/,gi;
&RunCmd( "ss WorkFold \$/tf2/release/dev $g_MainBaseDir" );
}
else
{
$vssfile =~ s,u:/hl2_main/,\$/hl2/release/dev/,gi;
&RunCmd( "ss WorkFold \$/hl2/release/dev $g_MainBaseDir" );
}
print "\n";
unlink $file;
&RunCmd( "ss Get -I- $vssfile" );
}
}
sub SyncMainSource
{
# SYNC MAIN
&CD( $g_MainBranchDir );
&RunCmd( "p4 sync" );
}
sub SyncMainContent
{
# SYNC VSS
&CD( $g_MainBranchDir );
&RunCmd( "clean.bat" );
if( $g_UseVSS )
{
&SSGet( "\$/hl2/release/dev", $g_MainBaseDir );
&SSGet( "\$/hl1ports/release/dev", $g_MainBaseDir );
# NOTE: only get tf2 bin since we aren't testing tf2 right now
&SSGet( "\$/tf2/release/dev/tf2/bin", "$g_MainBaseDir/tf2/bin" );
}
else
{
&FastSSGet( $g_MainBaseDir, "all" );
}
}
sub BuildMain
{
if( $g_UseIncredibuildForMain )
{
$ENV{"USE_INCREDIBUILD"} = "1";
}
&CD( $g_MainBranchDir );
&RunCmd( "clean.bat" );
&RunCmd( "build_hl2.bat" );
&RunCmd( "build_hl1_game.bat" );
&RunCmd( "build_cs_game.bat" );
&RunCmd( "build_tf2_game.bat" );
if( $g_UseIncredibuildForMain )
{
undef $ENV{"USE_INCREDIBUILD"};
}
}
sub SyncLocalBranchSource
{
&CD( $g_LocalBranchDir );
&RunCmd( "p4mf.bat $g_LocalBranchName $g_LocalBranchClient pause" );
# FIXME: This needs to specify the changelist since p4mf makes a new changelist.
# &RunCmd( "p4 submit" );
}
sub SyncMainCopySource
{
&CD( $g_LocalBranchMainCopyDir );
&RunCmd( "p4 integrate -d -i -b $g_LocalBranchMainCopyName" );
&RunCmd( "p4 resolve -at ..." );
# Update the changelist and submit
&RunCmd( "p4 change -o | sed -e \"s/<enter description here>/Merge from main/g\" | p4 submit -i" );
}
sub SyncLocalBranchContent
{
&CD( $g_LocalBranchDir );
# CLEAN LOCAL BRANCH
&RunCmd( "clean.bat" );
# SYNC VSS
if( $g_UseVSS )
{
&SSGet( "\$/hl2/release/dev", $g_LocalBaseDir );
if( $g_LocalBranchHasHL1Port || $g_LocalBranchHasCSPort )
{
&SSGet( "\$/hl1ports/release/dev", $g_LocalBaseDir );
}
if( $g_LocalBranchHasTF2 )
{
&SSGet( "\$/tf2/release/dev", $g_LocalBaseDir );
}
}
else
{
if( $g_LocalBranchHasHL1Port || $g_LocalBranchHasCSPort )
{
&FastSSGet( $g_LocalBaseDir, "all" );
}
else
{
&FastSSGet( $g_LocalBaseDir, "hl2" );
}
# FIXME: screwed on tf2 here.
}
}
sub BuildLocalBranch
{
&CD( $g_LocalBranchDir );
# BUILD DEBUG if we don't want release only
if( !( $stage =~ /release/i ) )
{
# CLEAN LOCAL BRANCH
&RunCmd( "clean.bat" );
&RunCmd( "build_hl2.bat debug" );
if( $g_LocalBranchHasHL1Port )
{
&RunCmd( "build_hl1_game.bat debug" );
}
if( $g_LocalBranchHasCSPort )
{
&RunCmd( "build_cs_game.bat debug" );
}
if( $g_LocalBranchHasTF2 )
{
&RunCmd( "build_tf2_game.bat debug" );
}
}
if( !( $stage =~ /debug/i ) )
{
# CLEAN LOCAL BRANCH
&RunCmd( "clean.bat" );
# BUILD RELEASE
&RunCmd( "build_hl2.bat" );
if( $g_LocalBranchHasHL1Port )
{
&RunCmd( "build_hl1_game.bat" );
}
if( $g_LocalBranchHasCSPort )
{
&RunCmd( "build_cs_game.bat" );
}
if( $g_LocalBranchHasTF2 )
{
&RunCmd( "build_tf2_game.bat" );
}
}
}
sub GetMainUpToDate
{
&SyncMainSource();
&SyncMainContent();
&BuildMain();
}
sub LockPerforce
{
while( 1 )
{
my $thing = `p4mutex lock main_src 0 $g_P4UserName 207.173.178.12:1666`;
print $thing;
last if $thing =~ /Success/;
sleep 30;
}
}
sub SaveMainTimeStampsBeforeIntegrate
{
&CD( $g_MainBranchDir );
# Get a list of files that are going to be integrated into main so that we can save off their time stamp info.
my @filestointegrate = `p4 integrate -n -r -b $g_LocalBranchName`;
my $file;
local( * TIMESTAMPS );
open TIMESTAMPS, ">$g_CheckinFileStampTimes";
foreach $file ( @filestointegrate )
{
$file =~ s,//ValveGames/main/src/([^#]*)\#.*,$1,gi;
$file =~ s/\n//;
$file =~ s,\\,/,g;
my $localfilename = "$g_MainBranchDir/$file";
my @statinfo = stat $localfilename;
next if !@statinfo;
my $mtime = $statinfo[9];
print TIMESTAMPS $file . "|" . $mtime . "\n";
}
close TIMESTAMPS;
}
sub SetMainTimeStampsOnRevertedFiles
{
&CD( $g_MainBranchDir );
# Get a list of files that we might have to revert times on if they aren't in the changelist.
local( *TIMESTAMPS );
open TIMESTAMPS, "<$g_CheckinFileStampTimes";
my @timestamps = <TIMESTAMPS>;
my %filetotimestamp;
my $i;
for( $i = 0; $i < scalar( @timestamps ); $i++ )
{
$timestamps[$i] =~ s/\n//;
$timestamps[$i] =~ m/^(.*)\|(.*)$/;
$filetotimestamp{$1} = $2;
}
close TIMESTAMPS;
my $key;
foreach $key( keys( %filetotimestamp ) )
{
print "before: \'$key\" \"$filetotimestamp{$key}\"\n";
}
local( *CHANGELIST );
open CHANGELIST, "p4 change -o|";
while( <CHANGELIST> )
{
if( m,//ValveGames/main/src/(.*)\s+\#,i )
{
if( defined $filetotimestamp{$1} )
{
undef $filetotimestamp{$1};
}
}
}
close CHANGELIST;
foreach $key( keys( %filetotimestamp ) )
{
if( defined $filetotimestamp{$key} )
{
my $filename = $g_MainBranchDir . "/" . $key;
$filename =~ s,/,\\,g;
my @statresults;
if( @statresults = stat $filename )
{
my $mode = $statresults[2];
my $atime = $statresults[8];
my $mtime = $statresults[9];
print "reverting timestamp for $filename\n";
chmod 0666, $filename || die $!;
utime $atime, $filetotimestamp{$key}, $filename || die $!;
chmod $mode, $filename || die $!;
}
}
}
}
if( $stage eq "synclocal" || $stage eq "synclocalrelease" || $stage eq "synclocaldebug" || $stage eq "sync" )
{
&SyncLocalBranchSource();
&SyncMainCopySource();
&SyncLocalBranchContent();
&BuildLocalBranch();
}
if( $stage eq "synclocalsrc" || $stage eq "synclocalsrcrelease" )
{
&SyncLocalBranchSource();
&SyncMainCopySource();
&BuildLocalBranch();
}
if( $stage eq "syncmainsrc" )
{
&SyncMainSource();
&BuildMain();
}
if( $stage eq "syncmain" || $stage eq "sync" )
{
&GetMainUpToDate();
}
if( $stage eq "syncmaincontent" )
{
&SyncMainContent();
}
if( $stage == 1 )
{
# lock p4
# &LockPerforce();
&GetMainUpToDate();
# merge main into local branch
&SyncLocalBranchSource();
# TODO: need a way to detect if there are conflicts or not. If there are, pause here.
# Make a copy of targets so that we can tell which ones changed.
&RunCmd( "robocopy $g_MainBaseDir\\ $g_MainBaseDir\\checkinbins\\ /purge" );
&RunCmd( "robocopy $g_MainBaseDir\\bin\\. $g_MainBaseDir\\checkinbins\\bin\\. /mir" );
&RunCmd( "robocopy $g_MainBaseDir\\hl2\\bin\\. $g_MainBaseDir\\checkinbins\\hl2\\bin\\. /mir" );
&RunCmd( "robocopy $g_MainBaseDir\\hl1\\bin\\. $g_MainBaseDir\\checkinbins\\hl1\\bin\\. /mir" );
&RunCmd( "robocopy $g_MainBaseDir\\cstrike\\bin\\. $g_MainBaseDir\\checkinbins\\cstrike\\bin\\. /mir" );
&RunCmd( "robocopy $g_MainBaseDir\\tf2\\bin\\. $g_MainBaseDir\\checkinbins\\tf2\\bin\\. /mir" );
&RunCmd( "robocopy $g_MainBaseDir\\platform\\servers\\. $g_MainBaseDir\\checkinbins\\platform\\servers\\. /mir" );
&RunCmd( "robocopy $g_MainBranchDir\\lib\\. $g_MainBaseDir\\checkinbins\\$g_MainBranchSubdir\\lib\\. /mir" );
# integrate from personal branch into main. . accept theirs.
# TODO: need to check if main has a changelist or not and warn!
&CD( $g_MainBranchDir );
&SaveMainTimeStampsBeforeIntegrate();
&RunCmd( "p4 integrate -r -b $g_LocalBranchName" );
&RunCmd( "p4 resolve -at ..." );
# revert unchanged files.
my @unchanged = `p4 diff -sr`;
my $file;
foreach $file ( @unchanged )
{
&RunCmd( "p4 revert $file" );
}
print "Do \"checkin.pl 2\" when you are done reverting unchanging files and fixing up any other diffs in your main client.\n";
}
elsif( $stage == 2 )
{
&SetMainTimeStampsOnRevertedFiles();
# build main with the new changes
&BuildMain();
# compare what we just built to what we saved off earlier
my @filesToCheckOut;
my @filesThatHaveNotChanged;
&CompareDirs( \@filesToCheckOut, \@filesThatHaveNotChanged );
my $file;
# $g_DebugStub = 1;
foreach $file ( @filesThatHaveNotChanged )
{
&RevertFile( $file );
}
foreach $file ( @filesToCheckOut )
{
&CheckoutFile( $file );
}
print "-----------------\n";
print "Do \"checkin.pl 3\" when you are finished testing to checkin files and release the mutex.\n";
}
elsif( $stage == 3 )
{
my @filesToCheckOut;
my @filesThatHaveNotChanged;
&CompareDirs( \@filesToCheckOut, \@filesThatHaveNotChanged );
# TODO: check stuff in here and unlock p4
# TODO: go ahead and sync src_main to main so that they match
# TODO: merge main into src again so any changes that you made while checking in are propogated
&SyncMainCopySource();
}
+116
View 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\\hl2\\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 );
}
+86
View File
@@ -0,0 +1,86 @@
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\\hl2\\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];
# 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;
+172
View File
@@ -0,0 +1,172 @@
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/360/ )
{
$uInt = "N";
}
print FP pack $uInt, $crc;
close FP;
}
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\\hl2\\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\\hl2\\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;
+41
View File
@@ -0,0 +1,41 @@
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;
}
if( !scalar( @ARGV ) )
{
die "Usage: crc32filewithincludes.pl filename\n";
}
$data = &ReadInputFileWithIncludes( shift );
#print "data: $data\n";
$crc = crc32( $data );
print $crc;
exit 0;
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+175
View File
@@ -0,0 +1,175 @@
import sys, re, vsdotnetxmlparser
class EZXMLError:
pass
class EZXMLElement:
"""
Members:
Name : string
Attrs : list with attributes [(name,value), (name, value), ...]
Children : list of XMLElements
Parent : parent XMLElement
"""
def GetAttributeValue( self, attrName ):
for a in self.Attrs:
if a[0] == attrName:
return a[1]
return None
def RemoveAttribute( self, attrName ):
for i,a in enumerate( self.Attrs ):
if a[0] == attrName:
self.Attrs.pop( i )
return 1
return 0
def RemoveFromParent( self ):
if not self.Parent:
raise EZXMLError
self.Parent.Children.remove( self )
class EZXMLFile:
#
# PUBLIC INTERFACE
#
def __init__( self, data ):
self.Version = ''
self.Encoding = ''
self.RootElement = None
self.__CurElement = None
self.__ElementIndexRE = re.compile( r'<(?P<index>.+)>(?P<name>.+)' )
#p = xml.parsers.expat.ParserCreate()
p = vsdotnetxmlparser.VSDotNetXMLParser()
p.ordered_attributes = 1
p.XmlDeclHandler = self.__xml_decl_handler
p.StartElementHandler = self.__start_element
p.EndElementHandler = self.__end_element
p.Parse( data, 1 )
# Write the current contents to a file.
def WriteFile( self, file ):
file.write( '<?xml version="%s" encoding="%s"?>\r\n' % (self.Version, self.Encoding) )
if self.RootElement:
self.__WriteFile_R( file, self.RootElement, 0 )
"""
Find an element (starting at the root).
If elementName has backslashes in it (like 'VisualStudioProject\Configurations\Tool'), then it will recurse into each element.
Each element can also have an optional count telling which element to find:
'VisualStudioProject\Configurations\<3>Tool'
"""
def GetElement( self, elementName ):
if not self.RootElement:
return None
pathList = elementName.split( '\\' )
return self.__GetElementByPath_R( [self.RootElement], pathList, 0 )
"""
AttributePath is specified the same way as GetElement.
Returns None if the path to the element or attribute doesn't exist.
"""
def GetAttribute( self, attributePath ):
if not self.RootElement:
return None
pathList = attributePath.split( '\\' )
attributeName = pathList.pop()
e = self.__GetElementByPath_R( [self.RootElement], pathList, 0 )
if e:
return e.GetAttributeValue( attributeName )
else:
return None
#
# INTERNAL STUFF
#
def __GetElementByPath_R( self, curElementList, pathList, index ):
indexToFind = 1
indexFound = 0
m = self.__ElementIndexRE.match( pathList[index] )
if m:
nameToFind = m.group('name').upper()
indexToFind = int( m.group('index') )
else:
nameToFind = pathList[index].upper()
for x in curElementList:
if x.Name.upper() == nameToFind:
indexFound += 1
if indexFound == indexToFind:
if index == len( pathList ) - 1:
return x
else:
return self.__GetElementByPath_R( x.Children, pathList, index+1 )
return None
def __WriteFile_R( self, file, curElement, indentLevel ):
tabChars = ""
for i in xrange(0,indentLevel):
tabChars = tabChars + '\t'
file.write( tabChars )
keyListLen = len( curElement.Attrs )
if keyListLen == 0:
file.write( '<%s>\r\n' % (curElement.Name) )
else:
file.write( '<%s\r\n' % (curElement.Name) )
bClosedBlock = 0
for i,e in enumerate( curElement.Attrs ):
file.write( tabChars + '\t' )
file.write( '%s="%s"' % (e[0], e[1]) )
# VS.NET XML files use this special syntax on elements that have attributes and no children.
if len( curElement.Children ) == 0 and i == keyListLen-1 and curElement.Name != 'File':
file.write( '/>\r\n' )
bClosedBlock = 1
elif i == keyListLen-1:
file.write( '>\r\n' )
else:
file.write( '\r\n' )
for child in curElement.Children:
self.__WriteFile_R( file, child, indentLevel+1 )
if not bClosedBlock:
file.write( tabChars )
file.write( '</%s>\r\n' % (curElement.Name) )
# XML parser handler functions
def __xml_decl_handler( self, version, encoding, standalone ):
self.Version = version
self.Encoding = encoding
def __start_element( self, name, attrs ):
e = EZXMLElement()
e.Name = name
e.Attrs = zip( attrs[::2], attrs[1::2] ) # Cool slicing trick.. this takes a list like [1,2,3,4] and makes it into [[1,2], [3,4]]
e.Children = None
e.Parent = self.__CurElement
e.Children = []
if self.__CurElement:
self.__CurElement.Children.append( e )
else:
self.RootElement = e
self.__CurElement = e
def __end_element( self, name ):
self.__CurElement = self.__CurElement.Parent
+110
View 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";
}
+177
View File
@@ -0,0 +1,177 @@
#!/usr/bin/python
# ========= Copyright Valve Corporation, All rights reserved. ============
import subprocess
import re
import os
import sys
reValve = re.compile( "valve", flags = re.IGNORECASE )
reTurtleRock = re.compile( "turtle rock", flags = re.IGNORECASE )
reCopyright = re.compile( "copyright", flags = re.IGNORECASE )
sOutputCopyright = "//========= Copyright Valve Corporation, All rights reserved. ============//\n"
def IsOldCopyrightLine( line ):
if( len( reCopyright.findall( line ) ) == 0 ):
return False
if( len( reValve.findall( line ) ) == 0
and len( reTurtleRock.findall( line ) ) == 0 ):
return False
return True
rFilesWithNoCopyrightNotice = []
def FixCopyrightNotice( sFullPath ):
nLine = 0
f = open( sFullPath, "r" )
if( not f ):
print( "Unable to open file " + sFullPath + "\n" )
return
rFileContents = f.readlines()
f.close()
nOldCopyright = -1
for line in rFileContents:
if( nLine < 10 ):
if( line == sOutputCopyright ):
# File already has the right notice
return
if( IsOldCopyrightLine( line ) ):
nOldCopyright = nLine
break
nLine += 1
if( nOldCopyright == -1 ):
rFilesWithNoCopyrightNotice.append( sFullPath )
rFileContents.insert( 0, sOutputCopyright )
else:
rFileContents[ nOldCopyright ] = sOutputCopyright
# open the file for edit
subprocess.call( [ "p4", "edit", sFullPath ], stdout = subprocess.PIPE )
# open the file for writing
f = open( sFullPath, "w" )
f.writelines( rFileContents )
f.close()
rDirsToSkip = [
'thirdparty',
'external',
'BinkSDK',
'bink',
'bink_x360',
'freetype',
'GL',
'maya',
'miles',
'curl',
'ihfx',
'lxma',
'modo',
'openal',
'opengl',
'p4api',
'python',
'quicktime_win32',
'xsi',
'speex',
'ocaml',
'perl5',
'dx10sdk',
'dx11sdk',
'dx9sdk',
'haptics',
'ajb',
'stb',
'havok',
'hk_physics',
'lua',
'maxsdk',
'x360xdk',
'swigwin-1.3.34',
'sapi51',
'WMPSDK10',
'FontMaker',
'mxtk',
'nvtristriplib',
'g15',
'lzma',
'libparsifal-0.8.3',
'parsifal',
'libpng',
'mysql',
'zip',
'zlib',
'Zlib',
'windowssdk',
'bzip2',
'jpeglib',
'MakeGameData',
'toollib',
]
rFileExtensionsToSkip = [
'.pb.h',
'.pb.cpp',
'.spa.h',
'ATI_Compress.h',
'luaxlib.h',
'lua.h',
'luaconf.h',
'lualib.h',
'eax.h',
'IceKey.cpp',
'nvtc.h',
'amd3dx.h',
'halton.h',
'snappy',
'extendedtrace',
]
def FixCopyrightNoticeWalk( sPath ):
for root, dirs, files in os.walk( sPath ):
print "Walking directory", root
#print root, dirs
for sDir in rDirsToSkip:
if sDir in dirs:
print "Skipping dir ", os.path.join( root, sDir )
dirs.remove( sDir )
for sFilename in files:
sShortFilename, sFileExt = os.path.splitext( sFilename )
if( sFileExt in [ '.cpp', '.h' ] ):
bSkip = False
for sExt in rFileExtensionsToSkip:
if sExt in sFilename:
bSkip = True
#print "filename=", sFilename
if( bSkip ):
print "Skipping ", sFilename, "because of its extension"
else:
FixCopyrightNotice( os.path.join( root, sFilename ) )
#FixCopyrightNotice( os.path.join( "..", "..", "bitmap", "bitmap.cpp" ) )
#FixCopyrightNoticeWalk( os.path.join( "..", "..", "bitmap" ) )
if( len( sys.argv ) != 2 ):
print "Usage: fixcopyrights.py <path>"
sys.exit(1)
FixCopyrightNoticeWalk( sys.argv[1] )
if( len( rFilesWithNoCopyrightNotice ) ):
f = open( "newcopyrights.txt", "w" )
for file in rFilesWithNoCopyrightNotice:
f.write( file + "\n" )
f.close()
print "Copyright notices added to", len( rFilesWithNoCopyrightNotice ), "files. See newcopyrights.txt for a list\n"
Binary file not shown.
Binary file not shown.
+949
View File
@@ -0,0 +1,949 @@
BEGIN {use File::Basename; push @INC, dirname($0); }
require "valve_perl_helpers.pl";
sub ReadInputFile
{
local( $filename ) = shift;
local( *INPUT );
local( @output );
open INPUT, "<$filename" || die;
local( $line );
local( $linenum ) = 1;
while( $line = <INPUT> )
{
# print "LINE: $line";
# $line =~ s/\n//g;
# local( $postfix ) = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
# $postfix .= "; LINEINFO($filename)($linenum)\n";
if( $line =~ m/\#include\s+\"(.*)\"/i )
{
push @output, &ReadInputFile( $1 );
}
else
{
# push @output, $line . $postfix;
push @output, $line;
}
$linenum++;
}
close INPUT;
# print "-----------------\n";
# print @output;
# print "-----------------\n";
return @output;
}
$dynamic_compile = defined $ENV{"dynamic_shaders"} && $ENV{"dynamic_shaders"} != 0;
$generateListingFile = 0;
$spewCombos = 0;
@startTimes = times;
$startTime = time;
$g_produceCppClasses = 1;
$g_produceCompiledVcs = 1;
while( 1 )
{
$fxc_filename = shift;
if( $fxc_filename =~ m/-source/ )
{
shift;
}
elsif( $fxc_filename =~ m/-nv3x/i )
{
$nvidia = 1;
}
elsif( $fxc_filename =~ m/-ps20a/i )
{
$ps2a = 1;
}
elsif( $fxc_filename =~ m/-x360/i )
{
# enable x360
$g_x360 = 1;
}
elsif( $fxc_filename =~ m/-novcs/i )
{
$g_produceCompiledVcs = 0;
}
elsif( $fxc_filename =~ m/-nocpp/i )
{
$g_produceCppClasses = 0;
}
else
{
last;
}
}
$argstring = $fxc_filename;
$fxc_basename = $fxc_filename;
$fxc_basename =~ s/^.*-----//;
$fxc_filename =~ s/-----.*$//;
$debug = 0;
$forcehalf = 0;
sub ToUpper
{
local( $in ) = shift;
$in =~ tr/a-z/A-Z/;
return $in;
}
sub CreateCCodeToSpewDynamicCombo
{
local( $out ) = "";
$out .= "\t\tOutputDebugString( \"src:$fxc_filename vcs:$fxc_basename dynamic index\" );\n";
$out .= "\t\tchar tmp[128];\n";
$out .= "\t\tint shaderID = ";
local( $scale ) = 1;
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
local( $name ) = @dynamicDefineNames[$i];
local( $varname ) = "m_n" . $name;
$out .= "( $scale * $varname ) + ";
$scale *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
}
$out .= "0;\n";
if( scalar( @dynamicDefineNames ) + scalar( @staticDefineNames ) > 0 )
{
$out .= "\t\tint nCombo = shaderID;\n";
}
my $type = GetShaderType( $fxc_filename );
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
$out .= "\t\tint n$dynamicDefineNames[$i] = nCombo % ";
$out .= ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) + $dynamicDefineMin[$i];
$out .= ";\n";
$out .= "\t\tsprintf( tmp, \"\%d\", n$dynamicDefineNames[$i] );\n";
$out .= "\t\tOutputDebugString( \" $dynamicDefineNames[$i]";
$out .= "=\" );\n";
$out .= "\t\tOutputDebugString( tmp );\n";
$out .= "\t\tnCombo = nCombo / " . ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) . ";\n";
$out .= "\n";
}
$out .= "\t\tOutputDebugString( \"\\n\" );\n";
return $out;
}
sub CreateCCodeToSpewStaticCombo
{
local( $out ) = "";
$out .= "\t\tOutputDebugString( \"src:$fxc_filename vcs:$fxc_basename static index\" );\n";
$out .= "\t\tchar tmp[128];\n";
$out .= "\t\tint shaderID = ";
local( $scale ) = 1;
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
$scale *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
}
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
local( $name ) = @staticDefineNames[$i];
local( $varname ) = "m_n" . $name;
$out .= "( $scale * $varname ) + ";
$scale *= $staticDefineMax[$i] - $staticDefineMin[$i] + 1;
}
$out .= "0;\n";
# $out .= "\t\tsprintf( tmp, \"\%d\\n\", shaderID );\n";
# $out .= "\t\tOutputDebugString( tmp );\n\n";
if( scalar( @staticDefineNames ) + scalar( @staticDefineNames ) > 0 )
{
$out .= "\t\tint nCombo = shaderID;\n";
}
my $type = GetShaderType( $fxc_filename );
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
$out .= "\t\tnCombo = nCombo / " . ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) . ";\n";
}
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
$out .= "\t\tint n$staticDefineNames[$i] = nCombo % ";
$out .= ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) + $staticDefineMin[$i];
$out .= ";\n";
$out .= "\t\tsprintf( tmp, \"\%d\", n$staticDefineNames[$i] );\n";
$out .= "\t\tOutputDebugString( \" $staticDefineNames[$i]";
$out .= "=\" );\n";
$out .= "\t\tOutputDebugString( tmp );\n";
$out .= "\t\tnCombo = nCombo / " . ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) . ";\n";
$out .= "\n";
}
$out .= "\t\tOutputDebugString( \"\\n\" );\n";
return $out;
}
sub WriteHelperVar
{
local( $name ) = shift;
local( $min ) = shift;
local( $max ) = shift;
local( $varname ) = "m_n" . $name;
local( $boolname ) = "m_b" . $name;
push @outputHeader, "private:\n";
push @outputHeader, "\tint $varname;\n";
push @outputHeader, "#ifdef _DEBUG\n";
push @outputHeader, "\tbool $boolname;\n";
push @outputHeader, "#endif\n";
push @outputHeader, "public:\n";
# int version of set function
push @outputHeader, "\tvoid Set" . $name . "( int i )\n";
push @outputHeader, "\t{\n";
push @outputHeader, "\t\tAssert( i >= $min && i <= $max );\n";
push @outputHeader, "\t\t$varname = i;\n";
push @outputHeader, "#ifdef _DEBUG\n";
push @outputHeader, "\t\t$boolname = true;\n";
push @outputHeader, "#endif\n";
push @outputHeader, "\t}\n";
# bool version of set function
push @outputHeader, "\tvoid Set" . $name . "( bool i )\n";
push @outputHeader, "\t{\n";
# push @outputHeader, "\t\tAssert( i >= $min && i <= $max );\n";
push @outputHeader, "\t\t$varname = i ? 1 : 0;\n";
push @outputHeader, "#ifdef _DEBUG\n";
push @outputHeader, "\t\t$boolname = true;\n";
push @outputHeader, "#endif\n";
push @outputHeader, "\t}\n";
}
sub WriteStaticBoolExpression
{
local( $prefix ) = shift;
local( $operator ) = shift;
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
if( $i )
{
push @outputHeader, " $operator ";
}
local( $name ) = @staticDefineNames[$i];
local( $boolname ) = "m_b" . $name;
push @outputHeader, "$prefix$boolname";
}
push @outputHeader, ";\n";
}
sub WriteDynamicBoolExpression
{
local( $prefix ) = shift;
local( $operator ) = shift;
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
if( $i )
{
push @outputHeader, " $operator ";
}
local( $name ) = @dynamicDefineNames[$i];
local( $boolname ) = "m_b" . $name;
push @outputHeader, "$prefix$boolname";
}
push @outputHeader, ";\n";
}
sub WriteDynamicHelperClasses
{
local( $basename ) = $fxc_basename;
$basename =~ tr/A-Z/a-z/;
local( $classname ) = $basename . "_Dynamic_Index";
push @outputHeader, "class $classname\n";
push @outputHeader, "{\n";
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
$name = $dynamicDefineNames[$i];
$min = $dynamicDefineMin[$i];
$max = $dynamicDefineMax[$i];
&WriteHelperVar( $name, $min, $max );
}
push @outputHeader, "public:\n";
# push @outputHeader, "void SetPixelShaderIndex( IShaderAPI *pShaderAPI ) { pShaderAPI->SetPixelShaderIndex( GetIndex() ); }\n";
push @outputHeader, "\t$classname()\n";
push @outputHeader, "\t{\n";
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
local( $name ) = @dynamicDefineNames[$i];
local( $boolname ) = "m_b" . $name;
local( $varname ) = "m_n" . $name;
push @outputHeader, "#ifdef _DEBUG\n";
push @outputHeader, "\t\t$boolname = false;\n";
push @outputHeader, "#endif // _DEBUG\n";
push @outputHeader, "\t\t$varname = 0;\n";
}
push @outputHeader, "\t}\n";
push @outputHeader, "\tint GetIndex()\n";
push @outputHeader, "\t{\n";
push @outputHeader, "\t\t// Asserts to make sure that we aren't using any skipped combinations.\n";
foreach $skip (@perlskipcodeindividual)
{
# can't do this static and dynamic can see each other.
# $skip =~ s/\$/m_n/g;
# $skip =~ s/defined//g;
# push @outputHeader, "\t\tAssert( !( $skip ) );\n";
# print "\t\tAssert( !( $skip ) );\n";
}
push @outputHeader, "\t\t// Asserts to make sure that we are setting all of the combination vars.\n";
push @outputHeader, "#ifdef _DEBUG\n";
if( scalar( @dynamicDefineNames ) > 0 )
{
push @outputHeader, "\t\tbool bAllDynamicVarsDefined = ";
WriteDynamicBoolExpression( "", "&&" );
}
if( scalar( @dynamicDefineNames ) > 0 )
{
push @outputHeader, "\t\tAssert( bAllDynamicVarsDefined );\n";
}
push @outputHeader, "#endif // _DEBUG\n";
if( $spewCombos && scalar( @dynamicDefineNames ) )
{
push @outputHeader, &CreateCCodeToSpewDynamicCombo();
}
push @outputHeader, "\t\treturn ";
local( $scale ) = 1;
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
local( $name ) = @dynamicDefineNames[$i];
local( $varname ) = "m_n" . $name;
push @outputHeader, "( $scale * $varname ) + ";
$scale *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
}
push @outputHeader, "0;\n";
push @outputHeader, "\t}\n";
push @outputHeader, "};\n";
push @outputHeader, "\#define shaderDynamicTest_" . $basename . " ";
my $prefix;
my $shaderType = &GetShaderType( $fxc_filename );
if( $shaderType =~ m/^vs/i )
{
$prefix = "vsh_";
}
else
{
$prefix = "psh_";
}
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
local( $name ) = @dynamicDefineNames[$i];
push @outputHeader, $prefix . "forgot_to_set_dynamic_" . $name . " + ";
}
push @outputHeader, "0\n";
}
sub WriteStaticHelperClasses
{
local( $basename ) = $fxc_basename;
$basename =~ tr/A-Z/a-z/;
local( $classname ) = $basename . "_Static_Index";
push @outputHeader, "#include \"shaderlib/cshader.h\"\n";
push @outputHeader, "class $classname\n";
push @outputHeader, "{\n";
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
$name = $staticDefineNames[$i];
$min = $staticDefineMin[$i];
$max = $staticDefineMax[$i];
&WriteHelperVar( $name, $min, $max );
}
push @outputHeader, "public:\n";
# push @outputHeader, "void SetShaderIndex( IShaderShadow *pShaderShadow ) { pShaderShadow->SetPixelShaderIndex( GetIndex() ); }\n";
push @outputHeader, "\t$classname( )\n";
push @outputHeader, "\t{\n";
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
local( $name ) = @staticDefineNames[$i];
local( $boolname ) = "m_b" . $name;
local( $varname ) = "m_n" . $name;
if ( length( $staticDefineInit{$name} ) )
{
push @outputHeader, "#ifdef _DEBUG\n";
push @outputHeader, "\t\t$boolname = true;\n";
push @outputHeader, "#endif // _DEBUG\n";
push @outputHeader, "\t\t$varname = $staticDefineInit{$name};\n";
}
else
{
push @outputHeader, "#ifdef _DEBUG\n";
push @outputHeader, "\t\t$boolname = false;\n";
push @outputHeader, "#endif // _DEBUG\n";
push @outputHeader, "\t\t$varname = 0;\n";
}
}
push @outputHeader, "\t}\n";
push @outputHeader, "\tint GetIndex()\n";
push @outputHeader, "\t{\n";
push @outputHeader, "\t\t// Asserts to make sure that we aren't using any skipped combinations.\n";
foreach $skip (@perlskipcodeindividual)
{
$skip =~ s/\$/m_n/g;
# push @outputHeader, "\t\tAssert( !( $skip ) );\n";
}
push @outputHeader, "\t\t// Asserts to make sure that we are setting all of the combination vars.\n";
push @outputHeader, "#ifdef _DEBUG\n";
if( scalar( @staticDefineNames ) > 0 )
{
push @outputHeader, "\t\tbool bAllStaticVarsDefined = ";
WriteStaticBoolExpression( "", "&&" );
}
if( scalar( @staticDefineNames ) > 0 )
{
push @outputHeader, "\t\tAssert( bAllStaticVarsDefined );\n";
}
push @outputHeader, "#endif // _DEBUG\n";
if( $spewCombos && scalar( @staticDefineNames ) )
{
push @outputHeader, &CreateCCodeToSpewStaticCombo();
}
push @outputHeader, "\t\treturn ";
local( $scale ) = 1;
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
$scale *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
}
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
local( $name ) = @staticDefineNames[$i];
local( $varname ) = "m_n" . $name;
push @outputHeader, "( $scale * $varname ) + ";
$scale *= $staticDefineMax[$i] - $staticDefineMin[$i] + 1;
}
push @outputHeader, "0;\n";
push @outputHeader, "\t}\n";
push @outputHeader, "};\n";
push @outputHeader, "\#define shaderStaticTest_" . $basename . " ";
my $prefix;
my $shaderType = &GetShaderType( $fxc_filename );
if( $shaderType =~ m/^vs/i )
{
$prefix = "vsh_";
}
else
{
$prefix = "psh_";
}
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
local( $name ) = @staticDefineNames[$i];
push @outputHeader, $prefix . "forgot_to_set_static_" . $name . " + " unless (length($staticDefineInit{$name} ));
}
push @outputHeader, "0\n";
}
sub GetNewMainName
{
local( $shadername ) = shift;
local( $combo ) = shift;
local( $i );
$shadername =~ s/\./_/g;
local( $name ) = $shadername;
for( $i = 0; $i < scalar( @defineNames ); $i++ )
{
local( $val ) = ( $combo % ( $defineMax[$i] - $defineMin[$i] + 1 ) ) + $defineMin[$i];
$name .= "_" . $defineNames[$i] . "_" . $val;
$combo = $combo / ( $defineMax[$i] - $defineMin[$i] + 1 );
}
# return $name;
return "main";
}
sub RenameMain
{
local( $shadername ) = shift;
local( $combo ) = shift;
local( $name ) = &GetNewMainName( $shadername, $combo );
return "/Dmain=$name /E$name ";
}
sub GetShaderType
{
local( $shadername ) = shift; # hack - use global variables
$shadername = $fxc_basename;
if( $shadername =~ m/ps30/i )
{
if( $debug )
{
return "ps_3_sw";
}
else
{
return "ps_3_0";
}
}
elsif( $shadername =~ m/ps20b/i )
{
return "ps_2_b";
}
elsif( $shadername =~ m/ps20/i )
{
if( $debug )
{
return "ps_2_sw";
}
else
{
if( $ps2a )
{
return "ps_2_a";
}
else
{
return "ps_2_0";
}
}
}
elsif( $shadername =~ m/ps14/i )
{
return "ps_1_4";
}
elsif( $shadername =~ m/ps11/i )
{
return "ps_1_1";
}
elsif( $shadername =~ m/vs30/i )
{
if( $debug )
{
return "vs_3_sw";
}
else
{
return "vs_3_0";
}
}
elsif( $shadername =~ m/vs20/i )
{
if( $debug )
{
return "vs_2_sw";
}
else
{
return "vs_2_0";
}
}
elsif( $shadername =~ m/vs14/i )
{
return "vs_1_1";
}
elsif( $shadername =~ m/vs11/i )
{
return "vs_1_1";
}
else
{
die "\n\nSHADERNAME = $shadername\n\n";
}
}
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;
}
sub CreateCFuncToCreateCompileCommandLine
{
local( $out ) = "";
$out .= "\t\tOutputDebugString( \"compiling src:$fxc_filename vcs:$fxc_basename \" );\n";
$out .= "\t\tchar tmp[128];\n";
$out .= "\t\tsprintf( tmp, \"\%d\\n\", shaderID );\n";
$out .= "\t\tOutputDebugString( tmp );\n";
$out .= "\t\tstatic PrecompiledShaderByteCode_t byteCode;\n";
if( scalar( @dynamicDefineNames ) + scalar( @staticDefineNames ) > 0 )
{
$out .= "\t\tint nCombo = shaderID;\n";
}
# $out .= "\tvoid BuildCompileCommandLine( int nCombo, char *pResult, int maxLength )\n";
# $out .= "\t{\n";
$out .= "\t\tD3DXMACRO ";
$out .= "defineMacros";
$out .= "[";
$out .= scalar( @dynamicDefineNames ) + scalar( @staticDefineNames ) + 1; # add 1 for null termination
$out .= "];\n";
if( scalar( @dynamicDefineNames ) + scalar( @staticDefineNames ) > 0 )
{
$out .= "\t\tchar tmpStringBuf[1024];\n";
$out .= "\t\tchar *pTmpString = tmpStringBuf;\n\n";
}
local( $i );
my $type = GetShaderType( $fxc_filename );
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
$out .= "\t\tsprintf( pTmpString, \"%d\", nCombo % ";
$out .= ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) + $dynamicDefineMin[$i];
$out .= " );\n";
$out .= "\t\tdefineMacros";
$out .= "[";
$out .= $i;
$out .= "]";
$out .= "\.Name = ";
$out .= "\"$dynamicDefineNames[$i]\";\n";
$out .= "\t\tint n$dynamicDefineNames[$i] = nCombo % ";
$out .= ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) + $dynamicDefineMin[$i];
$out .= ";\n";
$out .= "\t\tUNUSED( n$dynamicDefineNames[$i] );\n";
$out .= "\t\tdefineMacros";
$out .= "[";
$out .= $i;
$out .= "]";
$out .= "\.Definition = ";
$out .= "pTmpString;\n";
$out .= "\t\tpTmpString += strlen( pTmpString ) + 1;\n";
$out .= "\t\tsprintf( tmp, \"\%d\", n$dynamicDefineNames[$i] );\n";
$out .= "\t\tOutputDebugString( \" $dynamicDefineNames[$i]";
$out .= "=\" );\n";
$out .= "\t\tOutputDebugString( tmp );\n";
$out .= "\t\tnCombo = nCombo / " . ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) . ";\n";
$out .= "\n";
}
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
$out .= "\t\tsprintf( pTmpString, \"%d\", nCombo % ";
$out .= ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) + $staticDefineMin[$i];
$out .= " );\n";
$out .= "\t\tdefineMacros";
$out .= "[";
$out .= $i + scalar( @dynamicDefineNames );
$out .= "]";
$out .= "\.Name = ";
$out .= "\"$staticDefineNames[$i]\";\n";
$out .= "\t\tint n$staticDefineNames[$i] = nCombo % ";
$out .= ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) + $staticDefineMin[$i];
$out .= ";\n";
$out .= "\t\tUNUSED( n$staticDefineNames[$i] );\n";
$out .= "\t\tdefineMacros";
$out .= "[";
$out .= $i + scalar( @dynamicDefineNames );
$out .= "]";
$out .= "\.Definition = ";
$out .= "pTmpString;\n";
$out .= "\t\tpTmpString += strlen( pTmpString ) + 1;\n";
$out .= "\t\tsprintf( tmp, \"\%d\", n$staticDefineNames[$i] );\n";
$out .= "\t\tOutputDebugString( \" $staticDefineNames[$i]";
$out .= "=\" );\n";
$out .= "\t\tOutputDebugString( tmp );\n";
$out .= "\t\tnCombo = nCombo / " . ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) . ";\n";
$out .= "\n";
}
$out .= "\t\tOutputDebugString( \"\\n\" );\n";
$cskipcode = $perlskipcode;
$cskipcode =~ s/\$/n/g;
$out .= "\t\tif( $cskipcode )\n\t\t{\n";
$out .= "\t\t\tstatic char blah[4] = { 0, 0, 0, 0 };\n";
$out .= "\t\t\tbyteCode.m_pRawData = blah;\n";
$out .= "\t\t\tbyteCode.m_nSizeInBytes = 4;\n";
$out .= "\t\t\treturn byteCode;\n";
$out .= "\t\t}\n";
$out .= "\t\t// Must null terminate macros.\n";
$out .= "\t\tdefineMacros[";
$out .= scalar( @dynamicDefineNames ) + scalar( @staticDefineNames );
$out .= "]";
$out .= ".Name = NULL;\n";
$out .= "\t\tdefineMacros[";
$out .= scalar( @dynamicDefineNames ) + scalar( @staticDefineNames );
$out .= "]";
$out .= ".Definition = NULL;\n\n";
$out .= "\t\tLPD3DXBUFFER pShader; // NOTE: THESE LEAK!!!\n";
$out .= "\t\tLPD3DXBUFFER pErrorMessages; // NOTE: THESE LEAK!!!\n";
$out .= "\t\tHRESULT hr = D3DXCompileShaderFromFile( \"u:\\\\hl2_e3_2004\\\\src_e3_2004\\\\materialsystem\\\\stdshaders\\\\$fxc_filename\",\n\t\t\tdefineMacros,\n\t\t\tNULL, // LPD3DXINCLUDE \n\t\t\t\"main\",\n\t\t\t\"$type\",\n\t\t\t0, // DWORD Flags\n\t\t\t&pShader,\n\t\t\t&pErrorMessages,\n\t\t\tNULL // LPD3DXCONSTANTTABLE *ppConstantTable\n\t\t\t );\n";
$out .= "\t\tif( hr != D3D_OK )\n";
$out .= "\t\t{\n";
$out .= "\t\t\tconst char *pErrorMessageString = ( const char * )pErrorMessages->GetBufferPointer();\n";
$out .= "\t\t\tOutputDebugString( pErrorMessageString );\n";
$out .= "\t\t\tOutputDebugString( \"\\n\" );\n";
$out .= "\t\t\tAssert( 0 );\n";
$out .= "\t\t\tstatic char blah[4] = { 0, 0, 0, 0 };\n";
$out .= "\t\t\tbyteCode.m_pRawData = blah;\n";
$out .= "\t\t\tbyteCode.m_nSizeInBytes = 4;\n";
$out .= "\t\t}\n";
$out .= "\t\telse\n";
$out .= "\t\t{\n";
$out .= "\t\t\tbyteCode.m_pRawData = pShader->GetBufferPointer();\n";
$out .= "\t\t\tbyteCode.m_nSizeInBytes = pShader->GetBufferSize();\n";
$out .= "\t\t}\n";
$out .= "\t\treturn byteCode;\n";
return $out;
}
#print "--------\n";
if ( $g_x360 )
{
$fxctmp = "fxctmp9_360_tmp";
}
else
{
$fxctmp = "fxctmp9_tmp";
}
if( !stat $fxctmp )
{
mkdir $fxctmp, 0777 || die $!;
}
# suck in an input file (using includes)
#print "$fxc_filename...";
@fxc = ReadInputFile( $fxc_filename );
# READ THE TOP OF THE FILE TO FIND SHADER COMBOS
foreach $line ( @fxc )
{
$line="" if ($g_x360 && ($line=~/\[PC\]/)); # line marked as [PC] when building for x360
$line="" if (($g_x360 == 0) && ($line=~/\[XBOX\]/)); # line marked as [XBOX] when building for pc
if ( $fxc_basename =~ m/_ps(\d+\w?)$/i )
{
my $psver = $1;
$line="" if (($line =~/\[ps\d+\w?\]/i) && ($line!~/\[ps$psver\]/i)); # line marked for a version of compiler and not what we build
}
if ( $fxc_basename =~ m/_vs(\d+\w?)$/i )
{
my $vsver = $1;
$line="" if (($line =~/\[vs\d+\w?\]/i) && ($line!~/\[vs$vsver\]/i)); # line marked for a version of compiler and not what we build
}
my $init_expr;
$init_expr = $1 if ( $line=~/\[\=([^\]]+)\]/); # parse default init expression for combos
$line=~s/\[[^\[\]]*\]//; # cut out all occurrences of
# square brackets and whatever is
# inside all these modifications
# to the line are seen later when
# processing skips and centroids
next if( $line =~ m/^\s*$/ );
if( $line =~ m/^\s*\/\/\s*STATIC\s*\:\s*\"(.*)\"\s+\"(\d+)\.\.(\d+)\"/ )
{
local( $name, $min, $max );
$name = $1;
$min = $2;
$max = $3;
# print STDERR "STATIC: \"$name\" \"$min..$max\"\n";
push @staticDefineNames, $name;
push @staticDefineMin, $min;
push @staticDefineMax, $max;
$staticDefineInit{$name}=$init_expr;
}
elsif( $line =~ m/^\s*\/\/\s*DYNAMIC\s*\:\s*\"(.*)\"\s+\"(\d+)\.\.(\d+)\"/ )
{
local( $name, $min, $max );
$name = $1;
$min = $2;
$max = $3;
# print STDERR "DYNAMIC: \"$name\" \"$min..$max\"\n";
push @dynamicDefineNames, $name;
push @dynamicDefineMin, $min;
push @dynamicDefineMax, $max;
}
}
# READ THE WHOLE FILE AND FIND SKIP STATEMENTS
foreach $line ( @fxc )
{
if( $line =~ m/^\s*\/\/\s*SKIP\s*\s*\:\s*(.*)$/ )
{
# print $1 . "\n";
$perlskipcode .= "(" . $1 . ")||";
push @perlskipcodeindividual, $1;
}
}
if( defined $perlskipcode )
{
$perlskipcode .= "0";
$perlskipcode =~ s/\n//g;
}
else
{
$perlskipcode = "0";
}
# READ THE WHOLE FILE AND FIND CENTROID STATEMENTS
foreach $line ( @fxc )
{
if( $line =~ m/^\s*\/\/\s*CENTROID\s*\:\s*TEXCOORD(\d+)\s*$/ )
{
$centroidEnable{$1} = 1;
# print "CENTROID: $1\n";
}
}
if( $spewCombos )
{
push @outputHeader, "#include \"windows.h\"\n";
}
#push @outputHeader, "\#include \"shaderlib\\baseshader.h\"\n";
#push @outputHeader, "IShaderDynamicAPI *CBaseShader::s_pShaderAPI;\n";
# Go ahead an compute the mask of samplers that need to be centroid sampled
$centroidMask = 0;
foreach $centroidRegNum ( keys( %centroidEnable ) )
{
# print "THING: $samplerName $centroidRegNum\n";
$centroidMask += 1 << $centroidRegNum;
}
#printf "0x%x\n", $centroidMask;
$numCombos = &CalcNumCombos();
#print "$numCombos combos\n";
if( $g_produceCompiledVcs && !$dynamic_compile )
{
open FOUT, ">>filelistgen.txt" || die "can't open filelistgen.txt";
print FOUT "**** generated by fxc_prep.pl ****\n";
print FOUT "#BEGIN " . $fxc_basename . "\n";
print FOUT "$fxc_filename" . "\n";
print FOUT "#DEFINES-D:\n";
for( $i = 0; $i < scalar( @dynamicDefineNames ); \$i++ )
{
print FOUT "$dynamicDefineNames[$i]=";
print FOUT $dynamicDefineMin[$i];
print FOUT "..";
print FOUT $dynamicDefineMax[$i];
print FOUT "\n";
}
print FOUT "#DEFINES-S:\n";
for( $i = 0; $i < scalar( @staticDefineNames ); \$i++ )
{
print FOUT "$staticDefineNames[$i]=";
print FOUT $staticDefineMin[$i];
print FOUT "..";
print FOUT $staticDefineMax[$i];
print FOUT "\n";
}
print FOUT "#SKIP:\n";
print FOUT "$perlskipcode\n";
print FOUT "#COMMAND:\n";
# first line
print FOUT "fxc.exe ";
print FOUT "/DTOTALSHADERCOMBOS=$numCombos ";
print FOUT "/DCENTROIDMASK=$centroidMask ";
print FOUT "/DNUMDYNAMICCOMBOS=" . &CalcNumDynamicCombos() . " ";
print FOUT "/DFLAGS=0x0 "; # Nothing here for now.
print FOUT "\n";
#defines go here
# second line
print FOUT &RenameMain( $fxc_filename, $i );
print FOUT "/T" . &GetShaderType( $fxc_filename ) . " ";
print FOUT "/DSHADER_MODEL_" . &ToUpper( &GetShaderType( $fxc_filename ) ) . "=1 ";
if( $nvidia )
{
print FOUT "/DNV3X=1 "; # enable NV3X codepath
}
if ( $g_x360 )
{
print FOUT "/D_X360=1 "; # shaders can identify X360 centric code
# print FOUT "/Xbe:2- "; # use the less-broken old back end
}
if( $debug )
{
print FOUT "/Od "; # disable optimizations
print FOUT "/Zi "; # enable debug info
}
# print FOUT "/Zi "; # enable debug info
print FOUT "/nologo ";
# print FOUT "/Fhtmpshader.h ";
print FOUT "/Foshader.o ";
print FOUT "$fxc_filename";
print FOUT ">output.txt 2>&1";
print FOUT "\n";
#end of command line
print FOUT "#END\n";
print FOUT "**** end ****\n";
close FOUT;
}
if ( $g_produceCppClasses )
{
# Write out the C++ helper class for picking shader combos
&WriteStaticHelperClasses();
&WriteDynamicHelperClasses();
my $incfilename = "$fxctmp\\$fxc_basename" . ".inc";
&WriteFile( $incfilename, join( "", @outputHeader ) );
}
if( $generateListingFile )
{
my $listFileName = "$fxctmp/$fxc_basename" . ".lst";
print "writing $listFileName\n";
if( !open FILE, ">$listFileName" )
{
die;
}
print FILE @listingOutput;
close FILE;
}
@endTimes = times;
$endTime = time;
#printf "Elapsed user time: %.2f seconds!\n", $endTimes[0] - $startTimes[0];
#printf "Elapsed system time: %.2f seconds!\n", $endTimes[1] - $startTimes[1];
#printf "Elapsed child user time: %.2f seconds!\n", $endTimes[2] - $startTimes[2];
#printf "Elapsed child system time: %.2f seconds!\n", $endTimes[3] - $startTimes[3];
#printf "Elapsed total time: %.2f seconds!\n", $endTime - $startTime;
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+94
View File
@@ -0,0 +1,94 @@
#!perl
use File::Find;
use File::Basename;
$dir_to_run_on = shift;
$max_size = shift;
if ( (! length( $dir_to_run_on ) || (! $max_size ) ) )
{
die "format is 'limit_vtf_sizes game_dir_to_run_on size'. maxisze -1 to unlimit";
}
open(CMDOUT,">\runit.cmd");
find(\&ProcessFile, $dir_to_run_on);
close CMDOUT;
sub ProcessFile
{
local($_) = $File::Find::name;
my $origname=$_;
my $srcname;
s@\\@/@g;
if (/\.vtf$/i) # is a vtf?
{
next if (m@/hud/@i); # don't shrink hud textures
next if (m@/vgui/@i); # don't shrink hud textures
my $vtex_it=0;
if ( s@game/(.*)/materials/@content/\1/materialsrc/@i )
{
$srcname=$_;
s/\.vtf$/\.txt/i;
if (-e $_ )
{
my $txtname=$_;
# decide whether or not to add the limits
open(TXTIN,$txtname) || die "can't open $_ for read something weird has happened";
my $txtout;
my $should_add_it=1;
while( <TXTIN>)
{
next if ( ( $max_size == -1) && (/maxwidth/i || /maxheight/i) ); # lose this line
$txtout.=$_;
$should_add_it = 0 if (/maxwidth/i || /maxheight/i || /nomip/i || /reduce/i );
}
close TXTIN;
if ($should_add_it )
{
print `p4 edit $txtname`;
open(TXTOUT,">$txtname");
print TXTOUT $txtout;
print TXTOUT "maxwidth $max_size\nmaxheight $max_size\n" if ($max_size != -1);
close TXTOUT;
$vtex_it = 1;
}
}
else
{
if (-d dirname($_) )
{
print "$_ not found. Creating it\n";
open(TXTOUT,">$_" ) || die "can't create $_?";
print TXTOUT "maxwidth $max_size\nmaxheight $max_size\n" if( $max_size != -1);
close TXTOUT;
print `p4 add $_`;
$vtex_it=1;
}
else
{
print "directory does not exist in content for $_\n";
}
}
}
else
{
die "I dont understand the file $_ : bad path?";
}
if ($vtex_it)
{
my $name=$srcname;
$name=~s@\..*$@@; # kill extension
$cmd="vtex -nopause $name";
$cmd=~s@/@\\@g;
print "execute:$cmd\n";
print CMDOUT "$cmd\n";
# print `$cmd`."\n";
}
}
}
Binary file not shown.
Binary file not shown.
+329
View File
@@ -0,0 +1,329 @@
###############################################################
#
# generateDEF.pl
#
# Parses a .map file and generates a .def file
# for exporting functions from a dll.
#
# Note: Map Exports must be enabled in the project properties
#
###############################################################
my @baselist;
my @output;
my $baseLen = 63;
######################################
# Adds tabs for better formatting
sub Add_Tabs
{
my $name = shift;
my $num = int( ($baseLen - length( $name )) / 8 );
for( $i = 0; $i < $num; $i++ )
{
push( @output, "\t" );
}
}
######################################
# Open, validate, and read a file (not implemented yet)
sub Read_File
{
my $name = shift;
my @file = shift;
# read in the file
if ( open(INFILE, "$name" ) )
{
@file = <INFILE>;
close( INFILE );
}
else
{
print( "Error opening file $name\n" );
exit 1;
}
}
#####################################
# Start of script
print( "Valve Software - make360def.pl\n" );
print( "Copyright (c) 1996-2006, Valve LLC, All rights reserved.\n" );
my $filename = $ARGV[0];
my $numArgs = 1;
my @lines = ();
my @deflines = ();
if ( $ARGV[0] =~ /-check$/i )
{
$numArgs = 3;
$check = 1;
$filename = $ARGV[1];
$defname = $ARGV[2];
}
elsif ( $ARGV[0] =~ /-checkauto/i )
{
$defname = $ARGV[1];
$check = 2;
}
if ( @ARGV < $numArgs )
{
print( "ERROR: Missing filename(s)\n" );
exit 1;
}
if ( $check == 1 )
{
# swap filenames if necessary
if ( $filename =~ /.def/ )
{
my $temp = $filename;
$filename = $defname;
$defname = $temp;
}
# validate extensions
unless ( $filename =~ /.map/ && $defname =~ /.def/ )
{
print( "ERROR: Invalid file extensions. -check requires a .map file and a .def file.\n" );
exit 1;
}
# read in the def file
if ( open(INFILE, "$defname" ) )
{
@deflines = <INFILE>;
close( INFILE );
}
else
{
print( "ERROR: Couldn't open file $defname.\n" );
exit 1;
}
}
elsif ( $check == 2 )
{
# read in the def file
if ( open(INFILE, "$defname" ) )
{
@deflines = <INFILE>;
close( INFILE );
}
else
{
print( "ERROR: Couldn't open file $defname.\n" );
exit 1;
}
# validate that the first export is CreateInterface*
# validate that the export ordinals are sequential and ordered
my $line;
my $start = false;
my $idx = 1;
for ( @deflines )
{
$line = $_;
if ( $line =~ /@(\d+)[ |\n]/ )
{
if ( $1 == 1 )
{
unless ( $line =~ /CreateInterface/ )
{
# first export must be CreateInterface*
$line =~ /\s+([\S]*)/;
print( "**************************************************\n" );
print( " ERROR: First export must be CreateInterface*. \n" );
print( " Export \"", $1, "\" found instead! \n" );
print( " This is a FATAL ERROR with the def file. \n" );
print( " Please contact an Xbox 360 engineer immediately.\n" );
print( "**************************************************\n" );
exit 1;
}
}
if ( $1 != $idx )
{
# exports are out of order
print( "**************************************************\n" );
print( " ERROR: Def file exports are not sequential \n" );
print( " This may cause unexpected behavior at runtime. \n" );
print( " Please contact an Xbox 360 engineer immediately.\n" );
print( "**************************************************\n" );
exit 1;
}
++$idx;
}
}
exit 0;
}
# Get the base name
$filename =~ /(\w+(\.360)?).map/;
my $basename = $1;
# Read in the source file
if ( open(INFILE, "$filename" ) )
{
@lines = <INFILE>;
close( INFILE );
}
else
{
print( "ERROR: Couldn't open file $filename.\n" );
exit 1;
}
# Delete the lines up to the exports section
my $len = 0;
my $exportsFound = 0;
for( @lines )
{
$len++;
if( /^ Exports$/ )
{
splice( @lines, 0, $len+3 );
$exportsFound = 1;
}
}
if ( $exportsFound == 0 )
{
print( "ERROR: No Exports section found in $filename. " );
print( "Relink the project with 'Map Exports' enabled.\n" );
exit 1;
}
if ( $check == 1 )
{
# Check for exports in the map that aren't in the def
print( "make360def: Comparing $filename and $defname\n" );
# strip the first 2 lines from the def
splice( @deflines, 0, 2 );
my $defEntryCt = $#deflines + 1;
my $defMatches = 0;
# for each line in the map
for( @lines )
{
my $found = 0;
# Pull the export name from the map line
my $mapline;
if ( /(\d+)\s+(\S+)/ )
{
$mapline = $2;
}
else
{
# ignore this line
next;
}
# for each line in the def
for( @deflines )
{
/(\S+)/;
if ( $1 =~ /^\Q$mapline\E$/ )
{
$found = 1;
$defMatches++;
last;
}
}
if ( $found == 0 )
{
print( "ERROR: New export found in $filename, " );
print( "so the map file and def file are out of sync. " );
print( "You must relink the project to generate a new def file.\n" );
exit 1;
}
}
# Make sure all the def lines were matched
if ( $defMatches != $defEntryCt )
{
print( "ERROR: An export was removed from $filename, " );
print( "so the map file and def file are out of sync. " );
print( "You must relink the project to generate a new def file.\n" );
exit 1;
}
print( "make360def: Comparison complete, files match.\n" );
exit 0;
}
# start the def file
print( "make360def: Generating $basename.def\n" );
push( @output, "LIBRARY\t$basename.dll\n" );
push( @output, "EXPORTS\n" );
# process each line in the export section
my $interfacePrefix = "0000000000";
for( @lines )
{
if ( /(\d+)\s+(\S+)/ )
{
my $func = $2;
if ( $func =~ /CreateInterface/ )
{
# Force createInterface to sort first
$func = join( '', $interfacePrefix, $func );
}
push( @baselist, $func );
}
}
# sort the list
my @sortedlist = sort {uc($a) cmp uc($b)} @baselist;
#my @sortedlist = @baselist;
my $ordinal = 1;
for( @sortedlist )
{
my $func = $_;
if ( /$interfacePrefix(.*)/ )
{
# Strip the added characters
$func = $1;
}
push( @output, "\t$func\t" );
Add_Tabs( $func );
push( @output, "\@$ordinal\n" );
$ordinal++;
}
# write the def file
print( "make360def: Saving $basename.def.\n" );
open ( OUTFILE, ">$basename.def" );
print OUTFILE @output;
close ( OUTFILE );
print( "make360def: Finished.\n" );
exit 0;
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+388
View File
@@ -0,0 +1,388 @@
#!perl
use XML::Simple;
use Data::Dumper;
use Getopt::Long;
use File::Basename;
use Cwd 'abs_path';
use Cwd;
use Digest::MD5 qw(md5 md5_hex md5_base64);
GetOptions( "verbose"=>\$verbose,
"projlist"=>\$projlist,
"x360"=>\$x360 );
$sln_name=shift || &PrintArgumentSummaryAndExit;
my $curdir=cwd;
$curdir=~ (m@(^.*/[a-z_]*src[0-9]?)@i) || die "Can't determine srcroot from current directory $curdir";
$srcroot=lc($1);
$linker_tool_name="VCLinkerTool";
$linker_tool_name="VCX360LinkerTool" if ($x360);
@output_only_projects_dependent_upon = ();
&ReadVPCProjects;
if ( $sln_name =~ /^\@(\S+)/)
{
$sln_name=$1;
&ReadGroup($1);
foreach $proj (@PROJS)
{
&AddProject(lc(abs_path($proj)),1);
}
if ( $projlist )
{
&WriteProjectListFile( $sln_name );
}
else
{
&WriteSolutionFile($sln_name);
}
}
else
{
# normal mode
while($_ = shift )
{
if ( /^\@(\S+)/)
{
# accept group names
&ReadGroup($1);
foreach $proj (@PROJS)
{
&AddProject(lc(abs_path($proj)),1);
}
}
elsif ( /^\*(\S+)/)
{
push( @output_only_projects_dependent_upon, lc( $1 ) );
&ReadGroup("everything");
foreach $proj (@PROJS)
{
&AddProject(lc(abs_path($proj)),0);
}
}
else
{
unless(/\.vcproj/) # if no extension specified, assume its a project name from projects.vgc
{
$_=$projpath{lc($_)} if length($projpath{lc($_)});
}
foreach $path (split(/\s+/,$_))
{
$path=~s@\s+@@g;
&AddProject(lc(abs_path($path)),1) if length($path);
}
}
}
if ( $projlist )
{
&WriteProjectListFile( $sln_name );
}
else
{
&WriteSolutionFile($sln_name);
}
}
sub WriteSolutionFile
{
local($sln)=@_;
$sln="$sln.sln" unless ( $sln=~/\./); # add extension if needed
if ( ( -e $sln && ( ! ( -w $sln ) ) ) )
{
print STDERR "$sln is write-protected. Doing p4 edit.\n";
print `p4 edit $sln`;
die "Failed to make $sln writeable" if ( ! ( -w $sln ) );
}
open(SLN,">$sln" ) || die "can't open output $sln";
# generate a guid for the sln
my $sln_guid="8BC9CEB8-8B4A-11D0-8D11-".substr(uc(md5_hex(basename($sln))),0,12);
print SLN "\xef\xbb\xbf\nMicrosoft Visual Studio Solution File, Format Version 9.00\n# Visual Studio 2005\n";
foreach $proj (@PROJECTS)
{
# check dependencies for "*" projects
if ( (! length( $force_project_inclusion{$proj} ) ) &&
( @output_only_projects_dependent_upon ))
{
my $skip_it = 1;
foreach $output_only ( @output_only_projects_dependent_upon )
{
$skip_it = 0 if ( $output_only eq lc( $proj ) );
foreach $lib (split(/,/,$depends_on{$proj}))
{
$skip_it = 0 if ( $output_only eq lc($lib) );
foreach $prvd (split(/,/,$provider{$lib}))
{
$skip_it = 0 if ( $output_only eq $prvd );
}
}
}
next if ( $skip_it );
}
print SLN "Project(\"{",$sln_guid,"}\") = \"$proj\", \"$relpath{$proj}\", \"$guid{$proj}\"\n";
#, now do dependencies
if ( length($depends_on{$proj} ) )
{
print SLN "\tProjectSection(ProjectDependencies) = postProject\n";
foreach $lib (split(/,/,$depends_on{$proj}))
{
if ( length($provider{$lib}) )
{
foreach $prvd (split(/,/,$provider{$lib}))
{
print SLN "\t\t$guid{$prvd} = $guid{$prvd}\n" if ( length($prvd) );
}
}
else
{
print "I don't know who provides $lib for $proj\n" if ( $verbose && length($lib) );
}
}
print SLN "\tEndProjectSection\n";
}
print SLN "EndProject\n";
}
print SLN "Global\n";
print SLN "\tGlobalSection(SolutionProperties) = preSolution\n";
print SLN "\t\tHideSolutionNode = FALSE\n";
print SLN "\tEndGlobalSection\n";
print SLN "EndGlobal\n";
close SLN;
}
sub WriteProjectListFile
{
local($txtfile) = @_;
$txtfile = "$txtfile.txt" unless ( $txtfile=~/\./); # add extension if needed
open(SLN,">$txtfile" ) || die "can't open output $txtfile";
foreach $proj (@PROJECTS)
{
# check dependencies for "*" projects
if ( (! length( $force_project_inclusion{$proj} ) ) &&
( @output_only_projects_dependent_upon ))
{
my $skip_it = 1;
foreach $output_only ( @output_only_projects_dependent_upon )
{
$skip_it = 0 if ( $output_only eq lc( $proj ) );
foreach $lib (split(/,/,$depends_on{$proj}))
{
$skip_it = 0 if ( $output_only eq lc($lib) );
foreach $prvd (split(/,/,$provider{$lib}))
{
$skip_it = 0 if ( $output_only eq $prvd );
}
}
}
next if ( $skip_it );
}
push @plist, $proj;
}
# now, we need to satisfy all dependencies
while( $#plist >= 0)
{
@worklist=@plist;
undef @plist;
PROJECT: foreach $proj( @worklist )
{
if ( length($depends_on{$proj} ) )
{
foreach $lib (split(/,/,$depends_on{$proj}))
{
if ( length($provider{$lib}) )
{
foreach $prvd (split(/,/,$provider{$lib}))
{
if ( length( $prvd ) && ( !$already_did{$prvd} ) )
{
push @plist, $proj; # can't do it yet
next PROJECT;
}
}
}
}
}
$already_did{$proj} = 1;
print SLN "$relpath{$proj}\n";
}
}
close SLN;
}
sub PrintArgumentSummaryAndExit
{
print "Format of command is\n";
my $switches="[ -projlist -verbose -x360 ]";
print "\t MKSLN $switches <solutionname.sln > proj1.vcproj proj2.vcproj ...\n";
print "OR\t MKSLN $switches \@vpcgroupname\n";
print "OR\t MKSLN $switches sln_name \@vpcgroupname\n";
print "OR\t MKSLN $switches sln_name *project create a solution including only that project and things dependent on it.\n";
}
sub AddProject
{
local($fname, $force )=@_;
local($/);
print "add project $fname\n" if ( $verbose );
open( VCP_IN, $fname ) || die "can't open $fname";
my $xmltext=<VCP_IN>;
close VCP_IN;
my $xml=XMLin($xmltext, forcearray => [ 'File', 'Filter' ] ); #, keyattr =>[ 'name', 'key', 'id', 'Name']);
my $pname=lc($xml->{Name});
$force_project_inclusion{$pname} = "yes" if ( $force );
return if ($already_processed{$pname} );
$already_processed{$pname}=1;
my $id=$xml->{ProjectGUID};
unless( length($id) )
{
die "project $fname doesn't have a guid. Generated by an old VPC?";
}
$id = "{".$id."}" unless( $id=~ /}/);
$guid{$pname}=$id;
push @PROJECTS,$pname;
$vcprojpath{$pname}=$fname;
#get targetname
my $targetname=$xml->{Name};
# get output target
my $tools=$xml->{Configurations}->{Configuration}[0];
# walk the tool list to see if this project outpus a .lib that something might depend on
my $outputtarget;
foreach $tool (@{$tools->{'Tool'}})
{
if ( $tool->{Name} eq "VCLibrarianTool" )
{
my $outputtarget=lc(basename($tool->{OutputFile}));
$provider{$outputtarget}.=",$pname";
print "$pname provides $outputtarget\n" if ($verbose);
}
if ( $tool->{Name} eq $linker_tool_name )
{
my $outputtarget=$tool->{'ImportLibrary'};
if ( length($outputtarget) )
{
$outputtarget=~s/\$\(TargetName\)/$targetname/i;
$outputtarget=lc(basename($outputtarget));
$outputtarget =~ s/\.lib/_360.lib/ if ( $x360 );
$provider{$outputtarget}=basename($pname);
print "$pname provides $outputtarget\n" if ($verbose);
}
}
}
foreach $filter (@{$xml->{Files}->{Filter}})
{
foreach $file (@{$filter->{File}})
{
my $f = lc($file->{RelativePath});
if ( $f=~/\.lib$/i) # library dependency
{
my $libname=basename($f);
$depends_on{$pname}.=",".$libname;
print "$pname depends on $libname\n" if ($verbose);
}
}
}
# generate relative pathname
$fname=~s@^$srcroot/@@i;
$fname=~s@/@\\@g;
$relpath{$pname}=$fname;
}
sub ReadGroup
{
local($matchgroup)=@_;
my $curmatch=0;
open(GROUPS,"$srcroot/vpc_scripts/groups.vgc") || die "can't open groups.vgc";
while(<GROUPS>)
{
&FixupVPCLine;
if (/^\$Group\s+(.*)$/)
{
my $groups=" $1 ";
$groups=~s@\"@@g;
$curmatch=0;
$curmatch=1 if ( $groups=~/ $matchgroup /i );
}
elsif ( $curmatch && (/^\s*\"([^\"]+)\"/) )
{
my $proj=lc($1);
my $path=$projpath{$proj};
if (length($path))
{
foreach $prj (split(/\s+/, $path))
{
$prj=~s@\s+@@g;
next unless (length($prj));
if ( -e $prj )
{
push @PROJS,$prj;
print "found proj $prj\n" if ($verbose);
}
else
{
print STDERR "can't find $prj\n";
}
}
}
else
{
print STDERR "couldn't find project name $proj (group = $matchgroup )\n";
}
}
else
{
$curmatch = 0 if (/\}/);
}
}
}
sub ReadVPCProjects
{
# group mode. ugh 100x harder to parse vpc than .vcproj
open(PROJS,"$srcroot/vpc_scripts/projects.vgc" ) || die "can't open projects.vgc";
while(<PROJS>)
{
&FixupVPCLine;
if (/^\s*\$Project\s+\"([^\"]+)\"/)
{
$curproj=$1;
}
elsif (/^\s*\"([^\"]+)\.vpc\"/)
{
my $base = $1;
$base="$base"."_x360" if ( $x360 );
$projpath{lc($curproj)}.=" $base.vcproj";
}
}
close PROJS;
}
sub FixupVPCLine
{
s@[\n\r]@@g;
s@//.*$@@g; # kill comments
# use [] skips. need something smarter here. for now, implicit /allgames except hl1 and portalmp
$_=undef if ( /\$HL1/);
$_=undef if ( /\$PORTALMP/);
}
+280
View File
@@ -0,0 +1,280 @@
FATAL
cannot open file
I/O error closing file
I/O error writing file
I/O error reading file
out of memory
assembler limit : macro parameter name table full
invalid command-line option
nesting level too deep
unmatched macro nesting
line too long
unmatched block nesting
directive must be in control block
error count exceeds 100; stopping assembly
invalid numerical command-line argument
too many arguments
statement too complex
N/A
missing source filename
COFF error writing file
invalid debug and browser data; file exceeds line limit
cannot find link.exe
cannot find cvpack.exe
SEVERE
memory operand not allowed in context
immediate operand not allowed
cannot have more than one ELSE clause per IF block
extra characters after statement
symbol type conflict
symbol redefinition
undefined symbol
non-benign record redefinition
syntax error
syntax error in expression
invalid type expression
distance invalid for word size of current segment
PROC, MACRO, or macro repeat directive must precede LOCAL
.MODEL must precede this directive
cannot define as public or external
segment attributes cannot change
expression expected
operator expected
invalid use of external symbol
operand must be RECORD type or field
identifier not a record
record constants may not span line breaks
instruction operands must be the same size
instruction operand must have size
invalid operand size for instruction
operands must be in same segment
constant expected
operand must be a memory expression
expression must be a code address
multiple base registers not allowed
multiple index registers not allowed
must be index or base register
invalid use of register
invalid INVOKE argument
must be in segment block
DUP too complex
too many initial values for structure
statement not allowed inside structure definition
missing operand for macro operator
line too long
segment register not allowed in context
string or text literal too long
statement too complex
identifier too long
invalid character in file
missing angle bracket or brace in literal
missing single or double quotation mark in string
empty (null) string
nondigit in number
syntax error in floating-point constant
real or BCD number not allowed
text item required
forced error
forced error : value equal to 0
forced error : value not equal to 0
forced error : symbol not defined
forced error : symbol defined
forced error : string blank
forced error : string not blank
forced error : strings equal
forced error : strings not equal
[ELSE]IF2/.ERR2 not allowed : single-pass assembler
expression too complex for .UNTILCXZ
can ALIGN only to power of 2
structure alignment must be 1, 2, 4, 8, or 16
expected
incompatible CPU mode and segment size
LOCK must be followed by a memory operation
instruction prefix not allowed
no operands allowed for this instruction
invalid instruction operands
initializer magnitude too large for specified size
cannot access symbol in given segment or group
operands have different frames
cannot access label through segment registers
jump destination too far
jump destination must specify a label
instruction does not allow NEAR indirect addressing
instruction does not allow FAR indirect addressing
instruction does not allow FAR direct addressing
jump distance not possible in current CPU mode
missing operand after unary operator
cannot mix 16- and 32-bit registers
invalid scale value
constant value too large
instruction or register not accepted in current CPU mode
reserved word expected
instruction form requires 80386/486
END directive required at end of file
too many bits in RECORD
positive value expected
index value past end of string
count must be positive or zero
count value too large
operand must be relocatable
constant or relocatable label expected
segment, group, or segment register expected
segment expected
invalid operand for OFFSET
invalid use of external absolute
segment or group not allowed
cannot add two relocatable labels
cannot add memory expression and code label
segment exceeds 64K limit
invalid type for a data declaration
HIGH and LOW require immediate operands
N/A
cannot have implicit far jump or call to near label
use of register assumed to ERROR
only white space or comment can follow backslash
COMMENT delimiter expected
conflicting parameter definition
PROC and prototype calling conventions conflict
invalid radix tag
INVOKE argument type mismatch : argument
invalid coprocessor register
instructions and initialized data not allowed in AT segments
/AT switch requires the TINY memory model
cannot have segment address references with TINY model
language type must be specified
PROLOGUE must be macro function
EPILOGUE must be macro procedure
alternate identifier not allowed with EXTERNDEF
text macro nesting level too deep
N/A
missing macro argument
EXITM used inconsistently
macro function argument list too long
N/A
VARARG parameter must be last parameter
VARARG parameter not allowed with LOCAL
VARARG parameter requires C calling convention
ORG needs a constant or local offset
register value overwritten by INVOKE
structure too large to pass with INVOKE : argument
not overriding private proc as public
too many arguments to INVOKE
too few arguments to INVOKE
invalid data initializer
N/A
RET operand too large
too many operands to instruction
cannot have more than one .ELSE clause per .IF block
expected data label
cannot nest procedures
EXPORT must be FAR
procedure declared with two visibility attributes
macro label not defined
invalid symbol type in expression
byte register cannot be first operand
word register cannot be first operand
special register cannot be first operand
coprocessor register cannot be first operand
cannot change size of expression computations
syntax error in control-flow directive
cannot use 16-bit register with a 32-bit address
constant value out of range
missing right parenthesis
type is wrong size for register
structure cannot be instanced
non-benign structure redefinition: label incorrect
non-benign structure redefinition: too few labels
OLDSTRUCTS/NOOLDSTRUCTS state cannot be changed
non-benign structure redefinition: incorrect initializers
non-benign structure redefinition: too few initializers
non-benign structure redefinition: label has incorrect offset
structure field expected
unexpected literal found in expression
N/A
divide by zero in expression
directive must appear inside a macro
cannot expand macro function
too few bits in RECORD
macro function cannot redefine itself
N/A
invalid qualified type
floating-point initializer on an integer variable
nested structure improperly initialized
invalid use of FLAT
structure improperly initialized
improper list initialization
initializer must be a string or single item
initializer must be a single item
initializer must be a single byte
improper use of list initializer
improper literal initialization
extra characters in literal initialization
must use floating-point initializer
cannot use .EXIT for OS_OS2 with .8086
invalid combination with segment alignment
INVOKE requires prototype for procedure
cannot include structure in self
symbol language attribute conflict
non-benign COMM redefinition
COMM variable exceeds 64K
parameter or local cannot have void type
cannot use TINY model with OS_OS2
expression size must be 32 bits
.EXIT does not work with 32-bit segments
.STARTUP does not work with 32-bit segments
ORG directive not allowed in unions
D/T
illegal use of segment register
cannot declare scoped code label as PUBLIC
.MSFLOAT directive is obsolete : .MSFLOAT ignored
ESC instruction is obsolete : ESC ignored
missing operator in expression
missing right parenthesis in expression
missing left parenthesis in expression
reference to forward macro definition
16 bit segments not allowed with /coff option
FAR not allowed in flat model comm variables
invalid .model parameter for flat model
ALIAS name is empty
GROUP directive not allowed with /coff option
.FPO is not compatible with nested procedures
LEVEL 1
cannot modify READONLY segment
N/A
non-unique STRUCT/UNION field used without qualification
start address on END directive ignored with .STARTUP
cannot ASSUME CS
unknown default prologue argument
too many arguments in macro call
option untranslated, directive required
invalid command-line option value, default is used
insufficent memory for /EP : /EP ignored
expected '>' on text literal
multiple .MODEL directives found : .MODEL ignored
line number information for segment without class 'CODE'
instructions and initialized data not supported in AT segments
directive ignored with /coff switch
/Gc switch incompatible with flat model
/AT switch incompatible with flat model
invalid command-line option
directive ignored without /coff switch
directive ignored outside a procedure
LOADDS ignored in flat model
debug information too complex for
with /coff switch, leading underscore required for start address
LEVEL 2
@@: label defined but not referenced
expression expected, assume value 0
EXTERNDEF previously assumed to be external
length of symbol previously assumed to be different
symbol previously assumed to not be in a group
types are different
calling convention not supported in flat model
LEVEL 3
N/A
no return from procedure
N/A
conditional jump lengthened
procedure argument or local not referenced
expression may be pass-dependent
structure contains no members
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
exec $(dirname $0)/ccache "${DT_TOOLCHAIN_DIR}"/usr/bin/clang -Qunused-arguments "$@"
+24
View File
@@ -0,0 +1,24 @@
if( scalar( @ARGV ) != 2 )
{
die "Usage: playback_getframe.pl framenum blah.txt\n";
}
# getframe.pl framenum blah.txt
$line = 0;
$desiredFrame = shift;
$frame = 1;
open INPUT, shift || die;
while( <INPUT> )
{
$line++;
if( /Dx8Present/ )
{
$frame++;
}
if( $frame == $desiredFrame )
{
print "$line: $_";
}
last if $frame > $desiredFrame;
}
close INPUT;
+169
View File
@@ -0,0 +1,169 @@
# getfinalstate.pl blah.txt line
# note: the state is *before* the line that you specify
die "Usage: playback_getstate.pl blah.txt cmd\n" if scalar( @ARGV ) != 2;
open INPUT, shift || die;
$desiredcmd = shift;
$line = 0;
sub PadNumber
{
local( $str ) = shift;
local( $desiredLen ) = shift;
local( $len ) = length $str;
while( $len < $desiredLen )
{
$str = "0" . $str;
$len++;
}
return $str;
}
while( <INPUT> )
{
m/^cmd: (\d+) /;
$cmdnum = $1;
# print "$cmdnum\n";
if( $cmdnum == $desiredcmd )
{
print "$_";
last;
}
if( /Dx8SetTextureStageState:\s*stage:\s*(\d+)\s*state:\s*(\S+)\s*,\s*value:\s*(\S+)/ )
{
$texturestate{"$2 $1"} = $3;
# print "$1 $2 $3\n";
}
# elsif( /Dx8SetTextureStageState/i )
# {
# die "$_";
# }
if( /Dx8SetRenderState:\s*(\S+)\s+(\S+.*)*$/ )
{
$renderstate{$1} = $2;
}
# elsif( /Dx8SetRenderState/i )
# {
# die "$_";
# }
if( /Dx8SetVertexShaderConstant:\s*reg:\s*(\d+)\s*numvecs:\s*(\d+)\s*val:\s*(.*)$/ )
{
local( $reg ) = $1;
local( $count ) = $2;
local( $val ) = $3;
local( $i );
for( $i = 0; $i < $count; $i++, $reg++ )
{
$val =~ s/^\s*(\[\s*\S+\s+\S+\s+\S+\s+\S+\s*\])(.*$)/$2/;
$vertconst{ "vshconst " . &PadNumber( $reg, 2 ) } = $1;
}
}
# elsif( /Dx8SetVertexShaderConstant/i )
# {
# die "$_";
# }
if( /Dx8SetPixelShaderConstant:\s*reg:\s*(\d+)\s*numvecs:\s*(\d+)\s*val:\s*(.*)$/ )
{
local( $reg ) = $1;
local( $count ) = $2;
local( $val ) = $3;
local( $i );
for( $i = 0; $i < $count; $i++, $reg++ )
{
$val =~ s/^\s*(\[\s*\S+\s+\S+\s+\S+\s+\S+\s*\])(.*$)/$2/;
$pixelconst{ "pshconst " . &PadNumber( $reg, 2 ) } = $1;
}
}
# elsif( /Dx8SetPixelShaderConstant/i )
# {
# die "$_";
# }
if( /Dx8SetStreamSource:\s*vertexBufferID:\s*(\d+)\s*streamID:\s*(\d+)\s*vertexSize:\s*(\d+)\s*$/ )
{
$streamsrc{$2} = "vertexBufferID: $1 vertexSize: $3";
}
# elsif( /Dx8SetStreamSource/i )
# {
# die "$_";
# }
if( /Dx8CreateVertexShader:\s*id:\s*(\d+)\s+dwDecl:\s*(.*)$/ )
{
$vshdecl{$1} = $2;
}
elsif( /Dx8CreateVertexShader/i )
{
die "$_";
}
if( /Dx8SetVertexShader:\s*vertexShader:\s*(\d+)\s*$/ )
{
$currentVertexShader = $1;
}
elsif( /Dx8SetVertexShader:/i )
{
die "$_";
}
if( /Dx8SetPixelShader:\s*pixelShader:\s*(\d+)\s*$/ )
{
$currentPixelShader = $1;
}
elsif( /Dx8SetPixelShader:/i )
{
die "$_";
}
if( /Dx8SetVertexBufferFormat:\s*id:\s*(\d+)\s*vertexFormat:\s*(.*)$/ )
{
$vbformat{$1} = $2;
}
elsif( /Dx8SetVertexBufferFormat/i )
{
die "$_";
}
}
close INPUT;
foreach $state ( sort( keys( %texturestate ) ) )
{
print "$state = $texturestate{$state}\n";
}
foreach $state ( sort( keys( %renderstate ) ) )
{
print "$state = $renderstate{$state}\n";
}
foreach $state ( sort( keys( %vertconst ) ) )
{
print "$state = $vertconst{$state}\n";
}
foreach $state ( sort( keys( %pixelconst ) ) )
{
print "$state = $pixelconst{$state}\n";
}
foreach $state ( sort( keys( %streamsrc ) ) )
{
$streamsrc{$state} =~ m/vertexBufferID:\s*(\d+)\s+/;
local( $vertbufid ) = $1;
print "stream $state = $streamsrc{$state} vbformat: $vbformat{$vertbufid}\n";
}
#foreach $state ( sort( keys( %vbformat ) ) )
#{
# print "vbformat $state = $vbformat{$state}\n";
#}
print "current vsh: $currentVertexShader vshdecl: $vshdecl{$currentVertexShader}\n";
print "current psh: $currentPixelShader\n";
+27
View File
@@ -0,0 +1,27 @@
# This gives you all calls between lock and unlock for the specified texture.
# gettexlock.pl texid blah.txt
$desiredTexture = shift;
open INPUT, shift || die;
while( <INPUT> )
{
if( /Dx8LockTexture: id: (\d+)\s+/ )
{
if( $1 == $desiredTexture )
{
print "----------------------------------------------------\n";
print;
$gotit = 1;
}
}
elsif( $gotit && /Dx8UnlockTexture: id: (\d+)\s+/ )
{
die if $1 != $desiredTexture;
print;
$gotit = 0;
}
else
{
print if( $gotit );
}
}
close INPUT;
+23
View File
@@ -0,0 +1,23 @@
# getframe.pl vbid blah.txt
$desiredVB = shift;
open INPUT, shift || die;
while( <INPUT> )
{
if( /Dx8VertexData: id: (\d+)\s+/ )
{
if( $1 == $desiredVB )
{
print;
$gotit = 1;
}
}
elsif( $gotit && /^vertex:/ )
{
print;
}
else
{
$gotit = 0;
}
}
close INPUT;
+1
View File
@@ -0,0 +1 @@
grep Dx8Present %1 | wc -l
+27
View File
@@ -0,0 +1,27 @@
if( scalar( @ARGV ) != 1 )
{
die "Usage: playback_numprims.pl frame.txt\n";
}
open INPUT, shift || die;
$numprims = 0;
$numcalls = 0;
while( <INPUT> )
{
if( /DrawIndexedPrimitive.*numPrimitives:\s*(\d+)\s*$/i )
{
$numprims += $1;
if( $1 > 85 )
{
$numfreeprims += $1;
}
else
{
$numfreeprims += 85;
}
$numcalls++;
}
}
close INPUT;
print "$numprims primitives\n";
print "$numfreeprims freeprimitives\n";
print "$numcalls calls\n";
+333
View 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 = "$g_SourceDir\\x360xdk\\bin\\win32\\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;
+25
View File
@@ -0,0 +1,25 @@
PuTTY is copyright 1997-2007 Simon Tatham.
Portions copyright Robert de Bath, Joris van Rantwijk, Delian
Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry,
Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus
Kuhn, and CORE SDI S.A.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+40
View File
@@ -0,0 +1,40 @@
PuTTY README
============
This is the README file for the PuTTY installer distribution. If
you're reading this, you've probably just run our installer and
installed PuTTY on your system.
What should I do next?
----------------------
If you want to use PuTTY to connect to other computers, or use PSFTP
to transfer files, you should just be able to run them from the
Start menu.
If you want to use the command-line-only file transfer utility PSCP,
you will probably want to put the PuTTY installation directory on
your PATH. How you do this depends on your version of Windows. On
Windows NT, 2000, and XP, you can set it using Control Panel > System;
on Windows 95, 98, and Me, you will need to edit AUTOEXEC.BAT. Consult
your Windows manuals for details.
Some versions of Windows will refuse to run HTML Help files (.CHM)
if they are installed on a network drive. If you have installed
PuTTY on a network drive, you might want to check that the help file
works properly. If not, see http://support.microsoft.com/kb/896054
for information on how to solve this problem.
What do I do if it doesn't work?
--------------------------------
The PuTTY home web site is
http://www.chiark.greenend.org.uk/~sgtatham/putty/
Here you will find our list of known bugs and pending feature
requests. If your problem is not listed in there, or in the FAQ, or
in the manuals, read the Feedback page to find out how to report
bugs to us. PLEASE read the Feedback page carefully: it is there to
save you time as well as us. Do not send us one-line bug reports
telling us `it doesn't work'.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+492
View File
@@ -0,0 +1,492 @@
:Title PuTTY User Manual
1 Title page=Top
1 Chapter 1: Introduction to PuTTY
2 Chapter 1: Introduction to PuTTY=t00000000
2 Section 1.1: What are SSH, Telnet and Rlogin?=t00000001
2 Section 1.2: How do SSH, Telnet and Rlogin differ?=t00000002
1 Chapter 2: Getting started with PuTTY
2 Chapter 2: Getting started with PuTTY=t00000003
2 Section 2.1: Starting a session=t00000004
2 Section 2.2: Verifying the host key (SSH only)=t00000005
2 Section 2.3: Logging in=t00000006
2 Section 2.4: After logging in=t00000007
2 Section 2.5: Logging out=t00000008
1 Chapter 3: Using PuTTY
2 Chapter 3: Using PuTTY=t00000009
2 Section 3.1: During your session
3 Section 3.1: During your session=t00000010
3 Section 3.1.1: Copying and pasting text=t00000011
3 Section 3.1.2: Scrolling the screen back=t00000012
3 Section 3.1.3: The System menu
4 Section 3.1.3: The System menu=t00000013
4 Section 3.1.3.1: The PuTTY Event Log=t00000014
4 Section 3.1.3.2: Special commands=t00000015
4 Section 3.1.3.3: Starting new sessions=t00000016
4 Section 3.1.3.4: Changing your session settings=t00000017
4 Section 3.1.3.5: Copy All to Clipboard=t00000018
4 Section 3.1.3.6: Clearing and resetting the terminal=t00000019
4 Section 3.1.3.7: Full screen mode=t00000020
1 Section 3.2: Creating a log file of your session=t00000021
1 Section 3.3: Altering your character set configuration=t00000022
1 Section 3.4: Using X11 forwarding in SSH=t00000023
1 Section 3.5: Using port forwarding in SSH=t00000024
1 Section 3.6: Making raw TCP connections=t00000025
1 Section 3.7: Connecting to a local serial line=t00000026
2 Section 3.8: The PuTTY command line
3 Section 3.8: The PuTTY command line=t00000027
3 Section 3.8.1: Starting a session from the command line=t00000028
3 Section 3.8.2: -cleanup=options.cleanup
3 Section 3.8.3: Standard command-line options
4 Section 3.8.3: Standard command-line options=t00000029
4 Section 3.8.3.1: -load: load a saved session=t00000030
4 Section 3.8.3.2: Selecting a protocol: -ssh, -telnet, -rlogin, -raw=t00000031
4 Section 3.8.3.3: -v: increase verbosity=t00000032
4 Section 3.8.3.4: -l: specify a login name=t00000033
4 Section 3.8.3.5: -L, -R and -D: set up port forwardings=t00000034
4 Section 3.8.3.6: -m: read a remote command or script from a file=t00000035
4 Section 3.8.3.7: -P: specify a port number=t00000036
4 Section 3.8.3.8: -pw: specify a password=t00000037
4 Section 3.8.3.9: -agent and -noagent: control use of Pageant for authentication=t00000038
4 Section 3.8.3.10: -A and -a: control agent forwarding=t00000039
4 Section 3.8.3.11: -X and -x: control X11 forwarding=t00000040
4 Section 3.8.3.12: -t and -T: control pseudo-terminal allocation=t00000041
4 Section 3.8.3.13: -N: suppress starting a shell or command=t00000042
4 Section 3.8.3.14: -nc: make a remote network connection in place of a remote shell or command=t00000043
4 Section 3.8.3.15: -C: enable compression=t00000044
4 Section 3.8.3.16: -1 and -2: specify an SSH protocol version=t00000045
4 Section 3.8.3.17: -4 and -6: specify an Internet protocol version=t00000046
4 Section 3.8.3.18: -i: specify an SSH private key=t00000047
4 Section 3.8.3.19: -pgpfp: display PGP key fingerprints=t00000048
1 Chapter 4: Configuring PuTTY
2 Chapter 4: Configuring PuTTY=t00000049
2 Section 4.1: The Session panel
3 Section 4.1: The Session panel=t00000050
3 Section 4.1.1: The host name section=session.hostname
3 Section 4.1.2: Loading and storing saved sessions=session.saved
3 Section 4.1.3: Close Window on Exit=session.coe
2 Section 4.2: The Logging panel
3 Section 4.2: The Logging panel=logging.main
3 Section 4.2.1: Log file name=logging.filename
3 Section 4.2.2: What to do if the log file already exists=logging.exists
3 Section 4.2.3: Flush log file frequently=logging.flush
3 Section 4.2.4: Options specific to SSH packet logging
4 Section 4.2.4: Options specific to SSH packet logging=t00000051
4 Section 4.2.4.1: Omit known password fields=logging.ssh.omitpassword
4 Section 4.2.4.2: Omit session data=logging.ssh.omitdata
2 Section 4.3: The Terminal panel
3 Section 4.3: The Terminal panel=t00000052
3 Section 4.3.1: Auto wrap mode initially on=terminal.autowrap
3 Section 4.3.2: DEC Origin Mode initially on=terminal.decom
3 Section 4.3.3: Implicit CR in every LF=terminal.lfhascr
3 Section 4.3.4: Use background colour to erase screen=terminal.bce
3 Section 4.3.5: Enable blinking text=terminal.blink
3 Section 4.3.6: Answerback to ^E=terminal.answerback
3 Section 4.3.7: Local echo=terminal.localecho
3 Section 4.3.8: Local line editing=terminal.localedit
3 Section 4.3.9: Remote-controlled printing=terminal.printing
2 Section 4.4: The Keyboard panel
3 Section 4.4: The Keyboard panel=t00000053
3 Section 4.4.1: Changing the action of the Backspace key=keyboard.backspace
3 Section 4.4.2: Changing the action of the Home and End keys=keyboard.homeend
3 Section 4.4.3: Changing the action of the function keys and keypad=keyboard.funkeys
3 Section 4.4.4: Controlling Application Cursor Keys mode=keyboard.appcursor
3 Section 4.4.5: Controlling Application Keypad mode=keyboard.appkeypad
3 Section 4.4.6: Using NetHack keypad mode=keyboard.nethack
3 Section 4.4.7: Enabling a DEC-like Compose key=keyboard.compose
3 Section 4.4.8: Control-Alt is different from AltGr=keyboard.ctrlalt
2 Section 4.5: The Bell panel
3 Section 4.5: The Bell panel=t00000054
3 Section 4.5.1: Set the style of bell=bell.style
3 Section 4.5.2: Taskbar/caption indication on bell=bell.taskbar
3 Section 4.5.3: Control the bell overload behaviour=bell.overload
2 Section 4.6: The Features panel
3 Section 4.6: The Features panel=t00000055
3 Section 4.6.1: Disabling application keypad and cursor keys=features.application
3 Section 4.6.2: Disabling xterm-style mouse reporting=features.mouse
3 Section 4.6.3: Disabling remote terminal resizing=features.resize
3 Section 4.6.4: Disabling switching to the alternate screen=features.altscreen
3 Section 4.6.5: Disabling remote window title changing=features.retitle
3 Section 4.6.6: Response to remote window title querying=features.qtitle
3 Section 4.6.7: Disabling destructive backspace=features.dbackspace
3 Section 4.6.8: Disabling remote character set configuration=features.charset
3 Section 4.6.9: Disabling Arabic text shaping=features.arabicshaping
3 Section 4.6.10: Disabling bidirectional text display=features.bidi
2 Section 4.7: The Window panel
3 Section 4.7: The Window panel=t00000056
3 Section 4.7.1: Setting the size of the PuTTY window=window.size
3 Section 4.7.2: What to do when the window is resized=window.resize
3 Section 4.7.3: Controlling scrollback=window.scrollback
3 Section 4.7.4: Push erased text into scrollback=window.erased
2 Section 4.8: The Appearance panel
3 Section 4.8: The Appearance panel=t00000057
3 Section 4.8.1: Controlling the appearance of the cursor=appearance.cursor
3 Section 4.8.2: Controlling the font used in the terminal window=appearance.font
3 Section 4.8.3: Hide mouse pointer when typing in window=appearance.hidemouse
3 Section 4.8.4: Controlling the window border=appearance.border
2 Section 4.9: The Behaviour panel
3 Section 4.9: The Behaviour panel=t00000058
3 Section 4.9.1: Controlling the window title=appearance.title
3 Section 4.9.2: Warn before closing window=behaviour.closewarn
3 Section 4.9.3: Window closes on ALT-F4=behaviour.altf4
3 Section 4.9.4: System menu appears on ALT-Space=behaviour.altspace
3 Section 4.9.5: System menu appears on Alt alone=behaviour.altonly
3 Section 4.9.6: Ensure window is always on top=behaviour.alwaysontop
3 Section 4.9.7: Full screen on Alt-Enter=behaviour.altenter
2 Section 4.10: The Translation panel
3 Section 4.10: The Translation panel=t00000059
3 Section 4.10.1: Controlling character set translation=translation.codepage
3 Section 4.10.2: Treat CJK ambiguous characters as wide=translation.cjkambigwide
3 Section 4.10.3: Caps Lock acts as Cyrillic switch=translation.cyrillic
3 Section 4.10.4: Controlling display of line-drawing characters=translation.linedraw
3 Section 4.10.5: Controlling copy and paste of line drawing characters=selection.linedraw
2 Section 4.11: The Selection panel
3 Section 4.11: The Selection panel=t00000060
3 Section 4.11.1: Pasting in Rich Text Format=selection.rtf
3 Section 4.11.2: Changing the actions of the mouse buttons=selection.buttons
3 Section 4.11.3: Shift overrides application's use of mouse=selection.shiftdrag
3 Section 4.11.4: Default selection mode=selection.rect
3 Section 4.11.5: Configuring word-by-word selection=selection.charclasses
2 Section 4.12: The Colours panel
3 Section 4.12: The Colours panel=t00000061
3 Section 4.12.1: Allow terminal to specify ANSI colours=colours.ansi
3 Section 4.12.2: Allow terminal to use xterm 256-colour mode=colours.xterm256
3 Section 4.12.3: Bolded text is a different colour=colours.bold
3 Section 4.12.4: Attempt to use logical palettes=colours.logpal
3 Section 4.12.5: Use system colours=colours.system
3 Section 4.12.6: Adjusting the colours in the terminal window=colours.config
2 Section 4.13: The Connection panel
3 Section 4.13: The Connection panel=t00000062
3 Section 4.13.1: Using keepalives to prevent disconnection=connection.keepalive
3 Section 4.13.2: Disable Nagle's algorithm=connection.nodelay
3 Section 4.13.3: Enable TCP keepalives=connection.tcpkeepalive
3 Section 4.13.4: Internet protocol=connection.ipversion
2 Section 4.14: The Data panel
3 Section 4.14: The Data panel=t00000063
3 Section 4.14.1: Auto-login username=connection.username
3 Section 4.14.2: Terminal-type string=connection.termtype
3 Section 4.14.3: Terminal speeds=connection.termspeed
3 Section 4.14.4: Setting environment variables on the server=telnet.environ
2 Section 4.15: The Proxy panel
3 Section 4.15: The Proxy panel=proxy.main
3 Section 4.15.1: Setting the proxy type=proxy.type
3 Section 4.15.2: Excluding parts of the network from proxying=proxy.exclude
3 Section 4.15.3: Name resolution when using a proxy=proxy.dns
3 Section 4.15.4: Username and password=proxy.auth
3 Section 4.15.5: Specifying the Telnet or Local proxy command=proxy.command
2 Section 4.16: The Telnet panel
3 Section 4.16: The Telnet panel=t00000064
3 Section 4.16.1: Handling of OLD_ENVIRON ambiguity=telnet.oldenviron
3 Section 4.16.2: Passive and active Telnet negotiation modes=telnet.passive
3 Section 4.16.3: Keyboard sends Telnet special commands=telnet.specialkeys
3 Section 4.16.4: Return key sends Telnet New Line instead of ^M=telnet.newline
2 Section 4.17: The Rlogin panel
3 Section 4.17: The Rlogin panel=t00000065
3 Section 4.17.1: Local username=rlogin.localuser
2 Section 4.18: The SSH panel
3 Section 4.18: The SSH panel=t00000066
3 Section 4.18.1: Executing a specific command on the server=ssh.command
3 Section 4.18.2: Don't start a shell or command at all=ssh.noshell
3 Section 4.18.3: Enable compression=ssh.compress
3 Section 4.18.4: Preferred SSH protocol version=ssh.protocol
3 Section 4.18.5: Encryption algorithm selection=ssh.ciphers
2 Section 4.19: The Kex panel
3 Section 4.19: The Kex panel=t00000067
3 Section 4.19.1: Key exchange algorithm selection=ssh.kex.order
3 Section 4.19.2: Repeat key exchange=ssh.kex.repeat
2 Section 4.20: The Auth panel
3 Section 4.20: The Auth panel=t00000068
3 Section 4.20.1: Bypass authentication entirely=ssh.auth.bypass
3 Section 4.20.2: Attempt authentication using Pageant=ssh.auth.pageant
3 Section 4.20.3: Attempt TIS or CryptoCard authentication=ssh.auth.tis
3 Section 4.20.4: Attempt keyboard-interactive authentication=ssh.auth.ki
3 Section 4.20.5: Allow agent forwarding=ssh.auth.agentfwd
3 Section 4.20.6: Allow attempted changes of username in SSH-2=ssh.auth.changeuser
3 Section 4.20.7: Private key file for authentication=ssh.auth.privkey
2 Section 4.21: The TTY panel
3 Section 4.21: The TTY panel=t00000069
3 Section 4.21.1: Don't allocate a pseudo-terminal=ssh.nopty
3 Section 4.21.2: Sending terminal modes=ssh.ttymodes
2 Section 4.22: The X11 panel
3 Section 4.22: The X11 panel=ssh.tunnels.x11
3 Section 4.22.1: Remote X11 authentication=ssh.tunnels.x11auth
2 Section 4.23: The Tunnels panel
3 Section 4.23: The Tunnels panel=ssh.tunnels.portfwd
3 Section 4.23.1: Controlling the visibility of forwarded ports=ssh.tunnels.portfwd.localhost
3 Section 4.23.2: Selecting Internet protocol version for forwarded ports=ssh.tunnels.portfwd.ipversion
2 Section 4.24: The Bugs panel
3 Section 4.24: The Bugs panel=t00000070
3 Section 4.24.1: Chokes on SSH-1 ignore messages=ssh.bugs.ignore1
3 Section 4.24.2: Refuses all SSH-1 password camouflage=ssh.bugs.plainpw1
3 Section 4.24.3: Chokes on SSH-1 RSA authentication=ssh.bugs.rsa1
3 Section 4.24.4: Miscomputes SSH-2 HMAC keys=ssh.bugs.hmac2
3 Section 4.24.5: Miscomputes SSH-2 encryption keys=ssh.bugs.derivekey2
3 Section 4.24.6: Requires padding on SSH-2 RSA signatures=ssh.bugs.rsapad2
3 Section 4.24.7: Misuses the session ID in SSH-2 PK auth=ssh.bugs.pksessid2
3 Section 4.24.8: Handles SSH-2 key re-exchange badly=ssh.bugs.rekey2
2 Section 4.25: The Serial panel
3 Section 4.25: The Serial panel=t00000071
3 Section 4.25.1: Selecting a serial line to connect to=serial.line
3 Section 4.25.2: Selecting the speed of your serial line=serial.speed
3 Section 4.25.3: Selecting the number of data bits=serial.databits
3 Section 4.25.4: Selecting the number of stop bits=serial.stopbits
3 Section 4.25.5: Selecting the serial parity checking scheme=serial.parity
3 Section 4.25.6: Selecting the serial flow control scheme=serial.flow
1 Section 4.26: Storing configuration in a file=t00000072
1 Chapter 5: Using PSCP to transfer files securely
2 Chapter 5: Using PSCP to transfer files securely=t00000073
2 Section 5.1: Starting PSCP=t00000074
2 Section 5.2: PSCP Usage
3 Section 5.2: PSCP Usage=t00000075
3 Section 5.2.1: The basics
4 Section 5.2.1: The basics=t00000076
4 Section 5.2.1.1: user=t00000077
4 Section 5.2.1.2: host=t00000078
4 Section 5.2.1.3: source=t00000079
4 Section 5.2.1.4: target=t00000080
3 Section 5.2.2: Options
4 Section 5.2.2: Options=t00000081
4 Section 5.2.2.1: -ls list remote files=t00000082
4 Section 5.2.2.2: -p preserve file attributes=t00000083
4 Section 5.2.2.3: -q quiet, don't show statistics=t00000084
4 Section 5.2.2.4: -r copies directories recursively=t00000085
4 Section 5.2.2.5: -batch avoid interactive prompts=t00000086
4 Section 5.2.2.6: -sftp, -scp force use of particular protocol=t00000087
2 Section 5.2.3: Return value=t00000088
2 Section 5.2.4: Using public key authentication with PSCP=t00000089
1 Chapter 6: Using PSFTP to transfer files securely
2 Chapter 6: Using PSFTP to transfer files securely=t00000090
2 Section 6.1: Starting PSFTP
3 Section 6.1: Starting PSFTP=t00000091
3 Section 6.1.1: -b: specify a file containing batch commands=t00000092
3 Section 6.1.2: -bc: display batch commands as they are run=t00000093
3 Section 6.1.3: -be: continue batch processing on errors=t00000094
3 Section 6.1.4: -batch: avoid interactive prompts=t00000095
2 Section 6.2: Running PSFTP
3 Section 6.2: Running PSFTP=t00000096
3 Section 6.2.1: General quoting rules for PSFTP commands=t00000097
3 Section 6.2.2: Wildcards in PSFTP=t00000098
3 Section 6.2.3: The open command: start a session=t00000099
3 Section 6.2.4: The quit command: end your session=t00000100
3 Section 6.2.5: The close command: close your connection=t00000101
3 Section 6.2.6: The help command: get quick online help=t00000102
3 Section 6.2.7: The cd and pwd commands: changing the remote working directory=t00000103
3 Section 6.2.8: The lcd and lpwd commands: changing the local working directory=t00000104
3 Section 6.2.9: The get command: fetch a file from the server=t00000105
3 Section 6.2.10: The put command: send a file to the server=t00000106
3 Section 6.2.11: The mget and mput commands: fetch or send multiple files=t00000107
3 Section 6.2.12: The reget and reput commands: resuming file transfers=t00000108
3 Section 6.2.13: The dir command: list remote files=t00000109
3 Section 6.2.14: The chmod command: change permissions on remote files=t00000110
3 Section 6.2.15: The del command: delete remote files=t00000111
3 Section 6.2.16: The mkdir command: create remote directories=t00000112
3 Section 6.2.17: The rmdir command: remove remote directories=t00000113
3 Section 6.2.18: The mv command: move and rename remote files=t00000114
3 Section 6.2.19: The ! command: run a local Windows command=t00000115
1 Section 6.3: Using public key authentication with PSFTP=t00000116
1 Chapter 7: Using the command-line connection tool Plink
2 Chapter 7: Using the command-line connection tool Plink=t00000117
2 Section 7.1: Starting Plink=t00000118
2 Section 7.2: Using Plink
3 Section 7.2: Using Plink=t00000119
3 Section 7.2.1: Using Plink for interactive logins=t00000120
3 Section 7.2.2: Using Plink for automated connections=t00000121
3 Section 7.2.3: Plink command line options
4 Section 7.2.3: Plink command line options=t00000122
4 Section 7.2.3.1: -batch: disable all interactive prompts=t00000123
4 Section 7.2.3.2: -s: remote command is SSH subsystem=t00000124
1 Section 7.3: Using Plink in batch files and scripts=t00000125
1 Section 7.4: Using Plink with CVS=t00000126
1 Section 7.5: Using Plink with WinCVS=t00000127
1 Chapter 8: Using public keys for SSH authentication
2 Chapter 8: Using public keys for SSH authentication=t00000128
2 Section 8.1: Public key authentication - an introduction=t00000129
2 Section 8.2: Using PuTTYgen, the PuTTY key generator
3 Section 8.2: Using PuTTYgen, the PuTTY key generator=puttygen.general
3 Section 8.2.1: Generating a new key=t00000130
3 Section 8.2.2: Selecting the type of key=puttygen.keytype
3 Section 8.2.3: Selecting the size (strength) of the key=puttygen.bits
3 Section 8.2.4: The Generate button=puttygen.generate
3 Section 8.2.5: The Key fingerprint box=puttygen.fingerprint
3 Section 8.2.6: Setting a comment for your key=puttygen.comment
3 Section 8.2.7: Setting a passphrase for your key=puttygen.passphrase
3 Section 8.2.8: Saving your private key to a disk file=puttygen.savepriv
3 Section 8.2.9: Saving your public key to a disk file=puttygen.savepub
3 Section 8.2.10: Public key for pasting into authorized_keys file=puttygen.pastekey
3 Section 8.2.11: Reloading a private key=puttygen.load
3 Section 8.2.12: Dealing with private keys in other formats=puttygen.conversions
1 Section 8.3: Getting ready for public key authentication=t00000131
1 Chapter 9: Using Pageant for authentication
2 Chapter 9: Using Pageant for authentication=pageant.general
2 Section 9.1: Getting started with Pageant=t00000132
2 Section 9.2: The Pageant main window
3 Section 9.2: The Pageant main window=t00000133
3 Section 9.2.1: The key list box=pageant.keylist
3 Section 9.2.2: The Add Key button=pageant.addkey
3 Section 9.2.3: The Remove Key button=pageant.remkey
2 Section 9.3: The Pageant command line
3 Section 9.3: The Pageant command line=t00000134
3 Section 9.3.1: Making Pageant automatically load keys on startup=t00000135
3 Section 9.3.2: Making Pageant run another program=t00000136
1 Section 9.4: Using agent forwarding=t00000137
1 Section 9.5: Security considerations=t00000138
1 Chapter 10: Common error messages
2 Chapter 10: Common error messages=t00000139
2 Section 10.1: The server's host key is not cached in the registry=errors.hostkey.absent
2 Section 10.2: WARNING - POTENTIAL SECURITY BREACH!=errors.hostkey.changed
2 Section 10.3: Out of space for port forwardings=t00000140
2 Section 10.4: The first cipher supported by the server is ... below the configured warning threshold=t00000141
2 Section 10.5: Server sent disconnect message type 2 (protocol error): "Too many authentication failures for root"=t00000142
2 Section 10.6: Out of memory=t00000143
2 Section 10.7: Internal error, Internal fault, Assertion failed=t00000144
2 Section 10.8: Unable to use this private key file, Couldn't load private key, Key is of wrong type=errors.cantloadkey
2 Section 10.9: Server refused our public key or Key refused=t00000145
2 Section 10.10: Access denied, Authentication refused=t00000146
2 Section 10.11: Incorrect CRC received on packet or Incorrect MAC received on packet=t00000147
2 Section 10.12: Incoming packet was garbled on decryption=t00000148
2 Section 10.13: PuTTY X11 proxy: various errors=t00000149
2 Section 10.14: Network error: Software caused connection abort=t00000150
2 Section 10.15: Network error: Connection reset by peer=t00000151
2 Section 10.16: Network error: Connection refused=t00000152
2 Section 10.17: Network error: Connection timed out=t00000153
1 Appendix A: PuTTY FAQ
2 Appendix A: PuTTY FAQ=t00000154
2 Section A.1: Introduction
3 Section A.1: Introduction=t00000155
3 Question A.1.1: What is PuTTY?=t00000156
2 Section A.2: Features supported in PuTTY
3 Section A.2: Features supported in PuTTY=t00000157
3 Question A.2.1: Does PuTTY support SSH-2?=t00000158
3 Question A.2.2: Does PuTTY support reading OpenSSH or ssh.com SSH-2 private key files?=t00000159
3 Question A.2.3: Does PuTTY support SSH-1?=t00000160
3 Question A.2.4: Does PuTTY support local echo?=t00000161
3 Question A.2.5: Does PuTTY support storing settings, so I don't have to change them every time?=t00000162
3 Question A.2.6: Does PuTTY support storing its settings in a disk file?=t00000163
3 Question A.2.7: Does PuTTY support full-screen mode, like a DOS box?=t00000164
3 Question A.2.8: Does PuTTY have the ability to remember my password so I don't have to type it every time?=t00000165
3 Question A.2.9: Is there an option to turn off the annoying host key prompts?=t00000166
3 Question A.2.10: Will you write an SSH server for the PuTTY suite, to go with the client?=t00000167
3 Question A.2.11: Can PSCP or PSFTP transfer files in ASCII mode?=t00000168
2 Section A.3: Ports to other operating systems
3 Section A.3: Ports to other operating systems=t00000169
3 Question A.3.1: What ports of PuTTY exist?=t00000170
3 Question A.3.2: Is there a port to Unix?=t00000171
3 Question A.3.3: What's the point of the Unix port? Unix has OpenSSH.=t00000172
3 Question A.3.4: Will there be a port to Windows CE or PocketPC?=t00000173
3 Question A.3.5: Is there a port to Windows 3.1?=t00000174
3 Question A.3.6: Will there be a port to the Mac?=t00000175
3 Question A.3.7: Will there be a port to EPOC?=t00000176
2 Section A.4: Embedding PuTTY in other programs
3 Section A.4: Embedding PuTTY in other programs=t00000177
3 Question A.4.1: Is the SSH or Telnet code available as a DLL?=t00000178
3 Question A.4.2: Is the SSH or Telnet code available as a Visual Basic component?=t00000179
3 Question A.4.3: How can I use PuTTY to make an SSH connection from within another program?=t00000180
2 Section A.5: Details of PuTTY's operation
3 Section A.5: Details of PuTTY's operation=t00000181
3 Question A.5.1: What terminal type does PuTTY use?=t00000182
3 Question A.5.2: Where does PuTTY store its data?=t00000183
2 Section A.6: HOWTO questions
3 Section A.6: HOWTO questions=t00000184
3 Question A.6.1: What login name / password should I use?=t00000185
3 Question A.6.2: What commands can I type into my PuTTY terminal window?=t00000186
3 Question A.6.3: How can I make PuTTY start up maximised?=t00000187
3 Question A.6.4: How can I create a Windows shortcut to start a particular saved session directly?=t00000188
3 Question A.6.5: How can I start an SSH session straight from the command line?=t00000189
3 Question A.6.6: How do I copy and paste between PuTTY and other Windows applications?=t00000190
3 Question A.6.7: How do I use all PuTTY's features (public keys, proxying, cipher selection, etc.) in PSCP, PSFTP and Plink?=t00000191
3 Question A.6.8: How do I use PSCP.EXE? When I double-click it gives me a command prompt window which then closes instantly.=t00000192
3 Question A.6.9: How do I use PSCP to copy a file whose name has spaces in?=t00000193
2 Section A.7: Troubleshooting
3 Section A.7: Troubleshooting=t00000194
3 Question A.7.1: Why do I see Incorrect MAC received on packet?=t00000195
3 Question A.7.2: Why do I see Fatal: Protocol error: Expected control record in PSCP?=t00000196
3 Question A.7.3: I clicked on a colour in the Colours panel, and the colour didn't change in my terminal.=t00000197
3 Question A.7.4: Plink on Windows 95 says it can't find WS2_32.DLL.=t00000198
3 Question A.7.5: After trying to establish an SSH-2 connection, PuTTY says Out of memory and dies.=t00000199
3 Question A.7.6: When attempting a file transfer, either PSCP or PSFTP says Out of memory and dies.=t00000200
3 Question A.7.7: PSFTP transfers files much slower than PSCP.=t00000201
3 Question A.7.8: When I run full-colour applications, I see areas of black space where colour ought to be, or vice versa.=t00000202
3 Question A.7.9: When I change some terminal settings, nothing happens.=t00000203
3 Question A.7.10: My PuTTY sessions unexpectedly close after they are idle for a while.=t00000204
3 Question A.7.11: PuTTY's network connections time out too quickly when network connectivity is temporarily lost.=t00000205
3 Question A.7.12: When I cat a binary file, I get PuTTYPuTTYPuTTY on my command line.=t00000206
3 Question A.7.13: When I cat a binary file, my window title changes to a nonsense string.=t00000207
3 Question A.7.14: My keyboard stops working once PuTTY displays the password prompt.=t00000208
3 Question A.7.15: One or more function keys don't do what I expected in a server-side application.=t00000209
3 Question A.7.16: Since my SSH server was upgraded to OpenSSH 3.1p1/3.4p1, I can no longer connect with PuTTY.=t00000210
3 Question A.7.17: Why do I see Couldn't load private key from ...? Why can PuTTYgen load my key but not PuTTY?=t00000211
3 Question A.7.18: When I'm connected to a Red Hat Linux 8.0 system, some characters don't display properly.=t00000212
3 Question A.7.19: Since I upgraded to PuTTY 0.54, the scrollback has stopped working when I run screen.=t00000213
3 Question A.7.20: Since I upgraded Windows XP to Service Pack 2, I can't use addresses like 127.0.0.2.=t00000214
3 Question A.7.21: PSFTP commands seem to be missing a directory separator (slash).=t00000215
3 Question A.7.22: Do you want to hear about Software caused connection abort?=t00000216
3 Question A.7.23: My SSH-2 session locks up for a few seconds every so often.=t00000217
3 Question A.7.24: PuTTY fails to start up. Windows claims that the application configuration is incorrect.=t00000218
2 Section A.8: Security questions
3 Section A.8: Security questions=t00000219
3 Question A.8.1: Is it safe for me to download PuTTY and use it on a public PC?=t00000220
3 Question A.8.2: What does PuTTY leave on a system? How can I clean up after it?=t00000221
3 Question A.8.3: How come PuTTY now supports DSA, when the website used to say how insecure it was?=t00000222
3 Question A.8.4: Couldn't Pageant use VirtualLock() to stop private keys being written to disk?=t00000223
2 Section A.9: Administrative questions
3 Section A.9: Administrative questions=t00000224
3 Question A.9.1: Would you like me to register you a nicer domain name?=t00000225
3 Question A.9.2: Would you like free web hosting for the PuTTY web site?=t00000226
3 Question A.9.3: Would you link to my web site from the PuTTY web site?=t00000227
3 Question A.9.4: Why don't you move PuTTY to SourceForge?=t00000228
3 Question A.9.5: Why can't I subscribe to the putty-bugs mailing list?=t00000229
3 Question A.9.6: If putty-bugs isn't a general-subscription mailing list, what is?=t00000230
3 Question A.9.7: How can I donate to PuTTY development?=t00000231
3 Question A.9.8: Can I have permission to put PuTTY on a cover disk / distribute it with other software / etc?=t00000232
3 Question A.9.9: Can you sign an agreement indemnifying us against security problems in PuTTY?=t00000233
3 Question A.9.10: Can you sign this form granting us permission to use/distribute PuTTY?=t00000234
3 Question A.9.11: Can you write us a formal notice of permission to use PuTTY?=t00000235
3 Question A.9.12: Can you sign anything for us?=t00000236
3 Question A.9.13: If you won't sign anything, can you give us some sort of assurance that you won't make PuTTY closed-source in future?=t00000237
3 Question A.9.14: Can you provide us with export control information / FIPS certification for PuTTY?=t00000238
2 Section A.10: Miscellaneous questions
3 Section A.10: Miscellaneous questions=t00000239
3 Question A.10.1: Is PuTTY a port of OpenSSH, or based on OpenSSH?=t00000240
3 Question A.10.2: Where can I buy silly putty?=t00000241
3 Question A.10.3: What does PuTTY mean?=t00000242
3 Question A.10.4: How do I pronounce PuTTY?=t00000243
1 Appendix B: Feedback and bug reporting
2 Appendix B: Feedback and bug reporting=t00000244
2 Section B.1: General guidelines
3 Section B.1: General guidelines=t00000245
3 Section B.1.1: Sending large attachments=t00000246
3 Section B.1.2: Other places to ask for help=t00000247
1 Section B.2: Reporting bugs=t00000248
1 Section B.3: Requesting extra features=t00000249
1 Section B.4: Requesting features that have already been requested=t00000250
1 Section B.5: Support requests=t00000251
1 Section B.6: Web server administration=t00000252
1 Section B.7: Asking permission for things=t00000253
1 Section B.8: Mirroring the PuTTY web site=t00000254
1 Section B.9: Praise and compliments=t00000255
1 Section B.10: E-mail address=t00000256
1 Appendix C: PuTTY Licence
2 Appendix C: PuTTY Licence=t00000257
1 Appendix D: PuTTY hacking guide
2 Appendix D: PuTTY hacking guide=t00000258
2 Section D.1: Cross-OS portability=t00000259
2 Section D.2: Multiple backends treated equally=t00000260
2 Section D.3: Multiple sessions per process on some platforms=t00000261
2 Section D.4: C, not C++=t00000262
2 Section D.5: Security-conscious coding=t00000263
2 Section D.6: Independence of specific compiler=t00000264
2 Section D.7: Small code size=t00000265
2 Section D.8: Single-threaded code=t00000266
2 Section D.9: Keystrokes sent to the server wherever possible=t00000267
2 Section D.10: 640×480 friendliness in configuration panels=t00000268
2 Section D.11: Automatically generated Makefiles=t00000269
2 Section D.12: Coroutines in ssh.c=t00000270
2 Section D.13: Single compilation of each source file=t00000271
2 Section D.14: Do as we say, not as we do=t00000272
1 Appendix E: PuTTY download keys and signatures
2 Appendix E: PuTTY download keys and signatures=pgpfingerprints
2 Section E.1: Public keys=t00000273
2 Section E.2: Security details
3 Section E.2: Security details=t00000274
3 Section E.2.1: The Development Snapshots keys=t00000275
3 Section E.2.2: The Releases keys=t00000276
3 Section E.2.3: The Master Keys=t00000277
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+79
View File
@@ -0,0 +1,79 @@
# usage: recentchanges.pl <changelist number> <filespec>
#
# Outputs changelist notes for changelists starting at the changelist number until now
# that involve files in the filespec, grouped by user.
#
# Output file is recentchanges.txt, output to the current working dir.
BEGIN {use File::Basename; push @INC, dirname($0); }
require "valve_perl_helpers.pl";
# take in the revision number we want and the filespec to look at
my $from_changelist = shift;
my $branch = shift;
if ( length($from_changelist) < 1 || length($branch) < 1 )
{
die "usage: recentchanges.pl <'from' changelist number> <filespec>";
}
my $cmd = "p4 changes -l $branch\@$from_changelist,\@now";
my @fstat = &RunCommand( $cmd );
my $lastuser;
my %changes;
foreach $line ( @fstat )
{
#if the line starts with "Change"
#then store the user, all lines after this are changes by this user
if ( $line =~ m/^Change/ )
{
my $data = 'Change (1234) on (date) by (name)@(clientspec)';
my @values = split(' ', $line);
@usersplit = split('@', $values[5]);
$lastuser = $usersplit[0];
}
else
{
#this is a change line, associate it with the user in our %changes hash
chomp($line);
# skip empty and 'merge from main' lines
if ( length($line) > 0 && $line !~ m/Merge from main/ )
{
#strip leading whitespace
$line =~ s/^\s+//;
# if the first char is not '-', add '- ' to the front
if ( $line !~ m/^-/ )
{
$line = "- $line";
}
push @{ $changes{$lastuser} }, $line;
}
}
}
chdir();
open(OUTFILE, ">recentchanges.txt");
foreach $user ( keys %changes )
{
print "$user\n";
print OUTFILE "$user\n";
foreach $i ( 0 .. $#{ $changes{$user} } )
{
print "$changes{$user}[$i]\n";
print OUTFILE "$changes{$user}[$i]\n";
}
print "\n";
print OUTFILE "\n";
}
close(OUTFILE);
Binary file not shown.
+137
View File
@@ -0,0 +1,137 @@
#! perl
use File::Find;
use Cwd;
use File::Basename;
use Getopt::Long;
$last_errors="";
$nosync = 0;
$mail = 0;
$daemon = 0;
$mailto="cgreen";
$mailfrom="autotest";
$ignoremutex = 0;
$result = GetOptions(
"nosync" => \$nosync,
"daemon" => \$daemon,
"mailto:s" => \$mailto,
"mailfrom:s" => \$mailfrom,
"ignoremutex" => \$ignoremutex,
"mail" => \$mail );
$iter = 0;
while( 1 )
{
my $hasChange = 1;
my $mutex_held = 0;
unless($nosync)
{
# check for mutex held
unless( $ignoremutex || $nosync )
{
open(MUTEX,"p4 counters|") || die "cant' run p4";
while(<MUTEX>)
{
$mutex_held = 1 if ( /main_src_lock_\S+\s*=\s*1/);
}
close MUTEX;
}
unless( $mutex_held )
{
print STDERR "Syncing...\n";
system "p4 sync > sync.txt 2>&1";
open SYNC, "<sync.txt";
while( <SYNC> )
{
if( m/File\(s\) up-to-date/ )
{
$hasChange = 0;
}
print;
}
close SYNC;
}
}
if ( $mutex_held )
{
print STDERR "mutex held, waiting\n";
}
else
{
if( $hasChange || ($iter == 0 ) )
{
print "Running tests\n";
&RunUnitTests;
}
else
{
print "no changes\n";
}
$iter++;
last unless ($daemon);
}
sleep 30;
}
sub RunUnitTests
{
$error_output ="";
find(\&Visitfile,".");
if ( length($error_output ) )
{
print STDERR "errors detected\n";
open CHANGES, "p4 changes -m 10 -s submitted //ValveGames/main/src/...|";
my @changes = <CHANGES>;
close CHANGES;
if ( $mail && ($error_output ne $last_errors ) )
{
use Net::SMTP;
$smtp = Net::SMTP->new('exchange2.valvesoftware.com');
$smtp->mail($mailfrom);
$smtp->to($mailto);
$smtp->data();
$smtp->datasend("To: $mailto\n");
$smtp->datasend("Subject: Errors from Unit tests\n");
$smtp->datasend($error_output);
$smtp->datasend("-" x 75);
$smtp->datasend("\nLAST 10 SUBMITS TO MAIN:\n");
$smtp->datasend(join("",@changes ) );
$smtp->dataend();
$smtp->quit;
}
}
$last_errors = $error_output;
}
sub Visitfile
{
local($_)= $File::Find::name;
next unless( -e "test_error_reporting.pl" );
if (/\.(pl|exe|bat)$/i)
{
unlink("errors.txt");
my $extension=$1;
$extension=~tr/A-Z/a-z/;
my $cmd;
$cmd="perl $_" if ( $extension eq "pl");
$cmd="$_" if ( $extension eq "exe");
$cmd="$_" if ( $extension eq "bat");
print STDERR "run $cmd: ",`$cmd`,"\n";
if (open(ERRIN,"errors.txt" ) )
{
local($/);
print STDERR "errors found!\n";
$error_output.="* Failed test: $cmd: ".<ERRIN>."\n";
close ERRIN;
}
}
}
Binary file not shown.
+27
View File
@@ -0,0 +1,27 @@
from vsdotnetxmlparser import *
#print f.GetAttribute( 'VisualStudioProject\\Configurations\\Configuration\\<2>Tool\\CommandLine' )
WriteSeparateVCProj( LoadVCProj( 'cl_dll\\client.vcproj' ), ["Debug DoD|Win32", "Release DoD|Win32"], 'cl_dll\\client_dod.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'cl_dll\\client.vcproj' ), ["Debug CounterStrike|Win32", "Release CounterStrike|Win32"], 'cl_dll\\client_cs.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'cl_dll\\client.vcproj' ), ["Debug HL1|Win32", "Release HL1|Win32"], 'cl_dll\\client_hl1.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'cl_dll\\client.vcproj' ), ["Debug HL2|Win32", "Release HL2|Win32"], 'cl_dll\\client_hl2.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'cl_dll\\client.vcproj' ), ["Debug TF2|Win32", "Release TF2|Win32"], 'cl_dll\\client_tf2.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'cl_dll\\client.vcproj' ), ["Debug SDK|Win32", "Release SDK|Win32"], 'cl_dll\\client_temp_sdk.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'cl_dll\\client.vcproj' ), ["Debug HL2MP|Win32", "Release HL2MP|Win32"], 'cl_dll\\client_hl2mp.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'cl_dll\\client.vcproj' ), ["Debug Episodic HL2|Win32", "Release Episodic HL2|Win32"], 'cl_dll\\client_episodic.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'dlls\\hl.vcproj' ), ["Debug DoD|Win32", "Release DoD|Win32"], 'dlls\\hl_dod.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'dlls\\hl.vcproj' ), ["Debug CounterStrike|Win32", "Release CounterStrike|Win32"], 'dlls\\hl_cs.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'dlls\\hl.vcproj' ), ["Debug HL1|Win32", "Release HL1|Win32"], 'dlls\\hl_hl1.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'dlls\\hl.vcproj' ), ["Debug HL2|Win32", "Release HL2|Win32"], 'dlls\\hl_hl2.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'dlls\\hl.vcproj' ), ["Debug TF2|Win32", "Release TF2|Win32"], 'dlls\\hl_tf2.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'dlls\\hl.vcproj' ), ["Debug SDK|Win32", "Release SDK|Win32"], 'dlls\\hl_temp_sdk.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'dlls\\hl.vcproj' ), ["Debug HL2MP|Win32", "Release HL2MP|Win32"], 'dlls\\hl_hl2mp.vcproj' )
WriteSeparateVCProj( LoadVCProj( 'dlls\\hl.vcproj' ), ["Debug Episodic HL2|Win32", "Release Episodic HL2|Win32"], 'dlls\\hl_episodic.vcproj' )
+60
View File
@@ -0,0 +1,60 @@
# This script sets up VMPI.
$pathToExes = "..\\..\\..\\game\\bin"; # assuming we're under hl2\src\devtools\bin.
my $baseNetworkPath = @ARGV[0];
if ( $baseNetworkPath )
{
my @filesToCopy = (
"tier0.dll",
"vstdlib.dll",
"vmpi_service.exe",
"vmpi_service_ui.exe",
"vmpi_service_install.exe",
"WaitAndRestart.exe",
"vmpi_transfer.exe",
"filesystem_stdio.dll" );
# Verify that the files we're interested in exist.
foreach $filename ( @filesToCopy )
{
my $fullFilename = "$pathToExes\\$filename";
if ( !( -e $fullFilename ) )
{
die "Missing $fullFilename.\n";
}
}
# Create the directories on the network.
if ( !( -e $baseNetworkPath ) )
{
mkdir $baseNetworkPath or die "Can't create directory: $baseNetworkPath";
}
if ( !( -e "$baseNetworkPath\\services" ) )
{
mkdir( "$baseNetworkPath\\services" ) or die "ERROR: Can't create directory: $baseNetworkPath\\services";
}
# Now copy all the files up.
foreach $filename ( @filesToCopy )
{
my $fullFilename = "$pathToExes\\$filename";
`"copy $fullFilename $baseNetworkPath\\services"`;
}
print "\n";
print "Finished installing VMPI into $baseNetworkPath.\n\n";
print "Have all available worker machines run:\n";
print " $baseNetworkPath\\services\\vmpi_service_install.exe\n";
print "to setup the worker service.\n";
}
else
{
print "setup_vmpi.pl <UNC path to a server all machines can access>\n";
print "example: setup_vmpi.pl \\\\ftknox\\scratch\\vmpi\n";
}
+36
View 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";
Binary file not shown.
Binary file not shown.
+54
View 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;
+451
View File
@@ -0,0 +1,451 @@
#
# Arguments parsing
#
local $script = $0;
while ( 1 )
{
local $arg = shift;
if ( $arg =~ /-catsrgb1/i )
{ goto RUN_CAT_SRGB_1; }
if ( $arg =~ /-safecat/i )
{ goto RUN_SAFE_CAT; }
if ( $arg =~ /-delaywrite/i )
{ goto RUN_DELAY_WRITE; }
if ( $arg =~ /-processvmts/i )
{ goto RUN_PROCESS_VMTS; }
# default mode - forward to processvmts:
# exit system( "dir" );
exit system( "dir /s /b *.vmt | perl $script -processvmts" );
}
RUN_CAT_SRGB_1:
#
# ----------- Adding "srgb 1" to options list --------
#
local $bAlreadyHasSrgb1 = 0;
while ( <> )
{
local $line = $_;
print $line;
$bAlreadyHasSrgb1 = 1 if $line =~ /srgb(.*)1/i;
}
print "\nsrgb 1\n" if !$bAlreadyHasSrgb1;
exit 0;
RUN_DELAY_WRITE:
#
# ----------- Delay write to a file (essentially delayed shell redirection) ----
#
local *fileptr;
local $filename = shift;
local @lines;
while ( <> ) { push( @lines, $_ ); }
open( fileptr, ">$filename" );
foreach ( @lines ) { print fileptr $_ ; }
close( fileptr );
exit 0;
RUN_SAFE_CAT:
#
# ----------- Cat of a non-existing file will succeed ----
#
local *fileptr;
local $filename = shift;
exit 1 if !open( fileptr, "<$filename" );
while ( <fileptr> ) { print $_ ; }
close( fileptr );
exit 0;
RUN_PROCESS_VMTS:
#
# ----------- Processing the list of vmts ------------
#
#
# Lookup array of directories under which to search for
# textures when resolving texture paths from vmt.
#
local @textureslookup = (
# "u:/data/content/tf/",
# "u:/data/content/portal/",
# "u:/data/content/ep2/",
# "u:/data/content/episodic/",
"u:/data/content/hl2/",
);
#
# Mapping of shaders that require srgb conversion for
# basetextures. Entries listed lowercase, mapped to 1.
#
local %srgbshaders = (
vertexlitgeneric => 1,
lightmappedgeneric => 1,
unlitgeneric => 1,
eyerefract => 1,
portalrefract => 1,
aftershock => 1,
sky => 1,
lightmappedreflective => 1,
portalstaticoverlay => 1,
particlesphere => 1,
shatteredglass => 1,
sprite => 1,
spritecard => 1,
teeth => 1,
treeleaf => 1,
vortwarp => 1,
water => 1,
windowimposter => 1,
worldtwotextureblend => 1,
worldvertexalpha => 1,
);
#
# Mapping of variables that we will be looking for.
#
local %shadervarscheck = (
basetexture => 1,
basetexture2 => 1,
basetexture3 => 1,
basetexture4 => 1,
envmap => 1,
iris => 1,
ambientoccltexture => 1,
refracttinttexture => 1,
albedo => 1,
compress => 1,
stretch => 1,
emissiveblendbasetexture => 1,
emissiveblendtexture => 1,
fleshinteriortexture => 1,
fleshbordertexture1d => 1,
fleshsubsurfacetexture => 1,
fleshcubetexture => 1,
texture2 => 1,
hdrcompressedtexture => 1,
hdrcompressedtexture0 => 1,
hdrcompressedtexture1 => 1,
hdrcompressedtexture2 => 1,
portalcolortexture => 1,
monitorscreen => 1,
staticblendtexture => 1,
refracttexture => 1,
reflecttexture => 1,
);
#
# After parsing the list of vmt files contains a map of
# texture names as keys to the list of two elements:
# [0]
# 0: texture is non-srgb
# 1: texture is srgb and needs conversion
# -1: texture is ambiguous
# [1]
# list of vmts referring to the texture
#
local %textures2convert;
#
# Parse our list of vmt files
# Generate the list with "dir /s /b *.vmt"
#
while ( <> )
{
local $fname = $_;
$fname =~ s/^\s*(.*)\s*$/$1/;
$fname =~ s/\\/\//g;
# print "-" . $fname . "-\n";
# Open the file
local *vmtfileptr;
open( vmtfileptr, "<$fname" ) || die;
local $line;
local $shadername;
local %basetexture;
local $basetexture_real;
local $basetexture_blacklisted = 0;
# Find shadername and textures
while ( $line = <vmtfileptr> )
{
$line =~ s/^\s*(.*)\s*$/$1/;
$line = lc( $line );
if ( $. == 1 )
{
$shadername = $line;
$shadername =~ s/\"//g;
}
while ( ( $varname, undef ) = each %shadervarscheck )
{
next if $line !~ /^\s*["]?\$$varname["]?\s+(.*)$/i;
$line = $1;
if ( $line =~ /^\"([^\"])*\"(.*)$/ ) {
$line =~ s/^\"([^\"]*)\"(.*)$/$1/;
} else {
$line =~ s/^(\S*)(.*)$/$1/;
}
$line =~ s/^\s*(.*)\s*$/$1/;
$line =~ s/\\/\//g;
next if $line =~ /^\_rt/i;
$basetexture{ $line } = 1;
$basetexture_real = $line if $varname =~ /^basetexture$/i;
last;
}
# blacklist stuff
$basetexture_blacklisted = 1 if $line =~ /^\s*["]?\$extractgreenalpha["]?\s*(.*)$/i;
print ">>> $fname blacklisted by >>> $line >>>\n" if $line =~ /^\s*["]?\$extractgreenalpha["]?\s*(.*)$/i;
}
delete $basetexture{ $basetexture_real } if $basetexture_blacklisted;
print ">>> blacklisted texture: $basetexture_real .\n" if $basetexture_blacklisted;
delete $basetexture{ "env_cubemap" };
close vmtfileptr;
# Print the shader and the base texture
# print "\tshader = " . $shadername . "\n";
# foreach ( keys %basetexture ) { print "\ttexture = " . $_ . "\n" };
# If the texture needs a conversion stick it into the map
local $isSrgb = 1; #--shadercheck--( exists $srgbshaders{ $shadername } ? 1 : 0 );
foreach ( keys %basetexture )
{
local $basetexture = $_;
if ( exists $textures2convert{ $basetexture } )
{
# Check for validity
$isSrgb = -1 if $textures2convert{ $basetexture }->[0] != $isSrgb;
}
else
{
$textures2convert{ $basetexture } = [ $isSrgb, [] ];
}
$textures2convert{ $basetexture }->[0] = $isSrgb;
push( @{ $textures2convert{ $basetexture }->[1] }, $fname );
}
}
#
# Now walk over the accumulated textures and establish the srgb mapping
#
local @failedtextures;
while ( ( $basetexture, $value ) = each %textures2convert )
{
local $isSrgb = $value->[0];
if ( -1 == $isSrgb )
{
print "Warning: Ambiguity for ";
print "$basetexture from ";
foreach ( @{ $value->[1] } ) { print " $_"; };
print "!\n";
}
next if 1 != $isSrgb;
#
# Need to convert this texture
#
local $res = ConvertTexture( $basetexture );
push( @failedtextures, $basetexture ) if !$res;
}
# Dump failed textures
if ( $#failedtextures > 0 )
{
print "\n---- errors ----\n";
foreach ( @failedtextures )
{
local $basetexture = $_;
print "ERROR: $basetexture in ";
foreach ( @{ $textures2convert{ $basetexture }->[1] } ) { print " $_"; }
print ";\n";
}
print "---- end ----\n";
}
#
# Converts a texture.
# Returns 1 for txt, 2 for psd, 3 for newly created txt.
# Returns 0 when nothing found.
#
sub ConvertTexture
{
local $basetexture = shift;
local $result = 0;
print "-- $basetexture ... ";
foreach ( @textureslookup )
{
# Try to open the txt file
local $txpath = $_ . "materialsrc/" . $basetexture;
if ( -f "$txpath.txt" || -f "$txpath.tga" )
{
# Check it out
print "txt, p4 ... ";
`p4 edit "$txpath.txt" >nul 2>&1`;
`p4 lock "$txpath.txt" >nul 2>&1`;
`perl $script -safecat "$txpath.txt" | perl $script -catsrgb1 | perl $script -delaywrite "$txpath.txt"`;
`p4 add "$txpath.txt" >nul 2>&1` if -f "$txpath.txt";
# Also patch the VTF
$txpath =~ s,/content/,/game/,;
$txpath =~ s,/materialsrc/,/materials/,;
#PatchVtfFile( "$txpath.vtf" );
print "done ... ";
++ $result;
}
if ( -f "$txpath.psd" )
{
# Check it out
print "psd, p4 ... ";
`p4 edit "$txpath.psd" >nul 2>&1`;
`p4 lock "$txpath.psd" >nul 2>&1`;
`psdinfo -read "$txpath.psd" | perl $script -catsrgb1 | psdinfo -write "$txpath.psd"`;
`p4 add "$txpath.psd" >nul 2>&1`;
# Also patch the VTF
$txpath =~ s,/content/,/game/,;
$txpath =~ s,/materialsrc/,/materials/,;
#PatchVtfFile( "$txpath.vtf" );
print "done ... ";
++ $result;
}
}
foreach ( @textureslookup )
{
# Try to find the vtf file
local $txpath = $_ . "materials/" . $basetexture;
$txpath =~ s,/content/,/game/,i;
if ( -f "$txpath.vtf" )
{
if ( !$result )
{
# Create the text file then
print "src missing ... ";
$txpath =~ s,/game/,/content/,,i;
$txpath =~ s,/materials/,/materialsrc/,;
`p4 edit "$txpath.txt" >nul 2>&1`;
`p4 lock "$txpath.txt" >nul 2>&1`;
`perl $script -safecat "$txpath.txt" | perl $script -catsrgb1 | perl $script -delaywrite "$txpath.txt"`;
`p4 add "$txpath.txt" >nul 2>&1` if -f "$txpath.txt";
# Also patch the VTF
$txpath =~ s,/content/,/game/,;
$txpath =~ s,/materialsrc/,/materials/,;
}
PatchVtfFile( "$txpath.vtf" );
print "done ... ";
++ $result;
}
}
if ( !$result )
{
print "ERROR: not found.\n";
}
else
{
print "ok.\n";
}
return $result;
}
exit 0;
RUN_PATCH_VTF:
#
# ----------- Patch a VTF file --------
#
local $filename = shift;
exit PatchVtfFile( $filename );
sub PatchVtfFile
{
local *fileptr;
local $filename = shift;
local $vtfFlags;
print "vtf, p4 ... ";
`p4 edit "$filename" >nul 2>&1`;
`p4 lock "$filename" >nul 2>&1`;
if ( !open( fileptr, "+<$filename" ) )
{
print "VTF missing ... ";
return 1;
}
binmode( fileptr );
seek( fileptr, 5 * 4, 0 );
read( fileptr, $vtfFlags, 4 );
$vtfFlags = unpack( "I", $vtfFlags );
# adding SRGB flag
$vtfFlags = $vtfFlags | 0x00000040; # mask or
seek( fileptr, 5 * 4, 0 );
print fileptr pack( "I", $vtfFlags );
close( fileptr );
print "vtf ok ... ";
return 0;
}
Binary file not shown.
+14
View File
@@ -0,0 +1,14 @@
"Universe"
{
"Public"
{
"Keys"
{
"CodeSignature"
{
"EncryptedPrivateKey" "6DA7F10F1B16A4012FFDE4BB09B857A8E3254573CDE9C0E91B12AEF01E8B1624FB8606058946D7D45AEE3C73EE69F6BC30CE703D25ACAC7C96DC5A87EB8DE6B2820AF5BDD5835E3BBA8C6BF679595323212E82E1BCEF57EAF06338084D3E0592F7B9A6F1BBE752947F72BC80C4A50493F7ECBA39FD73CF02BBEFF407BFCD9D956E0F337D4A68D82998979BD11409BC2A908580DB2DB3FECB96D1F95DB4C28E50900B0413D02D5073E669B54A090F5B19CA6B8A918B81CEC7EEF105E181235713B8BE293E149CF6F3CBA0AAC96B6017ECC51B00C31526F357CCD3F5889FC5895C3787399AE22CCA53B3AADEBC2D1FE3A6C1D628A0CF8D68808A08BDADA904555613B00889CD4A59F1B42FC88ACEE2C350CB4EA12B8A9CD3CE16A7E4832817D2A4C7B420AFC3BC3596513B4E3690508848AF55D83693E30199E97A42467B24585DEA5C6311D94BDE922FD7795B434D6ACCB544A04E290D3D944727D35C1A9478F33E82D3C6B97EE615FAFD0A82CCCB65EABD07580630FA6C654631695B5A0F1B9AD1E86297499E1DDC992D82D782B67AA809B8102780327A7DB4EB56FBA0FB5614D65E88A88BF322CE21DB5651CBABB0A01DAC97F78E1A92EA3CF5C2EA23A4921264137F2CCE3417857FD93347BD9C46EFD89E0016912BD7ED807252EEF43C88573EE3D66F345E55B185A9372D0A84DF574895EC4D2BF4572A1D1250D6BAB76C528B17957DA67201331C3CE20D255C2A01CA704E05F65FA9DFCF498B84F3E4E0C3D42F9D6FDAC0DD5708512F609FFF6290BEA8B00B758474E03391C475E376DD3A4586939E08454D293BF3D365D8472AF36125008630BE95339D893BF061E178CC46BC0BEB6D8420BF366E612718D4C30F39B6276DBE155F744A88663E2BAE53DC83B5BF60704BEAF9002EE1AB64E5E644"
"PublicKey" "30819D300D06092A864886F70D010101050003818B0030818702818100B1260881BDFE84463D88C6AB8DB914A2E593893C10508B8A5ABDF692E9A5419A3EDBAE86A052849983B75E3B425C18178B260003D857DF0B6505C6CF9C84F5859FCE3B63F1FB2D4818501F6C5FA4AD1430EEB081A74ABD74CD1F4AA1FCCA3B88DD0548AED34443CEB52444EAE9099AA4FE66B2E6224D02381C248025C7044079020111"
}
}
}
}
Binary file not shown.
Binary file not shown.
+64
View File
@@ -0,0 +1,64 @@
#perl
#! perl
use Getopt::Long;
$mail = 1;
$mailto="cgreen";
$mailfrom="cgreen\@valvesoftware.com";
$branch="main";
$result = GetOptions(
"nosync" => \$nosync,
"clean" => \$clean,
"mailto:s" => \$mailto,
"branch:s" => \$branch,
"mailfrom:s" => \$mailfrom,
"mail" => \$mail );
print STDERR `p4 sync` unless ($nosync);
print STDERR `perl devtools/bin/vpc2linuxmake.pl`;
print STDERR `make clean` if ($clean);
open(ERROROUT, "./linux_makeinorder.sh 2>&1 |" ) || die "can't create pipe to compile";
while(<ERROROUT>)
{
my $iserror = /error:/;
$iserror = 1 if (/^.*:\d+:\d+:/);
$errtxt .= $_ if ($iserror );
print $_;
}
if (length($errtxt) )
{
if ($mail)
{
use Net::SMTP;
open CHANGES, "p4 changes -m 10 -s submitted //ValveGames/$branch/src/...|";
my @changes = <CHANGES>;
close CHANGES;
$smtp = Net::SMTP->new('exchange2.valvesoftware.com');
$smtp->mail($mailfrom);
$smtp->to($mailto);
$smtp->data();
$smtp->datasend("To: $mailto\n");
$smtp->datasend("Subject: [$branch broken in linux]\n");
$smtp->datasend("\nThere are errors building $branch for linux.\nSome help is available at http://intranet.valvesoftware.com/wiki/index.php/Writing_code_that_is_compatible_between_gcc_and_visual_studio\n\n$errtxt");
$smtp->datasend("-" x 75);
$smtp->datasend("\nLAST 10 SUBMITS TO MAIN:\n");
$smtp->datasend(join("",@changes ) );
$smtp->dataend();
$smtp->quit;
}
else
{
print STDERR "*****ERRORS****\n$errtxt\n";
}
}
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More