initial
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
// ----------------------------------------- //
|
||||
// File generated by VPC //
|
||||
// ----------------------------------------- //
|
||||
|
||||
Source file: F:\csgo_64\cstrike15_src\utils\shadercompile_launcher\shadercompile_launcher.cpp
|
||||
Debug output file: F:\csgo_64\cstrike15_src\utils\shadercompile_launcher\shadercompile_launcher.cpp
|
||||
Release output file: F:\csgo_64\cstrike15_src\utils\shadercompile_launcher\shadercompile_launcher.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
141
utils/shadercompile_launcher/shadercompile_launcher.cpp
Normal file
141
utils/shadercompile_launcher/shadercompile_launcher.cpp
Normal file
@@ -0,0 +1,141 @@
|
||||
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//=============================================================================//
|
||||
// vrad_launcher.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
|
||||
#include <windows.h>
|
||||
#include "interface.h"
|
||||
#include <direct.h>
|
||||
#include "tier1/strtools.h"
|
||||
#include "tier0/icommandline.h"
|
||||
#include "ishadercompiledll.h"
|
||||
#include <stdio.h>
|
||||
#include <conio.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 );
|
||||
}
|
||||
}
|
||||
|
||||
void Pause( void )
|
||||
{
|
||||
// printf( "Pause\n" );
|
||||
// fflush( stdout );
|
||||
// getch();
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
char dllName[512];
|
||||
|
||||
Pause();
|
||||
CommandLine()->CreateCmdLine( argc, argv );
|
||||
|
||||
char fullPath[512], redirectFilename[512];
|
||||
MakeFullPath( argv[0], fullPath, sizeof( fullPath ) );
|
||||
Q_StripFilename( fullPath );
|
||||
Q_snprintf( redirectFilename, sizeof( redirectFilename ), "%s\\%s", fullPath, "vrad.redirect" );
|
||||
|
||||
Pause();
|
||||
// First, look for vrad.redirect and load the dll specified in there if possible.
|
||||
CSysModule *pModule = NULL;
|
||||
FILE *fp = fopen( redirectFilename, "rt" );
|
||||
if ( fp )
|
||||
{
|
||||
if ( fgets( dllName, sizeof( dllName ), fp ) )
|
||||
{
|
||||
char *pEnd = strstr( dllName, "\n" );
|
||||
if ( pEnd )
|
||||
*pEnd = 0;
|
||||
|
||||
pModule = Sys_LoadModule( dllName );
|
||||
if ( pModule )
|
||||
printf( "Loaded alternate VRAD DLL (%s) specified in vrad.redirect.\n", dllName );
|
||||
else
|
||||
printf( "Can't find '%s' specified in vrad.redirect.\n", dllName );
|
||||
}
|
||||
|
||||
fclose( fp );
|
||||
}
|
||||
Pause();
|
||||
|
||||
// If it didn't load the module above, then use the
|
||||
if ( !pModule )
|
||||
{
|
||||
strcpy( dllName, "shadercompile_dll.dll" );
|
||||
pModule = Sys_LoadModule( dllName );
|
||||
}
|
||||
|
||||
Pause();
|
||||
if( !pModule )
|
||||
{
|
||||
printf( "vrad_launcher error: can't load %s\n%s", dllName, GetLastErrorString() );
|
||||
Pause();
|
||||
return 1;
|
||||
}
|
||||
|
||||
Pause();
|
||||
CreateInterfaceFn fn = Sys_GetFactory( pModule );
|
||||
if( !fn )
|
||||
{
|
||||
printf( "vrad_launcher error: can't get factory from vrad_dll.dll\n" );
|
||||
Sys_UnloadModule( pModule );
|
||||
return 2;
|
||||
}
|
||||
|
||||
int retCode = 0;
|
||||
IShaderCompileDLL *pDLL = (IShaderCompileDLL*)fn( SHADER_COMPILE_INTERFACE_VERSION, &retCode );
|
||||
if( !pDLL )
|
||||
{
|
||||
printf( "vrad_launcher error: can't get IVRadDLL interface from vrad_dll.dll\n" );
|
||||
Sys_UnloadModule( pModule );
|
||||
return 3;
|
||||
}
|
||||
|
||||
int returnValue = pDLL->main( argc, argv );
|
||||
Sys_UnloadModule( pModule );
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
21
utils/shadercompile_launcher/shadercompile_launcher.vpc
Normal file
21
utils/shadercompile_launcher/shadercompile_launcher.vpc
Normal file
@@ -0,0 +1,21 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// SHADERCOMPILE_LAUNCHER.VPC
|
||||
//
|
||||
// Project Script
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
$Macro SRCDIR "..\.."
|
||||
$Macro OUTBINDIR "$SRCDIR\..\game\bin"
|
||||
$Macro OUTBINNAME "shadercompile"
|
||||
|
||||
$Include "$SRCDIR\vpc_scripts\source_exe_con_win32_base.vpc"
|
||||
|
||||
$Project "Shadercompile_launcher"
|
||||
{
|
||||
$Folder "Source Files"
|
||||
{
|
||||
-$File "$SRCDIR\public\tier0\memoverride.cpp"
|
||||
|
||||
$File "shadercompile_launcher.cpp"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
"vpc_cache"
|
||||
{
|
||||
"CacheVersion" "1"
|
||||
"win32"
|
||||
{
|
||||
"CRCFile" "shadercompile_launcher.vcxproj.vpc_crc"
|
||||
"OutputFiles"
|
||||
{
|
||||
"0" "shadercompile_launcher.vcxproj"
|
||||
"1" "shadercompile_launcher.vcxproj.filters"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user