//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: // // $NoKeywords: $ // //=============================================================================// // vrad_launcher.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include "tier1/strtools.h" #include "tier0/icommandline.h" char* GetLastErrorString() { static char err[2048]; LPVOID lpMsgBuf; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, NULL ); strncpy( err, (char*)lpMsgBuf, sizeof( err ) ); LocalFree( lpMsgBuf ); err[ sizeof( err ) - 1 ] = 0; return err; } void MakeFullPath( const char *pIn, char *pOut, int outLen ) { if ( pIn[0] == '/' || pIn[0] == '\\' || pIn[1] == ':' ) { // It's already a full path. Q_strncpy( pOut, pIn, outLen ); } else { _getcwd( pOut, outLen ); Q_strncat( pOut, "\\", outLen, COPY_ALL_CHARACTERS ); Q_strncat( pOut, pIn, outLen, COPY_ALL_CHARACTERS ); } } int main(int argc, char* argv[]) { char dllName[512]; CommandLine()->CreateCmdLine( argc, argv ); // check whether they used the -both switch. If this is specified, vrad will be run // twice, once with -hdr and once without int both_arg=0; for(int arg=1;argmain( argc, argv ); Sys_UnloadModule( pModule ); pModule=0; } return returnValue; }