initial
This commit is contained in:
34
launcher/_vpc_/manifest_launcher/win32/manifest.txt
Normal file
34
launcher/_vpc_/manifest_launcher/win32/manifest.txt
Normal file
@@ -0,0 +1,34 @@
|
||||
// ----------------------------------------- //
|
||||
// File generated by VPC //
|
||||
// ----------------------------------------- //
|
||||
|
||||
Source file: F:\csgo_64\cstrike15_src\common\debug_dll_check.cpp
|
||||
Debug output file: F:\csgo_64\cstrike15_src\common\debug_dll_check.cpp
|
||||
Release output file: F:\csgo_64\cstrike15_src\common\debug_dll_check.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: F:\csgo_64\cstrike15_src\public\filesystem_init.cpp
|
||||
Debug output file: F:\csgo_64\cstrike15_src\public\filesystem_init.cpp
|
||||
Release output file: F:\csgo_64\cstrike15_src\public\filesystem_init.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: F:\csgo_64\cstrike15_src\launcher\launcher.cpp
|
||||
Debug output file: F:\csgo_64\cstrike15_src\launcher\launcher.cpp
|
||||
Release output file: F:\csgo_64\cstrike15_src\launcher\launcher.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: F:\csgo_64\cstrike15_src\public\tier0\memoverride.cpp
|
||||
Debug output file: F:\csgo_64\cstrike15_src\public\tier0\memoverride.cpp
|
||||
Release output file: F:\csgo_64\cstrike15_src\public\tier0\memoverride.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
Source file: F:\csgo_64\cstrike15_src\launcher\reslistgenerator.cpp
|
||||
Debug output file: F:\csgo_64\cstrike15_src\launcher\reslistgenerator.cpp
|
||||
Release output file: F:\csgo_64\cstrike15_src\launcher\reslistgenerator.cpp
|
||||
Containing unity file:
|
||||
PCH file:
|
||||
|
||||
37
launcher/ifilesystem.h
Normal file
37
launcher/ifilesystem.h
Normal file
@@ -0,0 +1,37 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $Workfile: $
|
||||
// $Date: $
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#ifndef IFILESYSTEM_H
|
||||
#define IFILESYSTEM_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
|
||||
class IFileSystem;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Loads, unloads the file system DLL
|
||||
//-----------------------------------------------------------------------------
|
||||
bool FileSystem_LoadFileSystemModule( void );
|
||||
void FileSystem_UnloadFileSystemModule( void );
|
||||
|
||||
CSysModule * FileSystem_LoadModule( const char* path );
|
||||
void FileSystem_UnloadModule( CSysModule *pModule );
|
||||
|
||||
bool FileSystem_Init( );
|
||||
void FileSystem_Shutdown( void );
|
||||
|
||||
// Sets the file system search path based on the game directory
|
||||
bool FileSystem_SetGameDirectory( char const* pGameDir );
|
||||
|
||||
extern IFileSystem *g_pFileSystem;
|
||||
|
||||
#endif // IFILESYSTEM_H
|
||||
1978
launcher/launcher.cpp
Normal file
1978
launcher/launcher.cpp
Normal file
File diff suppressed because it is too large
Load Diff
107
launcher/launcher.vpc
Normal file
107
launcher/launcher.vpc
Normal file
@@ -0,0 +1,107 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// LAUNCHER.VPC
|
||||
//
|
||||
// Project Script
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
$Macro SRCDIR ".."
|
||||
$Macro OUTBINDIR "$SRCDIR\..\game\bin"
|
||||
|
||||
$include "$SRCDIR\vpc_scripts\source_dll_base.vpc"
|
||||
|
||||
$Configuration
|
||||
{
|
||||
$General
|
||||
{
|
||||
$AdditionalProjectDependencies "$BASE;togl" [$OSXALL && $SDL]
|
||||
}
|
||||
$Compiler
|
||||
{
|
||||
$PreprocessorDefinitions "$BASE;LAUNCHERONLY;INCLUDE_SCALEFORM"
|
||||
$PreprocessorDefinitions "$BASE;ALLOW_TEXT_MODE=1" [$CSTRIKE_TRUNK_BUILD||$CSTRIKE_STAGING_BUILD]
|
||||
}
|
||||
|
||||
$Linker [!$PS3]
|
||||
{
|
||||
$AdditionalDependencies "$BASE shlwapi.lib winmm.lib wsock32.lib odbc32.lib odbccp32.lib $SRCDIR\dx9sdk\lib\dinput8.lib" [$WINDOWS]
|
||||
$SystemFrameworks "Carbon;AppKit;OpenGL;IOKit"
|
||||
$SystemFrameworks "Carbon;AppKit;OpenGL;IOKit"
|
||||
$SystemLibraries "iconv" [$OSXALL]
|
||||
$SystemLibraries "SDL2" [$LINUXALL]
|
||||
// We run from the ./game dir, but want to look in the ./game/bin directory when loading libraries.
|
||||
// To dump rpath/runpath of a library, use "chrpath --list blah.so" or "objdump -x blah.so" or "readelf -d bin/launcher.so"
|
||||
$GCC_ExtraLinkerFlags "-Wl,--enable-new-dtags -Wl,-z,origin -Wl,-rpath,'$$ORIGIN' -L/usr/lib32 -L/usr/lib" [$LINUXALL]
|
||||
}
|
||||
}
|
||||
|
||||
$Configuration "Debug"
|
||||
{
|
||||
$Linker
|
||||
{
|
||||
$AdditionalDependencies "$BASE Xonlined.lib" [$X360]
|
||||
}
|
||||
}
|
||||
|
||||
$Configuration "Release"
|
||||
{
|
||||
$Linker
|
||||
{
|
||||
$AdditionalDependencies "$BASE Xonline.lib" [$X360]
|
||||
}
|
||||
}
|
||||
|
||||
$Project
|
||||
{
|
||||
$Folder "Source Files" [$PS3]
|
||||
{
|
||||
-$File "$SRCDIR\common\ps3\prx.cpp"
|
||||
}
|
||||
}
|
||||
|
||||
$Project "launcher"
|
||||
{
|
||||
$Folder "Source Files"
|
||||
{
|
||||
$File "$SRCDIR\public\filesystem_init.cpp"
|
||||
$File "launcher.cpp"
|
||||
$File "reslistgenerator.cpp"
|
||||
$File "prx.cpp" [$PS3]
|
||||
}
|
||||
|
||||
$Folder "Header Files"
|
||||
{
|
||||
$File "$SRCDIR\public\tier0\basetypes.h"
|
||||
$File "$SRCDIR\public\tier0\dbg.h"
|
||||
$File "$SRCDIR\common\engine_launcher_api.h"
|
||||
$File "$SRCDIR\public\tier0\fasttimer.h"
|
||||
$File "$SRCDIR\public\appframework\iappsystem.h"
|
||||
$File "$SRCDIR\public\tier0\icommandline.h"
|
||||
$File "ifilesystem.h"
|
||||
$File "$SRCDIR\public\vgui\IHTML.h"
|
||||
$File "$SRCDIR\public\vgui\IImage.h"
|
||||
$File "$SRCDIR\public\tier1\interface.h"
|
||||
$File "$SRCDIR\public\vgui\ISurface.h"
|
||||
$File "$SRCDIR\public\vgui\KeyCode.h"
|
||||
$File "$SRCDIR\public\tier0\mem.h"
|
||||
$File "$SRCDIR\public\tier0\memalloc.h"
|
||||
$File "$SRCDIR\public\vgui\MouseCode.h"
|
||||
$File "$SRCDIR\public\tier0\platform.h"
|
||||
$File "reslistgenerator.h"
|
||||
$File "$SRCDIR\public\string_t.h"
|
||||
$File "$SRCDIR\public\tier1\strtools.h"
|
||||
$File "$SRCDIR\public\mathlib\vector2d.h"
|
||||
$File "$SRCDIR\public\vgui\vgui.h"
|
||||
$File "$SRCDIR\public\vstdlib\vstdlib.h"
|
||||
}
|
||||
|
||||
$folder "Link Libraries"
|
||||
{
|
||||
$Lib appframework
|
||||
$Lib tier2
|
||||
$Lib tier3
|
||||
$ImplibExternal steam_api [ ( $WIN32 || $POSIX || $PS3 ) && !$NO_STEAM ]
|
||||
$ImplibExternal steam_api64 [ $WIN64 && !$NO_STEAM ]
|
||||
$ImpLib togl [!$IS_LIB_PROJECT && $GL]
|
||||
$ImpLib SDL2 [$SDL && !$LINUXALL]
|
||||
}
|
||||
}
|
||||
13
launcher/launcher.vpc.vpc_cache
Normal file
13
launcher/launcher.vpc.vpc_cache
Normal file
@@ -0,0 +1,13 @@
|
||||
"vpc_cache"
|
||||
{
|
||||
"CacheVersion" "1"
|
||||
"win32"
|
||||
{
|
||||
"CRCFile" "launcher.vcxproj.vpc_crc"
|
||||
"OutputFiles"
|
||||
{
|
||||
"0" "launcher.vcxproj"
|
||||
"1" "launcher.vcxproj.filters"
|
||||
}
|
||||
}
|
||||
}
|
||||
44
launcher/prx.cpp
Normal file
44
launcher/prx.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#include "platform.h"
|
||||
#include "basetypes.h"
|
||||
#include "dbg.h"
|
||||
#include "logging.h"
|
||||
#include <cellstatus.h>
|
||||
#include <sys/prx.h>
|
||||
#include "ps3/ps3_helpers.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define launcher_ps3 launcher_dbg
|
||||
#else
|
||||
#define launcher_ps3 launcher_rel
|
||||
#endif
|
||||
|
||||
|
||||
PS3_PRX_SYS_MODULE_INFO_FULLMACROREPLACEMENTHELPER( launcher );
|
||||
SYS_MODULE_START( _launcher_ps3_prx_entry );
|
||||
|
||||
|
||||
|
||||
int LauncherMain( int argc, char **argv );
|
||||
|
||||
void Launcher_ShutdownCallback()
|
||||
{
|
||||
LoggingSystem_ResetCurrentLoggingState(); // tear down all logging listeners
|
||||
}
|
||||
|
||||
// An exported function is needed to generate the project's PRX stub export library
|
||||
extern "C" int _launcher_ps3_prx_entry( unsigned int args, void *pArg )
|
||||
{
|
||||
Assert( args >= sizeof( PS3_LoadLauncher_Parameters_t ) );
|
||||
|
||||
PS3_LoadLauncher_Parameters_t *pParams = reinterpret_cast< PS3_LoadLauncher_Parameters_t * >( pArg );
|
||||
Assert( pParams->cbSize >= sizeof( PS3_LoadLauncher_Parameters_t ) );
|
||||
|
||||
pParams->pfnLauncherMain = LauncherMain;
|
||||
|
||||
// Return tier0 shutdown callback
|
||||
pParams->pfnLauncherShutdown = Launcher_ShutdownCallback;
|
||||
|
||||
return SYS_PRX_RESIDENT;
|
||||
}
|
||||
|
||||
BIN
launcher/res/launcher.ico
Normal file
BIN
launcher/res/launcher.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
555
launcher/reslistgenerator.cpp
Normal file
555
launcher/reslistgenerator.cpp
Normal file
@@ -0,0 +1,555 @@
|
||||
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// Defines the entry point for the application.
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#include "reslistgenerator.h"
|
||||
#include "filesystem.h"
|
||||
#include "tier1/utlrbtree.h"
|
||||
#include "tier1/fmtstr.h"
|
||||
#include "characterset.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier1/utlvector.h"
|
||||
#include "tier1/utlbuffer.h"
|
||||
#include "tier0/icommandline.h"
|
||||
#include "tier1/keyvalues.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
bool SaveResList( const CUtlRBTree< CUtlString, int > &list, char const *pchFileName, char const *pchSearchPath )
|
||||
{
|
||||
FileHandle_t fh = g_pFullFileSystem->Open( pchFileName, "wt", pchSearchPath );
|
||||
if ( fh != FILESYSTEM_INVALID_HANDLE )
|
||||
{
|
||||
for ( int i = list.FirstInorder(); i != list.InvalidIndex(); i = list.NextInorder( i ) )
|
||||
{
|
||||
g_pFullFileSystem->Write( list[ i ].String(), Q_strlen( list[ i ].String() ), fh );
|
||||
g_pFullFileSystem->Write( "\n", 1, fh );
|
||||
}
|
||||
|
||||
g_pFullFileSystem->Close( fh );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void LoadResList( CUtlRBTree< CUtlString, int > &list, char const *pchFileName, char const *pchSearchPath )
|
||||
{
|
||||
CUtlBuffer buffer( 0, 0, CUtlBuffer::TEXT_BUFFER );
|
||||
if ( !g_pFullFileSystem->ReadFile( pchFileName, pchSearchPath, buffer ) )
|
||||
{
|
||||
// does not exist
|
||||
return;
|
||||
}
|
||||
|
||||
characterset_t breakSet;
|
||||
CharacterSetBuild( &breakSet, "" );
|
||||
|
||||
// parse reslist
|
||||
char szToken[ MAX_PATH ];
|
||||
for ( ;; )
|
||||
{
|
||||
int nTokenSize = buffer.ParseToken( &breakSet, szToken, sizeof( szToken ) );
|
||||
if ( nTokenSize <= 0 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Q_strlower( szToken );
|
||||
Q_FixSlashes( szToken );
|
||||
|
||||
// Ensure filename has "quotes" around it
|
||||
CUtlString s;
|
||||
if ( szToken[ 0 ] == '\"' )
|
||||
{
|
||||
Assert( Q_strlen( szToken ) > 2 );
|
||||
Assert( szToken[ Q_strlen( szToken ) - 1 ] == '\"' );
|
||||
s = szToken;
|
||||
}
|
||||
else
|
||||
{
|
||||
s = CFmtStr( "\"%s\"", szToken );
|
||||
}
|
||||
|
||||
int idx = list.Find( s );
|
||||
if ( idx == list.InvalidIndex() )
|
||||
{
|
||||
list.Insert( s );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool ReslistLogLessFunc( CUtlString const &pLHS, CUtlString const &pRHS )
|
||||
{
|
||||
return CaselessStringLessThan( pLHS.Get(), pRHS.Get() );
|
||||
}
|
||||
|
||||
void SortResList( char const *pchFileName, char const *pchSearchPath )
|
||||
{
|
||||
CUtlRBTree< CUtlString, int > sorted( 0, 0, ReslistLogLessFunc );
|
||||
LoadResList( sorted, pchFileName, pchSearchPath );
|
||||
|
||||
// Now write it back out
|
||||
SaveResList( sorted, pchFileName, pchSearchPath );
|
||||
}
|
||||
|
||||
void MergeResLists( CUtlVector< CUtlString > &fileNames, char const *pchOutputFile, char const *pchSearchPath )
|
||||
{
|
||||
CUtlRBTree< CUtlString, int > sorted( 0, 0, ReslistLogLessFunc );
|
||||
for ( int i = 0; i < fileNames.Count(); ++i )
|
||||
{
|
||||
LoadResList( sorted, fileNames[ i ].String(), pchSearchPath );
|
||||
}
|
||||
|
||||
// Now write it back out
|
||||
SaveResList( sorted, pchOutputFile, pchSearchPath );
|
||||
}
|
||||
|
||||
class CWorkItem
|
||||
{
|
||||
public:
|
||||
CWorkItem()
|
||||
{
|
||||
}
|
||||
|
||||
CUtlString m_sSubDir;
|
||||
CUtlString m_sAddCommands;
|
||||
};
|
||||
class CResListGenerator: public IResListGenerator
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
STATE_SETUP = 0,
|
||||
STATE_BUILDINGRESLISTS,
|
||||
STATE_GENERATINGCACHES,
|
||||
STATE_MAXSTATES
|
||||
};
|
||||
|
||||
CResListGenerator();
|
||||
|
||||
virtual void Init( char const *pchBaseDir, char const *pchGameDir );
|
||||
virtual bool IsActive();
|
||||
virtual void Shutdown();
|
||||
virtual bool TickAndFixupCommandLine();
|
||||
virtual bool ShouldContinue();
|
||||
|
||||
private:
|
||||
|
||||
bool InitCommandFile( char const *pchGameDir, char const *pchCommandFile );
|
||||
void LoadMapList( char const *pchGameDir, CUtlVector< CUtlString > &vecMaps, char const *pchMapFile );
|
||||
void CollateFiles( char const *pchResListFilename );
|
||||
void Collate();
|
||||
|
||||
bool m_bInitialized;
|
||||
bool m_bActive;
|
||||
bool m_bCreatingForXbox;
|
||||
|
||||
CUtlString m_sBaseDir;
|
||||
CUtlString m_sGameDir;
|
||||
CUtlString m_sFullGamePath;
|
||||
|
||||
CUtlString m_sFinalDir;
|
||||
CUtlString m_sWorkingDir;
|
||||
CUtlString m_sBaseCommandLine;
|
||||
CUtlString m_sOriginalCommandLine;
|
||||
CUtlString m_sInitialStartMap;
|
||||
|
||||
int m_nCurrentWorkItem;
|
||||
CUtlVector< CWorkItem > m_WorkItems;
|
||||
|
||||
CUtlVector< CUtlString > m_MapList;
|
||||
int m_nCurrentState;
|
||||
};
|
||||
|
||||
static CResListGenerator g_ResListGenerator;
|
||||
IResListGenerator *reslistgenerator = &g_ResListGenerator;
|
||||
|
||||
CResListGenerator::CResListGenerator() :
|
||||
m_bInitialized( false ),
|
||||
m_bActive( false ),
|
||||
m_bCreatingForXbox( false ),
|
||||
m_nCurrentWorkItem( 0 ),
|
||||
m_nCurrentState( STATE_SETUP )
|
||||
{
|
||||
MEM_ALLOC_CREDIT();
|
||||
|
||||
m_sFinalDir = "reslists";
|
||||
m_sWorkingDir = "reslists_work";
|
||||
}
|
||||
|
||||
void CResListGenerator::CollateFiles( char const *pchResListFilename )
|
||||
{
|
||||
CUtlVector< CUtlString > vecReslists;
|
||||
|
||||
for ( int i = 0; i < m_WorkItems.Count(); ++i )
|
||||
{
|
||||
char fn[ MAX_PATH ];
|
||||
Q_snprintf( fn, sizeof( fn ), "%s\\%s\\%s\\%s", m_sFullGamePath.String(), m_sWorkingDir.String(), m_WorkItems[ i ].m_sSubDir.String(), pchResListFilename );
|
||||
vecReslists.AddToTail( fn );
|
||||
}
|
||||
|
||||
MergeResLists( vecReslists, CFmtStr( "%s\\%s\\%s", m_sFullGamePath.String(), m_sFinalDir.String(), pchResListFilename ), "GAME" );
|
||||
}
|
||||
|
||||
void CResListGenerator::Init( char const *pchBaseDir, char const *pchGameDir )
|
||||
{
|
||||
if ( IsX360() )
|
||||
{
|
||||
// not used or supported, PC builds them for Xbox
|
||||
return;
|
||||
}
|
||||
|
||||
// Because we have to call this inside the first Apps "PreInit", we need only Init on the very first call
|
||||
if ( m_bInitialized )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_bInitialized = true;
|
||||
|
||||
m_sBaseDir = pchBaseDir;
|
||||
m_sGameDir = pchGameDir;
|
||||
|
||||
char path[MAX_PATH];
|
||||
Q_snprintf( path, sizeof(path), "%s/%s", m_sBaseDir.String(), m_sGameDir.String() );
|
||||
Q_FixSlashes( path );
|
||||
Q_strlower( path );
|
||||
m_sFullGamePath = path;
|
||||
|
||||
const char *pchCommandFile = NULL;
|
||||
if ( CommandLine()->CheckParm( "-makereslists", &pchCommandFile ) && pchCommandFile )
|
||||
{
|
||||
// base path setup, now can get and parse command file
|
||||
// one time setup ONLY
|
||||
InitCommandFile( path, pchCommandFile );
|
||||
}
|
||||
}
|
||||
|
||||
void CResListGenerator::Shutdown()
|
||||
{
|
||||
if ( !m_bActive )
|
||||
return;
|
||||
}
|
||||
|
||||
bool CResListGenerator::IsActive()
|
||||
{
|
||||
return m_bInitialized && m_bActive;
|
||||
}
|
||||
|
||||
void CResListGenerator::Collate()
|
||||
{
|
||||
char szDir[MAX_PATH];
|
||||
V_snprintf( szDir, sizeof( szDir ), "%s\\%s", m_sFullGamePath.String(), m_sFinalDir.String() );
|
||||
g_pFullFileSystem->CreateDirHierarchy( szDir, "GAME" );
|
||||
|
||||
// Now create the collated/merged data
|
||||
CollateFiles( "all.lst" );
|
||||
CollateFiles( "engine.lst" );
|
||||
for ( int i = 0 ; i < m_MapList.Count(); ++i )
|
||||
{
|
||||
CollateFiles( CFmtStr( "%s.lst", m_MapList[ i ].String() ) );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Called at each restart invocation, clocks the state.
|
||||
// Returns TRUE if caller should proceed with command line, FALSE otherwise.
|
||||
// FALSE is used to stop the reslist process which requires additional post passes.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CResListGenerator::TickAndFixupCommandLine()
|
||||
{
|
||||
if ( !m_bActive )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// clock the state
|
||||
switch ( m_nCurrentState )
|
||||
{
|
||||
default:
|
||||
m_bActive = false;
|
||||
break;
|
||||
|
||||
case STATE_SETUP:
|
||||
// first time
|
||||
m_nCurrentState = STATE_BUILDINGRESLISTS;
|
||||
break;
|
||||
|
||||
case STATE_BUILDINGRESLISTS:
|
||||
{
|
||||
CommandLine()->RemoveParm( "-startmap" );
|
||||
|
||||
// Advance to next item
|
||||
++m_nCurrentWorkItem;
|
||||
if ( m_nCurrentWorkItem >= m_WorkItems.Count() )
|
||||
{
|
||||
// out of work, finalize
|
||||
Collate();
|
||||
|
||||
// advance to next state
|
||||
++m_nCurrentState;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_GENERATINGCACHES:
|
||||
++m_nCurrentState;
|
||||
break;
|
||||
}
|
||||
|
||||
switch ( m_nCurrentState )
|
||||
{
|
||||
default:
|
||||
m_bActive = false;
|
||||
break;
|
||||
|
||||
case STATE_BUILDINGRESLISTS:
|
||||
{
|
||||
Assert( m_nCurrentWorkItem < m_WorkItems.Count() );
|
||||
|
||||
const CWorkItem &work = m_WorkItems[ m_nCurrentWorkItem ];
|
||||
|
||||
// Clean the working dir
|
||||
char szWorkingDir[ 512 ];
|
||||
Q_snprintf( szWorkingDir, sizeof( szWorkingDir ), "%s\\%s", m_sWorkingDir.String(), work.m_sSubDir.String() );
|
||||
|
||||
char szFullWorkingDir[MAX_PATH];
|
||||
V_snprintf( szFullWorkingDir, sizeof( szFullWorkingDir ), "%s\\%s", m_sFullGamePath.String(), szWorkingDir );
|
||||
g_pFullFileSystem->CreateDirHierarchy( szFullWorkingDir, "GAME" );
|
||||
|
||||
// Preserve startmap
|
||||
char const *pszStartMap = NULL;
|
||||
CommandLine()->CheckParm( "-startmap", &pszStartMap );
|
||||
char szMap[ MAX_PATH ] = { 0 };
|
||||
if ( pszStartMap )
|
||||
{
|
||||
Q_strncpy( szMap, pszStartMap, sizeof( szMap ) );
|
||||
}
|
||||
|
||||
// Prepare stuff
|
||||
// Reset command line based on current state
|
||||
char szCmd[ 512 ];
|
||||
Q_snprintf( szCmd, sizeof( szCmd ), "%s %s %s -reslistdir %s", m_sOriginalCommandLine.String(), m_sBaseCommandLine.String(), work.m_sAddCommands.String(), szWorkingDir );
|
||||
CommandLine()->CreateCmdLine( szCmd );
|
||||
|
||||
// Never rebuild caches by default, inly do it in STATE_GENERATINGCACHES
|
||||
CommandLine()->AppendParm( "-norebuildaudio", NULL );
|
||||
if ( szMap[ 0 ] )
|
||||
{
|
||||
CommandLine()->AppendParm( "-startmap", szMap );
|
||||
}
|
||||
|
||||
if ( m_bCreatingForXbox )
|
||||
{
|
||||
CommandLine()->AppendParm( "-xboxreslist", NULL );
|
||||
}
|
||||
|
||||
Warning( "Generating Reslists: Setting command line:\n'%s'\n", CommandLine()->GetCmdLine() );
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_GENERATINGCACHES:
|
||||
{
|
||||
if ( m_bCreatingForXbox )
|
||||
{
|
||||
// Xbox has no caches, process finished
|
||||
m_bActive = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// Prepare stuff
|
||||
// Reset command line based on current state
|
||||
char szCmd[ 512 ];
|
||||
Q_snprintf( szCmd, sizeof( szCmd ), "%s -reslistdir %s -rebuildaudio", m_sOriginalCommandLine.String(), m_sFinalDir.String());
|
||||
CommandLine()->CreateCmdLine( szCmd );
|
||||
|
||||
CommandLine()->RemoveParm( "-norebuildaudio" );
|
||||
CommandLine()->RemoveParm( "-makereslists" );
|
||||
|
||||
Warning( "Generating Caches: Setting command line:\n'%s'\n", CommandLine()->GetCmdLine() );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !m_bActive )
|
||||
{
|
||||
// no further processing required, make the engine shut down cleanly in this pass
|
||||
CommandLine()->RemoveParm( "-makereslists" );
|
||||
CommandLine()->AppendParm( "-autoquit", NULL );
|
||||
}
|
||||
|
||||
// continue
|
||||
return m_bActive;
|
||||
}
|
||||
|
||||
bool CResListGenerator::ShouldContinue()
|
||||
{
|
||||
// some states require post processing
|
||||
// let the state processing determine the final quit state
|
||||
if ( !m_bActive || m_nCurrentState >= STATE_MAXSTATES )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CResListGenerator::LoadMapList( char const *pchGameDir, CUtlVector< CUtlString > &vecMaps, char const *pchMapFile )
|
||||
{
|
||||
char fullpath[ 512 ];
|
||||
Q_snprintf( fullpath, sizeof( fullpath ), "%s/%s", pchGameDir, pchMapFile );
|
||||
|
||||
// Load them in
|
||||
CUtlBuffer buf( 0, 0, CUtlBuffer::TEXT_BUFFER );
|
||||
|
||||
if ( g_pFullFileSystem->ReadFile( fullpath, "GAME", buf ) )
|
||||
{
|
||||
char szMap[ MAX_PATH ];
|
||||
while ( true )
|
||||
{
|
||||
buf.GetLine( szMap, sizeof( szMap ) );
|
||||
if ( !szMap[ 0 ] )
|
||||
break;
|
||||
|
||||
// Strip trailing CR/LF chars
|
||||
int len = Q_strlen( szMap );
|
||||
while ( len >= 1 && ( ( szMap[ len - 1 ] == '\n' ) || ( szMap[ len - 1 ] == '\r' ) ) )
|
||||
{
|
||||
szMap[ len - 1 ] = 0;
|
||||
len = Q_strlen( szMap );
|
||||
}
|
||||
|
||||
CUtlString newMap;
|
||||
newMap = szMap;
|
||||
vecMaps.AddToTail( newMap );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Error( "Unable to maplist file %s\n", fullpath );
|
||||
}
|
||||
}
|
||||
|
||||
bool CResListGenerator::InitCommandFile( char const *pchGameDir, char const *pchCommandFile )
|
||||
{
|
||||
if ( *pchCommandFile == '+' ||
|
||||
*pchCommandFile == '-' )
|
||||
{
|
||||
Msg( "CResListGenerator: Falling back to legacy reslists system.\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
char fullpath[ 512 ];
|
||||
Q_snprintf( fullpath, sizeof( fullpath ), "%s/%s", pchGameDir, pchCommandFile );
|
||||
|
||||
CUtlBuffer buf;
|
||||
if ( !g_pFullFileSystem->ReadFile( fullpath, "GAME", buf ) )
|
||||
{
|
||||
Error( "Unable to load '%s'\n", fullpath );
|
||||
return false;
|
||||
}
|
||||
|
||||
KeyValues *kv = new KeyValues( "reslists" );
|
||||
if ( !kv->LoadFromBuffer( "reslists", (const char *)buf.Base() ) )
|
||||
{
|
||||
Error( "Unable to parse keyvalues from '%s'\n", fullpath );
|
||||
kv->deleteThis();
|
||||
return false;
|
||||
}
|
||||
|
||||
CUtlString sMapListFile = kv->GetString( "maplist", "maplist.txt" );
|
||||
LoadMapList( pchGameDir, m_MapList, sMapListFile );
|
||||
if ( m_MapList.Count() <= 0 )
|
||||
{
|
||||
Error( "Maplist file '%s' empty or missing!!!\n", sMapListFile.String() );
|
||||
kv->deleteThis();
|
||||
return false;
|
||||
}
|
||||
|
||||
char const *pszSolo = NULL;
|
||||
if ( CommandLine()->CheckParm( "-reslistmap", &pszSolo ) && pszSolo )
|
||||
{
|
||||
m_MapList.Purge();
|
||||
|
||||
CUtlString newMap;
|
||||
newMap = pszSolo;
|
||||
m_MapList.AddToTail( newMap );
|
||||
}
|
||||
|
||||
m_nCurrentWorkItem = CommandLine()->ParmValue( "-startstage", 0 );
|
||||
|
||||
char const *pszStartMap = NULL;
|
||||
CommandLine()->CheckParm( "-startmap", &pszStartMap );
|
||||
if ( pszStartMap )
|
||||
{
|
||||
m_sInitialStartMap = pszStartMap;
|
||||
}
|
||||
|
||||
CommandLine()->RemoveParm( "-startstage" );
|
||||
CommandLine()->RemoveParm( "-makereslists" );
|
||||
CommandLine()->RemoveParm( "-reslistdir" );
|
||||
CommandLine()->RemoveParm( "-norebuildaudio" );
|
||||
CommandLine()->RemoveParm( "-startmap" );
|
||||
|
||||
m_sOriginalCommandLine = CommandLine()->GetCmdLine();
|
||||
|
||||
// Add it back in for first map
|
||||
if ( pszStartMap )
|
||||
{
|
||||
CommandLine()->AppendParm( "-startmap", m_sInitialStartMap.String() );
|
||||
}
|
||||
|
||||
m_sBaseCommandLine = kv->GetString( "basecommandline", "" );
|
||||
m_sFinalDir = kv->GetString( "finaldir", m_sFinalDir.String() );
|
||||
m_sWorkingDir = kv->GetString( "workdir", m_sWorkingDir.String() );
|
||||
m_bCreatingForXbox = kv->GetInt( "xbox", 0 ) != 0;
|
||||
|
||||
int i = 0;
|
||||
do
|
||||
{
|
||||
char sz[ 32 ];
|
||||
Q_snprintf( sz, sizeof( sz ), "%i", i );
|
||||
KeyValues *subKey = kv->FindKey( sz, false );
|
||||
if ( !subKey )
|
||||
break;
|
||||
|
||||
CWorkItem work;
|
||||
|
||||
work.m_sSubDir = subKey->GetString( "subdir", "" );
|
||||
work.m_sAddCommands = subKey->GetString( "addcommands", "" );
|
||||
|
||||
if ( work.m_sSubDir.Length() > 0 )
|
||||
{
|
||||
m_WorkItems.AddToTail( work );
|
||||
}
|
||||
else
|
||||
{
|
||||
Error( "%s: failed to specify 'subdir' for item %s\n", fullpath, sz );
|
||||
}
|
||||
|
||||
++i;
|
||||
} while ( true );
|
||||
|
||||
m_bActive = m_WorkItems.Count() > 0;
|
||||
|
||||
m_nCurrentWorkItem = clamp( m_nCurrentWorkItem, 0, m_WorkItems.Count() - 1 );
|
||||
|
||||
bool bCollate = CommandLine()->CheckParm( "-collate" ) ? true : false;
|
||||
if ( bCollate )
|
||||
{
|
||||
Collate();
|
||||
m_bActive = false;
|
||||
exit( -1 );
|
||||
}
|
||||
|
||||
kv->deleteThis();
|
||||
|
||||
return m_bActive;
|
||||
}
|
||||
|
||||
|
||||
31
launcher/reslistgenerator.h
Normal file
31
launcher/reslistgenerator.h
Normal file
@@ -0,0 +1,31 @@
|
||||
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// Defines the entry point for the application.
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef RESLISTGENERATOR_H
|
||||
#define RESLISTGENERATOR_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
class IResListGenerator
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void Init( char const *pchBaseDir, char const *pchGameDir ) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
virtual bool IsActive() = 0;
|
||||
// Returns true if processing should continue, otherwise false
|
||||
virtual bool TickAndFixupCommandLine() = 0;
|
||||
virtual bool ShouldContinue() = 0;
|
||||
};
|
||||
|
||||
extern IResListGenerator *reslistgenerator;
|
||||
|
||||
#endif // RESLISTGENERATOR_H
|
||||
|
||||
1
launcher/vsi.nul
Normal file
1
launcher/vsi.nul
Normal file
@@ -0,0 +1 @@
|
||||
IMPORTANT: Do not remove the custom build step for this file
|
||||
3
launcher/xbox/xbox.def
Normal file
3
launcher/xbox/xbox.def
Normal file
@@ -0,0 +1,3 @@
|
||||
LIBRARY launcher_360.dll
|
||||
EXPORTS
|
||||
LauncherMain @1
|
||||
Reference in New Issue
Block a user