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.

77 lines
3.2 KiB

  1. //====== Copyright � 1996-2008, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose: interface to steam for game play statistics
  4. //
  5. //=============================================================================
  6. #ifndef ISTEAMGAMESTATS_H
  7. #define ISTEAMGAMESTATS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. //-----------------------------------------------------------------------------
  12. // Purpose: Functions for recording game play sessions and details thereof
  13. //-----------------------------------------------------------------------------
  14. class ISteamGameStats
  15. {
  16. public:
  17. CALL_RESULT( GameStatsSessionIssued_t )
  18. virtual SteamAPICall_t GetNewSession( int8 nAccountType, uint64 ulAccountID, int32 nAppID, RTime32 rtTimeStarted ) = 0;
  19. CALL_RESULT( GameStatsSessionClosed_t )
  20. virtual SteamAPICall_t EndSession( uint64 ulSessionID, RTime32 rtTimeEnded, int nReasonCode ) = 0;
  21. virtual EResult AddSessionAttributeInt( uint64 ulSessionID, const char* pstrName, int32 nData ) = 0;
  22. virtual EResult AddSessionAttributeString( uint64 ulSessionID, const char* pstrName, const char *pstrData ) = 0;
  23. virtual EResult AddSessionAttributeFloat( uint64 ulSessionID, const char* pstrName, float fData ) = 0;
  24. virtual EResult AddNewRow( uint64 *pulRowID, uint64 ulSessionID, const char *pstrTableName ) = 0;
  25. virtual EResult CommitRow( uint64 ulRowID ) = 0;
  26. virtual EResult CommitOutstandingRows( uint64 ulSessionID ) = 0;
  27. virtual EResult AddRowAttributeInt( uint64 ulRowID, const char *pstrName, int32 nData ) = 0;
  28. virtual EResult AddRowAtributeString( uint64 ulRowID, const char *pstrName, const char *pstrData ) = 0;
  29. virtual EResult AddRowAttributeFloat( uint64 ulRowID, const char *pstrName, float fData ) = 0;
  30. virtual EResult AddSessionAttributeInt64( uint64 ulSessionID, const char *pstrName, int64 llData ) = 0;
  31. virtual EResult AddRowAttributeInt64( uint64 ulRowID, const char *pstrName, int64 llData ) = 0;
  32. };
  33. #define STEAMGAMESTATS_INTERFACE_VERSION "SteamGameStats001"
  34. //-----------------------------------------------------------------------------
  35. // Purpose: nAccountType for GetNewSession
  36. //-----------------------------------------------------------------------------
  37. enum EGameStatsAccountType
  38. {
  39. k_EGameStatsAccountType_Steam = 1, // ullAccountID is a 64-bit SteamID for a player
  40. k_EGameStatsAccountType_Xbox = 2, // ullAccountID is a 64-bit XUID
  41. k_EGameStatsAccountType_SteamGameServer = 3, // ullAccountID is a 64-bit SteamID for a game server
  42. };
  43. //-----------------------------------------------------------------------------
  44. // Purpose: callback for GetNewSession() method
  45. //-----------------------------------------------------------------------------
  46. struct GameStatsSessionIssued_t
  47. {
  48. enum { k_iCallback = k_iSteamGameStatsCallbacks + 1 };
  49. uint64 m_ulSessionID;
  50. EResult m_eResult;
  51. bool m_bCollectingAny;
  52. bool m_bCollectingDetails;
  53. };
  54. //-----------------------------------------------------------------------------
  55. // Purpose: callback for EndSession() method
  56. //-----------------------------------------------------------------------------
  57. struct GameStatsSessionClosed_t
  58. {
  59. enum { k_iCallback = k_iSteamGameStatsCallbacks + 2 };
  60. uint64 m_ulSessionID;
  61. EResult m_eResult;
  62. };
  63. #endif // ISTEAMGAMESTATS_H