Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef VMPI_FILESYSTEM_H
  8. #define VMPI_FILESYSTEM_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "interface.h"
  13. class IFileSystem;
  14. class MessageBuffer;
  15. // Use this to read virtual files.
  16. #define VMPI_VIRTUAL_FILES_PATH_ID "VMPI_VIRTUAL_FILES_PATH_ID"
  17. // When you hook the file system with VMPI and are a worker, it blocks on file reads
  18. // and uses MPI to communicate with the master to transfer files it needs over.
  19. //
  20. // The filesystem, by default (and it maxFileSystemMemoryUsage is left at zero),
  21. // keeps the contents of the files that get opened in memory. You can pass in a
  22. // value here to put a cap on it, in which case it'll unload the least-recently-used
  23. // files when it hits the limit.
  24. IFileSystem* VMPI_FileSystem_Init( int maxFileSystemMemoryUsage, IFileSystem *pPassThru );
  25. // On the master machine, this really should be called before the app shuts down and
  26. // global destructors are called. If it isn't, it might lock up waiting for a thread to exit.
  27. //
  28. // This returns the original filesystem you passed into VMPI_FileSystem_Init so you can uninitialize it.
  29. IFileSystem* VMPI_FileSystem_Term();
  30. // Causes it to error out on any Open() calls.
  31. void VMPI_FileSystem_DisableFileAccess();
  32. // Returns a factory that will hand out BASEFILESYSTEM_INTERFACE_VERSION when asked for it.
  33. CreateInterfaceFn VMPI_FileSystem_GetFactory();
  34. // This function creates a virtual file that workers can then open and read out of.
  35. // NOTE: when reading from the file, you must use VMPI_VIRTUAL_FILES_PATH_ID as the path ID
  36. // or else it won't find the file.
  37. void VMPI_FileSystem_CreateVirtualFile( const char *pFilename, const void *pData, unsigned long fileLength );
  38. #endif // VMPI_FILESYSTEM_H