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.

247 lines
9.3 KiB

  1. //===== Copyright c 1996-2009, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #ifndef IMATCHTITLE_H
  8. #define IMATCHTITLE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #if defined ( _PS3 )
  13. #define TITLE_DATA_PREFIX "PS3."
  14. #define TITLE_DATA_DEVICE_MOVE_PREFIX "MOVE."
  15. #define TITLE_DATA_DEVICE_SHARP_SHOOTER_PREFIX "SHARP_SHOOTER."
  16. #else
  17. #define TITLE_DATA_PREFIX ""
  18. #endif
  19. struct TitleDataFieldsDescription_t
  20. {
  21. enum DataType_t
  22. {
  23. DT_0 = 0,
  24. DT_uint8 = 8,
  25. DT_BITFIELD = 9,
  26. DT_uint16 = 16,
  27. DT_uint32 = 32,
  28. DT_float = 33,
  29. DT_uint64 = 64
  30. };
  31. enum DataBlock_t
  32. {
  33. DB_TD1 = 0,
  34. DB_TD2 = 1,
  35. DB_TD3 = 2,
  36. DB_TD_COUNT = 3
  37. };
  38. char const *m_szFieldName;
  39. DataBlock_t m_iTitleDataBlock;
  40. DataType_t m_eDataType;
  41. union
  42. {
  43. int m_numBytesOffset;
  44. int m_nUserDataValue0;
  45. };
  46. };
  47. struct TitleAchievementsDescription_t
  48. {
  49. char const *m_szAchievementName; // Name by which achievement can be awarded and queried
  50. int m_idAchievement; // Achievement ID on the platform
  51. int m_numComponents; // Number of achievement component title data bits
  52. };
  53. struct TitleAvatarAwardsDescription_t
  54. {
  55. char const *m_szAvatarAwardName; // Name by which avatar award can be awarded and queried
  56. int m_idAvatarAward; // Avatar award ID on the platform
  57. char const *m_szTitleDataBitfieldStatName; // Name of a bitfield in title data storage representing whether avatar award has been earned
  58. };
  59. struct TitleDlcDescription_t
  60. {
  61. uint64 m_uiLicenseMaskId;
  62. int m_idDlcAppId;
  63. int m_idDlcPackageId;
  64. char const *m_szTitleDataBitfieldStatName; // Name of a bitfield in title data storage representing whether dlc has been discovered installed
  65. };
  66. enum TitleSettingsFlags_t
  67. {
  68. MATCHTITLE_SETTING_MULTIPLAYER = ( 1 << 0 ), // Title wants network sockets initialization
  69. MATCHTITLE_SETTING_NODEDICATED = ( 1 << 1 ), // Title doesn't support dedicated servers
  70. MATCHTITLE_PLAYERMGR_DISABLED = ( 1 << 2 ), // Title doesn't need friends presence poll
  71. MATCHTITLE_SERVERMGR_DISABLED = ( 1 << 3 ), // Title doesn't need group servers poll
  72. MATCHTITLE_INVITE_ONLY_SINGLE_USER = ( 1 << 4 ), // Accepted game invite forcefully disables splitscreen (e.g.: 1-on-1 games)
  73. MATCHTITLE_VOICE_INGAME = ( 1 << 5 ), // When in active gameplay lobby system doesn't transmit voice
  74. MATCHTITLE_XLSPPATCH_SUPPORTED = ( 1 << 6 ), // Title supports xlsp patch containers
  75. MATCHTITLE_PLAYERMGR_ALLFRIENDS = ( 1 << 7 ), // Player manager by default fetches only friends for same game, this will force all friends to be fetched
  76. MATCHTITLE_PLAYERMGR_FRIENDREQS = ( 1 << 8 ), // Player manager by default fetches only real friends, this will force friend requests to also be fetched
  77. };
  78. abstract_class IMatchTitle
  79. {
  80. public:
  81. // Title ID
  82. virtual uint64 GetTitleID() = 0;
  83. // Service ID for XLSP
  84. virtual uint64 GetTitleServiceID() = 0;
  85. // Describe title settings using a bitwise combination of flags
  86. virtual uint64 GetTitleSettingsFlags() = 0;
  87. // Prepare network startup params for the title
  88. virtual void PrepareNetStartupParams( void *pNetStartupParams ) = 0;
  89. // Get total number of players supported by the title
  90. virtual int GetTotalNumPlayersSupported() = 0;
  91. // Get a guest player name
  92. virtual char const * GetGuestPlayerName( int iUserIndex ) = 0;
  93. // Decipher title data fields
  94. virtual TitleDataFieldsDescription_t const * DescribeTitleDataStorage() = 0;
  95. // Title achievements
  96. virtual TitleAchievementsDescription_t const * DescribeTitleAchievements() = 0;
  97. // Title avatar awards
  98. virtual TitleAvatarAwardsDescription_t const * DescribeTitleAvatarAwards() = 0;
  99. // Title leaderboards
  100. virtual KeyValues * DescribeTitleLeaderboard( char const *szLeaderboardView ) = 0;
  101. // Sets up all necessary client-side convars and user info before
  102. // connecting to server
  103. virtual void PrepareClientForConnect( KeyValues *pSettings ) = 0;
  104. // Start up a listen server with the given settings
  105. virtual bool StartServerMap( KeyValues *pSettings ) = 0;
  106. // Title DLC description
  107. virtual TitleDlcDescription_t const * DescribeTitleDlcs() = 0;
  108. // Run every frame
  109. virtual void RunFrame() = 0;
  110. };
  111. //
  112. // Matchmaking title settings extension interface
  113. //
  114. abstract_class IMatchTitleGameSettingsMgr
  115. {
  116. public:
  117. // Extends server game details
  118. virtual void ExtendServerDetails( KeyValues *pDetails, KeyValues *pRequest ) = 0;
  119. // Adds the essential part of game details to be broadcast
  120. virtual void ExtendLobbyDetailsTemplate( KeyValues *pDetails, char const *szReason, KeyValues *pFullSettings ) = 0;
  121. // Extends game settings update packet for lobby transition,
  122. // either due to a migration or due to an endgame condition
  123. virtual void ExtendGameSettingsForLobbyTransition( KeyValues *pSettings, KeyValues *pSettingsUpdate, bool bEndGame ) = 0;
  124. // Adds data for datacenter reporting
  125. virtual void ExtendDatacenterReport( KeyValues *pReportMsg, char const *szReason ) = 0;
  126. // Rolls up game details for matches grouping
  127. // valid pDetails, null pRollup
  128. // returns a rollup representation of pDetails to be used as an indexing key
  129. // valid pDetails, valid pRollup (usually called second time)
  130. // rolls the details into the rollup, aggregates some values, when
  131. // the aggregate values are missing in pRollup, then this is the first
  132. // details entry being aggregated and would establish the first rollup
  133. // returns pRollup
  134. // null pDetails, valid pRollup
  135. // tries to determine if the rollup should remain even though no details
  136. // matched it, adjusts pRollup to represent no aggregated data
  137. // returns null to drop pRollup, returns pRollup to keep rollup
  138. virtual KeyValues * RollupGameDetails( KeyValues *pDetails, KeyValues *pRollup, KeyValues *pQuery ) = 0;
  139. // Defines session search keys for matchmaking
  140. virtual KeyValues * DefineSessionSearchKeys( KeyValues *pSettings ) = 0;
  141. // Defines dedicated server search key
  142. virtual KeyValues * DefineDedicatedSearchKeys( KeyValues *pSettings, bool bNeedOfficialServer, int nSearchPass ) = 0;
  143. // Initializes full game settings from potentially abbreviated game settings
  144. virtual void InitializeGameSettings( KeyValues *pSettings, char const *szReason ) = 0;
  145. // Sets the bspname key given a mapgroup
  146. virtual void SetBspnameFromMapgroup( KeyValues *pSettings ) = 0;
  147. // Extends game settings update packet before it gets merged with
  148. // session settings and networked to remote clients
  149. virtual void ExtendGameSettingsUpdateKeys( KeyValues *pSettings, KeyValues *pUpdateDeleteKeys ) = 0;
  150. virtual KeyValues * ExtendTeamLobbyToGame( KeyValues *pSettings ) = 0;
  151. // Prepares system for session creation
  152. virtual KeyValues * PrepareForSessionCreate( KeyValues *pSettings ) = 0;
  153. // Executes the command on the session settings, this function on host
  154. // is allowed to modify Members/Game subkeys and has to fill in modified players KeyValues
  155. // When running on a remote client "ppPlayersUpdated" is NULL and players cannot
  156. // be modified
  157. virtual void ExecuteCommand( KeyValues *pCommand, KeyValues *pSessionSystemData, KeyValues *pSettings, KeyValues **ppPlayersUpdated ) = 0;
  158. // Prepares the host lobby for game or adjust settings of new players who
  159. // join a game in progress, this function is allowed to modify
  160. // Members/Game subkeys and has to fill in modified players KeyValues
  161. virtual void PrepareLobbyForGame( KeyValues *pSettings, KeyValues **ppPlayersUpdated ) = 0;
  162. // Prepares the host team lobby for game adjusting the game settings
  163. // this function is allowed to prepare modification package to update
  164. // Game subkeys.
  165. // Returns the update/delete package to be applied to session settings
  166. // and pushed to dependent two sesssion of the two teams.
  167. virtual KeyValues * PrepareTeamLinkForGame( KeyValues *pSettingsLocal, KeyValues *pSettingsRemote ) = 0;
  168. // Prepares the client lobby for migration
  169. // this function is called when the client session is still in the state
  170. // of "client" while handling the original host disconnection and decision
  171. // has been made that local machine will be elected as new "host"
  172. // Returns NULL if migration should proceed normally
  173. // Returns [ kvroot { "error" "n/a" } ] if migration should be aborted.
  174. virtual KeyValues * PrepareClientLobbyForMigration( KeyValues *pSettingsLocal, KeyValues *pMigrationInfo ) = 0;
  175. // Prepares the session for server disconnect
  176. // this function is called when the session is still in the active gameplay
  177. // state and while localhost is handling the disconnection from game server.
  178. // Returns NULL to allow default flow
  179. // Returns [ kvroot { "disconnecthdlr" "<opt>" } ] where <opt> can be:
  180. // "destroy" : to trigger a disconnection error and destroy the session
  181. // "lobby" : to initiate a "salvaging" lobby transition
  182. virtual KeyValues * PrepareClientLobbyForGameDisconnect( KeyValues *pSettingsLocal, KeyValues *pDisconnectInfo ) = 0;
  183. // Validates if client profile can set a stat or get awarded an achievement
  184. virtual bool AllowClientProfileUpdate( KeyValues *kvUpdate ) = 0;
  185. // Retrieves the indexed formula from the match system settings file. (MatchSystem.360.res)
  186. virtual char const * GetFormulaAverage( int index ) = 0;
  187. // Called by the client to notify matchmaking that it should update matchmaking properties based
  188. // on player distribution among the teams.
  189. virtual void UpdateTeamProperties( KeyValues *pCurrentSettings, KeyValues *pTeamProperties ) = 0;
  190. };
  191. #endif // IMATCHTITLE_H