Browse Source

Fix tier0, tier2

android
JusicP 4 years ago
parent
commit
317a067326
  1. 189
      public/p4lib/ip4.h
  2. 26
      tier0/vprof.cpp
  3. 6
      tier2/p4helpers.cpp

189
public/p4lib/ip4.h

@ -0,0 +1,189 @@ @@ -0,0 +1,189 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef IP4_H
#define IP4_H
#ifdef _WIN32
#pragma once
#endif
#include "tier1/utlsymbol.h"
#include "tier1/utlvector.h"
#include "tier1/utlstring.h"
#include "appframework/IAppSystem.h"
//-----------------------------------------------------------------------------
// Current perforce file state
//-----------------------------------------------------------------------------
enum P4FileState_t
{
P4FILE_UNOPENED = 0,
P4FILE_OPENED_FOR_ADD,
P4FILE_OPENED_FOR_EDIT,
P4FILE_OPENED_FOR_DELETE,
P4FILE_OPENED_FOR_INTEGRATE,
};
//-----------------------------------------------------------------------------
// Purpose: definition of a file
//-----------------------------------------------------------------------------
struct P4File_t
{
CUtlSymbol m_sName; // file name
CUtlSymbol m_sPath; // residing folder
CUtlSymbol m_sDepotFile; // the name in the depot
CUtlSymbol m_sClientFile; // the name on the client in Perforce syntax
CUtlSymbol m_sLocalFile; // the name on the client in local syntax
int m_iHeadRevision; // head revision number
int m_iHaveRevision; // the revision the clientspec has synced locally
bool m_bDir; // directory
bool m_bDeleted; // deleted
P4FileState_t m_eOpenState; // current change state
int m_iChangelist; // changelist current opened in
};
//-----------------------------------------------------------------------------
// Purpose: a single revision of a file
//-----------------------------------------------------------------------------
struct P4Revision_t
{
int m_iChange; // changelist number
int m_nYear, m_nMonth, m_nDay;
int m_nHour, m_nMinute, m_nSecond;
CUtlSymbol m_sUser; // submitting user
CUtlSymbol m_sClient; // submitting client
CUtlString m_Description;
};
//-----------------------------------------------------------------------------
// Purpose: a single clientspec
//-----------------------------------------------------------------------------
struct P4Client_t
{
CUtlSymbol m_sName;
CUtlSymbol m_sUser;
CUtlSymbol m_sHost; // machine name this client is on
CUtlSymbol m_sLocalRoot; // local path
};
//-----------------------------------------------------------------------------
// Purpose: Interface to accessing P4 commands
//-----------------------------------------------------------------------------
#define P4_INTERFACE_VERSION "VP4001"
// Vitaliy - 09-Feb-'07: if anybody ups the version of this interface, please
// move the method "SetOpenFileChangeList" into the appropriate section.
abstract_class IP4 : public IAppSystem
{
public:
// name of the current clientspec
virtual P4Client_t &GetActiveClient() = 0;
// changes the current client
virtual void SetActiveClient(const char *clientname) = 0;
// Refreshes the current client from p4 settings
virtual void RefreshActiveClient() = 0;
// translate filespecs into the desired syntax
virtual void GetDepotFilePath(char *depotFilePath, const char *filespec, int size) = 0;
virtual void GetClientFilePath(char *clientFilePath, const char *filespec, int size) = 0;
virtual void GetLocalFilePath(char *localFilePath, const char *filespec, int size) = 0;
// retreives the list of files in a path
virtual CUtlVector<P4File_t> &GetFileList( const char *path ) = 0;
// returns the list of files opened for edit/integrate/delete
virtual void GetOpenedFileList( CUtlVector<P4File_t> &fileList ) = 0;
virtual void GetOpenedFileList( const char *pRootDirectory, CUtlVector<P4File_t> &fileList ) = 0;
virtual void GetOpenedFileListInPath( const char *pPathID, CUtlVector<P4File_t> &fileList ) = 0;
// retrieves revision history for a file or directory
virtual CUtlVector<P4Revision_t> &GetRevisionList( const char *path, bool bIsDir ) = 0;
// returns a list of clientspecs
virtual CUtlVector<P4Client_t> &GetClientList() = 0;
// changes the clientspec to remove the specified path (cloaking)
virtual void RemovePathFromActiveClientspec( const char *path ) = 0;
// file manipulation
virtual bool OpenFileForAdd( const char *pFullPath ) = 0;
virtual bool OpenFileForEdit( const char *pFullPath ) = 0;
virtual bool OpenFileForDelete( const char *pFullPath ) = 0;
// submit/revert
virtual bool SubmitFile( const char *pFullPath, const char *pDescription ) = 0;
virtual bool RevertFile( const char *pFullPath ) = 0;
// file checkin/checkout for multiple files
virtual bool OpenFilesForAdd( int nCount, const char **ppFullPathList ) = 0;
virtual bool OpenFilesForEdit( int nCount, const char **ppFullPathList ) = 0;
virtual bool OpenFilesForDelete( int nCount, const char **ppFullPathList ) = 0;
// submit/revert for multiple files
virtual bool SubmitFiles( int nCount, const char **ppFullPathList, const char *pDescription ) = 0;
virtual bool RevertFiles( int nCount, const char **ppFullPathList ) = 0;
// Is this file in perforce?
virtual bool IsFileInPerforce( const char *pFullPath ) = 0;
// Get the perforce file state
virtual P4FileState_t GetFileState( const char *pFullPath ) = 0;
// depot root
virtual const char *GetDepotRoot() = 0;
virtual int GetDepotRootLength() = 0;
// local root
virtual const char *GetLocalRoot() = 0;
virtual int GetLocalRootLength() = 0;
// Gets a string for a symbol
virtual const char *String( CUtlSymbol s ) const = 0;
// Returns which clientspec a file lies under. This will
// search for p4config files in root directories of the file
// It returns false if it didn't find a p4config file.
virtual bool GetClientSpecForFile( const char *pFullPath, char *pClientSpec, int nMaxLen ) = 0;
virtual bool GetClientSpecForDirectory( const char *pFullPathDir, char *pClientSpec, int nMaxLen ) = 0;
// Returns which clientspec a filesystem path ID lies under. This will
// search for p4config files in all root directories of the all paths in
// the search path. NOTE: All directories in a path need to use the same clientspec
// or this function will return false.
// It returns false if it didn't find a p4config file.
virtual bool GetClientSpecForPath( const char *pPathId, char *pClientSpec, int nMaxLen ) = 0;
// Opens a file in p4 win
virtual void OpenFileInP4Win( const char *pFullPath ) = 0;
// have we connected? if not, nothing works
virtual bool IsConnectedToServer( bool bRetry = true ) = 0;
// Returns file information for a single file
virtual bool GetFileInfo( const char *pFullPath, P4File_t *pFileInfo ) = 0;
// retreives the list of files in a path, using a known client spec
virtual CUtlVector<P4File_t> &GetFileListUsingClientSpec( const char *pPath, const char *pClientSpec ) = 0;
// retrieves the last error from the last op (which is likely to span multiple lines)
// this is only valid after OpenFile[s]For{Add,Edit,Delete} or {Submit,Revert}File[s]
virtual const char *GetLastError() = 0;
// sets the name of the changelist to open files under, NULL for "Default" changelist
virtual void SetOpenFileChangeList( const char *pChangeListName ) = 0;
};
#endif // IP4_H

