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.

99 lines
2.7 KiB

  1. //===== Copyright � 1996-2009, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. //===========================================================================//
  6. #ifndef MM_EXTENSIONS_H
  7. #define MM_EXTENSIONS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "UtlStringMap.h"
  12. #include "vgui/ILocalize.h"
  13. #include "engine/inetsupport.h"
  14. #include "cdll_int.h"
  15. #include "eiface.h"
  16. #include "igameevents.h"
  17. #ifdef _X360
  18. #include "ixboxsystem.h"
  19. #endif
  20. #include "eiface.h"
  21. #include "mm_framework.h"
  22. #include "engine/ienginevoice.h"
  23. class CMatchExtensions : public IMatchExtensions
  24. {
  25. // Methods of IMatchExtensions
  26. public:
  27. // Registers an extension interface
  28. virtual void RegisterExtensionInterface( char const *szInterfaceString, void *pvInterface );
  29. // Unregisters an extension interface
  30. virtual void UnregisterExtensionInterface( char const *szInterfaceString, void *pvInterface );
  31. // Gets a pointer to a registered extension interface
  32. virtual void * GetRegisteredExtensionInterface( char const *szInterfaceString );
  33. public:
  34. CMatchExtensions();
  35. ~CMatchExtensions();
  36. protected:
  37. struct RegisteredInterface_t
  38. {
  39. void *m_pvInterface;
  40. int m_nRefCount;
  41. RegisteredInterface_t() : m_nRefCount( 0 ), m_pvInterface( 0 ) {}
  42. };
  43. typedef CUtlStringMap< RegisteredInterface_t > InterfaceMap_t;
  44. InterfaceMap_t m_mapRegisteredInterfaces;
  45. protected:
  46. void OnExtensionInterfaceUpdated( char const *szInterfaceString, void *pvInterface );
  47. public:
  48. vgui::ILocalize * GetILocalize() { return m_exts.m_pILocalize; }
  49. INetSupport * GetINetSupport() { return m_exts.m_pINetSupport; }
  50. IEngineVoice * GetIEngineVoice() { return m_exts.m_pIEngineVoice; }
  51. IVEngineClient * GetIVEngineClient() { return m_exts.m_pIVEngineClient; }
  52. IVEngineServer * GetIVEngineServer() { return m_exts.m_pIVEngineServer; }
  53. IServerGameDLL * GetIServerGameDLL() { return m_exts.m_pIServerGameDLL; }
  54. IGameEventManager2 * GetIGameEventManager2() { return m_exts.m_pIGameEventManager2; }
  55. IBaseClientDLL * GetIBaseClientDLL() { return m_exts.m_pIBaseClientDLL; }
  56. #ifdef _X360
  57. IXboxSystem * GetIXboxSystem() { return m_exts.m_pIXboxSystem; }
  58. IXOnline * GetIXOnline() { return m_exts.m_pIXOnline; }
  59. #endif
  60. protected:
  61. // Known extension interfaces
  62. struct Exts_t
  63. {
  64. inline Exts_t() { memset( this, 0, sizeof( *this ) ); }
  65. vgui::ILocalize *m_pILocalize;
  66. INetSupport *m_pINetSupport;
  67. IEngineVoice *m_pIEngineVoice;
  68. IVEngineClient *m_pIVEngineClient;
  69. IVEngineServer *m_pIVEngineServer;
  70. IServerGameDLL *m_pIServerGameDLL;
  71. IGameEventManager2 *m_pIGameEventManager2;
  72. IBaseClientDLL *m_pIBaseClientDLL;
  73. #ifdef _X360
  74. IXboxSystem *m_pIXboxSystem;
  75. IXOnline *m_pIXOnline;
  76. #endif
  77. }
  78. m_exts;
  79. };
  80. // Match title singleton
  81. extern CMatchExtensions *g_pMatchExtensions;
  82. #endif // MM_EXTENSIONS_H