summaryrefslogtreecommitdiff
path: root/utils/vvis_launcher
diff options
context:
space:
mode:
Diffstat (limited to 'utils/vvis_launcher')
-rw-r--r--utils/vvis_launcher/StdAfx.cpp15
-rw-r--r--utils/vvis_launcher/StdAfx.h31
-rw-r--r--utils/vvis_launcher/vvis_launcher.cpp79
-rw-r--r--utils/vvis_launcher/vvis_launcher.vpc51
4 files changed, 176 insertions, 0 deletions
diff --git a/utils/vvis_launcher/StdAfx.cpp b/utils/vvis_launcher/StdAfx.cpp
new file mode 100644
index 0000000..37ff27f
--- /dev/null
+++ b/utils/vvis_launcher/StdAfx.cpp
@@ -0,0 +1,15 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+// stdafx.cpp : source file that includes just the standard includes
+// vvis_launcher.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/utils/vvis_launcher/StdAfx.h b/utils/vvis_launcher/StdAfx.h
new file mode 100644
index 0000000..e67fc75
--- /dev/null
+++ b/utils/vvis_launcher/StdAfx.h
@@ -0,0 +1,31 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#if !defined(AFX_STDAFX_H__29316173_1244_4B6A_B361_1ADB126E69F2__INCLUDED_)
+#define AFX_STDAFX_H__29316173_1244_4B6A_B361_1ADB126E69F2__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+
+#include <windows.h>
+#include <stdio.h>
+#include "interface.h"
+
+// TODO: reference additional headers your program requires here
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__29316173_1244_4B6A_B361_1ADB126E69F2__INCLUDED_)
diff --git a/utils/vvis_launcher/vvis_launcher.cpp b/utils/vvis_launcher/vvis_launcher.cpp
new file mode 100644
index 0000000..edf03d2
--- /dev/null
+++ b/utils/vvis_launcher/vvis_launcher.cpp
@@ -0,0 +1,79 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+// vvis_launcher.cpp : Defines the entry point for the console application.
+//
+
+#include "stdafx.h"
+#include <direct.h>
+#include "tier1/strtools.h"
+#include "tier0/icommandline.h"
+#include "ilaunchabledll.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;
+}
+
+
+int main(int argc, char* argv[])
+{
+ CommandLine()->CreateCmdLine( argc, argv );
+ const char *pDLLName = "vvis_dll.dll";
+
+ CSysModule *pModule = Sys_LoadModule( pDLLName );
+ if ( !pModule )
+ {
+ printf( "vvis launcher error: can't load %s\n%s", pDLLName, GetLastErrorString() );
+ return 1;
+ }
+
+ CreateInterfaceFn fn = Sys_GetFactory( pModule );
+ if( !fn )
+ {
+ printf( "vvis launcher error: can't get factory from %s\n", pDLLName );
+ Sys_UnloadModule( pModule );
+ return 2;
+ }
+
+ int retCode = 0;
+ ILaunchableDLL *pDLL = (ILaunchableDLL*)fn( LAUNCHABLE_DLL_INTERFACE_VERSION, &retCode );
+ if( !pDLL )
+ {
+ printf( "vvis launcher error: can't get IVVisDLL interface from %s\n", pDLLName );
+ Sys_UnloadModule( pModule );
+ return 3;
+ }
+
+ pDLL->main( argc, argv );
+ Sys_UnloadModule( pModule );
+
+ return 0;
+}
+
diff --git a/utils/vvis_launcher/vvis_launcher.vpc b/utils/vvis_launcher/vvis_launcher.vpc
new file mode 100644
index 0000000..7171340
--- /dev/null
+++ b/utils/vvis_launcher/vvis_launcher.vpc
@@ -0,0 +1,51 @@
+//-----------------------------------------------------------------------------
+// VVIS_LAUNCHER.VPC
+//
+// Project Script
+//-----------------------------------------------------------------------------
+
+$Macro SRCDIR "..\.."
+$Macro OUTBINDIR "$SRCDIR\..\game\bin"
+$Macro OUTBINNAME "vvis"
+
+$Include "$SRCDIR\vpc_scripts\source_exe_con_base.vpc"
+
+$Configuration
+{
+ $Compiler
+ {
+ $AdditionalIncludeDirectories "$BASE,..\common"
+ $Create/UsePrecompiledHeader "Use Precompiled Header (/Yu)"
+ $PrecompiledHeaderFile "Debug/vvis_launcher.pch"
+ }
+
+ $Linker [$WIN32]
+ {
+ $EnableLargeAddresses "Support Addresses Larger Than 2 Gigabytes (/LARGEADDRESSAWARE)"
+ }
+}
+
+$Project "Vvis_launcher"
+{
+ $Folder "Source Files"
+ {
+ $File "vvis_launcher.cpp"
+
+ $File "StdAfx.cpp"
+ {
+ $Configuration
+ {
+ $Compiler
+ {
+ $Create/UsePrecompiledHeader "Create Precompiled Header (/Yc)"
+ }
+ }
+ }
+ }
+
+ $Folder "Header Files"
+ {
+ $File "$SRCDIR\public\tier1\interface.h"
+ $File "StdAfx.h"
+ }
+}