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.

160 lines
6.9 KiB

  1. //====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose: interface to app data in Steam
  4. //
  5. //=============================================================================
  6. #ifndef ISTEAMAPPS_H
  7. #define ISTEAMAPPS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. const int k_cubAppProofOfPurchaseKeyMax = 240; // max supported length of a legacy cd key
  12. //-----------------------------------------------------------------------------
  13. // Purpose: interface to app data
  14. //-----------------------------------------------------------------------------
  15. class ISteamApps
  16. {
  17. public:
  18. virtual bool BIsSubscribed() = 0;
  19. virtual bool BIsLowViolence() = 0;
  20. virtual bool BIsCybercafe() = 0;
  21. virtual bool BIsVACBanned() = 0;
  22. virtual const char *GetCurrentGameLanguage() = 0;
  23. virtual const char *GetAvailableGameLanguages() = 0;
  24. // only use this member if you need to check ownership of another game related to yours, a demo for example
  25. virtual bool BIsSubscribedApp( AppId_t appID ) = 0;
  26. // Takes AppID of DLC and checks if the user owns the DLC & if the DLC is installed
  27. virtual bool BIsDlcInstalled( AppId_t appID ) = 0;
  28. // returns the Unix time of the purchase of the app
  29. virtual uint32 GetEarliestPurchaseUnixTime( AppId_t nAppID ) = 0;
  30. // Checks if the user is subscribed to the current app through a free weekend
  31. // This function will return false for users who have a retail or other type of license
  32. // Before using, please ask your Valve technical contact how to package and secure your free weekened
  33. virtual bool BIsSubscribedFromFreeWeekend() = 0;
  34. // Returns the number of DLC pieces for the running app
  35. virtual int GetDLCCount() = 0;
  36. // Returns metadata for DLC by index, of range [0, GetDLCCount()]
  37. virtual bool BGetDLCDataByIndex( int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize ) = 0;
  38. // Install/Uninstall control for optional DLC
  39. virtual void InstallDLC( AppId_t nAppID ) = 0;
  40. virtual void UninstallDLC( AppId_t nAppID ) = 0;
  41. // Request legacy cd-key for yourself or owned DLC. If you are interested in this
  42. // data then make sure you provide us with a list of valid keys to be distributed
  43. // to users when they purchase the game, before the game ships.
  44. // You'll receive an AppProofOfPurchaseKeyResponse_t callback when
  45. // the key is available (which may be immediately).
  46. virtual void RequestAppProofOfPurchaseKey( AppId_t nAppID ) = 0;
  47. virtual bool GetCurrentBetaName( char *pchName, int cchNameBufferSize ) = 0; // returns current beta branch name, 'public' is the default branch
  48. virtual bool MarkContentCorrupt( bool bMissingFilesOnly ) = 0; // signal Steam that game files seems corrupt or missing
  49. virtual uint32 GetInstalledDepots( AppId_t appID, DepotId_t *pvecDepots, uint32 cMaxDepots ) = 0; // return installed depots in mount order
  50. // returns current app install folder for AppID, returns folder name length
  51. virtual uint32 GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize ) = 0;
  52. virtual bool BIsAppInstalled( AppId_t appID ) = 0; // returns true if that app is installed (not necessarily owned)
  53. virtual CSteamID GetAppOwner() = 0; // returns the SteamID of the original owner. If different from current user, it's borrowed
  54. // Returns the associated launch param if the game is run via steam://run/<appid>//?param1=value1;param2=value2;param3=value3 etc.
  55. // Parameter names starting with the character '@' are reserved for internal use and will always return and empty string.
  56. // Parameter names starting with an underscore '_' are reserved for steam features -- they can be queried by the game,
  57. // but it is advised that you not param names beginning with an underscore for your own features.
  58. virtual const char *GetLaunchQueryParam( const char *pchKey ) = 0;
  59. // get download progress for optional DLC
  60. virtual bool GetDlcDownloadProgress( AppId_t nAppID, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) = 0;
  61. // return the buildid of this app, may change at any time based on backend updates to the game
  62. virtual int GetAppBuildId() = 0;
  63. // Request all proof of purchase keys for the calling appid and asociated DLC.
  64. // A series of AppProofOfPurchaseKeyResponse_t callbacks will be sent with
  65. // appropriate appid values, ending with a final callback where the m_nAppId
  66. // member is k_uAppIdInvalid (zero).
  67. virtual void RequestAllProofOfPurchaseKeys() = 0;
  68. };
  69. #define STEAMAPPS_INTERFACE_VERSION "STEAMAPPS_INTERFACE_VERSION008"
  70. // callbacks
  71. #if defined( VALVE_CALLBACK_PACK_SMALL )
  72. #pragma pack( push, 4 )
  73. #elif defined( VALVE_CALLBACK_PACK_LARGE )
  74. #pragma pack( push, 8 )
  75. #else
  76. #error isteamclient.h must be included
  77. #endif
  78. //-----------------------------------------------------------------------------
  79. // Purpose: posted after the user gains ownership of DLC & that DLC is installed
  80. //-----------------------------------------------------------------------------
  81. struct DlcInstalled_t
  82. {
  83. enum { k_iCallback = k_iSteamAppsCallbacks + 5 };
  84. AppId_t m_nAppID; // AppID of the DLC
  85. };
  86. //-----------------------------------------------------------------------------
  87. // Purpose: possible results when registering an activation code
  88. //-----------------------------------------------------------------------------
  89. enum ERegisterActivationCodeResult
  90. {
  91. k_ERegisterActivationCodeResultOK = 0,
  92. k_ERegisterActivationCodeResultFail = 1,
  93. k_ERegisterActivationCodeResultAlreadyRegistered = 2,
  94. k_ERegisterActivationCodeResultTimeout = 3,
  95. k_ERegisterActivationCodeAlreadyOwned = 4,
  96. };
  97. //-----------------------------------------------------------------------------
  98. // Purpose: response to RegisterActivationCode()
  99. //-----------------------------------------------------------------------------
  100. struct RegisterActivationCodeResponse_t
  101. {
  102. enum { k_iCallback = k_iSteamAppsCallbacks + 8 };
  103. ERegisterActivationCodeResult m_eResult;
  104. uint32 m_unPackageRegistered; // package that was registered. Only set on success
  105. };
  106. //---------------------------------------------------------------------------------
  107. // Purpose: posted after the user gains executes a steam url with query parameters
  108. // such as steam://run/<appid>//?param1=value1;param2=value2;param3=value3; etc
  109. // while the game is already running. The new params can be queried
  110. // with GetLaunchQueryParam.
  111. //---------------------------------------------------------------------------------
  112. struct NewLaunchQueryParameters_t
  113. {
  114. enum { k_iCallback = k_iSteamAppsCallbacks + 14 };
  115. };
  116. //-----------------------------------------------------------------------------
  117. // Purpose: response to RequestAppProofOfPurchaseKey/RequestAllProofOfPurchaseKeys
  118. // for supporting third-party CD keys, or other proof-of-purchase systems.
  119. //-----------------------------------------------------------------------------
  120. struct AppProofOfPurchaseKeyResponse_t
  121. {
  122. enum { k_iCallback = k_iSteamAppsCallbacks + 21 };
  123. EResult m_eResult;
  124. uint32 m_nAppID;
  125. uint32 m_cchKeyLength;
  126. char m_rgchKey[k_cubAppProofOfPurchaseKeyMax];
  127. };
  128. #pragma pack( pop )
  129. #endif // ISTEAMAPPS_H