diff --git a/public/matchmaking/idatacenter.h b/public/matchmaking/idatacenter.h new file mode 100644 index 00000000..d1067402 --- /dev/null +++ b/public/matchmaking/idatacenter.h @@ -0,0 +1,31 @@ +#ifndef _IDATACENTER_H_ +#define _IDATACENTER_H_ + +class IDatacenter; + +#include "imatchsystem.h" + +abstract_class IDatacenterCmdBatch +{ +public: + virtual void AddCommand( KeyValues * ) = 0; + virtual bool IsFinished() = 0; + virtual int GetNumResults() = 0; + virtual void * GetResult( int iElem ) = 0; + virtual void Destroy() = 0; +}; + +abstract_class IDatacenter +{ +public: + // + // GetStats + // retrieves the last received datacenter stats + // + virtual KeyValues * GetStats() = 0; + + virtual IDatacenterCmdBatch * CreateCmdBatch() = 0; +}; + + +#endif // _IDATACENTER_H_ diff --git a/public/matchmaking/imatchasync.h b/public/matchmaking/imatchasync.h new file mode 100644 index 00000000..18cc01bd --- /dev/null +++ b/public/matchmaking/imatchasync.h @@ -0,0 +1,62 @@ +//===== Copyright c 1996-2009, Valve Corporation, All rights reserved. ======// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// + +#ifndef IMATCHASYNC_H +#define IMATCHASYNC_H + +#ifdef _WIN32 +#pragma once +#endif + +// +// Describes possible states of an async operation +// +enum AsyncOperationState_t +{ + AOS_RUNNING, + AOS_ABORTING, + AOS_ABORTED, + AOS_FAILED, + AOS_SUCCEEDED, +}; + +// +// Interface of an async operation +// +abstract_class IMatchAsyncOperation +{ +public: + // Poll if operation has completed + virtual bool IsFinished() = 0; + + // Operation state + virtual AsyncOperationState_t GetState() = 0; + + // Retrieve a generic completion result for simple operations + // that return simple results upon success, + // results are operation-specific, may result in undefined behavior + // if operation is still in progress. + virtual uint64 GetResult() = 0; + + // Request operation to be aborted + virtual void Abort() = 0; + + // Release the operation interface and all resources + // associated with the operation. Operation callbacks + // will not be called after Release. Operation object + // cannot be accessed after Release. + virtual void Release() = 0; +}; + +abstract_class IMatchAsyncOperationCallback +{ +public: + // Signals when operation has finished + virtual void OnOperationFinished( IMatchAsyncOperation *pOperation ) = 0; +}; + +#endif // IMATCHASYNC_H diff --git a/public/matchmaking/imatchevents.h b/public/matchmaking/imatchevents.h new file mode 100644 index 00000000..e92dee0a --- /dev/null +++ b/public/matchmaking/imatchevents.h @@ -0,0 +1,259 @@ +//===== Copyright � 1996-2009, Valve Corporation, All rights reserved. ======// +// +// Purpose: +// +//===========================================================================// + +#ifndef IMATCHEVENTS_H +#define IMATCHEVENTS_H +#ifdef _WIN32 +#pragma once +#endif + + +abstract_class IMatchEventsSink +{ +public: + virtual void OnEvent( KeyValues *pEvent ) {} + + // + // List of events + // + +/* + "OnSysStorageDevicesChanged" + Signalled when system storage device change is detected. + params: + void + + "OnSysSigninChange" + Signalled when one or more users sign out. + params: + string "action" - signin change event: "signin", "signout" + int "numUsers" - how many users signed in/out (defines valid user0 - userN-1 fields) + int "mask" - bitmask of controllers affected + int "user%d" - controller index affected + + "OnSysXUIEvent" + Signalled when an XUI event occurs. + params: + string "action" - XUI action type: "opening", "closed" + + "OnSysMuteListChanged" + Signalled when system mute list change occurs. + params: + void + + "OnSysInputDevicesChanged" + Signalled when input device disconnection is detected. + params: + int "mask" - bitmask of which slot's controller was disconnected [0-1] + + + + "OnEngineLevelLoadingStarted" + Signalled when a level starts loading. + params: + string "name" - level name + + "OnEngineListenServerStarted" + Signalled when a listen server level loads enough to accept client connections. + params: + void + + "OnEngineLevelLoadingTick" + Signalled periodically while a level is loading, + after loading started and before loading finished. + params: + void + + "OnEngineLevelLoadingFinished" + Signalled when a level is finished loading. + params: + int "error" - whether an extended error occurred + string "reason" - reason description + + "OnEngineClientSignonStateChange" + Signalled when client's signon state is changing. + params: + int "slot" - client ss slot + int "old" - old state + int "new" - new state + int "count" - count + + "OnEngineDisconnectReason" + Signalled before a disconnect is going to occur and a reason + for disconnect is available. + params: + string "reason" - reason description + + "OnEngineEndGame" + Signalled before a disconnect is going to occur and notifies the members + of the game that the game has reached a conclusion or a vote to end the + game has passed and the game should terminate and return to lobby if possible. + params: + string "reason" - reason description + + + + "OnMatchPlayerMgrUpdate" + Signalled when a player manager update occurs. + params: + string "update" = - update type + "searchstarted" - search started + "searchfinished" - search finished + "friend" - friend details updated + uint64 "xuid" - xuid of a player if applicable + + "OnMatchPlayerMgrReset" + Signalled when the game needs to go into attract mode. + params: + string "reason" - one of the following reasons: + "GuestSignedIn" - guest user signed in + "GameUserSignedOut" - user involved in game has signed out + + "OnMatchServerMgrUpdate" + Signalled when a server manager update occurs. + params: + string "update" = - update type + "searchstarted" - search started + "searchfinished" - search finished + "server" - server details updated + uint64 "xuid" - xuid of a server if applicable + + "OnMatchSessionUpdate" + Signalled when a session changes. + params: + strings "state" = - new state of the session + "ready" - session is completely initialized and ready + "updated" - session settings have been updated + + + + "OnNetLanConnectionlessPacket" + Signalled when a lan network packet is received. + params: + string "from" - netadr of sender as recorded by network layer + subkey - packet message + + + + "OnProfilesChanged" + Signalled when new number of game users are set for the game. + params: + int "numProfiles" - number of game users set for the game + + "OnProfileDataLoaded" + Signalled when a user profile title data is loaded. + params: + int "iController" - index of controller whose title data is now loaded + + "OnProfileStorageAvailable" + Signalled when a user profile storage device is selected. + params: + int "iController" - index of controller whose storage device is now selected + + "OnProfileUnavailable" + Signalled when a user profile is detected as unavailable. + params: + int "iController" - index of controller whose profile was detected as unavailable + + + + "OnPlayerUpdated" + Signalled when information about a player changes. + params: + uint64 "xuid" - XUID of the player updated + + "OnPlayerRemoved" + Signalled when a player is removed from the game. + params: + uint64 "xuid" - XUID of the player removed + + "OnPlayerMachinesConnected" + Signalled when new machines become part of the session, they will be last + in the list of connected machines. + params: + int "numMachines" - number of new machines connected + + "OnPlayerActivity" + Signalled when a player activity is detected. + params: + uint64 "xuid" - XUID of the player + string "act" - type of activity: + "voice" - player is voice chatting + + + + "OnMuteChanged" + Signalled when a mute list is updated. + params: + void + + "OnInvite" + Signalled when game invite event occurs. + params: + int "user" - controller index accepting the invite or causing invite error + string "sessioninfo" - session info of the invite host + string "action" = - invite action + "accepted" - when an invite is accepted by user + "storage" - when a storage device needs to be validated + "error" - when an error occurs that prevents invite from being accepted + "join" - when destructive actions or storage devices are confirmed by user + "deny" - when invite is rejected by user + string "error" - error description: "NotOnline", "NoMultiplayer", etc. + ptr int "confirmed" - handler should set pointed int to 0 if confirmation is pending + and send a "join" action OnInvite event after destructive + actions are confirmed by user, storage devices are mounted, etc. +*/ + +}; + +abstract_class IMatchEventsSubscription +{ +public: + virtual void Subscribe( IMatchEventsSink *pSink ) = 0; + virtual void Unsubscribe( IMatchEventsSink *pSink ) = 0; + + virtual void BroadcastEvent( KeyValues *pEvent ) = 0; + + virtual void RegisterEventData( KeyValues *pEventData ) = 0; + virtual KeyValues * GetEventData( char const *szEventDataKey ) = 0; +}; + + +// +// Renamer for the match events event-handler function +// Usage: +// class MyClass : public CMatchEventsSinkFn< MyClass > +// { +// public: +// MyClass() : MatchEventsSinkFnClass( &MyClass::HandleMatchSinkEvent ) {} +// void HandleMatchSinkEvent( KeyValues *pEvent ); +// }; +// + +template < typename TDerived > +class CMatchEventsSinkFn : public IMatchEventsSink +{ +protected: + typedef TDerived DerivedClass; + typedef void ( TDerived::*PFnDerivedHandler_t )( KeyValues *pEvent ); + typedef CMatchEventsSinkFn< TDerived > MatchEventsSinkFnClass; + +protected: + explicit CMatchEventsSinkFn( PFnDerivedHandler_t pfn ) : m_pfnDerived( pfn ) {} + +public: + virtual void OnEvent( KeyValues *pEvent ) + { + ( static_cast< TDerived * >( this )->*m_pfnDerived )( pEvent ); + } + +private: + PFnDerivedHandler_t m_pfnDerived; +}; + + +#endif // IMATCHEVENTS_H + diff --git a/public/matchmaking/imatchextensions.h b/public/matchmaking/imatchextensions.h new file mode 100644 index 00000000..2f37764e --- /dev/null +++ b/public/matchmaking/imatchextensions.h @@ -0,0 +1,28 @@ +//===== Copyright c 1996-2009, Valve Corporation, All rights reserved. ======// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// + +#ifndef IMATCHEXTENSIONS_H +#define IMATCHEXTENSIONS_H + +#ifdef _WIN32 +#pragma once +#endif + +abstract_class IMatchExtensions +{ +public: + // Registers an extension interface + virtual void RegisterExtensionInterface( char const *szInterfaceString, void *pvInterface ) = 0; + + // Unregisters an extension interface + virtual void UnregisterExtensionInterface( char const *szInterfaceString, void *pvInterface ) = 0; + + // Gets a pointer to a registered extension interface + virtual void * GetRegisteredExtensionInterface( char const *szInterfaceString ) = 0; +}; + +#endif // IMATCHEXTENSIONS_H diff --git a/public/matchmaking/imatchframework.h b/public/matchmaking/imatchframework.h new file mode 100644 index 00000000..8593cedc --- /dev/null +++ b/public/matchmaking/imatchframework.h @@ -0,0 +1,102 @@ +//===== Copyright c 1996-2009, Valve Corporation, All rights reserved. ======// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// + +#ifndef IMATCHFRAMEWORK_H +#define IMATCHFRAMEWORK_H + +#ifdef _WIN32 +#pragma once +#endif + +class IMatchFramework; +class IMatchSession; + +#include "appframework/IAppSystem.h" + +#include "tier1/interface.h" +#include "KeyValues.h" + +#if !defined( _X360 ) +#include "xbox/xboxstubs.h" +#endif + +#include "inetchannel.h" + +#include "imatchasync.h" +#include "imatchtitle.h" +#include "imatchnetworkmsg.h" +#include "imatchextensions.h" +#include "imatchevents.h" +#include "imatchsystem.h" +#include "iplayermanager.h" +#include "iplayer.h" +#include "iservermanager.h" +#include "imatchvoice.h" +#include "isearchmanager.h" +#include "idatacenter.h" + +abstract_class IMatchFramework : public IAppSystem +{ +public: + // Run frame of the matchmaking framework + virtual void RunFrame() = 0; + + + // Get matchmaking extensions + virtual IMatchExtensions * GetMatchExtensions() = 0; + + // Get events container + virtual IMatchEventsSubscription * GetEventsSubscription() = 0; + + // Get the matchmaking title interface + virtual IMatchTitle * GetMatchTitle() = 0; + + // Get the match session interface of the current match framework type + virtual IMatchSession * GetMatchSession() = 0; + + // Get the network msg encode/decode factory + virtual IMatchNetworkMsgController * GetMatchNetworkMsgController() = 0; + + // Get the match system + virtual IMatchSystem * GetMatchSystem() = 0; + + // Entry point to create session + virtual void CreateSession( KeyValues *pSettings ) = 0; + + // Entry point to match into a session + virtual void MatchSession( KeyValues *pSettings ) = 0; + + // Accept invite + virtual void AcceptInvite( int iController ) = 0; + + // Close the session + virtual void CloseSession() = 0; +}; + +#define IMATCHFRAMEWORK_VERSION_STRING "MATCHFRAMEWORK_001" + + + +abstract_class IMatchSession +{ +public: + // Get an internal pointer to session system-specific data + virtual KeyValues * GetSessionSystemData() = 0; + + // Get an internal pointer to session settings + virtual KeyValues * GetSessionSettings() = 0; + + // Update session settings, only changing keys and values need + // to be passed and they will be updated + virtual void UpdateSessionSettings( KeyValues *pSettings ) = 0; + + // Issue a session command + virtual void Command( KeyValues *pCommand ) = 0; +}; + + +#endif // IMATCHFRAMEWORK_H diff --git a/public/matchmaking/imatchnetworkmsg.h b/public/matchmaking/imatchnetworkmsg.h new file mode 100644 index 00000000..e629d33c --- /dev/null +++ b/public/matchmaking/imatchnetworkmsg.h @@ -0,0 +1,49 @@ +//===== Copyright c 1996-2009, Valve Corporation, All rights reserved. ======// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// + +#ifndef IMATCHNETWORKMSG_H +#define IMATCHNETWORKMSG_H + +#ifdef _WIN32 +#pragma once +#endif + + +struct MM_QOS_t +{ + int nPingMsMin; // Minimum round-trip time in ms + int nPingMsMed; // Median round-trip time in ms + float flBwUpKbs; // Bandwidth upstream in kilobytes/s + float flBwDnKbs; // Bandwidth downstream in kilobytes/s + float flLoss; // Average packet loss in percents +}; + +struct MM_GameDetails_QOS_t +{ + void *m_pvData; // Encoded game details + int m_numDataBytes; // Length of game details + + int m_nPing; // Average ping in ms +}; + +abstract_class IMatchNetworkMsgController +{ +public: + // To determine host Quality-of-Service + virtual MM_QOS_t GetQOS() = 0; + + virtual KeyValues * GetActiveServerGameDetails( KeyValues *pRequest ) = 0; + + virtual KeyValues * UnpackGameDetailsFromQOS( MM_GameDetails_QOS_t const *pvQosReply ) = 0; + virtual KeyValues * UnpackGameDetailsFromSteamLobby( uint64 uiLobbyID ) = 0; + + virtual void PackageGameDetailsForQOS( KeyValues *pSettings, CUtlBuffer &buf ) = 0; + + virtual KeyValues * PackageGameDetailsForReservation( KeyValues *pSettings ) = 0; +}; + +#endif // IMATCHNETWORKMSG_H \ No newline at end of file diff --git a/public/matchmaking/imatchsystem.h b/public/matchmaking/imatchsystem.h new file mode 100644 index 00000000..5a969d11 --- /dev/null +++ b/public/matchmaking/imatchsystem.h @@ -0,0 +1,28 @@ +//========= Copyright � 1996-2009, Valve Corporation, All rights reserved. ============// + +#ifndef _IMATCHSYSTEM_H_ +#define _IMATCHSYSTEM_H_ + +class IPlayerManager; +class IGameManager; +class IServerManager; +class ISearchManager; +class IMatchVoice; +class IDatacenter; + +class IMatchSystem +{ +public: + virtual ::IPlayerManager * GetPlayerManager() = 0; + + virtual IMatchVoice * GetMatchVoice() = 0; + + virtual IServerManager * GetUserGroupsServerManager() = 0; + + virtual ISearchManager * CreateGameSearchManager( KeyValues *pParams ) = 0; + + virtual IDatacenter * GetDatacenter() = 0; +}; + +#endif + diff --git a/public/matchmaking/imatchtitle.h b/public/matchmaking/imatchtitle.h new file mode 100644 index 00000000..3ef7a6bc --- /dev/null +++ b/public/matchmaking/imatchtitle.h @@ -0,0 +1,164 @@ +//===== Copyright c 1996-2009, Valve Corporation, All rights reserved. ======// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// + +#ifndef IMATCHTITLE_H +#define IMATCHTITLE_H + +#ifdef _WIN32 +#pragma once +#endif + +struct TitleDataFieldsDescription_t +{ + enum DataType_t + { + DT_U8 = 8, + DT_U16 = 16, + DT_U32 = 32, + DT_FLOAT = 33, + DT_U64 = 64 + }; + + enum DataBlock_t + { + DB_TD1 = 0, + DB_TD2 = 1, + DB_TD3 = 2 + }; + + char const *m_szFieldName; + DataBlock_t m_iTitleDataBlock; + DataType_t m_eDataType; + int m_numBytesOffset; +}; + +struct TitleAchievementsDescription_t +{ + char const *m_szAchievementName; + int m_idAchievement; +}; + +struct TitleAvatarAwardsDescription_t +{ + char const *m_szAvatarAwardName; + int m_idAvatarAward; +}; + +abstract_class IMatchTitle +{ +public: + // Title ID + virtual uint64 GetTitleID() = 0; + + // Service ID for XLSP + virtual uint64 GetTitleServiceID() = 0; + + // Whether we are a single-player title or multi-player title + virtual bool IsMultiplayer() = 0; + + // Prepare network startup params for the title + virtual void PrepareNetStartupParams( void *pNetStartupParams ) = 0; + + // Get total number of players supported by the title + virtual int GetTotalNumPlayersSupported() = 0; + + // Get a guest player name + virtual char const * GetGuestPlayerName( int iUserIndex ) = 0; + + // Decipher title data fields + virtual TitleDataFieldsDescription_t const * DescribeTitleDataStorage() = 0; + + // Title achievements + virtual TitleAchievementsDescription_t const * DescribeTitleAchievements() = 0; + + // Title avatar awards + virtual TitleAvatarAwardsDescription_t const * DescribeTitleAvatarAwards() = 0; + + // Title leaderboards + virtual KeyValues * DescribeTitleLeaderboard( char const *szLeaderboardView ) = 0; + + // Sets up all necessary client-side convars and user info before + // connecting to server + virtual void PrepareClientForConnect( KeyValues *pSettings ) = 0; + + // Start up a listen server with the given settings + virtual bool StartServerMap( KeyValues *pSettings ) = 0; +}; + +// +// Matchmaking title settings extension interface +// + +abstract_class IMatchTitleGameSettingsMgr +{ +public: + // Extends server game details + virtual void ExtendServerDetails( KeyValues *pDetails, KeyValues *pRequest ) = 0; + + // Adds the essential part of game details to be broadcast + virtual void ExtendLobbyDetailsTemplate( KeyValues *pDetails, char const *szReason, KeyValues *pFullSettings ) = 0; + + // Extends game settings update packet for lobby transition, + // either due to a migration or due to an endgame condition + virtual void ExtendGameSettingsForLobbyTransition( KeyValues *pSettings, KeyValues *pSettingsUpdate, bool bEndGame ) = 0; + + + // Rolls up game details for matches grouping + // valid pDetails, null pRollup + // returns a rollup representation of pDetails to be used as an indexing key + // valid pDetails, valid pRollup (usually called second time) + // rolls the details into the rollup, aggregates some values, when + // the aggregate values are missing in pRollup, then this is the first + // details entry being aggregated and would establish the first rollup + // returns pRollup + // null pDetails, valid pRollup + // tries to determine if the rollup should remain even though no details + // matched it, adjusts pRollup to represent no aggregated data + // returns null to drop pRollup, returns pRollup to keep rollup + virtual KeyValues * RollupGameDetails( KeyValues *pDetails, KeyValues *pRollup, KeyValues *pQuery ) = 0; + + + // Defines session search keys for matchmaking + virtual KeyValues * DefineSessionSearchKeys( KeyValues *pSettings ) = 0; + + // Defines dedicated server search key + virtual KeyValues * DefineDedicatedSearchKeys( KeyValues *pSettings ) = 0; + + + // Initializes full game settings from potentially abbreviated game settings + virtual void InitializeGameSettings( KeyValues *pSettings ) = 0; + + // Extends game settings update packet before it gets merged with + // session settings and networked to remote clients + virtual void ExtendGameSettingsUpdateKeys( KeyValues *pSettings, KeyValues *pUpdateDeleteKeys ) = 0; + + // Prepares system for session creation + virtual KeyValues * PrepareForSessionCreate( KeyValues *pSettings ) = 0; + + + // Executes the command on the session settings, this function on host + // is allowed to modify Members/Game subkeys and has to fill in modified players KeyValues + // When running on a remote client "ppPlayersUpdated" is NULL and players cannot + // be modified + virtual void ExecuteCommand( KeyValues *pCommand, KeyValues *pSessionSystemData, KeyValues *pSettings, KeyValues **ppPlayersUpdated ) = 0; + + // Prepares the host lobby for game or adjust settings of new players who + // join a game in progress, this function is allowed to modify + // Members/Game subkeys and has to fill in modified players KeyValues + virtual void PrepareLobbyForGame( KeyValues *pSettings, KeyValues **ppPlayersUpdated ) = 0; + + // Prepares the host team lobby for game adjusting the game settings + // this function is allowed to prepare modification package to update + // Game subkeys. + // Returns the update/delete package to be applied to session settings + // and pushed to dependent two sesssion of the two teams. + virtual KeyValues * PrepareTeamLinkForGame( KeyValues *pSettingsLocal, KeyValues *pSettingsRemote ) = 0; + + virtual KeyValues * EndGameToLobbyUpdate( KeyValues *pSettings, KeyValues **ppSettingsUpdated, KeyValues **ppPlayersUpdated ) = 0; +}; + +#endif // IMATCHTITLE_H diff --git a/public/matchmaking/imatchvoice.h b/public/matchmaking/imatchvoice.h new file mode 100644 index 00000000..82b81134 --- /dev/null +++ b/public/matchmaking/imatchvoice.h @@ -0,0 +1,38 @@ +//===== Copyright c 1996-2009, Valve Corporation, All rights reserved. ======// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// + +#ifndef IMATCHVOICE_H +#define IMATCHVOICE_H + +#ifdef _WIN32 +#pragma once +#endif + +abstract_class IMatchVoice +{ +public: + // Whether remote player talking can be visualized / audible + virtual bool CanPlaybackTalker( XUID xuidTalker ) = 0; + + // Whether we are explicitly muting a remote player + virtual bool IsTalkerMuted( XUID xuidTalker ) = 0; + + // Whether we are muting any player on the player's machine + virtual bool IsMachineMuted( XUID xuidPlayer ) = 0; + + // Whether voice recording mode is currently active + virtual bool IsVoiceRecording() = 0; + + // Enable or disable voice recording + virtual void SetVoiceRecording( bool bRecordingEnabled ) = 0; + + // Enable or disable voice mute for a given talker + virtual void MuteTalker( XUID xuidTalker, bool bMute ) = 0; +}; + +#endif + diff --git a/public/matchmaking/iplayer.h b/public/matchmaking/iplayer.h new file mode 100644 index 00000000..c0032f55 --- /dev/null +++ b/public/matchmaking/iplayer.h @@ -0,0 +1,77 @@ +//========= Copyright � 1996-2009, Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=====================================================================================// + + +#ifndef _IPLAYER_H_ +#define _IPLAYER_H_ + +#include "tier1/KeyValues.h" + +struct UserProfileData +{ + float reputation; + int32 difficulty; + int32 sensitivity; + int32 yaxis; + int32 vibration; + int32 color1, color2; + int32 action_autoaim; + int32 action_autocenter; + int32 action_movementcontrol; + int32 region; + int32 achearned; + int32 cred; + int32 zone; + int32 titlesplayed; + int32 titleachearned; + int32 titlecred; +}; + +//Players are a wrapper or a networked player, as such they may not have all the information current, particularly when first created. +abstract_class IPlayer +{ +public: + enum OnlineState_t + { + STATE_OFFLINE, + STATE_NO_MULTIPLAYER, + STATE_ONLINE, + }; + +public: + //Info + virtual XUID GetXUID() = 0; + virtual int GetPlayerIndex() = 0; + + virtual char const * GetName() = 0; + + virtual OnlineState_t GetOnlineState() = 0; +}; + +abstract_class IPlayerFriend : public IPlayer +{ +public: + virtual wchar_t const * GetRichPresence() = 0; + + virtual KeyValues *GetGameDetails() = 0; + + virtual bool IsJoinable() = 0; + virtual void Join() = 0; +}; + +abstract_class IPlayerLocal : public IPlayer +{ +public: + virtual const UserProfileData& GetPlayerProfileData() = 0; + + virtual const void * GetPlayerTitleData( int iTitleDataIndex ) = 0; + virtual void UpdatePlayerTitleData( int iTitleDataIndex, const void *pvNewTitleData, int numBytesOffset, int numNewBytes ) = 0; + + virtual void GetLeaderboardData( KeyValues *pLeaderboardInfo ) = 0; + virtual void UpdateLeaderboardData( KeyValues *pLeaderboardInfo ) = 0; +}; + +#endif diff --git a/public/matchmaking/iplayermanager.h b/public/matchmaking/iplayermanager.h new file mode 100644 index 00000000..c6ae4cff --- /dev/null +++ b/public/matchmaking/iplayermanager.h @@ -0,0 +1,46 @@ +//========= Copyright � 1996-2009, Valve Corporation, All rights reserved. ============// + +#ifndef _IPLAYERMANAGER_H_ +#define _IPLAYERMANAGER_H_ + +class IPlayer; +class IPlayerFriend; +class IPlayerLocal; + +abstract_class IPlayerManager +{ +public: + // + // EnableServersUpdate + // controls whether friends data is being updated in the background + // + virtual void EnableFriendsUpdate( bool bEnable ) = 0; + + // + // GetLocalPlayer + // returns a local player interface for a given controller index + // + virtual IPlayerLocal * GetLocalPlayer( int iController ) = 0; + + // + // GetNumFriends + // returns number of friends discovered and for which data is available + // + virtual int GetNumFriends() = 0; + + // + // GetFriend + // returns player interface to the given friend or NULL if friend not found or not available + // + virtual IPlayerFriend * GetFriendByIndex( int index ) = 0; + virtual IPlayerFriend * GetFriendByXUID( XUID xuid ) = 0; + + // + // FindPlayer + // returns player interface by player's XUID or NULL if player not found or not available + // + virtual IPlayer * FindPlayer( XUID xuid ) = 0; +}; + + +#endif diff --git a/public/matchmaking/isearchmanager.h b/public/matchmaking/isearchmanager.h new file mode 100644 index 00000000..e75e761c --- /dev/null +++ b/public/matchmaking/isearchmanager.h @@ -0,0 +1,62 @@ +#ifndef _ISEARCHMANAGER_H_ +#define _ISEARCHMANAGER_H_ + +class IMatchSearchResult; +class ISearchManager; + +#include "imatchsystem.h" + +abstract_class IMatchSearchResult +{ +public: + // + // GetOnlineId + // returns result online id to store as reference + // + virtual XUID GetOnlineId() = 0; + + // + // GetGameDetails + // returns result game details + // + virtual KeyValues *GetGameDetails() = 0; + + // + // IsJoinable and Join + // returns whether result is joinable and initiates join to the result + // + virtual bool IsJoinable() = 0; + virtual void Join() = 0; +}; + +abstract_class ISearchManager +{ +public: + // + // EnableResultsUpdate + // controls whether server data is being updated in the background + // + virtual void EnableResultsUpdate( bool bEnable, KeyValues *pSearchParams = NULL ) = 0; + + // + // GetNumResults + // returns number of results discovered and for which data is available + // + virtual int GetNumResults() = 0; + + // + // GetResultByIndex / GetResultByOnlineId + // returns result interface to the given result or NULL if result not found or not available + // + virtual IMatchSearchResult* GetResultByIndex( int iResultIdx ) = 0; + virtual IMatchSearchResult* GetResultByOnlineId( XUID xuidResultOnline ) = 0; + + // + // Destroy + // destroys the search manager and all its results + // + virtual void Destroy() = 0; +}; + + +#endif // _ISEARCHMANAGER_H_ diff --git a/public/matchmaking/iservermanager.h b/public/matchmaking/iservermanager.h new file mode 100644 index 00000000..24c40331 --- /dev/null +++ b/public/matchmaking/iservermanager.h @@ -0,0 +1,56 @@ +#ifndef _ISERVERMANAGER_H_ +#define _ISERVERMANAGER_H_ + +class IServer; +class IServerManager; + +#include "imatchsystem.h" + +abstract_class IMatchServer +{ +public: + // + // GetOnlineId + // returns server online id to store as reference + // + virtual XUID GetOnlineId() = 0; + + // + // GetGameDetails + // returns server game details + // + virtual KeyValues *GetGameDetails() = 0; + + // + // IsJoinable and Join + // returns whether server is joinable and initiates join to the server + // + virtual bool IsJoinable() = 0; + virtual void Join() = 0; +}; + +abstract_class IServerManager +{ +public: + // + // EnableServersUpdate + // controls whether server data is being updated in the background + // + virtual void EnableServersUpdate( bool bEnable ) = 0; + + // + // GetNumServers + // returns number of servers discovered and for which data is available + // + virtual int GetNumServers() = 0; + + // + // GetServerByIndex / GetServerByOnlineId + // returns server interface to the given server or NULL if server not found or not available + // + virtual IMatchServer* GetServerByIndex( int iServerIdx ) = 0; + virtual IMatchServer* GetServerByOnlineId( XUID xuidServerOnline ) = 0; +}; + + +#endif // _ISERVERMANAGER_H_ diff --git a/public/matchmaking/l4d2/imatchext_l4d.h b/public/matchmaking/l4d2/imatchext_l4d.h new file mode 100644 index 00000000..9ea651ef --- /dev/null +++ b/public/matchmaking/l4d2/imatchext_l4d.h @@ -0,0 +1,84 @@ +//===== Copyright c 1996-2009, Valve Corporation, All rights reserved. ======// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// + +#ifndef IMATCHEXT_L4D_H +#define IMATCHEXT_L4D_H + +#ifdef _WIN32 +#pragma once +#endif + + +// +// +// WARNING!! WARNING!! WARNING!! WARNING!! +// This structure TitleData1 should remain +// intact after we ship otherwise +// users profiles will be busted. +// You are allowed to add fields at the end +// as long as structure size stays under +// XPROFILE_SETTING_MAX_SIZE = 1000 bytes. +// WARNING!! WARNING!! WARNING!! WARNING!! +// +struct TitleData1 +{ + uint64 unused; +}; + +// +// +// WARNING!! WARNING!! WARNING!! WARNING!! +// This structure TitleData2 should remain +// intact after we ship otherwise +// users profiles will be busted. +// You are allowed to add fields at the end +// as long as structure size stays under +// XPROFILE_SETTING_MAX_SIZE = 1000 bytes. +// WARNING!! WARNING!! WARNING!! WARNING!! +// +struct TitleData2 +{ + // Achievement Counters + uint8 iCountXxx; // ACHIEVEMENT_XXX + uint8 iCountYyy; // ACHIEVEMENT_YYY + + // Achievement Component Bitfields + uint8 iCompXxx; // ACHIEVEMENT_XXX +}; + +// +// +// WARNING!! WARNING!! WARNING!! WARNING!! +// This structure TitleData3 should remain +// intact after we ship otherwise +// users profiles will be busted. +// You are allowed to add fields at the end +// as long as structure size stays under +// XPROFILE_SETTING_MAX_SIZE = 1000 bytes. +// WARNING!! WARNING!! WARNING!! WARNING!! +// +struct TitleData3 +{ + uint64 unused; // unused, free for taking +}; + + +abstract_class IMatchExtL4D +{ +public: + // Get server map information for the session settings + virtual KeyValues * GetAllMissions() = 0; + virtual KeyValues * GetAllModes() = 0; + virtual KeyValues * GetMapInfo( KeyValues *pSettings, KeyValues **ppMissionInfo = NULL ) = 0; + virtual KeyValues * GetMapInfoByBspName( KeyValues *pSettings, char const *szBspMapName, KeyValues **ppMissionInfo = NULL ) = 0; + virtual KeyValues * GetGameModeInfo( char const *szGameModeName ) = 0; + virtual KeyValues * GetRandomMission( KeyValues *pSettings, uint64 dlcMask ) = 0; +}; + +#define IMATCHEXT_L4D_INTERFACE "IMATCHEXT_L4D_INTERFACE_001" + +#endif // IMATCHEXT_L4D_H