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.

60 lines
2.1 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Core types for the response rules -- criteria, responses, rules, and matchers.
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef RESPONSE_HOST_INTERFACE_H
  8. #define RESPONSE_HOST_INTERFACE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "filesystem.h"
  13. class IUniformRandomStream;
  14. class ICommandLine;
  15. namespace ResponseRules
  16. {
  17. // FUNCTIONS YOU MUST IMPLEMENT IN THE HOST EXECUTABLE:
  18. // These are functions that are mentioned in the header, but need their bodies implemented
  19. // in the .dll that links against this lib.
  20. // This is to wrap functions that previously came from the engine interface
  21. // back when the response rules were inside the server.dll . Now that the rules
  22. // are included into a standalone editor, we don't necessarily have an engine around,
  23. // so there needs to be some other implementation.
  24. abstract_class IEngineEmulator
  25. {
  26. public:
  27. /// Given an input text buffer data pointer, parses a single token into the variable token and returns the new
  28. /// reading position
  29. virtual const char *ParseFile( const char *data, char *token, int maxlen ) = 0;
  30. /// Return a pointer to an IFileSystem we can use to read and process scripts.
  31. virtual IFileSystem *GetFilesystem() = 0;
  32. /// Return a pointer to an instance of an IUniformRandomStream
  33. virtual IUniformRandomStream *GetRandomStream() = 0 ;
  34. /// Return a pointer to a tier0 ICommandLine
  35. virtual ICommandLine *GetCommandLine() = 0;
  36. /// Emulates the server's UTIL_LoadFileForMe
  37. virtual byte *LoadFileForMe( const char *filename, int *pLength ) = 0;
  38. /// Emulates the server's UTIL_FreeFile
  39. virtual void FreeFile( byte *buffer ) = 0;
  40. /// Somewhere in the host executable you should define this symbol and
  41. /// point it at a singleton instance.
  42. static IEngineEmulator *s_pSingleton;
  43. // this is just a function that returns the pointer above -- just in
  44. // case we need to define it differently. And I get asserts this way.
  45. static IEngineEmulator *Get();
  46. };
  47. };
  48. #endif