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.

155 lines
3.6 KiB

  1. //===== Copyright � 1996-2009, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. //===========================================================================//
  6. #ifndef MM_FRAMEWORK_H
  7. #define MM_FRAMEWORK_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tier0/dbg.h"
  12. #include "tier0/icommandline.h"
  13. #include "tier1/strtools.h"
  14. #include "tier1/checksum_crc.h"
  15. #include "tier1/keyvalues.h"
  16. #include "tier1/utlbuffer.h"
  17. #include "tier1/fmtstr.h"
  18. #include "mathlib/mathlib.h"
  19. #include "const.h"
  20. #include "inetmsghandler.h"
  21. #include "appframework/IAppSystemGroup.h"
  22. #include "matchmaking/imatchframework.h"
  23. #include "igameevents.h"
  24. #include "tier2/tier2.h"
  25. #include "vstdlib/jobthread.h"
  26. #include "extkeyvalues.h"
  27. #include "steam_apihook.h"
  28. class CMatchFramework;
  29. #include "mm_extensions.h"
  30. #include "mm_events.h"
  31. #include "mm_voice.h"
  32. #include "mm_session.h"
  33. #include "mm_netmgr.h"
  34. #include "matchsystem.h"
  35. #include "playermanager.h"
  36. #include "servermanager.h"
  37. #include "searchmanager.h"
  38. #include "datacenter.h"
  39. #include "mm_dlc.h"
  40. enum MatchFrameworkInviteFlags_t
  41. {
  42. // Indicates that invite was received using console mechanisms (XMB/boot/etc.)
  43. MM_INVITE_FLAG_CONSOLE = ( 1 << 0 ),
  44. // Indicates that the game was booted through a Steam invite
  45. MM_INVITE_FLAG_PCBOOT = ( 1 << 1 ),
  46. };
  47. class CMatchFramework :
  48. public CTier2AppSystem< IMatchFramework >,
  49. public IMatchEventsSink
  50. {
  51. // Methods of IAppSystem
  52. public:
  53. virtual bool Connect( CreateInterfaceFn factory );
  54. virtual void Disconnect();
  55. virtual void *QueryInterface( const char *pInterfaceName );
  56. virtual InitReturnVal_t Init();
  57. virtual void Shutdown();
  58. // Methods of IMatchFramework
  59. public:
  60. // Run frame of the matchmaking framework
  61. virtual void RunFrame();
  62. // Get matchmaking extensions
  63. virtual IMatchExtensions * GetMatchExtensions();
  64. // Get events container
  65. virtual IMatchEventsSubscription * GetEventsSubscription();
  66. // Get the matchmaking title interface
  67. virtual IMatchTitle * GetMatchTitle();
  68. // Get the match session interface of the current match framework type
  69. virtual IMatchSession * GetMatchSession();
  70. // Get the network msg encode/decode factory
  71. virtual IMatchNetworkMsgController * GetMatchNetworkMsgController();
  72. // Get the match system
  73. virtual IMatchSystem * GetMatchSystem();
  74. // Send the key values back to the server
  75. virtual void ApplySettings( KeyValues* keyValues );
  76. // Entry point to create session
  77. virtual void CreateSession( KeyValues *pSettings );
  78. // Entry point to match into a session
  79. virtual void MatchSession( KeyValues *pSettings );
  80. // Accept invite
  81. virtual void AcceptInvite( int iController );
  82. // Close the session
  83. virtual void CloseSession();
  84. // Checks to see if the current game is being played online ( as opposed to locally against bots )
  85. virtual bool IsOnlineGame( void );
  86. // Called by the client to notify matchmaking that it should update matchmaking properties based
  87. // on player distribution among the teams.
  88. virtual void UpdateTeamProperties( KeyValues *pTeamProperties );
  89. //
  90. // IMatchEventsSink
  91. //
  92. public:
  93. virtual void OnEvent( KeyValues *pEvent );
  94. // Additional matchmaking title-defined interface
  95. public:
  96. virtual IMatchTitleGameSettingsMgr * GetMatchTitleGameSettingsMgr();
  97. public:
  98. void SetCurrentMatchSession( IMatchSessionInternal *pNewMatchSession );
  99. uint64 GetLastInviteFlags();
  100. protected:
  101. void RunFrame_Invite();
  102. public:
  103. CMatchFramework();
  104. ~CMatchFramework();
  105. protected:
  106. IMatchSessionInternal *m_pMatchSession;
  107. bool m_bJoinTeamSession;
  108. KeyValues *m_pTeamSessionSettings;
  109. };
  110. extern CMatchFramework *g_pMMF;
  111. extern const char *COM_GetModDirectory();
  112. extern bool IsLocalClientConnectedToServer();
  113. #endif // MM_FRAMEWORK_H