Counter Strike : Global Offensive Source Code
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.

64 lines
1.7 KiB

  1. /// The local implementation of an AppSystem for this project
  2. #ifndef CLI_APPSYSTEM_ADAPTER_H
  3. #define CLI_APPSYSTEM_ADAPTER_H
  4. #include "appframework/appframework.h"
  5. #include "filesystem.h"
  6. #include "vstdlib/random.h"
  7. #include "icommandline.h"
  8. // if you don't use the proper AppSystem to make a filesystem connection:
  9. // #define TIER2_USE_INIT_DEFAULT_FILESYSTEM 1
  10. /// A singleton class used to set up all the DLL interfaces.
  11. /// EXTREMELY IMPORTANT: This class must exist in unmanaged code.
  12. //#pragma unmanaged
  13. class IFileSystem;
  14. class IUniformRandomStream;
  15. class ICommandLine;
  16. class CCLIAppSystemAdapter : public CAppSystemGroup // , public ResponseRules_CLI::ICLI_AppSystem_Adapter
  17. {
  18. //// UNMANAGED:
  19. private:
  20. virtual bool Create();
  21. virtual bool PreInit();
  22. virtual int Main() { return 0; } ///< never used, cannot be used
  23. virtual void PostShutdown() {Wipe(true);} ///< does it leak?
  24. virtual void Destroy() {};
  25. void Wipe( bool bPerformDelete );
  26. IUniformRandomStream *m_pLocalRandomStream;
  27. #if TIER2_USE_INIT_DEFAULT_FILESYSTEM
  28. #else
  29. IFileSystem *m_pFilesystem;
  30. #endif
  31. // IUniformRandomStream *m_pRandomstream;
  32. // ICommandLine *m_pCommandline;
  33. public:
  34. CCLIAppSystemAdapter();
  35. virtual ~CCLIAppSystemAdapter();
  36. void SetupFileSystem( ) ;
  37. /// Make the "LOCAL" filesystem directory point at the given path.
  38. void AddFileSystemRoot( const char *pPath ) ;
  39. IFileSystem * GetFilesytem();
  40. IUniformRandomStream * GetRandomStream();
  41. ICommandLine * GetCommandLine();
  42. };
  43. inline IUniformRandomStream * CCLIAppSystemAdapter::GetRandomStream()
  44. {
  45. return m_pLocalRandomStream;
  46. }
  47. inline ICommandLine * CCLIAppSystemAdapter::GetCommandLine()
  48. {
  49. return CommandLine();
  50. }
  51. #endif