From 6c0d1118bc5f61fbd86672aba74c3c640ec233cc Mon Sep 17 00:00:00 2001 From: Mikko Kokko Date: Thu, 29 Dec 2022 02:59:13 +0200 Subject: [PATCH] Update IFileSystem (#121) --- public/filesystem.h | 15 ++++++++++++++- public/filesystem_passthru.h | 7 ++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/public/filesystem.h b/public/filesystem.h index a806f320..d388e899 100644 --- a/public/filesystem.h +++ b/public/filesystem.h @@ -402,6 +402,13 @@ public: virtual void Reset() = 0; }; +enum EFileSystemPureState +{ + k_eFileSystemPureWhitelist, // File system is in pure whitelist mode + k_eFileSystemPureAllowDisk, // File system is allowing to load from disk, but has not loaded third-party files yet + k_eFileSystemPureLoadedFromDisk // File system has loaded third-party files from disk +}; + // Spew flags for SetWhitelistSpewFlags (set with the fs_whitelist_spew_flags cvar). // Update the comment for the fs_whitelist_spew_flags cvar if you change these. @@ -514,7 +521,7 @@ public: // remember it in case you add search paths with this path ID. virtual void MarkPathIDByRequestOnly( const char *pPathID, bool bRequestOnly ) = 0; - virtual bool BUnknown() = 0; + virtual bool IsFileInReadOnlySearchPath( const char *pFileName, const char *pPathID ) = 0; // converts a partial path into a full path virtual const char *RelativePathToFullPath( const char *pFileName, const char *pPathID, char *pLocalPath, int localPathBufferSize, PathTypeFilter_t pathFilter = FILTER_NONE, PathTypeQuery_t *pPathType = NULL ) = 0; @@ -847,9 +854,15 @@ public: virtual IIoStats *GetIoStats() = 0; + virtual EFileSystemPureState GetPureState() = 0; + virtual void AllowLoadFromDisk( bool bAllowLoadFromDisk ) = 0; + virtual void CacheAllVPKFileHashes( bool bCacheAllVPKHashes, bool bRecalculateAndCheckHashes ) = 0; virtual bool CheckVPKFileHash( int PackFileID, int nPackFileNumber, int nFileFraction, MD5Value_t &md5Value ) = 0; virtual void GetVPKFileStatisticsKV( KeyValues *pKV ) = 0; + + virtual void SetDisallowOutsideWrites( bool bDisallow ) = 0; + virtual bool GetDisallowOutsideWrites() = 0; }; //----------------------------------------------------------------------------- diff --git a/public/filesystem_passthru.h b/public/filesystem_passthru.h index 357cf0d4..3b7ab902 100644 --- a/public/filesystem_passthru.h +++ b/public/filesystem_passthru.h @@ -277,7 +277,12 @@ public: virtual void GetVPKFileStatisticsKV( KeyValues *pKV ) { m_pFileSystemPassThru->GetVPKFileStatisticsKV( pKV ); } - virtual bool BUnknown() { return m_pFileSystemPassThru->BUnknown(); } + virtual bool IsFileInReadOnlySearchPath( const char *pFileName, const char *pPathID ) { return m_pFileSystemPassThru->IsFileInReadOnlySearchPath( pFileName, pPathID ); } + + virtual EFileSystemPureState GetPureState() { return m_pFileSystemPassThru->GetPureState(); } + virtual void AllowLoadFromDisk( bool bAllowLoadFromDisk ) { return m_pFileSystemPassThru->AllowLoadFromDisk( bAllowLoadFromDisk ); } + virtual void SetDisallowOutsideWrites( bool bDisallow ) { return m_pFileSystemPassThru->SetDisallowOutsideWrites( bDisallow ); } + virtual bool GetDisallowOutsideWrites() { return m_pFileSystemPassThru->GetDisallowOutsideWrites(); } protected: IFileSystem *m_pFileSystemPassThru;