mirror of
https://github.com/nillerusr/source-engine.git
synced 2025-01-25 22:34:25 +00:00
revert some code
This commit is contained in:
parent
e502d4e14c
commit
adbe75007a
@ -205,8 +205,7 @@ int main( int argc, char *argv[] )
|
||||
printf( "%s\n", strerror(errno) );
|
||||
}
|
||||
#endif
|
||||
|
||||
void *dedicated = dlopen( "libdedicated", RTLD_NOW );
|
||||
void *dedicated = dlopen( "libdedicated" DLL_EXT_STRING, RTLD_NOW );
|
||||
if ( !dedicated )
|
||||
dedicated = dlopen( "dedicated" DLL_EXT_STRING, RTLD_NOW );
|
||||
|
||||
|
@ -1715,7 +1715,6 @@ bool ClientDLL_Load()
|
||||
{
|
||||
Assert ( !g_ClientDLLModule );
|
||||
|
||||
#if 0
|
||||
// Check the signature on the client dll. If this fails we load it anyway but put this client
|
||||
// into insecure mode so it won't connect to secure servers and get VAC banned
|
||||
if ( !Host_AllowLoadModule( "client.dll", "GAMEBIN", true ) )
|
||||
@ -1724,23 +1723,8 @@ bool ClientDLL_Load()
|
||||
Host_DisallowSecureServers();
|
||||
Host_AllowLoadModule( "client.dll","GAMEBIN", true );
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
g_ClientDLLModule = g_pFileSystem->LoadModule( "client", "GAMEBIN", false );
|
||||
#else
|
||||
char clientPath[MAX_PATH];
|
||||
const char *modName = CommandLine()->ParmValue("-game");
|
||||
|
||||
Q_snprintf(clientPath, MAX_PATH, "%s/libclient", modName);
|
||||
g_ClientDLLModule = Sys_LoadModule(clientPath);
|
||||
|
||||
if (!g_ClientDLLModule)
|
||||
{
|
||||
Q_snprintf(clientPath, MAX_PATH, "%s/client", modName);
|
||||
g_ClientDLLModule = Sys_LoadModule(clientPath);
|
||||
}
|
||||
#endif
|
||||
if ( g_ClientDLLModule )
|
||||
{
|
||||
g_ClientFactory = Sys_GetFactory( g_ClientDLLModule );
|
||||
|
@ -1122,7 +1122,6 @@ static bool LoadThisDll( char *szDllFilename, bool bIsServerOnly )
|
||||
{
|
||||
CSysModule *pDLL = NULL;
|
||||
|
||||
#if 0
|
||||
// check signature, don't let users with modified binaries connect to secure servers, they will get VAC banned
|
||||
if ( !Host_AllowLoadModule( szDllFilename, "GAMEBIN", true, bIsServerOnly ) )
|
||||
{
|
||||
@ -1134,16 +1133,6 @@ static bool LoadThisDll( char *szDllFilename, bool bIsServerOnly )
|
||||
// ensures that the game.dll is running under Steam
|
||||
// this will have to be undone when we want mods to be able to run
|
||||
if ((pDLL = g_pFileSystem->LoadModule(szDllFilename, "GAMEBIN", false)) == NULL)
|
||||
#endif
|
||||
char dllPath[MAX_PATH];
|
||||
const char *modName = CommandLine()->ParmValue("-game");
|
||||
Q_snprintf(dllPath, MAX_PATH, "%s/lib%s", modName, szDllFilename);
|
||||
if (!(pDLL = Sys_LoadModule(dllPath)))
|
||||
{
|
||||
Q_snprintf(dllPath, MAX_PATH, "%s/%s",modName, szDllFilename);
|
||||
pDLL = Sys_LoadModule(dllPath);
|
||||
}
|
||||
if (!pDLL)
|
||||
{
|
||||
ConMsg("Failed to load %s\n", szDllFilename);
|
||||
goto IgnoreThisDLL;
|
||||
|
@ -305,13 +305,103 @@ static bool Sys_GetExecutableName( char *out, int len )
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FileSystem_GetExecutableDir( char *exedir, int exeDirLen )
|
||||
{
|
||||
#ifdef ANDROID
|
||||
Q_strncpy( exedir, getenv("APP_LIB_PATH"), exeDirLen );
|
||||
#else
|
||||
# if 0
|
||||
exedir[0] = 0;
|
||||
|
||||
if ( s_bUseVProjectBinDir )
|
||||
{
|
||||
const char *pProject = GetVProjectCmdLineValue();
|
||||
if ( !pProject )
|
||||
{
|
||||
// Check their registry.
|
||||
pProject = getenv( GAMEDIR_TOKEN );
|
||||
}
|
||||
if ( pProject )
|
||||
{
|
||||
Q_snprintf( exedir, exeDirLen, "%s%c..%cbin", pProject, CORRECT_PATH_SEPARATOR, CORRECT_PATH_SEPARATOR );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !Sys_GetExecutableName( exedir, exeDirLen ) )
|
||||
return false;
|
||||
Q_StripFilename( exedir );
|
||||
|
||||
if ( IsX360() )
|
||||
{
|
||||
// The 360 can have its exe and dlls reside on different volumes
|
||||
// use the optional basedir as the exe dir
|
||||
if ( CommandLine()->FindParm( "-basedir" ) )
|
||||
{
|
||||
strcpy( exedir, CommandLine()->ParmValue( "-basedir", "" ) );
|
||||
}
|
||||
}
|
||||
|
||||
Q_FixSlashes( exedir );
|
||||
|
||||
const char* libDir = "bin";
|
||||
|
||||
// Return the bin directory as the executable dir if it's not in there
|
||||
// because that's really where we're running from...
|
||||
char ext[MAX_PATH];
|
||||
Q_StrRight( exedir, 4, ext, sizeof( ext ) );
|
||||
if ( ext[0] != CORRECT_PATH_SEPARATOR || Q_stricmp( ext+1, libDir ) != 0 )
|
||||
{
|
||||
Q_strncat( exedir, CORRECT_PATH_SEPARATOR_S, exeDirLen, COPY_ALL_CHARACTERS );
|
||||
Q_strncat( exedir, libDir, exeDirLen, COPY_ALL_CHARACTERS );
|
||||
Q_FixSlashes( exedir );
|
||||
}
|
||||
# endif
|
||||
Q_strncpy( exedir, LIBDIR, exeDirLen );
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool FileSystem_GetBaseDir( char *baseDir, int baseDirLen )
|
||||
{
|
||||
#ifdef ANDROID
|
||||
strncpy(baseDir, getenv("VALVE_GAME_PATH"), baseDirLen);
|
||||
Q_strncpy(baseDir, getenv("VALVE_GAME_PATH"), baseDirLen);
|
||||
return true;
|
||||
#else
|
||||
# if 0
|
||||
if ( FileSystem_GetExecutableDir( baseDir, baseDirLen ) )
|
||||
{
|
||||
Q_StripFilename( baseDir );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
# else
|
||||
return getcwd(baseDir, baseDirLen) != NULL;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void LaunchVConfig()
|
||||
{
|
||||
#if defined( _WIN32 ) && !defined( _X360 )
|
||||
char vconfigExe[MAX_PATH];
|
||||
FileSystem_GetExecutableDir( vconfigExe, sizeof( vconfigExe ) );
|
||||
Q_AppendSlash( vconfigExe, sizeof( vconfigExe ) );
|
||||
Q_strncat( vconfigExe, "vconfig.exe", sizeof( vconfigExe ), COPY_ALL_CHARACTERS );
|
||||
|
||||
char *argv[] =
|
||||
{
|
||||
vconfigExe,
|
||||
"-allowdebug",
|
||||
NULL
|
||||
};
|
||||
|
||||
_spawnv( _P_NOWAIT, vconfigExe, argv );
|
||||
#elif defined( _X360 )
|
||||
Msg( "Launching vconfig.exe not supported\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -329,6 +419,13 @@ FSReturnCode_t SetupFileSystemError( bool bRunVConfig, FSReturnCode_t retVal, co
|
||||
|
||||
Warning( "%s\n", g_FileSystemError );
|
||||
|
||||
// Run vconfig?
|
||||
// Don't do it if they specifically asked for it not to, or if they manually specified a vconfig with -game or -vproject.
|
||||
if ( bRunVConfig && g_FileSystemErrorMode == FS_ERRORMODE_VCONFIG && !CommandLine()->FindParm( CMDLINEOPTION_NOVCONFIG ) && !GetVProjectCmdLineValue() )
|
||||
{
|
||||
LaunchVConfig();
|
||||
}
|
||||
|
||||
if ( g_FileSystemErrorMode == FS_ERRORMODE_AUTO || g_FileSystemErrorMode == FS_ERRORMODE_VCONFIG )
|
||||
{
|
||||
Error( "%s\n", g_FileSystemError );
|
||||
@ -922,6 +1019,32 @@ bool DoesPathExistAlready( const char *pPathEnvVar, const char *pTestPath )
|
||||
}
|
||||
|
||||
|
||||
FSReturnCode_t GetSteamCfgPath( char *steamCfgPath, int steamCfgPathLen )
|
||||
{
|
||||
steamCfgPath[0] = 0;
|
||||
char executablePath[MAX_PATH];
|
||||
if ( !FileSystem_GetExecutableDir( executablePath, sizeof( executablePath ) ) )
|
||||
{
|
||||
return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetExecutableDir failed." );
|
||||
}
|
||||
Q_strncpy( steamCfgPath, executablePath, steamCfgPathLen );
|
||||
while ( 1 )
|
||||
{
|
||||
if ( DoesFileExistIn( steamCfgPath, "steam.cfg" ) )
|
||||
break;
|
||||
|
||||
if ( !Q_StripLastDir( steamCfgPath, steamCfgPathLen) )
|
||||
{
|
||||
// the file isnt found, thats ok, its not mandatory
|
||||
return FS_OK;
|
||||
}
|
||||
}
|
||||
Q_AppendSlash( steamCfgPath, steamCfgPathLen );
|
||||
Q_strncat( steamCfgPath, "steam.cfg", steamCfgPathLen, COPY_ALL_CHARACTERS );
|
||||
|
||||
return FS_OK;
|
||||
}
|
||||
|
||||
void SetSteamAppUser( KeyValues *pSteamInfo, const char *steamInstallPath, CSteamEnvVars &steamEnvVars )
|
||||
{
|
||||
// Always inherit the Steam user if it's already set, since it probably means we (or the
|
||||
@ -976,7 +1099,22 @@ void SetSteamUserPassphrase( KeyValues *pSteamInfo, CSteamEnvVars &steamEnvVars
|
||||
|
||||
FSReturnCode_t FileSystem_SetBasePaths( IFileSystem *pFileSystem )
|
||||
{
|
||||
// Er2: Deprecated. Used only in hammer
|
||||
pFileSystem->RemoveSearchPaths( "EXECUTABLE_PATH" );
|
||||
|
||||
char path[MAX_PATH];
|
||||
if ( !FileSystem_GetExecutableDir( path, MAX_PATH ) )
|
||||
return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetExecutableDir failed." );
|
||||
|
||||
pFileSystem->AddSearchPath( path, "EXECUTABLE_PATH" );
|
||||
|
||||
if ( !FileSystem_GetBaseDir( path, MAX_PATH ) )
|
||||
return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetBaseDir failed." );
|
||||
|
||||
pFileSystem->AddSearchPath( path, "BASE_PATH" );
|
||||
|
||||
Q_snprintf( path, MAX_PATH, "%s/%s", LIBDIR, CommandLine()->ParmValue("-game") );
|
||||
pFileSystem->AddSearchPath( path, "GAMEBIN" );
|
||||
|
||||
return FS_OK;
|
||||
}
|
||||
|
||||
@ -985,14 +1123,43 @@ FSReturnCode_t FileSystem_SetBasePaths( IFileSystem *pFileSystem )
|
||||
//-----------------------------------------------------------------------------
|
||||
FSReturnCode_t FileSystem_GetFileSystemDLLName( char *pFileSystemDLL, int nMaxLen, bool &bSteam )
|
||||
{
|
||||
// Assume we'll use local files
|
||||
#ifdef POSIX
|
||||
Q_strncpy( pFileSystemDLL, "libfilesystem_stdio" DLL_EXT_STRING, nMaxLen );
|
||||
#else
|
||||
Q_strncpy( pFileSystemDLL, "filesystem_stdio" DLL_EXT_STRING, nMaxLen );
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
bSteam = false;
|
||||
|
||||
// Inside of here, we don't have a filesystem yet, so we have to assume that the filesystem_stdio or filesystem_steam
|
||||
// is in this same directory with us.
|
||||
char executablePath[MAX_PATH];
|
||||
if ( !FileSystem_GetExecutableDir( executablePath, sizeof( executablePath ) ) )
|
||||
return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetExecutableDir failed." );
|
||||
|
||||
// Assume we'll use local files
|
||||
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%cfilesystem_stdio" DLL_EXT_STRING, executablePath, CORRECT_PATH_SEPARATOR );
|
||||
|
||||
#if !defined( _X360 )
|
||||
|
||||
// Use filsystem_steam if it exists?
|
||||
#if defined( OSX ) || defined( LINUX )
|
||||
struct stat statBuf;
|
||||
#endif
|
||||
if (
|
||||
#if defined( OSX ) || defined( LINUX )
|
||||
stat( pFileSystemDLL, &statBuf ) != 0
|
||||
#else
|
||||
_access( pFileSystemDLL, 0 ) != 0
|
||||
#endif
|
||||
) {
|
||||
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%cfilesystem_steam" DLL_EXT_STRING, executablePath, CORRECT_PATH_SEPARATOR );
|
||||
bSteam = true;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
char executablePath[MAX_PATH];
|
||||
if ( !FileSystem_GetExecutableDir( executablePath, sizeof( executablePath ) ) )
|
||||
return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetExecutableDir failed." );
|
||||
|
||||
// Assume we'll use local files
|
||||
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%clibfilesystem_stdio" DLL_EXT_STRING, executablePath, CORRECT_PATH_SEPARATOR );
|
||||
|
||||
#if !defined( _X360 )
|
||||
// Use filsystem_steam if it exists?
|
||||
#if defined( OSX ) || defined( LINUX )
|
||||
@ -1005,9 +1172,10 @@ FSReturnCode_t FileSystem_GetFileSystemDLLName( char *pFileSystemDLL, int nMaxLe
|
||||
_access( pFileSystemDLL, 0 ) != 0
|
||||
#endif
|
||||
) {
|
||||
Q_snprintf( pFileSystemDLL, nMaxLen, "filesystem_stdio" DLL_EXT_STRING );
|
||||
Q_snprintf( pFileSystemDLL, nMaxLen, "%s%cfilesystem_stdio" DLL_EXT_STRING, executablePath, CORRECT_PATH_SEPARATOR );
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
return FS_OK;
|
||||
|
@ -199,11 +199,16 @@ void FileSystem_AddSearchPath_Platform( IFileSystem *pFileSystem, const char *sz
|
||||
// See FSErrorMode_t. If you don't specify one here, then the default is FS_ERRORMODE_VCONFIG.
|
||||
void FileSystem_SetErrorMode( FSErrorMode_t errorMode = FS_ERRORMODE_VCONFIG );
|
||||
|
||||
bool FileSystem_GetExecutableDir( char *exedir, int exeDirLen );
|
||||
|
||||
// Clear SteamAppUser, SteamUserPassphrase, and SteamAppId from this process's environment.
|
||||
// TODO: always do this after LoadFileSysteModule.. there's no reason it should be
|
||||
// in the environment.
|
||||
void FileSystem_ClearSteamEnvVars();
|
||||
|
||||
// Find the steam.cfg above you for optional stuff
|
||||
FSReturnCode_t GetSteamCfgPath( char *steamCfgPath, int steamCfgPathLen );
|
||||
|
||||
// Returns the last error.
|
||||
const char *FileSystem_GetLastErrorString();
|
||||
|
||||
|
@ -79,7 +79,7 @@ def build(bld):
|
||||
'../common'
|
||||
]
|
||||
|
||||
defines = ['LIBDIR="%s"' % bld.env.LIBDIR]
|
||||
defines = []
|
||||
|
||||
libs = []
|
||||
if bld.env.DEST_OS == 'win32':
|
||||
|
@ -17,7 +17,7 @@ def configure(conf):
|
||||
def build(bld):
|
||||
source = ['unittest.cpp']
|
||||
includes = ['../../public']
|
||||
defines = ['LIBDIR="%s"' % bld.env.LIBDIR]
|
||||
defines = []
|
||||
libs = ['tier0', 'appframework', 'tier1', 'tier2','tier3', 'vstdlib', 'unitlib']
|
||||
|
||||
if bld.env.DEST_OS != 'win32':
|
||||
|
Loading…
x
Reference in New Issue
Block a user