1
This commit is contained in:
BIN
hammer_launcher/hammer_launcher.ico
Normal file
BIN
hammer_launcher/hammer_launcher.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
72
hammer_launcher/hammer_launcher.rc
Normal file
72
hammer_launcher/hammer_launcher.rc
Normal file
@ -0,0 +1,72 @@
|
||||
//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
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_HAMMER_LAUNCHER ICON DISCARDABLE "hammer_launcher.ico"
|
||||
|
||||
#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
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
43
hammer_launcher/hammer_launcher.vpc
Normal file
43
hammer_launcher/hammer_launcher.vpc
Normal file
@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// HAMMER_LAUNCHER.VPC
|
||||
//
|
||||
// Project Script
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
$Macro SRCDIR ".."
|
||||
$Macro OUTBINDIR "$SRCDIR\..\game\bin"
|
||||
$Macro OUTBINNAME "hammer"
|
||||
|
||||
$Include "$SRCDIR\vpc_scripts\source_exe_base.vpc"
|
||||
|
||||
$Configuration
|
||||
{
|
||||
$Compiler
|
||||
{
|
||||
$AdditionalOptions "$BASE /EHa"
|
||||
}
|
||||
|
||||
$Linker [$WIN32]
|
||||
{
|
||||
$EnableLargeAddresses "Support Addresses Larger Than 2 Gigabytes (/LARGEADDRESSAWARE)"
|
||||
}
|
||||
}
|
||||
|
||||
$Project "Hammer_launcher"
|
||||
{
|
||||
$Folder "Source Files"
|
||||
{
|
||||
-$File "$SRCDIR\public\tier0\memoverride.cpp"
|
||||
$File "main.cpp"
|
||||
}
|
||||
|
||||
$Folder "Resources"
|
||||
{
|
||||
$File "hammer_launcher.rc"
|
||||
}
|
||||
|
||||
$Folder "Link Libraries"
|
||||
{
|
||||
$Lib appframework
|
||||
}
|
||||
}
|
198
hammer_launcher/main.cpp
Normal file
198
hammer_launcher/main.cpp
Normal file
@ -0,0 +1,198 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Launcher for hammer, which is sitting in its own DLL
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#include <windows.h>
|
||||
#include <eh.h>
|
||||
#include "appframework/AppFramework.h"
|
||||
#include "ihammer.h"
|
||||
#include "tier0/dbg.h"
|
||||
#include "vstdlib/cvar.h"
|
||||
#include "filesystem.h"
|
||||
#include "materialsystem/imaterialsystem.h"
|
||||
#include "istudiorender.h"
|
||||
#include "filesystem_init.h"
|
||||
#include "datacache/idatacache.h"
|
||||
#include "datacache/imdlcache.h"
|
||||
#include "vphysics_interface.h"
|
||||
#include "vgui/ivgui.h"
|
||||
#include "vgui/ISurface.h"
|
||||
#include "inputsystem/iinputsystem.h"
|
||||
#include "tier0/icommandline.h"
|
||||
#include "p4lib/ip4.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Global systems
|
||||
//-----------------------------------------------------------------------------
|
||||
IHammer *g_pHammer;
|
||||
IMaterialSystem *g_pMaterialSystem;
|
||||
IFileSystem *g_pFileSystem;
|
||||
IDataCache *g_pDataCache;
|
||||
IInputSystem *g_pInputSystem;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// The application object
|
||||
//-----------------------------------------------------------------------------
|
||||
class CHammerApp : public CAppSystemGroup
|
||||
{
|
||||
public:
|
||||
// Methods of IApplication
|
||||
virtual bool Create( );
|
||||
virtual bool PreInit( );
|
||||
virtual int Main( );
|
||||
virtual void PostShutdown();
|
||||
virtual void Destroy();
|
||||
|
||||
private:
|
||||
int MainLoop();
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Define the application object
|
||||
//-----------------------------------------------------------------------------
|
||||
CHammerApp g_ApplicationObject;
|
||||
DEFINE_WINDOWED_APPLICATION_OBJECT_GLOBALVAR( g_ApplicationObject );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Create all singleton systems
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CHammerApp::Create( )
|
||||
{
|
||||
// Save some memory so engine/hammer isn't so painful
|
||||
CommandLine()->AppendParm( "-disallowhwmorph", NULL );
|
||||
|
||||
IAppSystem *pSystem;
|
||||
|
||||
// Add in the cvar factory
|
||||
AppModule_t cvarModule = LoadModule( VStdLib_GetICVarFactory() );
|
||||
pSystem = AddSystem( cvarModule, CVAR_INTERFACE_VERSION );
|
||||
if ( !pSystem )
|
||||
return false;
|
||||
|
||||
bool bSteam;
|
||||
char pFileSystemDLL[MAX_PATH];
|
||||
if ( FileSystem_GetFileSystemDLLName( pFileSystemDLL, MAX_PATH, bSteam ) != FS_OK )
|
||||
return false;
|
||||
|
||||
AppModule_t fileSystemModule = LoadModule( pFileSystemDLL );
|
||||
g_pFileSystem = (IFileSystem*)AddSystem( fileSystemModule, FILESYSTEM_INTERFACE_VERSION );
|
||||
|
||||
FileSystem_SetBasePaths( g_pFileSystem );
|
||||
|
||||
AppSystemInfo_t appSystems[] =
|
||||
{
|
||||
{ "materialsystem.dll", MATERIAL_SYSTEM_INTERFACE_VERSION },
|
||||
{ "inputsystem.dll", INPUTSYSTEM_INTERFACE_VERSION },
|
||||
{ "studiorender.dll", STUDIO_RENDER_INTERFACE_VERSION },
|
||||
{ "vphysics.dll", VPHYSICS_INTERFACE_VERSION },
|
||||
{ "datacache.dll", DATACACHE_INTERFACE_VERSION },
|
||||
{ "datacache.dll", MDLCACHE_INTERFACE_VERSION },
|
||||
{ "datacache.dll", STUDIO_DATA_CACHE_INTERFACE_VERSION },
|
||||
{ "vguimatsurface.dll", VGUI_SURFACE_INTERFACE_VERSION },
|
||||
{ "vgui2.dll", VGUI_IVGUI_INTERFACE_VERSION },
|
||||
{ "hammer_dll.dll", INTERFACEVERSION_HAMMER },
|
||||
{ "", "" } // Required to terminate the list
|
||||
};
|
||||
|
||||
if ( !AddSystems( appSystems ) )
|
||||
return false;
|
||||
|
||||
// Add Perforce separately since it's possible it isn't there. (SDK)
|
||||
if ( !CommandLine()->CheckParm( "-nop4" ) )
|
||||
{
|
||||
AppModule_t p4Module = LoadModule( "p4lib.dll" );
|
||||
AddSystem( p4Module, P4_INTERFACE_VERSION );
|
||||
}
|
||||
// Connect to interfaces loaded in AddSystems that we need locally
|
||||
g_pMaterialSystem = (IMaterialSystem*)FindSystem( MATERIAL_SYSTEM_INTERFACE_VERSION );
|
||||
g_pHammer = (IHammer*)FindSystem( INTERFACEVERSION_HAMMER );
|
||||
g_pDataCache = (IDataCache*)FindSystem( DATACACHE_INTERFACE_VERSION );
|
||||
g_pInputSystem = (IInputSystem*)FindSystem( INPUTSYSTEM_INTERFACE_VERSION );
|
||||
|
||||
// This has to be done before connection.
|
||||
g_pMaterialSystem->SetShaderAPI( "shaderapidx9.dll" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CHammerApp::Destroy()
|
||||
{
|
||||
g_pFileSystem = NULL;
|
||||
g_pMaterialSystem = NULL;
|
||||
g_pDataCache = NULL;
|
||||
g_pHammer = NULL;
|
||||
g_pInputSystem = NULL;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
SpewRetval_t HammerSpewFunc( SpewType_t type, tchar const *pMsg )
|
||||
{
|
||||
if ( type == SPEW_ASSERT )
|
||||
{
|
||||
return SPEW_DEBUGGER;
|
||||
}
|
||||
else if( type == SPEW_ERROR )
|
||||
{
|
||||
MessageBox( NULL, pMsg, "Hammer Error", MB_OK | MB_ICONSTOP );
|
||||
return SPEW_ABORT;
|
||||
}
|
||||
else
|
||||
{
|
||||
return SPEW_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Init, shutdown
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CHammerApp::PreInit( )
|
||||
{
|
||||
SpewOutputFunc( HammerSpewFunc );
|
||||
if ( !g_pHammer->InitSessionGameConfig( GetVProjectCmdLineValue() ) )
|
||||
return false;
|
||||
|
||||
//
|
||||
// Init the game and mod dirs in the file system.
|
||||
// This needs to happen before calling Init on the material system.
|
||||
//
|
||||
CFSSearchPathsInit initInfo;
|
||||
initInfo.m_pFileSystem = g_pFileSystem;
|
||||
initInfo.m_pDirectoryName = g_pHammer->GetDefaultModFullPath();
|
||||
|
||||
if ( FileSystem_LoadSearchPaths( initInfo ) != FS_OK )
|
||||
{
|
||||
Error( "Unable to load search paths!\n" );
|
||||
}
|
||||
|
||||
// Required to run through the editor
|
||||
g_pMaterialSystem->EnableEditorMaterials();
|
||||
|
||||
// needed for VGUI model rendering
|
||||
g_pMaterialSystem->SetAdapter( 0, MATERIAL_INIT_ALLOCATE_FULLSCREEN_TEXTURE );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CHammerApp::PostShutdown()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// main application
|
||||
//-----------------------------------------------------------------------------
|
||||
int CHammerApp::Main( )
|
||||
{
|
||||
return g_pHammer->MainLoop();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
23
hammer_launcher/resource.h
Normal file
23
hammer_launcher/resource.h
Normal file
@ -0,0 +1,23 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//=============================================================================//
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by hammer_launcher.rc
|
||||
//
|
||||
#define IDI_HAMMER_LAUNCHER 101
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
Reference in New Issue
Block a user