26
tier0/vprof.cpp

@ -1850,8 +1850,9 @@ static bool TelemetryInitialize() @@ -1850,8 +1850,9 @@ static bool TelemetryInitialize()
{
if( g_tmContext )
{
TmConnectionStatus status = tmGetConnectionStatus( g_tmContext );
//TmConnectionStatus status = tmGetConnectionStatus( g_tmContext );
TmConnectionStatus status = TmConnectionStatus::TMCS_DISCONNECTED;
if( status == TMCS_CONNECTED || status == TMCS_CONNECTING )
return true;
}
@ -1863,9 +1864,11 @@ static bool TelemetryInitialize() @@ -1863,9 +1864,11 @@ static bool TelemetryInitialize()
// Pass in 0 if you want to use the release mode DLL or 1 if you want to
// use the checked DLL. The checked DLL is compiled with optimizations but
// does extra run time checks and reporting.
int nLoadTelemetry = tmLoadTelemetry( 0 );
//int nLoadTelemetry = tmLoadTelemetry( 0 );
int nLoadTelemetry = 0;
retVal = tmStartup();
//retVal = tmStartup();
retVal = 0;
if ( retVal != TM_OK )
{
Warning( "TelemetryInit() failed: tmStartup() returned %d, tmLoadTelemetry() returned %d.\n", retVal, nLoadTelemetry );
@ -1877,7 +1880,8 @@ static bool TelemetryInitialize() @@ -1877,7 +1880,8 @@ static bool TelemetryInitialize()
g_pTmMemoryArena = new TmU8[ TELEMETRY_ARENA_SIZE ];
}
retVal = tmInitializeContext( &g_tmContext, g_pTmMemoryArena, TELEMETRY_ARENA_SIZE );
//retVal = tmInitializeContext( &g_tmContext, g_pTmMemoryArena, TELEMETRY_ARENA_SIZE );
retVal = 0;
if ( retVal != TM_OK )
{
delete [] g_pTmMemoryArena;
@ -1923,8 +1927,9 @@ static bool TelemetryInitialize() @@ -1923,8 +1927,9 @@ static bool TelemetryInitialize()
TmU32 TmOpenFlags = TMOF_DEFAULT | TMOF_MINIMAL_CONTEXT_SWITCHES;
/* TmOpenFlags |= TMOF_DISABLE_CONTEXT_SWITCHES | TMOF_INIT_NETWORKING*/
retVal = tmOpen( g_tmContext, pGameName, szBuildInfo, pServerAddress, tmType,
TELEMETRY_DEFAULT_PORT, TmOpenFlags, 1000 );
//retVal = tmOpen( g_tmContext, pGameName, szBuildInfo, pServerAddress, tmType,
// TELEMETRY_DEFAULT_PORT, TmOpenFlags, 1000 );
retVal = 0;
if ( retVal != TM_OK )
{
Warning( "TelemetryInitialize() failed: tmOpen returned %d.\n", retVal );
@ -1950,7 +1955,8 @@ static void TelemetryShutdown( bool InDtor = false ) @@ -1950,7 +1955,8 @@ static void TelemetryShutdown( bool InDtor = false )
Msg( "Shutting down telemetry.\n" );
}
TmConnectionStatus status = tmGetConnectionStatus( g_tmContext );
//TmConnectionStatus status = tmGetConnectionStatus( g_tmContext );
TmConnectionStatus status = 0;
if( status == TMCS_CONNECTED || status == TMCS_CONNECTING )
tmClose( g_tmContext );
@ -1959,8 +1965,8 @@ static void TelemetryShutdown( bool InDtor = false ) @@ -1959,8 +1965,8 @@ static void TelemetryShutdown( bool InDtor = false )
HTELEMETRY hShutdown = g_tmContext;
g_tmContext = NULL;
tmShutdownContext( hShutdown );
tmShutdown();
//tmShutdownContext( hShutdown );
//tmShutdown();
g_TelemetryLoaded = false;
}
}

6
tier2/p4helpers.cpp

@ -88,10 +88,12 @@ bool CP4File::IsFileInPerforce() @@ -88,10 +88,12 @@ bool CP4File::IsFileInPerforce()
bool CP4File::SetFileType(const CUtlString& desiredFileType)
{
if ( !p4 )
/*if ( !p4 )
return false;
return p4->SetFileType( m_sFilename.String(), desiredFileType.String() );
return p4->SetFileType( m_sFilename.String(), desiredFileType.String() );*/
Error("CP4File::SetFileType is unimplemented");
return false;
}

Loading…
Cancel
Save