summaryrefslogtreecommitdiff
path: root/utils/valvelib
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /utils/valvelib
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'utils/valvelib')
-rw-r--r--utils/valvelib/chooser.cpp77
-rw-r--r--utils/valvelib/chooser.h41
-rw-r--r--utils/valvelib/cstm1dlg.cpp396
-rw-r--r--utils/valvelib/cstm1dlg.h69
-rw-r--r--utils/valvelib/debug.cpp87
-rw-r--r--utils/valvelib/debug.h63
-rw-r--r--utils/valvelib/hlp/valvelib.hpj13
-rw-r--r--utils/valvelib/hlp/valvelib.rtf23
-rw-r--r--utils/valvelib/res/valvelib.icobin0 -> 766 bytes
-rw-r--r--utils/valvelib/resource.h34
-rw-r--r--utils/valvelib/stdafx.cpp13
-rw-r--r--utils/valvelib/stdafx.h29
-rw-r--r--utils/valvelib/template/confirm.inf28
-rw-r--r--utils/valvelib/template/newproj.inf20
-rw-r--r--utils/valvelib/valvelib.clw44
-rw-r--r--utils/valvelib/valvelib.cpp47
-rw-r--r--utils/valvelib/valvelib.h23
-rw-r--r--utils/valvelib/valvelib.rc202
-rw-r--r--utils/valvelib/valvelib.vcproj354
-rw-r--r--utils/valvelib/valvelibaw.cpp491
-rw-r--r--utils/valvelib/valvelibaw.h43
21 files changed, 2097 insertions, 0 deletions
diff --git a/utils/valvelib/chooser.cpp b/utils/valvelib/chooser.cpp
new file mode 100644
index 0000000..a2706fa
--- /dev/null
+++ b/utils/valvelib/chooser.cpp
@@ -0,0 +1,77 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+// chooser.cpp : Implements the CDialogChooser class
+//
+
+#include "stdafx.h"
+#include "valvelib.h"
+#include "chooser.h"
+#include "cstm1dlg.h"
+
+#ifdef _PSEUDO_DEBUG
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+// On construction, set up internal array with pointers to each step.
+CDialogChooser::CDialogChooser()
+{
+ m_pDlgs[0] = NULL;
+
+ m_pDlgs[1] = new CCustom1Dlg;
+
+ m_nCurrDlg = 0;
+}
+// Remember where the custom steps begin, so we can delete them in
+// the destructor
+#define FIRST_CUSTOM_STEP 1
+#define LAST_CUSTOM_STEP 1
+
+// The destructor deletes entries in the internal array corresponding to
+// custom steps.
+CDialogChooser::~CDialogChooser()
+{
+ for (int i = FIRST_CUSTOM_STEP; i <= LAST_CUSTOM_STEP; i++)
+ {
+ ASSERT(m_pDlgs[i] != NULL);
+ delete m_pDlgs[i];
+ }
+}
+
+// Use the internal array to determine the next step.
+CAppWizStepDlg* CDialogChooser::Next(CAppWizStepDlg* pDlg)
+{
+ ASSERT(0 <= m_nCurrDlg && m_nCurrDlg < LAST_DLG);
+ ASSERT(pDlg == m_pDlgs[m_nCurrDlg]);
+
+ m_nCurrDlg++;
+
+ // Force the custom dialog to re-figire out stuff when we enter it...
+// if (m_nCurrDlg == 1)
+// {
+// (CCustom1Dlg*)m_pDlgs[1]->Refresh
+// }
+
+ return m_pDlgs[m_nCurrDlg];
+}
+
+// Use the internal array to determine the previous step.
+CAppWizStepDlg* CDialogChooser::Back(CAppWizStepDlg* pDlg)
+{
+ ASSERT(1 <= m_nCurrDlg && m_nCurrDlg <= LAST_DLG);
+ ASSERT(pDlg == m_pDlgs[m_nCurrDlg]);
+
+ m_nCurrDlg--;
+
+ // Force the custom dialog to re-figire out stuff when we enter it...
+ if (m_nCurrDlg == 1)
+ {
+ }
+
+ return m_pDlgs[m_nCurrDlg];
+}
diff --git a/utils/valvelib/chooser.h b/utils/valvelib/chooser.h
new file mode 100644
index 0000000..3ccab8e
--- /dev/null
+++ b/utils/valvelib/chooser.h
@@ -0,0 +1,41 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+#if !defined(AFX_CHOOSER_H__132A47A9_C09B_41B3_9222_861583CB901A__INCLUDED_)
+#define AFX_CHOOSER_H__132A47A9_C09B_41B3_9222_861583CB901A__INCLUDED_
+
+// chooser.h : declaration of the CDialogChooser class
+// This class keeps track of what dialogs to pop up when.
+
+#define LAST_DLG 1
+
+class CDialogChooser
+{
+public:
+ CDialogChooser();
+ ~CDialogChooser();
+
+ // All calls by mfcapwz.dll to CValvelibAppWiz::Next
+ // & CValvelibAppWiz::Back are delegated to these member
+ // functions, which keep track of what dialog is up
+ // now, and what to pop up next.
+ CAppWizStepDlg* Next(CAppWizStepDlg* pDlg);
+ CAppWizStepDlg* Back(CAppWizStepDlg* pDlg);
+
+protected:
+ // Current step's index into the internal array m_pDlgs
+ int m_nCurrDlg;
+
+ // Internal array of pointers to the steps
+ CAppWizStepDlg* m_pDlgs[LAST_DLG + 1];
+};
+
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_CHOOSER_H__132A47A9_C09B_41B3_9222_861583CB901A__INCLUDED_)
diff --git a/utils/valvelib/cstm1dlg.cpp b/utils/valvelib/cstm1dlg.cpp
new file mode 100644
index 0000000..aecf9dd
--- /dev/null
+++ b/utils/valvelib/cstm1dlg.cpp
@@ -0,0 +1,396 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+// cstm1dlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "valvelib.h"
+#include "cstm1dlg.h"
+#include "valvelibaw.h"
+
+#ifdef _PSEUDO_DEBUG
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CCustom1Dlg dialog
+
+
+CCustom1Dlg::CCustom1Dlg()
+ : CAppWizStepDlg(CCustom1Dlg::IDD)
+{
+ //{{AFX_DATA_INIT(CCustom1Dlg)
+ m_RootPath = _T("");
+ m_TargetPath = _T("");
+ m_ProjectType = -1;
+ m_ToolProject = FALSE;
+ m_ImplibPath = _T("");
+ m_PublicProject = FALSE;
+ m_ConsoleApp = FALSE;
+ m_PublishImportLib = FALSE;
+ m_SrcPath = _T("");
+ //}}AFX_DATA_INIT
+
+ m_ProjectType = 0;
+ m_PublicProject = TRUE;
+ m_SrcPath = "src";
+}
+
+
+void CCustom1Dlg::DoDataExchange(CDataExchange* pDX)
+{
+ if (pDX->m_bSaveAndValidate == 0)
+ {
+ // Refresh the paths based on project information...
+ if (m_RootPath.GetLength() == 0)
+ {
+ if (!Valvelibaw.m_Dictionary.Lookup("FULL_DIR_PATH", m_RootPath))
+ m_RootPath = "u:\\hl2\\";
+
+ m_RootPath.MakeLower();
+
+ m_ToolProject = (m_RootPath.Find( "util" ) >= 0);
+
+ int idx = m_RootPath.Find( m_SrcPath ); // look for src tree
+ if (idx >= 0)
+ {
+ m_RootPath = m_RootPath.Left( idx );
+ }
+
+ m_TargetPath = m_RootPath;
+ m_TargetPath += m_SrcPath;
+ m_TargetPath += "\\lib\\public\\";
+
+ m_ImplibPath = "unused";
+ EnableCheckboxes();
+ }
+ }
+
+ CAppWizStepDlg::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CCustom1Dlg)
+ DDX_Text(pDX, IDC_EDIT_ROOT_PATH, m_RootPath);
+ DDX_Text(pDX, IDC_EDIT_TARGET_PATH, m_TargetPath);
+ DDX_CBIndex(pDX, IDC_SELECT_PROJECT_TYPE, m_ProjectType);
+ DDX_Check(pDX, IDC_CHECK_TOOL, m_ToolProject);
+ DDX_Text(pDX, IDC_EDIT_IMPLIB_PATH, m_ImplibPath);
+ DDX_Check(pDX, IDC_CHECK_PUBLIC, m_PublicProject);
+ DDX_Check(pDX, IDC_CHECK_CONSOLE_APP, m_ConsoleApp);
+ DDX_Check(pDX, IDC_CHECK_PUBLISH_IMPORT, m_PublishImportLib);
+ DDX_Text(pDX, IDC_EDIT_SRC_PATH, m_SrcPath);
+ //}}AFX_DATA_MAP
+}
+
+static void FixupPath( CString& path )
+{
+ int idx;
+ idx = path.Find("/");
+ while (idx >= 0)
+ {
+ path.SetAt(idx, '\\' );
+ idx = path.Find("/");
+ }
+
+ bool hasTerminatingSlash = ( path.Right(1).Find("\\") >= 0 );
+ if (!hasTerminatingSlash)
+ path += '\\';
+
+ path.MakeLower();
+}
+
+static int CountSlashes( CString& path )
+{
+ int count = 0;
+
+ int idx = path.Find("\\", 0);
+ while (idx >= 0)
+ {
+ ++count;
+ idx = path.Find("\\", idx+1 );
+ }
+
+ return count;
+}
+
+bool CCustom1Dlg::ComputeRelativePath( )
+{
+ if ( m_RootPath.GetAt(1) != ':' )
+ {
+ MessageBox( "Error! The root path must specify a drive!", "Bogus Root Path!", MB_ICONERROR | MB_OK );
+ return false;
+ }
+
+ if ( m_TargetPath.GetAt(1) != ':' )
+ {
+ MessageBox( "Error! The target path must specify a drive!", "Bogus Target Path!", MB_ICONERROR | MB_OK );
+ return false;
+ }
+
+ CString sourcePath;
+ if (!Valvelibaw.m_Dictionary.Lookup("FULL_DIR_PATH", sourcePath ))
+ {
+ MessageBox( "I can't seem to find the source path!??!", "Umm... Get Brian", MB_ICONERROR | MB_OK );
+ return false;
+ }
+
+ FixupPath( m_RootPath );
+ FixupPath( m_TargetPath );
+ FixupPath( sourcePath );
+
+ CString srcRootPath = m_RootPath;
+ srcRootPath += m_SrcPath;
+ srcRootPath += "\\";
+ FixupPath( srcRootPath );
+
+ if (sourcePath.Find( srcRootPath ) != 0)
+ {
+ MessageBox( "Error! The source path must lie under the root source path!", "Bogus Root Path!", MB_ICONERROR | MB_OK );
+ return false;
+ }
+
+ if (m_TargetPath.Find( m_RootPath ) != 0)
+ {
+ MessageBox( "Error! The target path must lie under the root path!", "Bogus Target Path!", MB_ICONERROR | MB_OK );
+ return false;
+ }
+
+ int rootLen = m_RootPath.GetLength();
+ int rootSrcLen = srcRootPath.GetLength();
+ int sourceLen = sourcePath.GetLength();
+ int targetLen = m_TargetPath.GetLength();
+ CString relativePath = m_TargetPath.Right( targetLen - rootLen );
+
+ // Now that we've got the relative source path,
+ // find out how many slashes are in it;
+ // that'll tell us how many paths to back up....
+ int i;
+ CString relativeSourcePath = sourcePath.Right( sourceLen - rootLen );
+ int numSlashes = CountSlashes(relativeSourcePath);
+ CString targetRelativePath;
+ for ( i = 0; i < numSlashes; ++i )
+ {
+ targetRelativePath += "..\\";
+ }
+
+ // Now that we've got the relative source path,
+ // find out how many slashes are in it;
+ // that'll tell us how many paths to back up....
+ CString rootSrcToProj = sourcePath.Right( sourceLen - rootSrcLen );
+ numSlashes = CountSlashes(rootSrcToProj);
+ CString projToRootSrc;
+ for ( i = 0; i < numSlashes; ++i )
+ {
+ projToRootSrc += "..\\";
+ }
+
+ Valvelibaw.m_Dictionary["VALVE_ROOT_RELATIVE_PATH"] = targetRelativePath;
+ Valvelibaw.m_Dictionary["VALVE_SRC_RELATIVE_PATH"] = projToRootSrc;
+ targetRelativePath += relativePath;
+ Valvelibaw.m_Dictionary["VALVE_ROOT_PATH"] = m_RootPath;
+ Valvelibaw.m_Dictionary["VALVE_ROOT_SRC_PATH"] = srcRootPath;
+ Valvelibaw.m_Dictionary["VALVE_TARGET_PATH"] = m_TargetPath;
+ Valvelibaw.m_Dictionary["VALVE_RELATIVE_PATH"] = targetRelativePath;
+
+ if (m_ToolProject)
+ Valvelibaw.m_Dictionary["VALVE_TOOL"] = "1";
+ if (m_PublicProject && (m_ProjectType != 2))
+ Valvelibaw.m_Dictionary["VALVE_PUBLIC_PROJECT"] = "1";
+ if (m_PublishImportLib && (m_ProjectType == 1))
+ Valvelibaw.m_Dictionary["VALVE_PUBLISH_IMPORT_LIB"] = "1";
+
+ // Import libraries
+ if (m_ProjectType == 1)
+ {
+ if ( m_ImplibPath.GetAt(1) != ':' )
+ {
+ MessageBox( "Error! The import library path must specify a drive!", "Bogus Import Library Path!", MB_ICONERROR | MB_OK );
+ return false;
+ }
+
+ if (m_ImplibPath.Find( srcRootPath ) != 0)
+ {
+ MessageBox( "Error! The import library path must lie under the root src path!", "Bogus Target Path!", MB_ICONERROR | MB_OK );
+ return false;
+ }
+
+ int implibLen = m_ImplibPath.GetLength();
+ relativePath = m_ImplibPath.Right( implibLen - rootSrcLen );
+ int numSlashes = CountSlashes(rootSrcToProj);
+ CString implibRelativePath;
+ for (int i = 0; i < numSlashes; ++i )
+ {
+ implibRelativePath += "..\\";
+ }
+ implibRelativePath += relativePath;
+
+ Valvelibaw.m_Dictionary["VALVE_IMPLIB_PATH"] = m_ImplibPath;
+ Valvelibaw.m_Dictionary["VALVE_IMPLIB_RELATIVE_PATH"] = implibRelativePath;
+ }
+
+ return true;
+}
+
+// This is called whenever the user presses Next, Back, or Finish with this step
+// present. Do all validation & data exchange from the dialog in this function.
+BOOL CCustom1Dlg::OnDismiss()
+{
+ if (!UpdateData(TRUE))
+ return FALSE;
+
+ if (!ComputeRelativePath())
+ return FALSE;
+
+ switch( m_ProjectType )
+ {
+ case 0:
+ Valvelibaw.m_Dictionary["VALVE_TARGET_TYPE"] = "lib";
+ Valvelibaw.m_Dictionary["PROJTYPE_LIB"] = "1";
+ break;
+
+ case 1:
+ Valvelibaw.m_Dictionary["VALVE_TARGET_TYPE"] = "dll";
+ Valvelibaw.m_Dictionary["PROJTYPE_DLL"] = "1";
+ break;
+
+ case 2:
+ Valvelibaw.m_Dictionary["VALVE_TARGET_TYPE"] = "exe";
+
+ if (m_ConsoleApp)
+ {
+ Valvelibaw.m_Dictionary["PROJTYPE_CON"] = "1";
+ }
+ break;
+ }
+
+ return TRUE; // return FALSE if the dialog shouldn't be dismissed
+}
+
+
+BEGIN_MESSAGE_MAP(CCustom1Dlg, CAppWizStepDlg)
+ //{{AFX_MSG_MAP(CCustom1Dlg)
+ ON_CBN_SELCHANGE(IDC_SELECT_PROJECT_TYPE, OnSelchangeSelectProjectType)
+ ON_EN_CHANGE(IDC_EDIT_ROOT_PATH, OnChangeEditRootPath)
+ ON_BN_CLICKED(IDC_CHECK_PUBLIC, OnCheckPublic)
+ ON_BN_CLICKED(IDC_CHECK_TOOL, OnCheckTool)
+ ON_BN_CLICKED(IDC_CHECK_PUBLISH_IMPORT, OnCheckPublishImport)
+ ON_EN_CHANGE(IDC_EDIT_SRC_PATH, OnChangeEditSrcPath)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CCustom1Dlg message handlers
+
+void CCustom1Dlg::RecomputeTargetPath()
+{
+ bool hasTerminatingSlash = ( m_RootPath.Right(1).FindOneOf("\\/") >= 0 );
+
+ m_TargetPath = m_RootPath;
+ if (!hasTerminatingSlash)
+ m_TargetPath += '\\';
+ m_ImplibPath = m_TargetPath;
+
+ switch( m_ProjectType )
+ {
+ case 0:
+ // static library
+ m_TargetPath += m_SrcPath;
+ m_TargetPath += m_PublicProject ? "\\lib\\public\\" : "\\lib\\common\\";
+ m_ImplibPath = "unused";
+ break;
+
+ case 1:
+ m_TargetPath += "bin\\";
+ m_ImplibPath += m_SrcPath;
+ m_ImplibPath += m_PublicProject ? "\\lib\\public\\" : "\\lib\\common\\";
+ break;
+
+ case 2:
+ m_TargetPath += "bin\\";
+ m_ImplibPath = "unused";
+ break;
+ }
+
+ UpdateData(FALSE);
+}
+
+void CCustom1Dlg::EnableCheckboxes()
+{
+ CWnd* pConsoleApp = GetDlgItem(IDC_CHECK_CONSOLE_APP);
+ CWnd* pPublishImport = GetDlgItem(IDC_CHECK_PUBLISH_IMPORT);
+ CWnd* pImportLib = GetDlgItem(IDC_EDIT_IMPLIB_PATH);
+ switch (m_ProjectType)
+ {
+ case 0:
+ pConsoleApp->EnableWindow( false );
+ pPublishImport->EnableWindow( false );
+ pImportLib->EnableWindow( false );
+ break;
+
+ case 1:
+ pConsoleApp->EnableWindow( false );
+ pPublishImport->EnableWindow( true );
+ pImportLib->EnableWindow( m_PublishImportLib );
+ break;
+
+ case 2:
+ pConsoleApp->EnableWindow( true );
+ pPublishImport->EnableWindow( false );
+ pImportLib->EnableWindow( false );
+ break;
+ }
+}
+
+void CCustom1Dlg::OnSelchangeSelectProjectType()
+{
+ if (!UpdateData(TRUE))
+ return;
+
+ RecomputeTargetPath();
+ EnableCheckboxes();
+}
+
+void CCustom1Dlg::OnChangeEditRootPath()
+{
+ if (!UpdateData(TRUE))
+ return;
+
+ RecomputeTargetPath();
+}
+
+void CCustom1Dlg::OnCheckPublic()
+{
+ if (!UpdateData(TRUE))
+ return;
+
+ RecomputeTargetPath();
+}
+
+void CCustom1Dlg::OnCheckTool()
+{
+ if (!UpdateData(TRUE))
+ return;
+
+ RecomputeTargetPath();
+}
+
+void CCustom1Dlg::OnCheckPublishImport()
+{
+ if (!UpdateData(TRUE))
+ return;
+
+ EnableCheckboxes();
+}
+
+void CCustom1Dlg::OnChangeEditSrcPath()
+{
+ if (!UpdateData(TRUE))
+ return;
+
+ RecomputeTargetPath();
+}
diff --git a/utils/valvelib/cstm1dlg.h b/utils/valvelib/cstm1dlg.h
new file mode 100644
index 0000000..a1ba09e
--- /dev/null
+++ b/utils/valvelib/cstm1dlg.h
@@ -0,0 +1,69 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+#if !defined(AFX_CSTM1DLG_H__F9EAE5A1_5043_41B1_80CA_495CB6723480__INCLUDED_)
+#define AFX_CSTM1DLG_H__F9EAE5A1_5043_41B1_80CA_495CB6723480__INCLUDED_
+
+// cstm1dlg.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CCustom1Dlg dialog
+
+class CCustom1Dlg : public CAppWizStepDlg
+{
+// Construction
+public:
+ CCustom1Dlg();
+ virtual BOOL OnDismiss();
+
+// Dialog Data
+ //{{AFX_DATA(CCustom1Dlg)
+ enum { IDD = IDD_CUSTOM1 };
+ CString m_RootPath;
+ CString m_TargetPath;
+ int m_ProjectType;
+ BOOL m_ToolProject;
+ CString m_ImplibPath;
+ BOOL m_PublicProject;
+ BOOL m_ConsoleApp;
+ BOOL m_PublishImportLib;
+ CString m_SrcPath;
+ //}}AFX_DATA
+
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CCustom1Dlg)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+ // Generated message map functions
+ //{{AFX_MSG(CCustom1Dlg)
+ afx_msg void OnSelchangeSelectProjectType();
+ afx_msg void OnChangeEditRootPath();
+ afx_msg void OnCheckPublic();
+ afx_msg void OnCheckTool();
+ afx_msg void OnCheckPublishImport();
+ afx_msg void OnChangeEditSrcPath();
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+
+private:
+ void RecomputeTargetPath();
+ bool ComputeRelativePath( );
+ void EnableCheckboxes();
+};
+
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_CSTM1DLG_H__F9EAE5A1_5043_41B1_80CA_495CB6723480__INCLUDED_)
diff --git a/utils/valvelib/debug.cpp b/utils/valvelib/debug.cpp
new file mode 100644
index 0000000..df54867
--- /dev/null
+++ b/utils/valvelib/debug.cpp
@@ -0,0 +1,87 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+#include "stdafx.h"
+
+#ifdef _PSEUDO_DEBUG // entire file
+
+#ifdef _PSEUDO_DEBUG
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+LONG AssertBusy = -1;
+LONG AssertReallyBusy = -1;
+
+BOOL AssertFailedLine(LPCSTR lpszFileName, int nLine)
+{
+ TCHAR szMessage[_MAX_PATH*2];
+
+ InterlockedDecrement(&AssertReallyBusy);
+
+ // format message into buffer
+ wsprintf(szMessage, _T("File %hs, Line %d"),
+ lpszFileName, nLine);
+
+ TCHAR szT[_MAX_PATH*2 + 20];
+ wsprintf(szT, _T("Assertion Failed: %s\n"), szMessage);
+ OutputDebugString(szT);
+
+ if (InterlockedIncrement(&AssertBusy) > 0)
+ {
+ InterlockedDecrement(&AssertBusy);
+
+ // assert within assert (examine call stack to determine first one)
+ DebugBreak();
+ return FALSE;
+ }
+
+ // active popup window for the current thread
+ HWND hWndParent = GetActiveWindow();
+ if (hWndParent != NULL)
+ hWndParent = GetLastActivePopup(hWndParent);
+
+ // display the assert
+ int nCode = ::MessageBox(hWndParent, szMessage, _T("Assertion Failed!"),
+ MB_TASKMODAL|MB_ICONHAND|MB_ABORTRETRYIGNORE|MB_SETFOREGROUND);
+
+ // cleanup
+ InterlockedDecrement(&AssertBusy);
+
+ if (nCode == IDIGNORE)
+ return FALSE; // ignore
+
+ if (nCode == IDRETRY)
+ return TRUE; // will cause DebugBreak
+
+ AfxAbort(); // should not return (but otherwise DebugBreak)
+ return TRUE;
+}
+
+void Trace(LPCTSTR lpszFormat, ...)
+{
+ va_list args;
+ va_start(args, lpszFormat);
+
+ int nBuf;
+ TCHAR szBuffer[512];
+
+ nBuf = _vstprintf(szBuffer, lpszFormat, args);
+ ASSERT(nBuf < (sizeof(szBuffer)/sizeof(szBuffer[0])));
+
+ CString strMessage;
+
+ if (AfxGetApp() != NULL)
+ strMessage = ((CString) (AfxGetApp()->m_pszExeName)) + _T(": ");
+ strMessage += szBuffer;
+ OutputDebugString(strMessage);
+
+ va_end(args);
+}
+
+
+#endif // _PSEUDO_DEBUG
diff --git a/utils/valvelib/debug.h b/utils/valvelib/debug.h
new file mode 100644
index 0000000..5a3de22
--- /dev/null
+++ b/utils/valvelib/debug.h
@@ -0,0 +1,63 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+#if !defined(AFX_DEBUG_H__D402C9F7_EF9A_4182_B9BE_F92F1ABB99EF__INCLUDED_)
+#define AFX_DEBUG_H__D402C9F7_EF9A_4182_B9BE_F92F1ABB99EF__INCLUDED_
+
+/////////////////////////////////////////////////////////////////////////////
+// Diagnostic support
+
+#ifdef _PSEUDO_DEBUG
+
+#undef TRACE
+#undef VERIFY
+#undef ASSERT
+#undef THIS_FILE
+#undef TRACE0
+#undef TRACE1
+#undef TRACE2
+#undef TRACE3
+
+
+// Note: file names are still ANSI strings (filenames rarely need UNICODE)
+BOOL AssertFailedLine(LPCSTR lpszFileName, int nLine);
+
+void Trace(PRINTF_FORMAT_STRING LPCTSTR lpszFormat, ...);
+
+// by default, debug break is asm int 3, or a call to DebugBreak, or nothing
+#if defined(_M_IX86)
+#define CustomDebugBreak() _asm { int 3 }
+#else
+#define CustomDebugBreak() DebugBreak()
+#endif
+
+#define TRACE ::Trace
+#define THIS_FILE __FILE__
+#define ASSERT(f) \
+ do \
+ { \
+ if (!(f) && AssertFailedLine(THIS_FILE, __LINE__)) \
+ CustomDebugBreak(); \
+ } while (0) \
+
+#define VERIFY(f) ASSERT(f)
+
+// The following trace macros are provided for backward compatiblity
+// (they also take a fixed number of parameters which provides
+// some amount of extra error checking)
+#define TRACE0(sz) ::Trace(_T(sz))
+#define TRACE1(sz, p1) ::Trace(_T(sz), p1)
+#define TRACE2(sz, p1, p2) ::Trace(_T(sz), p1, p2)
+#define TRACE3(sz, p1, p2, p3) ::Trace(_T(sz), p1, p2, p3)
+
+#endif // !_PSEUDO_DEBUG
+
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_DEBUG_H__D402C9F7_EF9A_4182_B9BE_F92F1ABB99EF__INCLUDED_)
diff --git a/utils/valvelib/hlp/valvelib.hpj b/utils/valvelib/hlp/valvelib.hpj
new file mode 100644
index 0000000..a2eba60
--- /dev/null
+++ b/utils/valvelib/hlp/valvelib.hpj
@@ -0,0 +1,13 @@
+[OPTIONS]
+TITLE=VALVELIB AppWizard Help
+COMPRESS=true
+WARNING=2
+HLP=valvelib.HLP
+ERRORLOG=valvelib.LOG
+
+[FILES]
+valvelib.rtf
+
+[MAP]
+#include <C:\Program Files\Microsoft Visual Studio\VC98\MFC\include\afxhelp.hm>
+#include <valvelib.hm>
diff --git a/utils/valvelib/hlp/valvelib.rtf b/utils/valvelib/hlp/valvelib.rtf
new file mode 100644
index 0000000..2f51b26
--- /dev/null
+++ b/utils/valvelib/hlp/valvelib.rtf
@@ -0,0 +1,23 @@
+{\rtf1\ansi \deff4\deflang1033{\fonttbl{\f2\fswiss\fcharset0\fprq2 Helv;}{\f4\froman\fcharset0\fprq2 Times New Roman;}{\f7\fswiss\fcharset0\fprq2 MS Sans Serif;}{\f9\fswiss\fcharset0\fprq2 Helvetica;}}
+{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;
+\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\nowidctlpar \f4\fs20 \snext0 Normal;}{\s1\sb240\nowidctlpar \b\f2\ul \sbasedon0\snext0 heading 1;}{\s2\sb120\nowidctlpar
+\b\f2 \sbasedon0\snext0 heading 2;}{\s3\li360\nowidctlpar \b\f4 \sbasedon0\snext17 heading 3;}{\s4\li360\nowidctlpar \f4\ul \sbasedon0\snext17 heading 4;}{\s5\li720\nowidctlpar \b\f4\fs20 \sbasedon0\snext17 heading 5;}{\s6\li720\nowidctlpar \f4\fs20\ul
+\sbasedon0\snext17 heading 6;}{\s7\li720\nowidctlpar \i\f4\fs20 \sbasedon0\snext17 heading 7;}{\s8\li720\nowidctlpar \i\f4\fs20 \sbasedon0\snext17 heading 8;}{\s9\li720\nowidctlpar \i\f4\fs20 \sbasedon0\snext17 heading 9;}{\*\cs10 \additive
+Default Paragraph Font;}{\*\cs15 \additive\fs16\up6\lang1033 \sbasedon10 footnote reference;}{\s16\nowidctlpar \f4\fs20 \sbasedon0\snext16 footnote text;}{\s17\li720\nowidctlpar \f4\fs20 \sbasedon0\snext17 Normal Indent;}{
+\s18\fi-240\li480\sb80\nowidctlpar\tx480 \f9 \sbasedon0\snext18 nscba;}{\s19\fi-240\li240\sa20\nowidctlpar \f9 \sbasedon0\snext19 j;}{\s20\li480\sa20\nowidctlpar \f9 \sbasedon0\snext20 ij;}{\s21\sb80\sa20\nowidctlpar \f9 \sbasedon0\snext21 btb;}{
+\s22\fi-240\li2400\sb20\sa20\nowidctlpar \f9\fs20 \sbasedon0\snext22 ctcb;}{\s23\fi-240\li480\sa40\nowidctlpar\tx480 \f9 \sbasedon0\snext23 ns;}{\s24\sa120\nowidctlpar \f9\fs28 \sbasedon0\snext24 TT;}{\s25\fi-240\li2400\sa20\nowidctlpar \f9
+\sbasedon0\snext25 crtj;}{\s26\fi-240\li480\nowidctlpar\tx480 \f9 \sbasedon0\snext26 nsca;}{\s27\sa20\nowidctlpar \f9 \sbasedon0\snext27 bt;}{\s28\li240\sb120\sa40\nowidctlpar \f9 \sbasedon0\snext28 Hf;}{\s29\li240\sb120\sa40\nowidctlpar \f9
+\sbasedon0\snext29 Hs;}{\s30\li480\sb120\sa40\nowidctlpar \f9 \sbasedon0\snext30 RT;}{\s31\fi-2160\li2160\sb240\sa80\nowidctlpar\tx2160 \f9 \sbasedon0\snext31 c;}{\s32\li2160\sa20\nowidctlpar \f9 \sbasedon0\snext32 ct;}{\s33\li240\sa20\nowidctlpar \f9
+\sbasedon0\snext33 it;}{\s34\li480\nowidctlpar \f9\fs20 \sbasedon0\snext34 nsct;}{\s35\fi-160\li400\sb80\sa40\nowidctlpar \f9 \sbasedon0\snext35 nscb;}{\s36\fi-2640\li2880\sb120\sa40\nowidctlpar\brdrb\brdrs\brdrw15 \brdrbtw\brdrs\brdrw15 \tx2880 \f9
+\sbasedon0\snext36 HC2;}{\s37\fi-2640\li2880\sb120\sa20\nowidctlpar\tx2880 \f9 \sbasedon0\snext37 C2;}{\s38\fi-240\li2400\sa20\nowidctlpar \f9\fs20 \sbasedon0\snext38 ctc;}{\s39\li2160\sb160\nowidctlpar \f9 \sbasedon0\snext39 crt;}{
+\s40\li480\sb20\sa40\nowidctlpar \f9 \sbasedon0\snext40 or;}{\s41\fi-259\li360\sb40\sa40\nowidctlpar\tx360 \f7\fs20 \sbasedon0\snext41 Ln1;}{\s42\li115\sb80\sa80\nowidctlpar \f7\fs20 \sbasedon0\snext0 *Intro;}{\s43\li115\sb80\sa80\keepn\nowidctlpar \b\f7
+\sbasedon3\snext42 *Title;}{\s44\fi-245\li360\sb80\nowidctlpar \f7\fs20 \snext44 *Jl;}{\s45\li360\sb40\sa40\nowidctlpar \f7\fs20 \snext0 Lp1;}{\s46\fi-1800\li1915\sb60\sl-240\slmult0\nowidctlpar\tx1915 \f7\fs20 \sbasedon0\snext46 Tph;}{
+\s47\li115\sb120\sa80\nowidctlpar \b\f7\fs20 \snext41 Proch;}{\*\cs48 \additive\super \sbasedon10 endnote reference;}}{\info{\author David Broman}{\operator David Broman}{\creatim\yr1993\mo11\dy4\hr18\min38}{\revtim\yr1996\mo11\dy21\hr10\min34}{\version6}
+{\edmins1}{\nofpages2}{\nofwords16}{\nofchars92}{\*\company Microsoft Corp}{\vern57443}}\widowctrl\ftnbj\aenddoc\hyphcaps0 \fet0\sectd \linex0\endnhere {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2
+\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6
+\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang
+{\pntxtb (}{\pntxta )}}
+\pard\plain \sl240\slmult0\widctlpar \f4\fs20 {\cs15\fs16\up6 #{\footnote \pard\plain \sl240\slmult0\widctlpar \f4\fs20 {\cs15\fs16\up6 #} HIDD_CUSTOM1}}{\fs16\up6 }{\b\f2\fs24\up6 Custom Dialog 1}{\f2
+\par }\pard \widctlpar {\f2 << Write a topic here that discusses your custom AppWizard's step 1>>
+\par }\page
+\par }
diff --git a/utils/valvelib/res/valvelib.ico b/utils/valvelib/res/valvelib.ico
new file mode 100644
index 0000000..4785d45
--- /dev/null
+++ b/utils/valvelib/res/valvelib.ico
Binary files differ
diff --git a/utils/valvelib/resource.h b/utils/valvelib/resource.h
new file mode 100644
index 0000000..945184d
--- /dev/null
+++ b/utils/valvelib/resource.h
@@ -0,0 +1,34 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by valvelib.rc
+//
+#define IDI_VALVELIB 1
+#define IDD_CUSTOM1 129
+#define IDC_SELECT_PROJECT_TYPE 1003
+#define IDC_EDIT_ROOT_PATH 1004
+#define IDC_EDIT_IMPLIB_PATH 1005
+#define IDC_EDIT_TARGET_PATH 1007
+#define IDC_CHECK_TOOL 1008
+#define IDC_CHECK_PUBLIC 1009
+#define IDC_CHECK_PUBLISH_IMPORT 1010
+#define IDC_CHECK_CONSOLE_APP 1011
+#define IDC_EDIT_SRC_PATH 1012
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_3D_CONTROLS 1
+#define _APS_NEXT_RESOURCE_VALUE 119
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1010
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/utils/valvelib/stdafx.cpp b/utils/valvelib/stdafx.cpp
new file mode 100644
index 0000000..7355ef5
--- /dev/null
+++ b/utils/valvelib/stdafx.cpp
@@ -0,0 +1,13 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+// stdafx.cpp : source file that includes just the standard includes
+// again.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
diff --git a/utils/valvelib/stdafx.h b/utils/valvelib/stdafx.h
new file mode 100644
index 0000000..78ef799
--- /dev/null
+++ b/utils/valvelib/stdafx.h
@@ -0,0 +1,29 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+#if !defined(AFX_STDAFX_H__A934D779_67D2_4174_BDA7_785C0F0F4E7A__INCLUDED_)
+#define AFX_STDAFX_H__A934D779_67D2_4174_BDA7_785C0F0F4E7A__INCLUDED_
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+#include <afxcmn.h> // MFC support for Windows 95 Common Controls
+#include "debug.h" // For ASSERT, VERIFY, and TRACE
+#include <customaw.h> // Custom AppWizard interface
+
+#import "c:\Program Files\Microsoft Visual Studio\Common\MSDev98\bin\ide\devbld.pkg"
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__A934D779_67D2_4174_BDA7_785C0F0F4E7A__INCLUDED_)
diff --git a/utils/valvelib/template/confirm.inf b/utils/valvelib/template/confirm.inf
new file mode 100644
index 0000000..d4afb9d
--- /dev/null
+++ b/utils/valvelib/template/confirm.inf
@@ -0,0 +1,28 @@
+About to create project $$root$$.$$VALVE_TARGET_TYPE$$:
+ Located in $$FULL_DIR_PATH$$
+ Target $$root$$.$$VALVE_TARGET_TYPE$$ will be copied into $$VALVE_TARGET_PATH$$
+$$IF(PROJTYPE_DLL)
+$$IF(VALVE_PUBLISH_IMPORT_LIB)
+ Import library $$root$$.lib will be copied into $$VALVE_IMPLIB_PATH$$
+$$ENDIF
+$$ENDIF
+
+$$IF(PROJTYPE_DLL || PROJTYPE_LIB)
+ Creating directory $$VALVE_ROOT_SRC_PATH$$common\$$root$$
+$$IF(VALVE_PUBLIC_PROJECT)
+ Creating directory $$VALVE_ROOT_SRC_PATH$$public\$$root$$
+$$ENDIF
+
+ Public Valve internal interfaces should be placed into
+ $$VALVE_ROOT_SRC_PATH$$common\$$root$$
+
+$$IF(VALVE_PUBLIC_PROJECT)
+ Public Mod-visible interfaces should be placed into
+ $$VALVE_ROOT_SRC_PATH$$public\$$root$$
+$$ENDIF
+$$ENDIF
+
+$$IF(PROJTYPE_DLL)
+ $$ROOT$$_DLL_EXPORT is defined for this project
+$$ENDIF
+
diff --git a/utils/valvelib/template/newproj.inf b/utils/valvelib/template/newproj.inf
new file mode 100644
index 0000000..189a566
--- /dev/null
+++ b/utils/valvelib/template/newproj.inf
@@ -0,0 +1,20 @@
+$$// newproj.inf = template for list of template files
+$$// format is 'sourceResName' \t 'destFileName'
+$$// The source res name may be preceded by any combination of '=', '-', '!', '?', ':', '#', and/or '*'
+$$// '=' => the resource is binary
+$$// '-' => the file should not be added to the project (all files are added to the project by default)
+$$// '!' => the file should be marked exclude from build
+$$// '?' => the file should be treated as a help file
+$$// ':' => the file should be treated as a resource
+$$// '#' => the file should be treated as a template (implies '!')
+$$// '*' => bypass the custom AppWizard's resources when loading
+$$// if name starts with / => create new subdir
+
+$$IF(PROJTYPE_DLL || PROJTYPE_LIB)
+/$$VALVE_SRC_RELATIVE_PATH$$common\$$root$$
+$$IF(VALVE_PUBLIC_PROJECT)
+/$$VALVE_SRC_RELATIVE_PATH$$public\$$root$$
+$$ENDIF
+$$ENDIF
+
+
diff --git a/utils/valvelib/valvelib.clw b/utils/valvelib/valvelib.clw
new file mode 100644
index 0000000..72b364d
--- /dev/null
+++ b/utils/valvelib/valvelib.clw
@@ -0,0 +1,44 @@
+; CLW file contains information for the MFC ClassWizard
+
+[General Info]
+Version=1
+LastClass=CCustom1Dlg
+LastTemplate=CDialog
+NewFileInclude1=#include "stdafx.h"
+NewFileInclude2=#include "valvelib.h"
+LastPage=0
+
+ClassCount=1
+Class1=CCustom1Dlg
+
+ResourceCount=1
+Resource1=IDD_CUSTOM1
+
+[CLS:CCustom1Dlg]
+Type=0
+BaseClass=CAppWizStepDlg
+HeaderFile=cstm1dlg.h
+ImplementationFile=cstm1dlg.cpp
+Filter=D
+VirtualFilter=dWC
+LastObject=IDC_EDIT_SRC_PATH
+
+[DLG:IDD_CUSTOM1]
+Type=1
+Class=CCustom1Dlg
+ControlCount=14
+Control1=IDC_STATIC,static,1342308352
+Control2=IDC_SELECT_PROJECT_TYPE,combobox,1342242819
+Control3=IDC_STATIC,static,1342308352
+Control4=IDC_EDIT_ROOT_PATH,edit,1350631552
+Control5=IDC_STATIC,static,1342308352
+Control6=IDC_EDIT_IMPLIB_PATH,edit,1350631552
+Control7=IDC_STATIC,static,1342308352
+Control8=IDC_EDIT_TARGET_PATH,edit,1350631552
+Control9=IDC_CHECK_TOOL,button,1342242819
+Control10=IDC_CHECK_PUBLIC,button,1342242819
+Control11=IDC_CHECK_PUBLISH_IMPORT,button,1342242819
+Control12=IDC_CHECK_CONSOLE_APP,button,1342242819
+Control13=IDC_STATIC,static,1342308352
+Control14=IDC_EDIT_SRC_PATH,edit,1350631552
+
diff --git a/utils/valvelib/valvelib.cpp b/utils/valvelib/valvelib.cpp
new file mode 100644
index 0000000..dd0c795
--- /dev/null
+++ b/utils/valvelib/valvelib.cpp
@@ -0,0 +1,47 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+// valvelib.cpp : Defines the initialization routines for the DLL.
+//
+
+#include "stdafx.h"
+#include <afxdllx.h>
+#include "valvelib.h"
+#include "valvelibaw.h"
+
+#ifdef _PSEUDO_DEBUG
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+static AFX_EXTENSION_MODULE ValvelibDLL = { NULL, NULL };
+
+extern "C" int APIENTRY
+DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+{
+ if (dwReason == DLL_PROCESS_ATTACH)
+ {
+ TRACE0("VALVELIB.AWX Initializing!\n");
+
+ // Extension DLL one-time initialization
+ AfxInitExtensionModule(ValvelibDLL, hInstance);
+
+ // Insert this DLL into the resource chain
+ new CDynLinkLibrary(ValvelibDLL);
+
+ // Register this custom AppWizard with MFCAPWZ.DLL
+ SetCustomAppWizClass(&Valvelibaw);
+ }
+ else if (dwReason == DLL_PROCESS_DETACH)
+ {
+ TRACE0("VALVELIB.AWX Terminating!\n");
+
+ // Terminate the library before destructors are called
+ AfxTermExtensionModule(ValvelibDLL);
+ }
+ return 1; // ok
+}
diff --git a/utils/valvelib/valvelib.h b/utils/valvelib/valvelib.h
new file mode 100644
index 0000000..c3b6aeb
--- /dev/null
+++ b/utils/valvelib/valvelib.h
@@ -0,0 +1,23 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+#if !defined(AFX_VALVELIB_H__206ABDD3_0BD0_4E71_8462_B6D18D116D1E__INCLUDED_)
+#define AFX_VALVELIB_H__206ABDD3_0BD0_4E71_8462_B6D18D116D1E__INCLUDED_
+
+#ifndef __AFXWIN_H__
+ #error include 'stdafx.h' before including this file for PCH
+#endif
+
+#include "resource.h" // main symbols
+
+// TODO: You may add any other custom AppWizard-wide declarations here.
+
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_VALVELIB_H__206ABDD3_0BD0_4E71_8462_B6D18D116D1E__INCLUDED_)
diff --git a/utils/valvelib/valvelib.rc b/utils/valvelib/valvelib.rc
new file mode 100644
index 0000000..a9f5cae
--- /dev/null
+++ b/utils/valvelib/valvelib.rc
@@ -0,0 +1,202 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "\0"
+ VALUE "CompanyName", "\0"
+ VALUE "FileDescription", "Valve Project AppWizard\0"
+ VALUE "FileVersion", "1, 0, 0, 1\0"
+ VALUE "InternalName", "VALVELIB\0"
+ VALUE "LegalCopyright", "Copyright � 2002\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "VALVELIB.DLL\0"
+ VALUE "PrivateBuild", "\0"
+ VALUE "ProductName", "Valve Project\0"
+ VALUE "ProductVersion", "1, 0, 0, 1\0"
+ VALUE "SpecialBuild", "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // !_MAC
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_CUSTOM1 DIALOG DISCARDABLE 0, 0, 286, 196
+STYLE DS_CONTROL | WS_CHILD | WS_TABSTOP
+FONT 8, "MS Sans Serif"
+BEGIN
+ LTEXT "Select Project Type",IDC_STATIC,118,10,66,10
+ COMBOBOX IDC_SELECT_PROJECT_TYPE,93,23,122,50,CBS_DROPDOWNLIST |
+ WS_TABSTOP
+ LTEXT "Root Path",IDC_STATIC,40,109,57,10
+ EDITTEXT IDC_EDIT_ROOT_PATH,115,109,147,12,ES_AUTOHSCROLL
+ LTEXT "Import Library Path",IDC_STATIC,40,159,66,11
+ EDITTEXT IDC_EDIT_IMPLIB_PATH,115,159,147,12,ES_AUTOHSCROLL
+ LTEXT "Output (Target) Path",IDC_STATIC,40,184,66,11
+ EDITTEXT IDC_EDIT_TARGET_PATH,115,184,147,12,ES_AUTOHSCROLL
+ CONTROL "Tool Project (uses multithreaded C libs)",
+ IDC_CHECK_TOOL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,115,
+ 45,143,11
+ CONTROL "Public Project (linked to by mods)",IDC_CHECK_PUBLIC,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,115,61,122,9
+ CONTROL "Publish Import Library",IDC_CHECK_PUBLISH_IMPORT,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,115,74,124,11
+ CONTROL "Console Application",IDC_CHECK_CONSOLE_APP,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,115,89,124,11
+ LTEXT "Src Path (Relative)",IDC_STATIC,40,134,65,8
+ EDITTEXT IDC_EDIT_SRC_PATH,115,134,147,12,ES_AUTOHSCROLL
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEMPLATE
+//
+
+NEWPROJ.INF TEMPLATE DISCARDABLE "template\\newproj.inf"
+CONFIRM.INF TEMPLATE DISCARDABLE "template\\confirm.inf"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_VALVELIB ICON DISCARDABLE "res\\valvelib.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog Info
+//
+
+IDD_CUSTOM1 DLGINIT
+BEGIN
+ IDC_SELECT_PROJECT_TYPE, 0x403, 22, 0
+0x7453, 0x7461, 0x6369, 0x4c20, 0x6269, 0x6172, 0x7972, 0x2820, 0x4c2e,
+0x4249, 0x0029,
+ IDC_SELECT_PROJECT_TYPE, 0x403, 23, 0
+0x7944, 0x616e, 0x696d, 0x2063, 0x694c, 0x7262, 0x7261, 0x2079, 0x2e28,
+0x4c44, 0x294c, "\000"
+ IDC_SELECT_PROJECT_TYPE, 0x403, 18, 0
+0x7845, 0x6365, 0x7475, 0x6261, 0x656c, 0x2820, 0x452e, 0x4558, 0x0029,
+
+ 0
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_CUSTOM1, DIALOG
+ BEGIN
+ BOTTOMMARGIN, 168
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+#include "afxres.rc" // Standard components
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/utils/valvelib/valvelib.vcproj b/utils/valvelib/valvelib.vcproj
new file mode 100644
index 0000000..f33a717
--- /dev/null
+++ b/utils/valvelib/valvelib.vcproj
@@ -0,0 +1,354 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="valvelib"
+ ProjectGUID="{B9FDD758-DFA9-4559-99E8-3451FF847972}"
+ SccProjectName=""
+ SccAuxPath=""
+ SccLocalPath=""
+ SccProvider=""
+ Keyword="MFCProj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_AFXEXT"
+ StringPooling="TRUE"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="3"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\Release/valvelib.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Copying custom AppWizard to Template directory..."
+ CommandLine="if not exist &quot;$(DevEnvDir)Template\nul&quot; md &quot;$(DevEnvDir)Template&quot;
+copy &quot;$(TargetPath)&quot; &quot;$(DevEnvDir)Template&quot;
+if exist &quot;$(OutDir)\$(TargetName).pdb&quot; copy &quot;$(OutDir)\$(TargetName).pdb&quot; &quot;$(DevEnvDir)Template&quot;
+"
+ Outputs="$(DevEnvDir)Template\$(TargetName).awx"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile=".\Release/valvelib.awx"
+ LinkIncremental="1"
+ SuppressStartupBanner="TRUE"
+ ProgramDatabaseFile=".\Release/valvelib.pdb"
+ SubSystem="2"
+ ImportLibrary=".\Release/valvelib.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="TRUE"
+ SuppressStartupBanner="TRUE"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/valvelib.tlb"
+ HeaderFileName=""/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Pseudo-Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_PSEUDO_DEBUG;_AFXEXT"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="3"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\Debug/valvelib.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Copying custom AppWizard to Template directory..."
+ CommandLine="if not exist &quot;$(DevEnvDir)Template\nul&quot; md &quot;$(DevEnvDir)Template&quot;
+copy &quot;$(TargetPath)&quot; &quot;$(DevEnvDir)Template&quot;
+if exist &quot;$(OutDir)\$(TargetName).pdb&quot; copy &quot;$(OutDir)\$(TargetName).pdb&quot; &quot;$(DevEnvDir)Template&quot;
+"
+ Outputs="$(DevEnvDir)Template\$(TargetName).awx"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile=".\Debug/valvelib.awx"
+ LinkIncremental="1"
+ SuppressStartupBanner="TRUE"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile=".\Debug/valvelib.pdb"
+ SubSystem="2"
+ ImportLibrary=".\Debug/valvelib.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="TRUE"
+ SuppressStartupBanner="TRUE"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/valvelib.tlb"
+ HeaderFileName=""/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG;_PSEUDO_DEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+ <File
+ RelativePath="Chooser.cpp">
+ </File>
+ <File
+ RelativePath="Cstm1Dlg.cpp">
+ </File>
+ <File
+ RelativePath="Debug.cpp">
+ </File>
+ <File
+ RelativePath="StdAfx.cpp">
+ <FileConfiguration
+ Name="Pseudo-Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="valvelib.cpp">
+ </File>
+ <File
+ RelativePath="hlp\valvelib.hpj">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Making help file..."
+ CommandLine="start /wait hcw /C /E /M &quot;hlp\$(InputName).hpj&quot;
+if errorlevel 1 goto :Error
+if not exist &quot;hlp\$(InputName).hlp&quot; goto :Error
+copy &quot;hlp\$(InputName).hlp&quot; &quot;$(OutDir)&quot;
+copy &quot;$(OutDir)\$(TargetName).hlp&quot; &quot;$(DevEnvDir)Template&quot;
+goto :done
+:Error
+echo hlp\&quot;$(InputName)&quot;.hpj(1) : error:
+type &quot;hlp\$(InputName).log&quot;
+:done
+"
+ AdditionalDependencies="hlp\AfxCore.rtf;hlp\AfxPrint.rtf;hlp\$(TargetName).hm;"
+ Outputs="$(OutDir)\$(InputName).hlp;$(DevEnvDir)Template"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Pseudo-Debug|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Making help file..."
+ CommandLine="start /wait hcw /C /E /M &quot;hlp\$(InputName).hpj&quot;
+if errorlevel 1 goto :Error
+if not exist &quot;hlp\$(InputName).hlp&quot; goto :Error
+copy &quot;hlp\$(InputName).hlp&quot; &quot;$(OutDir)&quot;
+copy &quot;$(OutDir)\$(TargetName).hlp&quot; &quot;$(DevEnvDir)Template&quot;
+goto :done
+:Error
+echo hlp\&quot;$(InputName)&quot;.hpj(1) : error:
+type &quot;hlp\$(InputName).log&quot;
+:done
+"
+ AdditionalDependencies="hlp\AfxCore.rtf;hlp\AfxPrint.rtf;hlp\$(TargetName).hm;"
+ Outputs="$(OutDir)\$(InputName).hlp;$(DevEnvDir)Template"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="valvelib.rc">
+ </File>
+ <File
+ RelativePath="valvelibAw.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl">
+ <File
+ RelativePath="Chooser.h">
+ </File>
+ <File
+ RelativePath="Cstm1Dlg.h">
+ </File>
+ <File
+ RelativePath="Debug.h">
+ </File>
+ <File
+ RelativePath="Resource.h">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Making help include file..."
+ CommandLine="echo. &gt;&quot;hlp\$(TargetName).hm&quot;
+echo // Commands (ID_* and IDM_*) &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+makehm ID_,HID_,0x10000 IDM_,HIDM_,0x10000 resource.h &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+echo. &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+echo // Prompts (IDP_*) &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+makehm IDP_,HIDP_,0x30000 resource.h &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+echo. &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+echo // Resources (IDR_*) &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+makehm IDR_,HIDR_,0x20000 resource.h &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+echo. &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+echo // Dialogs (IDD_*) &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+makehm IDD_,HIDD_,0x20000 resource.h &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+echo. &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+echo // Frame Controls (IDW_*) &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+makehm IDW_,HIDW_,0x50000 resource.h &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+"
+ Outputs="hlp\$(TargetName).hm"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Pseudo-Debug|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Making help include file..."
+ CommandLine="echo. &gt;&quot;hlp\$(TargetName).hm&quot;
+echo // Commands (ID_* and IDM_*) &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+makehm ID_,HID_,0x10000 IDM_,HIDM_,0x10000 resource.h &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+echo. &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+echo // Prompts (IDP_*) &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+makehm IDP_,HIDP_,0x30000 resource.h &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+echo. &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+echo // Resources (IDR_*) &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+makehm IDR_,HIDR_,0x20000 resource.h &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+echo. &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+echo // Dialogs (IDD_*) &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+makehm IDD_,HIDD_,0x20000 resource.h &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+echo. &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+echo // Frame Controls (IDW_*) &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+makehm IDW_,HIDW_,0x50000 resource.h &gt;&gt;&quot;hlp\$(TargetName).hm&quot;
+"
+ Outputs="hlp\$(TargetName).hm"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="StdAfx.h">
+ </File>
+ <File
+ RelativePath="valvelib.h">
+ </File>
+ <File
+ RelativePath="valvelibAw.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath="res\valvelib.ico">
+ </File>
+ </Filter>
+ <Filter
+ Name="Help Files"
+ Filter="cnt;rtf">
+ <File
+ RelativePath="hlp\valvelib.rtf">
+ </File>
+ </Filter>
+ <Filter
+ Name="Template Files"
+ Filter="&lt;templates&gt;">
+ <File
+ RelativePath="Template\confirm.inf">
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Pseudo-Debug|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="Template\newproj.inf">
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Pseudo-Debug|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/utils/valvelib/valvelibaw.cpp b/utils/valvelib/valvelibaw.cpp
new file mode 100644
index 0000000..ccfec7b
--- /dev/null
+++ b/utils/valvelib/valvelibaw.cpp
@@ -0,0 +1,491 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+// valvelibaw.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "valvelib.h"
+#include "valvelibaw.h"
+#include "chooser.h"
+
+#include <assert.h>
+
+#include<atlbase.h>
+extern CComModule _Module;
+#include <atlcom.h>
+#include <initguid.h>
+#include<comdef.h>
+
+
+#ifdef _PSEUDO_DEBUG
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+#define STUPID_MS_BUG 1
+
+enum Config_t
+{
+ CONFIG_DEBUG = 0,
+ CONFIG_RELEASE
+};
+
+enum Project_t
+{
+ PROJECT_LIB = 0,
+ PROJECT_DLL,
+ PROJECT_EXE
+};
+
+struct ProjectInfo_t
+{
+ DSProjectSystem::IConfigurationPtr m_pConfig;
+ long m_ConfigIndex;
+ Config_t m_Config;
+ Project_t m_Project;
+ CString m_RelativeTargetPath;
+ CString m_RelativeImplibPath;
+ CString m_RelativeRootPath;
+ CString m_RelativeSrcPath;
+ CString m_TargetPath;
+ CString m_RootName;
+ CString m_BuildName;
+ CString m_Ext;
+ bool m_Tool;
+ bool m_Console;
+ bool m_Public;
+ bool m_PublishImportLib;
+};
+
+
+// This is called immediately after the custom AppWizard is loaded. Initialize
+// the state of the custom AppWizard here.
+void CValvelibAppWiz::InitCustomAppWiz()
+{
+ // Create a new dialog chooser; CDialogChooser's constructor initializes
+ // its internal array with pointers to the steps.
+ m_pChooser = new CDialogChooser;
+
+ // Set the maximum number of steps.
+ SetNumberOfSteps(LAST_DLG);
+
+ // TODO: Add any other custom AppWizard-wide initialization here.
+}
+
+// This is called just before the custom AppWizard is unloaded.
+void CValvelibAppWiz::ExitCustomAppWiz()
+{
+ // Deallocate memory used for the dialog chooser
+ ASSERT(m_pChooser != NULL);
+ delete m_pChooser;
+ m_pChooser = NULL;
+
+ // TODO: Add code here to deallocate resources used by the custom AppWizard
+}
+
+// This is called when the user clicks "Create..." on the New Project dialog
+// or "Next" on one of the custom AppWizard's steps.
+CAppWizStepDlg* CValvelibAppWiz::Next(CAppWizStepDlg* pDlg)
+{
+ // Delegate to the dialog chooser
+ return m_pChooser->Next(pDlg);
+}
+
+// This is called when the user clicks "Back" on one of the custom
+// AppWizard's steps.
+CAppWizStepDlg* CValvelibAppWiz::Back(CAppWizStepDlg* pDlg)
+{
+ // Delegate to the dialog chooser
+ return m_pChooser->Back(pDlg);
+}
+
+
+//-----------------------------------------------------------------------------
+// Deals with compiler settings
+//-----------------------------------------------------------------------------
+
+static void SetupCompilerSettings(ProjectInfo_t& info)
+{
+ _bstr_t varTool;
+ _bstr_t varSwitch;
+ _variant_t varj = info.m_ConfigIndex;
+
+ // We're going to modify settings associated with cl.exe
+ varTool = "cl.exe";
+
+ // Standard include directories
+ CString includePath;
+ if (info.m_Public)
+ {
+ includePath.Format("/I%spublic", info.m_RelativeSrcPath,
+ info.m_RelativeSrcPath );
+
+ info.m_pConfig->AddToolSettings(varTool, (char const*)includePath, varj);
+ }
+
+ // Control which version of the debug libraries to use (static single thread
+ // for normal projects, multithread for tools)
+ if (info.m_Tool)
+ {
+ if (info.m_Config == CONFIG_DEBUG)
+ varSwitch = "/MTd";
+ else
+ varSwitch = "/MT";
+ }
+ else
+ {
+ // Suppress use of non-filesystem stuff in new non-tool projects...
+ if (info.m_Config == CONFIG_DEBUG)
+ varSwitch = "/D \"fopen=dont_use_fopen\" /MTd";
+ else
+ varSwitch = "/D \"fopen=dont_use_fopen\" /MT";
+ }
+ info.m_pConfig->AddToolSettings(varTool, varSwitch, varj);
+
+ // If it's a DLL, define a standard exports macro...
+ if (info.m_Project == PROJECT_DLL)
+ {
+ CString dllExport;
+ dllExport.Format("/D \"%s_DLL_EXPORT\"", info.m_RootName );
+ dllExport.MakeUpper();
+ info.m_pConfig->AddToolSettings(varTool, (char const*)dllExport, varj);
+ }
+
+ // /W4 - Warning level 4
+ // /FD - Generates file dependencies
+ // /G6 - optimize for pentium pro
+ // Add _WIN32, as that's what all our other code uses
+ varSwitch = "/W4 /FD /G6 /D \"_WIN32\"";
+ info.m_pConfig->AddToolSettings(varTool, varSwitch, varj);
+
+ // Remove Preprocessor def for MFC DLL specifier, _AFXDLL
+ // /GX - No exceptions,
+ // /YX - no precompiled headers
+ // Remove WIN32, it's put there by default
+ varSwitch = "/D \"_AFXDLL\" /GX /YX /D \"WIN32\"";
+ info.m_pConfig->RemoveToolSettings(varTool, varSwitch, varj);
+
+ switch (info.m_Config)
+ {
+ case CONFIG_DEBUG:
+ // Remove the following switches (avoid duplicates, in addition to other things)
+ varSwitch = "/D \"NDEBUG\" /Zi /ZI /GZ";
+ info.m_pConfig->RemoveToolSettings(varTool, varSwitch, varj);
+
+ // Add the following switches:
+ // /ZI - Includes debug information in a program database compatible with Edit and Continue.
+ // /Zi - Includes debug information in a program database (no Edit and Continue)
+ // /Od - Disable optimization
+ // /GZ - Catch release build problems (uninitialized variables, fp stack problems)
+ // /Op - Improves floating-point consistency
+ // /Gm - Minimal rebuild
+ // /FR - Generate Browse Info
+ varSwitch = "/D \"_DEBUG\" /Od /GZ /Op /Gm /FR\"Debug/\"";
+ info.m_pConfig->AddToolSettings(varTool, varSwitch, varj);
+
+ if (info.m_Project == PROJECT_LIB)
+ {
+ // Static libraries cannot use edit-and-continue, why compile it in?
+ varSwitch = "/Zi";
+ info.m_pConfig->AddToolSettings(varTool, varSwitch, varj);
+ }
+ else
+ {
+ varSwitch = "/ZI";
+ info.m_pConfig->AddToolSettings(varTool, varSwitch, varj);
+ }
+ break;
+
+ case CONFIG_RELEASE:
+ // Remove the following switches:
+ // /Zi - Generates complete debugging information
+ // /ZI - Includes debug information in a program database compatible with Edit and Continue.
+ // /Gm - Minimal rebuild
+ // /GZ - Catch release build problems (uninitialized variables, fp stack problems)
+ varSwitch = "/D \"_DEBUG\" /Gm /Zi /ZI /GZ";
+ info.m_pConfig->RemoveToolSettings(varTool, varSwitch, varj);
+
+ // Add the following switches:
+ // /Ox - Uses maximum optimization (/Ob1gity /Gs)
+ // /Ow - Assumes aliasing across function calls
+ // /Op - Improves floating-point consistency
+ // /Gf - String pooling
+ // /Oi - Generates intrinsic functions
+ // /Ot - Favors fast code
+ // /Og - Uses global optimizations
+ // /Gy - Enable function level linking
+ varSwitch = "/D \"NDEBUG\" /Ox /Ow /Op /Oi /Ot /Og /Gf /Gy";
+ info.m_pConfig->AddToolSettings(varTool, varSwitch, varj);
+ break;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Deals with resource compiler
+//-----------------------------------------------------------------------------
+
+static void SetupResourceCompilerSettings(ProjectInfo_t& info)
+{
+ _bstr_t varTool;
+ _bstr_t varSwitch;
+ _variant_t varj = info.m_ConfigIndex;
+
+ // Remove Preprocessor def for MFC DLL specifier, _AFXDLL
+ varTool = "rc.exe";
+ varSwitch = "/d \"_AFXDLL\"";
+ info.m_pConfig->RemoveToolSettings(varTool, varSwitch, varj);
+}
+
+
+//-----------------------------------------------------------------------------
+// Deals with linker settings
+//-----------------------------------------------------------------------------
+
+static void SetupLinkerSettings(ProjectInfo_t& info)
+{
+ _bstr_t varTool;
+ _bstr_t varSwitch;
+ _variant_t varj = info.m_ConfigIndex;
+
+ // We're going to modify settings associated with cl.exe
+ varTool = "link.exe";
+
+ // Remove windows libraries by default... hopefully we don't have windows dependencies
+ varSwitch = "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib";
+ info.m_pConfig->RemoveToolSettings(varTool, varSwitch, varj);
+
+ // Add libraries we always want to use
+ varSwitch = "tier0.lib";
+ info.m_pConfig->AddToolSettings(varTool, varSwitch, varj);
+
+ // Hook in the static library path
+ CString libPath;
+
+ // FIXME: Still haven't decided on build-specific publish dir
+
+ if (info.m_Public)
+ {
+ libPath.Format( "/libpath:\"%slib\\common\\\" /libpath:\"%slib\\public\\\"",
+ info.m_RelativeSrcPath, info.m_RelativeSrcPath );
+ }
+ else
+ {
+ libPath.Format( "/libpath:\"%slib\\common\\\"", info.m_RelativeSrcPath );
+ }
+
+ info.m_pConfig->AddToolSettings(varTool, (char const*)libPath, varj);
+}
+
+//-----------------------------------------------------------------------------
+// Deals with lib settings
+//-----------------------------------------------------------------------------
+
+static void SetupLibSettings(ProjectInfo_t& info)
+{
+}
+
+//-----------------------------------------------------------------------------
+// Deals with custom build steps
+//-----------------------------------------------------------------------------
+
+static void SetupCustomBuildSteps(ProjectInfo_t& info)
+{
+ // Create the custom build steps
+ CString copySteps;
+ CString targets;
+
+ if (info.m_Project == PROJECT_LIB)
+ {
+ CString targetPath;
+
+ targetPath.Format( "%s%s.%s", info.m_RelativeTargetPath, info.m_RootName, info.m_Ext );
+
+ // NOTE: The second attrib is commented out because I'm fairly certain it causes
+ // a bug in VSS to make it overwrite the target on a get
+ copySteps.Format(
+ "if exist %s attrib -r %s\n"
+ "copy $(TargetPath) %s\n"
+ "if exist $(TargetDir)\\%s.map copy $(TargetDir)\\%s.map %s%s.map",
+ targetPath, targetPath,
+ targetPath,
+ info.m_RootName, info.m_RootName, info.m_RelativeTargetPath, info.m_RootName );
+
+ targets.Format( "%s\n", targetPath );
+ }
+ else
+ {
+ CString targetPath;
+ targetPath.Format( "%s%s.%s", info.m_RelativeTargetPath, info.m_RootName, info.m_Ext );
+
+ // NOTE: The second attrib is commented out because I'm fairly certain it causes
+ // a bug in VSS to make it overwrite the target on a get
+ copySteps.Format(
+ "if exist %s attrib -r %s\n"
+ "copy $(TargetPath) %s\n"
+ "if exist $(TargetDir)\\%s.map copy $(TargetDir)\\%s.map %s%s.map",
+ targetPath, targetPath,
+ targetPath,
+ info.m_RootName, info.m_RootName, info.m_RelativeTargetPath, info.m_RootName );
+
+ targets.Format( "%s", targetPath );
+
+ if ((info.m_Project == PROJECT_DLL) && info.m_PublishImportLib)
+ {
+ CString targetPath;
+
+ targetPath.Format( "%s%s.lib", info.m_RelativeImplibPath, info.m_RootName );
+
+ CString impLibCopy;
+ impLibCopy.Format(
+ "\nif exist %s attrib -r %s\n"
+ "if exist $(TargetDir)\\%s.lib copy $(TargetDir)\\%s.lib %s\n",
+ targetPath, targetPath,
+ info.m_RootName, info.m_RootName, targetPath
+ );
+ copySteps += impLibCopy;
+
+ CString implibTarget;
+ implibTarget.Format( "\n%s", targetPath );
+ targets += implibTarget;
+ }
+ }
+
+ CString publishDir;
+ publishDir.Format( "Publishing to target directory (%s)...", info.m_RelativeTargetPath );
+ info.m_pConfig->AddCustomBuildStep( (char const*)copySteps, (char const*)targets, (char const*)publishDir );
+}
+
+//-----------------------------------------------------------------------------
+// Deals with MIDL build steps
+//-----------------------------------------------------------------------------
+
+static void SetupMIDLSettings(ProjectInfo_t& info)
+{
+}
+
+//-----------------------------------------------------------------------------
+// Deals with browse build steps
+//-----------------------------------------------------------------------------
+
+static void SetupBrowseSettings(ProjectInfo_t& info)
+{
+}
+
+void CValvelibAppWiz::CustomizeProject(IBuildProject* pProject)
+{
+ // This is called immediately after the default Debug and Release
+ // configurations have been created for each platform. You may customize
+ // existing configurations on this project by using the methods
+ // of IBuildProject and IConfiguration such as AddToolSettings,
+ // RemoveToolSettings, and AddCustomBuildStep. These are documented in
+ // the Developer Studio object model documentation.
+
+ // WARNING!! IBuildProject and all interfaces you can get from it are OLE
+ // COM interfaces. You must be careful to release all new interfaces
+ // you acquire. In accordance with the standard rules of COM, you must
+ // NOT release pProject, unless you explicitly AddRef it, since pProject
+ // is passed as an "in" parameter to this function. See the documentation
+ // on CCustomAppWiz::CustomizeProject for more information.
+
+ using namespace DSProjectSystem;
+
+ long lNumConfigs;
+ IConfigurationsPtr pConfigs;
+ IBuildProjectPtr pProj;
+
+ // Needed to convert IBuildProject to the DSProjectSystem namespace
+ pProj.Attach((DSProjectSystem::IBuildProject*)pProject, true);
+
+ // Add a release with symbols configuration
+ pProj->get_Configurations(&pConfigs);
+ pConfigs->get_Count(&lNumConfigs);
+
+ // Needed for OLE2T below
+ USES_CONVERSION;
+ CComBSTR configName;
+
+ ProjectInfo_t info;
+ if (!Valvelibaw.m_Dictionary.Lookup("VALVE_RELATIVE_PATH", info.m_RelativeTargetPath))
+ return;
+ if (!Valvelibaw.m_Dictionary.Lookup("root", info.m_RootName))
+ return;
+ if (!Valvelibaw.m_Dictionary.Lookup("VALVE_TARGET_TYPE", info.m_Ext))
+ return;
+ if (!Valvelibaw.m_Dictionary.Lookup("VALVE_ROOT_RELATIVE_PATH", info.m_RelativeRootPath))
+ return;
+ if (!Valvelibaw.m_Dictionary.Lookup("VALVE_SRC_RELATIVE_PATH", info.m_RelativeSrcPath))
+ return;
+ if (!Valvelibaw.m_Dictionary.Lookup("VALVE_TARGET_PATH", info.m_TargetPath))
+ return;
+
+ CString tmp;
+ info.m_Tool = (Valvelibaw.m_Dictionary.Lookup("VALVE_TOOL", tmp) != 0);
+ info.m_Console = (Valvelibaw.m_Dictionary.Lookup("PROJTYPE_CON", tmp) != 0);
+ info.m_Public = (Valvelibaw.m_Dictionary.Lookup("VALVE_PUBLIC_PROJECT", tmp) != 0);
+ info.m_PublishImportLib = (Valvelibaw.m_Dictionary.Lookup("VALVE_PUBLISH_IMPORT_LIB", tmp) != 0);
+ info.m_Project = PROJECT_LIB;
+ if ( strstr( info.m_Ext, "dll" ) != 0 )
+ {
+ info.m_Project = PROJECT_DLL;
+ if (!Valvelibaw.m_Dictionary.Lookup("VALVE_IMPLIB_RELATIVE_PATH", info.m_RelativeImplibPath))
+ return;
+ }
+ else if ( strstr( info.m_Ext, "exe" ) != 0 )
+ {
+ info.m_Project = PROJECT_EXE;
+ }
+
+ //Get each individual configuration
+ for (long j = 1 ; j <= lNumConfigs ; j++)
+ {
+ _bstr_t varTool;
+ _bstr_t varSwitch;
+ _variant_t varj = j;
+ info.m_ConfigIndex = j;
+
+ info.m_pConfig = pConfigs->Item(varj);
+
+ // Figure if we're debug or release
+ info.m_pConfig->get_Name( &configName );
+ info.m_Config = CONFIG_RELEASE;
+ info.m_BuildName = "Release";
+ if ( strstr( OLE2T(configName), "Debug" ) != 0 )
+ {
+ info.m_Config = CONFIG_DEBUG;
+ info.m_BuildName = "Debug";
+ }
+
+ // Not using MFC...
+ info.m_pConfig->AddToolSettings("mfc", "0", varj);
+
+ SetupCompilerSettings(info);
+ SetupResourceCompilerSettings(info);
+ if (info.m_Project != PROJECT_LIB)
+ {
+ SetupLinkerSettings(info);
+
+ if (!info.m_Console)
+ SetupMIDLSettings(info);
+ }
+ else
+ {
+ SetupLibSettings(info);
+ }
+ SetupCustomBuildSteps(info);
+ SetupBrowseSettings(info);
+
+ info.m_pConfig->MakeCurrentSettingsDefault();
+ }
+}
+
+
+// Here we define one instance of the CValvelibAppWiz class. You can access
+// m_Dictionary and any other public members of this class through the
+// global Valvelibaw.
+CValvelibAppWiz Valvelibaw;
+
diff --git a/utils/valvelib/valvelibaw.h b/utils/valvelib/valvelibaw.h
new file mode 100644
index 0000000..b3cd289
--- /dev/null
+++ b/utils/valvelib/valvelibaw.h
@@ -0,0 +1,43 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+#if !defined(AFX_VALVELIBAW_H__9C6B3FB5_1D05_4B77_A095_DC8F516057DE__INCLUDED_)
+#define AFX_VALVELIBAW_H__9C6B3FB5_1D05_4B77_A095_DC8F516057DE__INCLUDED_
+
+// valvelibaw.h : header file
+//
+
+class CDialogChooser;
+class IBuildProject;
+
+// All function calls made by mfcapwz.dll to this custom AppWizard (except for
+// GetCustomAppWizClass-- see valvelib.cpp) are through this class. You may
+// choose to override more of the CCustomAppWiz virtual functions here to
+// further specialize the behavior of this custom AppWizard.
+class CValvelibAppWiz : public CCustomAppWiz
+{
+public:
+ virtual CAppWizStepDlg* Next(CAppWizStepDlg* pDlg);
+ virtual CAppWizStepDlg* Back(CAppWizStepDlg* pDlg);
+
+ virtual void InitCustomAppWiz();
+ virtual void ExitCustomAppWiz();
+ virtual void CustomizeProject(IBuildProject* pProject);
+
+protected:
+ CDialogChooser* m_pChooser;
+};
+
+// This declares the one instance of the CValvelibAppWiz class. You can access
+// m_Dictionary and any other public members of this class through the
+// global Valvelibaw. (Its definition is in valvelibaw.cpp.)
+extern CValvelibAppWiz Valvelibaw;
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_VALVELIBAW_H__9C6B3FB5_1D05_4B77_A095_DC8F516057DE__INCLUDED_)