1 /*
2  * Copyright (c) 2015 Derelict Developers
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  *   notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  *   notice, this list of conditions and the following disclaimer in the
14  *   documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the names 'Derelict', 'DerelictILUT', nor the names of its contributors
17  *   may be used to endorse or promote products derived from this software
18  *   without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 module derelict.steamworks.types;
33 
34 import derelict.util.system;
35 
36 alias int32 = int;
37 alias uint64 = ulong;
38 alias int16 = short;
39 alias uint16 = ushort;
40 alias uint32 = uint;
41 
42 alias HSteamPipe = int32;
43 alias HSteamUser = int32;
44 alias HAuthTicket = uint32;
45 alias SteamAPICall_t = uint64;
46 alias FriendsGroupID_t = int16;
47 
48 alias AppId_t= uint32;
49 
50 enum EVoiceResult
51 {
52     k_EVoiceResultOK = 0,
53     k_EVoiceResultNotInitialized = 1,
54     k_EVoiceResultNotRecording = 2,
55     k_EVoiceResultNoData = 3,
56     k_EVoiceResultBufferTooSmall = 4,
57     k_EVoiceResultDataCorrupted = 5,
58     k_EVoiceResultRestricted = 6,
59     k_EVoiceResultUnsupportedCodec = 7,
60     k_EVoiceResultReceiverOutOfDate = 8,
61     k_EVoiceResultReceiverDidNotAnswer = 9,  
62 }
63 
64 // results from BeginAuthSession
65 enum EBeginAuthSessionResult
66 {
67     k_EBeginAuthSessionResultOK = 0,                        // Ticket is valid for this game and this steamID.
68     k_EBeginAuthSessionResultInvalidTicket = 1,             // Ticket is not valid.
69     k_EBeginAuthSessionResultDuplicateRequest = 2,          // A ticket has already been submitted for this steamID
70     k_EBeginAuthSessionResultInvalidVersion = 3,            // Ticket is from an incompatible interface version
71     k_EBeginAuthSessionResultGameMismatch = 4,              // Ticket is not for this game
72     k_EBeginAuthSessionResultExpiredTicket = 5,             // Ticket has expired
73 }
74 
75 enum EUserHasLicenseForAppResult
76 {
77     k_EUserHasLicenseResultHasLicense = 0,
78     k_EUserHasLicenseResultDoesNotHaveLicense = 1,
79     k_EUserHasLicenseResultNoAuth = 2,
80 }
81 
82 enum EPersonaState
83 {
84     k_EPersonaStateOffline = 0,         // friend is not currently logged on
85     k_EPersonaStateOnline = 1,          // friend is logged on
86     k_EPersonaStateBusy = 2,            // user is on, but busy
87     k_EPersonaStateAway = 3,            // auto-away feature
88     k_EPersonaStateSnooze = 4,          // auto-away for a long time
89     k_EPersonaStateLookingToTrade = 5,  // Online, trading
90     k_EPersonaStateLookingToPlay = 6,   // Online, wanting to play
91     k_EPersonaStateMax,
92 }
93 enum EChatEntryType
94 {
95     k_EChatEntryTypeInvalid = 0, 
96     k_EChatEntryTypeChatMsg = 1,        // Normal text message from another user
97     k_EChatEntryTypeTyping = 2,         // Another user is typing (not used in multi-user chat)
98     k_EChatEntryTypeInviteGame = 3,     // Invite from other user into that users current game
99     k_EChatEntryTypeEmote = 4,          // text emote message (deprecated, should be treated as ChatMsg)
100     //k_EChatEntryTypeLobbyGameStart = 5,   // lobby game is starting (dead - listen for LobbyGameCreated_t callback instead)
101     k_EChatEntryTypeLeftConversation = 6, // user has left the conversation ( closed chat window )
102     // Above are previous FriendMsgType entries, now merged into more generic chat entry types
103     k_EChatEntryTypeEntered = 7,        // user has entered the conversation (used in multi-user chat and group chat)
104     k_EChatEntryTypeWasKicked = 8,      // user was kicked (data: 64-bit steamid of actor performing the kick)
105     k_EChatEntryTypeWasBanned = 9,      // user was banned (data: 64-bit steamid of actor performing the ban)
106     k_EChatEntryTypeDisconnected = 10,  // user disconnected
107     k_EChatEntryTypeHistoricalChat = 11,    // a chat message from user's chat history or offilne message
108     k_EChatEntryTypeReserved1 = 12,
109     k_EChatEntryTypeReserved2 = 13,
110 }
111 
112 enum EFriendRelationship
113 {
114     k_EFriendRelationshipNone = 0,
115     k_EFriendRelationshipBlocked = 1,
116     k_EFriendRelationshipRequestRecipient = 2,
117     k_EFriendRelationshipFriend = 3,
118     k_EFriendRelationshipRequestInitiator = 4,
119     k_EFriendRelationshipIgnored = 5,
120     k_EFriendRelationshipIgnoredFriend = 6,
121     k_EFriendRelationshipSuggested = 7,
122     
123     // keep this updated
124     k_EFriendRelationshipMax = 8,
125 }
126 
127 enum EOverlayToStoreFlag
128 {
129     k_EOverlayToStoreFlag_None = 0,
130     k_EOverlayToStoreFlag_AddToCart = 1,
131     k_EOverlayToStoreFlag_AddToCartAndShow = 2,
132 };
133 
134 align(1)struct FriendGameInfo_t
135 {
136     CGameID m_gameID;
137     uint32 m_unGameIP;
138     uint16 m_usGamePort;
139     uint16 m_usQueryPort;
140     CSteamID m_steamIDLobby;
141 };
142 
143 extern(C++) interface CSteamID{}
144 extern(C++) interface CGameID{}
145 
146 extern(C++) interface ISteamUser
147 {
148     // returns the HSteamUser this interface represents
149     // this is only used internally by the API, and by a few select interfaces that support multi-user
150     HSteamUser GetHSteamUser();
151     
152     // returns true if the Steam client current has a live connection to the Steam servers. 
153     // If false, it means there is no active connection due to either a networking issue on the local machine, or the Steam server is down/busy.
154     // The Steam client will automatically be trying to recreate the connection as often as possible.
155     bool BLoggedOn();
156     
157     // returns the CSteamID of the account currently logged into the Steam client
158     // a CSteamID is a unique identifier for an account, and used to differentiate users in all parts of the Steamworks API
159     CSteamID GetSteamID();
160     
161     // Multiplayer Authentication functions
162     
163     // InitiateGameConnection() starts the state machine for authenticating the game client with the game server
164     // It is the client portion of a three-way handshake between the client, the game server, and the steam servers
165     //
166     // Parameters:
167     // void *pAuthBlob - a pointer to empty memory that will be filled in with the authentication token.
168     // int cbMaxAuthBlob - the number of bytes of allocated memory in pBlob. Should be at least 2048 bytes.
169     // CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client
170     // CGameID gameID - the ID of the current game. For games without mods, this is just CGameID( <appID> )
171     // uint32 unIPServer, uint16 usPortServer - the IP address of the game server
172     // bool bSecure - whether or not the client thinks that the game server is reporting itself as secure (i.e. VAC is running)
173     //
174     // return value - returns the number of bytes written to pBlob. If the return is 0, then the buffer passed in was too small, and the call has failed
175     // The contents of pBlob should then be sent to the game server, for it to use to complete the authentication process.
176     int InitiateGameConnection( void *pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure );
177     
178     // notify of disconnect
179     // needs to occur when the game client leaves the specified game server, needs to match with the InitiateGameConnection() call
180     void TerminateGameConnection( uint32 unIPServer, uint16 usPortServer );
181     
182     // Legacy functions
183     
184     // used by only a few games to track usage events
185     void TrackAppUsageEvent( CGameID gameID, int eAppUsageEvent, const char *pchExtraInfo = "" );
186     
187     // get the local storage folder for current Steam account to write application data, e.g. save games, configs etc.
188     // this will usually be something like "C:\Progam Files\Steam\userdata\<SteamID>\<AppID>\local"
189     bool GetUserDataFolder( char *pchBuffer, int cubBuffer );
190     
191     // Starts voice recording. Once started, use GetVoice() to get the data
192     void StartVoiceRecording( );
193     
194     // Stops voice recording. Because people often release push-to-talk keys early, the system will keep recording for
195     // a little bit after this function is called. GetVoice() should continue to be called until it returns
196     // k_eVoiceResultNotRecording
197     void StopVoiceRecording( );
198     
199     // Determine the amount of captured audio data that is available in bytes.
200     // This provides both the compressed and uncompressed data. Please note that the uncompressed
201     // data is not the raw feed from the microphone: data may only be available if audible 
202     // levels of speech are detected.
203     // nUncompressedVoiceDesiredSampleRate is necessary to know the number of bytes to return in pcbUncompressed - can be set to 0 if you don't need uncompressed (the usual case)
204     // If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nUncompressedVoiceDesiredSampleRate
205     EVoiceResult GetAvailableVoice( uint32 *pcbCompressed, uint32 *pcbUncompressed, uint32 nUncompressedVoiceDesiredSampleRate );
206     
207     // Gets the latest voice data from the microphone. Compressed data is an arbitrary format, and is meant to be handed back to 
208     // DecompressVoice() for playback later as a binary blob. Uncompressed data is 16-bit, signed integer, 11025Hz PCM format.
209     // Please note that the uncompressed data is not the raw feed from the microphone: data may only be available if audible 
210     // levels of speech are detected, and may have passed through denoising filters, etc.
211     // This function should be called as often as possible once recording has started; once per frame at least.
212     // nBytesWritten is set to the number of bytes written to pDestBuffer. 
213     // nUncompressedBytesWritten is set to the number of bytes written to pUncompressedDestBuffer. 
214     // You must grab both compressed and uncompressed here at the same time, if you want both.
215     // Matching data that is not read during this call will be thrown away.
216     // GetAvailableVoice() can be used to determine how much data is actually available.
217     // If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nUncompressedVoiceDesiredSampleRate
218     EVoiceResult GetVoice( bool bWantCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, bool bWantUncompressed, void *pUncompressedDestBuffer, uint32 cbUncompressedDestBufferSize, uint32 *nUncompressBytesWritten, uint32 nUncompressedVoiceDesiredSampleRate );
219     
220     // Decompresses a chunk of compressed data produced by GetVoice().
221     // nBytesWritten is set to the number of bytes written to pDestBuffer unless the return value is k_EVoiceResultBufferTooSmall.
222     // In that case, nBytesWritten is set to the size of the buffer required to decompress the given
223     // data. The suggested buffer size for the destination buffer is 22 kilobytes.
224     // The output format of the data is 16-bit signed at the requested samples per second.
225     // If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nDesiredSampleRate
226     EVoiceResult DecompressVoice( const void *pCompressed, uint32 cbCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, uint32 nDesiredSampleRate );
227     
228     // This returns the frequency of the voice data as it's stored internally; calling DecompressVoice() with this size will yield the best results
229     uint32 GetVoiceOptimalSampleRate();
230     
231     // Retrieve ticket to be sent to the entity who wishes to authenticate you. 
232     // pcbTicket retrieves the length of the actual ticket.
233     HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket );
234     
235     // Authenticate ticket from entity steamID to be sure it is valid and isnt reused
236     // Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )
237     EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID );
238     
239     // Stop tracking started by BeginAuthSession - called when no longer playing game with this entity
240     void EndAuthSession( CSteamID steamID );
241 
242     // Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to
243     void CancelAuthTicket( HAuthTicket hAuthTicket );
244     
245     // After receiving a user's authentication data, and passing it to BeginAuthSession, use this function
246     // to determine if the user owns downloadable content specified by the provided AppID.
247     EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID );
248     
249     // returns true if this users looks like they are behind a NAT device. Only valid once the user has connected to steam 
250     // (i.e a SteamServersConnected_t has been issued) and may not catch all forms of NAT.
251     bool BIsBehindNAT();
252     
253     // set data to be replicated to friends so that they can join your game
254     // CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client
255     // uint32 unIPServer, uint16 usPortServer - the IP address of the game server
256     void AdvertiseGame( CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer );
257     
258     // Requests a ticket encrypted with an app specific shared key
259     // pDataToInclude, cbDataToInclude will be encrypted into the ticket
260     // ( This is asynchronous, you must wait for the ticket to be completed by the server )
261     SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToInclude );
262 
263     // retrieve a finished ticket
264     bool GetEncryptedAppTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket );
265     
266     // Trading Card badges data access
267     // if you only have one set of cards, the series will be 1
268     // the user has can have two different badges for a series; the regular (max level 5) and the foil (max level 1)
269     int GetGameBadgeLevel( int nSeries, bool bFoil );
270     
271     // gets the Steam Level of the user, as shown on their profile
272     int GetPlayerSteamLevel();
273     
274     // Requests a URL which authenticates an in-game browser for store check-out,
275     // and then redirects to the specified URL. As long as the in-game browser
276     // accepts and handles session cookies, Steam microtransaction checkout pages
277     // will automatically recognize the user instead of presenting a login page.
278     // The result of this API call will be a StoreAuthURLResponse_t callback.
279     // NOTE: The URL has a very short lifetime to prevent history-snooping attacks,
280     // so you should only call this API when you are about to launch the browser,
281     // or else immediately navigate to the result URL using a hidden browser window.
282     // NOTE 2: The resulting authorization cookie has an expiration time of one day,
283     // so it would be a good idea to request and visit a new auth URL every 12 hours.
284     SteamAPICall_t RequestStoreAuthURL( const char *pchRedirectURL );
285     
286 version(_PS3){
287     // Initiates PS3 Logon request using just PSN ticket.  
288     //
289     // PARAMS: bInteractive - If set tells Steam to go ahead and show the PS3 NetStart dialog if needed to
290     // prompt the user for network setup/PSN logon before initiating the Steam side of the logon.
291     //
292     // Listen for SteamServersConnected_t or SteamServerConnectFailure_t for status.  SteamServerConnectFailure_t
293     // may return with EResult k_EResultExternalAccountUnlinked if the PSN account is unknown to Steam.  You should
294     // then call LogOnAndLinkSteamAccountToPSN() after prompting the user for credentials to establish a link. 
295     // Future calls to LogOn() after the one time link call should succeed as long as the user is connected to PSN.
296     void LogOn( bool bInteractive ) = 0;
297     
298     // Initiates a request to logon with a specific steam username/password and create a PSN account link at 
299     // the same time.  Should call this only if LogOn() has failed and indicated the PSN account is unlinked.
300     //
301     // PARAMS: bInteractive - If set tells Steam to go ahead and show the PS3 NetStart dialog if needed to
302     // prompt the user for network setup/PSN logon before initiating the Steam side of the logon.  pchUserName 
303     // should be the users Steam username, and pchPassword should be the users Steam password.
304     // 
305     // Listen for SteamServersConnected_t or SteamServerConnectFailure_t for status.  SteamServerConnectFailure_t
306     // may return with EResult k_EResultOtherAccountAlreadyLinked if already linked to another account. 
307     void LogOnAndLinkSteamAccountToPSN( bool bInteractive, const char *pchUserName, const char *pchPassword ) = 0;
308     
309     // Final logon option for PS3, this logs into an existing account if already linked, but if not already linked
310     // creates a new account using the info in the PSN ticket to generate a unique account name.  The new account is
311     // then linked to the PSN ticket.  This is the faster option for new users who don't have an existing Steam account
312     // to get into multiplayer.
313     //
314     // PARAMS: bInteractive - If set tells Steam to go ahead and show the PS3 NetStart dialog if needed to
315     // prompt the user for network setup/PSN logon before initiating the Steam side of the logon.
316     void LogOnAndCreateNewSteamAccountIfNeeded( bool bInteractive ) = 0;
317     
318     // Returns a special SteamID that represents the user's PSN information. Can be used to query the user's PSN avatar,
319     // online name, etc. through the standard Steamworks interfaces.
320     CSteamID GetConsoleSteamID() = 0;
321 }
322 }
323 
324 extern(C++) interface ISteamFriends
325 {
326     // returns the local players name - guaranteed to not be NULL.
327     // this is the same name as on the users community profile page
328     // this is stored in UTF-8 format
329     // like all the other interface functions that return a char *, it's important that this pointer is not saved
330     // off; it will eventually be free'd or re-allocated
331     const char *GetPersonaName();
332     
333     // Sets the player name, stores it on the server and publishes the changes to all friends who are online.
334     // Changes take place locally immediately, and a PersonaStateChange_t is posted, presuming success.
335     //
336     // The final results are available through the return value SteamAPICall_t, using SetPersonaNameResponse_t.
337     //
338     // If the name change fails to happen on the server, then an additional global PersonaStateChange_t will be posted
339     // to change the name back, in addition to the SetPersonaNameResponse_t callback.
340     SteamAPICall_t SetPersonaName( const char *pchPersonaName );
341     
342     // gets the status of the current user
343     EPersonaState GetPersonaState();
344     
345     // friend iteration
346     // takes a set of k_EFriendFlags, and returns the number of users the client knows about who meet that criteria
347     // then GetFriendByIndex() can then be used to return the id's of each of those users
348     int GetFriendCount( int iFriendFlags );
349     
350     // returns the steamID of a user
351     // iFriend is a index of range [0, GetFriendCount())
352     // iFriendsFlags must be the same value as used in GetFriendCount()
353     // the returned CSteamID can then be used by all the functions below to access details about the user
354     CSteamID GetFriendByIndex( int iFriend, int iFriendFlags );
355     
356     // returns a relationship to a user
357     EFriendRelationship GetFriendRelationship( CSteamID steamIDFriend );
358     
359     // returns the current status of the specified user
360     // this will only be known by the local user if steamIDFriend is in their friends list; on the same game server; in a chat room or lobby; or in a small group with the local user
361     EPersonaState GetFriendPersonaState( CSteamID steamIDFriend );
362     
363     // returns the name another user - guaranteed to not be NULL.
364     // same rules as GetFriendPersonaState() apply as to whether or not the user knowns the name of the other user
365     // note that on first joining a lobby, chat room or game server the local user will not known the name of the other users automatically; that information will arrive asyncronously
366     // 
367     const char *GetFriendPersonaName( CSteamID steamIDFriend );
368     
369     // returns true if the friend is actually in a game, and fills in pFriendGameInfo with an extra details 
370     bool GetFriendGamePlayed( CSteamID steamIDFriend, /+OUT_STRUCT()+/ FriendGameInfo_t *pFriendGameInfo );
371     // accesses old friends names - returns an empty string when their are no more items in the history
372     const char *GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaName );
373     // friends steam level
374     int GetFriendSteamLevel( CSteamID steamIDFriend );
375     
376     // Returns nickname the current user has set for the specified player. Returns NULL if the no nickname has been set for that player.
377     const char *GetPlayerNickname( CSteamID steamIDPlayer );
378     
379     // friend grouping (tag) apis
380     // returns the number of friends groups
381     int GetFriendsGroupCount();
382     // returns the friends group ID for the given index (invalid indices return k_FriendsGroupID_Invalid)
383     FriendsGroupID_t GetFriendsGroupIDByIndex( int iFG );
384     // returns the name for the given friends group (NULL in the case of invalid friends group IDs)
385     const char *GetFriendsGroupName( FriendsGroupID_t friendsGroupID );
386     // returns the number of members in a given friends group
387     int GetFriendsGroupMembersCount( FriendsGroupID_t friendsGroupID );
388     // gets up to nMembersCount members of the given friends group, if fewer exist than requested those positions' SteamIDs will be invalid
389     void GetFriendsGroupMembersList( FriendsGroupID_t friendsGroupID, /+OUT_ARRAY_CALL(nMembersCount, GetFriendsGroupMembersCount, friendsGroupID )+/ CSteamID *pOutSteamIDMembers, int nMembersCount );
390     
391     // returns true if the specified user meets any of the criteria specified in iFriendFlags
392     // iFriendFlags can be the union (binary or, |) of one or more k_EFriendFlags values
393     bool HasFriend( CSteamID steamIDFriend, int iFriendFlags );
394     
395     // clan (group) iteration and access functions
396     int GetClanCount();
397     CSteamID GetClanByIndex( int iClan );
398     const char *GetClanName( CSteamID steamIDClan );
399     const char *GetClanTag( CSteamID steamIDClan );
400     // returns the most recent information we have about what's happening in a clan
401     bool GetClanActivityCounts( CSteamID steamIDClan, int *pnOnline, int *pnInGame, int *pnChatting );
402     // for clans a user is a member of, they will have reasonably up-to-date information, but for others you'll have to download the info to have the latest
403     SteamAPICall_t DownloadClanActivityCounts( /+ARRAY_COUNT(cClansToRequest)+/ CSteamID *psteamIDClans, int cClansToRequest );
404     
405     // iterators for getting users in a chat room, lobby, game server or clan
406     // note that large clans that cannot be iterated by the local user
407     // note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby
408     // steamIDSource can be the steamID of a group, game server, lobby or chat room
409     int GetFriendCountFromSource( CSteamID steamIDSource );
410     CSteamID GetFriendFromSourceByIndex( CSteamID steamIDSource, int iFriend );
411     
412     // returns true if the local user can see that steamIDUser is a member or in steamIDSource
413     bool IsUserInSource( CSteamID steamIDUser, CSteamID steamIDSource );
414     
415     // User is in a game pressing the talk button (will suppress the microphone for all voice comms from the Steam friends UI)
416     void SetInGameVoiceSpeaking( CSteamID steamIDUser, bool bSpeaking );
417     
418     // activates the game overlay, with an optional dialog to open 
419     // valid options are "Friends", "Community", "Players", "Settings", "OfficialGameGroup", "Stats", "Achievements"
420     void ActivateGameOverlay( const char *pchDialog );
421     
422     // activates game overlay to a specific place
423     // valid options are
424     //      "steamid" - opens the overlay web browser to the specified user or groups profile
425     //      "chat" - opens a chat window to the specified user, or joins the group chat 
426     //      "jointrade" - opens a window to a Steam Trading session that was started with the ISteamEconomy/StartTrade Web API
427     //      "stats" - opens the overlay web browser to the specified user's stats
428     //      "achievements" - opens the overlay web browser to the specified user's achievements
429     //      "friendadd" - opens the overlay in minimal mode prompting the user to add the target user as a friend
430     //      "friendremove" - opens the overlay in minimal mode prompting the user to remove the target friend
431     //      "friendrequestaccept" - opens the overlay in minimal mode prompting the user to accept an incoming friend invite
432     //      "friendrequestignore" - opens the overlay in minimal mode prompting the user to ignore an incoming friend invite
433     void ActivateGameOverlayToUser( const char *pchDialog, CSteamID steamID );
434     
435     // activates game overlay web browser directly to the specified URL
436     // full address with protocol type is required, e.g. http://www.steamgames.com/
437     void ActivateGameOverlayToWebPage( const char *pchURL );
438     
439     // activates game overlay to store page for app
440     void ActivateGameOverlayToStore( AppId_t nAppID, EOverlayToStoreFlag eFlag );
441     
442     // Mark a target user as 'played with'. This is a client-side only feature that requires that the calling user is 
443     // in game 
444     void SetPlayedWith( CSteamID steamIDUserPlayedWith );
445     
446     // activates game overlay to open the invite dialog. Invitations will be sent for the provided lobby.
447     void ActivateGameOverlayInviteDialog( CSteamID steamIDLobby );
448     
449     // gets the small (32x32) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
450     int GetSmallFriendAvatar( CSteamID steamIDFriend );
451     
452     // gets the medium (64x64) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
453     int GetMediumFriendAvatar( CSteamID steamIDFriend );
454     
455     // gets the large (184x184) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
456     // returns -1 if this image has yet to be loaded, in this case wait for a AvatarImageLoaded_t callback and then call this again
457     int GetLargeFriendAvatar( CSteamID steamIDFriend );
458     
459     // requests information about a user - persona name & avatar
460     // if bRequireNameOnly is set, then the avatar of a user isn't downloaded 
461     // - it's a lot slower to download avatars and churns the local cache, so if you don't need avatars, don't request them
462     // if returns true, it means that data is being requested, and a PersonaStateChanged_t callback will be posted when it's retrieved
463     // if returns false, it means that we already have all the details about that user, and functions can be called immediately
464     bool RequestUserInformation( CSteamID steamIDUser, bool bRequireNameOnly );
465     
466     // requests information about a clan officer list
467     // when complete, data is returned in ClanOfficerListResponse_t call result
468     // this makes available the calls below
469     // you can only ask about clans that a user is a member of
470     // note that this won't download avatars automatically; if you get an officer,
471     // and no avatar image is available, call RequestUserInformation( steamID, false ) to download the avatar
472     SteamAPICall_t RequestClanOfficerList( CSteamID steamIDClan );
473     
474     // iteration of clan officers - can only be done when a RequestClanOfficerList() call has completed
475     
476     // returns the steamID of the clan owner
477     CSteamID GetClanOwner( CSteamID steamIDClan );
478     // returns the number of officers in a clan (including the owner)
479     int GetClanOfficerCount( CSteamID steamIDClan );
480     // returns the steamID of a clan officer, by index, of range [0,GetClanOfficerCount)
481     CSteamID GetClanOfficerByIndex( CSteamID steamIDClan, int iOfficer );
482     // if current user is chat restricted, he can't send or receive any text/voice chat messages.
483     // the user can't see custom avatars. But the user can be online and send/recv game invites.
484     // a chat restricted user can't add friends or join any groups.
485     uint32 GetUserRestrictions();
486     
487     // Rich Presence data is automatically shared between friends who are in the same game
488     // Each user has a set of Key/Value pairs
489     // Up to 20 different keys can be set
490     // There are two magic keys:
491     //      "status"  - a UTF-8 string that will show up in the 'view game info' dialog in the Steam friends list
492     //      "connect" - a UTF-8 string that contains the command-line for how a friend can connect to a game
493     // GetFriendRichPresence() returns an empty string "" if no value is set
494     // SetRichPresence() to a NULL or an empty string deletes the key
495     // You can iterate the current set of keys for a friend with GetFriendRichPresenceKeyCount()
496     // and GetFriendRichPresenceKeyByIndex() (typically only used for debugging)
497     bool SetRichPresence( const char *pchKey, const char *pchValue );
498     void ClearRichPresence();
499     const char *GetFriendRichPresence( CSteamID steamIDFriend, const char *pchKey );
500     int GetFriendRichPresenceKeyCount( CSteamID steamIDFriend );
501     const char *GetFriendRichPresenceKeyByIndex( CSteamID steamIDFriend, int iKey );
502     // Requests rich presence for a specific user.
503     void RequestFriendRichPresence( CSteamID steamIDFriend );
504     
505     // rich invite support
506     // if the target accepts the invite, the pchConnectString gets added to the command-line for launching the game
507     // if the game is already running, a GameRichPresenceJoinRequested_t callback is posted containing the connect string
508     // invites can only be sent to friends
509     bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString );
510     
511     // recently-played-with friends iteration
512     // this iterates the entire list of users recently played with, across games
513     // GetFriendCoplayTime() returns as a unix time
514     int GetCoplayFriendCount();
515     CSteamID GetCoplayFriend( int iCoplayFriend );
516     int GetFriendCoplayTime( CSteamID steamIDFriend );
517     AppId_t GetFriendCoplayGame( CSteamID steamIDFriend );
518     
519     // chat interface for games
520     // this allows in-game access to group (clan) chats from in the game
521     // the behavior is somewhat sophisticated, because the user may or may not be already in the group chat from outside the game or in the overlay
522     // use ActivateGameOverlayToUser( "chat", steamIDClan ) to open the in-game overlay version of the chat
523     SteamAPICall_t JoinClanChatRoom( CSteamID steamIDClan );
524     bool LeaveClanChatRoom( CSteamID steamIDClan );
525     int GetClanChatMemberCount( CSteamID steamIDClan );
526     CSteamID GetChatMemberByIndex( CSteamID steamIDClan, int iUser );
527     bool SendClanChatMessage( CSteamID steamIDClanChat, const char *pchText );
528     int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, void *prgchText, int cchTextMax, EChatEntryType *peChatEntryType, /+OUT_STRUCT()+/ CSteamID *psteamidChatter );
529     bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser );
530     
531     // interact with the Steam (game overlay / desktop)
532     bool IsClanChatWindowOpenInSteam( CSteamID steamIDClanChat );
533     bool OpenClanChatWindowInSteam( CSteamID steamIDClanChat );
534     bool CloseClanChatWindowInSteam( CSteamID steamIDClanChat );
535     
536     // peer-to-peer chat interception
537     // this is so you can show P2P chats inline in the game
538     bool SetListenForFriendsMessages( bool bInterceptEnabled );
539     bool ReplyToFriendMessage( CSteamID steamIDFriend, const char *pchMsgToSend );
540     int GetFriendMessage( CSteamID steamIDFriend, int iMessageID, void *pvData, int cubData, EChatEntryType *peChatEntryType );
541     
542     // following apis
543     SteamAPICall_t GetFollowerCount( CSteamID steamID );
544     SteamAPICall_t IsFollowing( CSteamID steamID );
545     SteamAPICall_t EnumerateFollowingList( uint32 unStartIndex );
546 }