Team Fortress 2 Source Code as on 22/4/2020
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.

675 lines
31 KiB

  1. //====== Copyright � 1996-2008, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose: public interface to user remote file storage in Steam
  4. //
  5. //=============================================================================
  6. #ifndef ISTEAMREMOTESTORAGE_H
  7. #define ISTEAMREMOTESTORAGE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "isteamclient.h"
  12. //-----------------------------------------------------------------------------
  13. // Purpose: Defines the largest allowed file size. Cloud files cannot be written
  14. // in a single chunk over 100MB (and cannot be over 200MB total.)
  15. //-----------------------------------------------------------------------------
  16. const uint32 k_unMaxCloudFileChunkSize = 100 * 1024 * 1024;
  17. //-----------------------------------------------------------------------------
  18. // Purpose: Structure that contains an array of const char * strings and the number of those strings
  19. //-----------------------------------------------------------------------------
  20. #if defined( VALVE_CALLBACK_PACK_SMALL )
  21. #pragma pack( push, 4 )
  22. #elif defined( VALVE_CALLBACK_PACK_LARGE )
  23. #pragma pack( push, 8 )
  24. #else
  25. #error isteamclient.h must be included
  26. #endif
  27. struct SteamParamStringArray_t
  28. {
  29. const char ** m_ppStrings;
  30. int32 m_nNumStrings;
  31. };
  32. #pragma pack( pop )
  33. // A handle to a piece of user generated content
  34. typedef uint64 UGCHandle_t;
  35. typedef uint64 PublishedFileUpdateHandle_t;
  36. typedef uint64 PublishedFileId_t;
  37. const PublishedFileId_t k_PublishedFileIdInvalid = 0;
  38. const UGCHandle_t k_UGCHandleInvalid = 0xffffffffffffffffull;
  39. const PublishedFileUpdateHandle_t k_PublishedFileUpdateHandleInvalid = 0xffffffffffffffffull;
  40. // Handle for writing to Steam Cloud
  41. typedef uint64 UGCFileWriteStreamHandle_t;
  42. const UGCFileWriteStreamHandle_t k_UGCFileStreamHandleInvalid = 0xffffffffffffffffull;
  43. const uint32 k_cchPublishedDocumentTitleMax = 128 + 1;
  44. const uint32 k_cchPublishedDocumentDescriptionMax = 8000;
  45. const uint32 k_cchPublishedDocumentChangeDescriptionMax = 8000;
  46. const uint32 k_unEnumeratePublishedFilesMaxResults = 50;
  47. const uint32 k_cchTagListMax = 1024 + 1;
  48. const uint32 k_cchFilenameMax = 260;
  49. const uint32 k_cchPublishedFileURLMax = 256;
  50. // Ways to handle a synchronization conflict
  51. enum EResolveConflict
  52. {
  53. k_EResolveConflictKeepClient = 1, // The local version of each file will be used to overwrite the server version
  54. k_EResolveConflictKeepServer = 2, // The server version of each file will be used to overwrite the local version
  55. };
  56. enum ERemoteStoragePlatform
  57. {
  58. k_ERemoteStoragePlatformNone = 0,
  59. k_ERemoteStoragePlatformWindows = (1 << 0),
  60. k_ERemoteStoragePlatformOSX = (1 << 1),
  61. k_ERemoteStoragePlatformPS3 = (1 << 2),
  62. k_ERemoteStoragePlatformLinux = (1 << 3),
  63. k_ERemoteStoragePlatformReserved2 = (1 << 4),
  64. k_ERemoteStoragePlatformAll = 0xffffffff
  65. };
  66. enum ERemoteStoragePublishedFileVisibility
  67. {
  68. k_ERemoteStoragePublishedFileVisibilityPublic = 0,
  69. k_ERemoteStoragePublishedFileVisibilityFriendsOnly = 1,
  70. k_ERemoteStoragePublishedFileVisibilityPrivate = 2,
  71. };
  72. enum EWorkshopFileType
  73. {
  74. k_EWorkshopFileTypeFirst = 0,
  75. k_EWorkshopFileTypeCommunity = 0, // normal Workshop item that can be subscribed to
  76. k_EWorkshopFileTypeMicrotransaction = 1, // Workshop item that is meant to be voted on for the purpose of selling in-game
  77. k_EWorkshopFileTypeCollection = 2, // a collection of Workshop or Greenlight items
  78. k_EWorkshopFileTypeArt = 3, // artwork
  79. k_EWorkshopFileTypeVideo = 4, // external video
  80. k_EWorkshopFileTypeScreenshot = 5, // screenshot
  81. k_EWorkshopFileTypeGame = 6, // Greenlight game entry
  82. k_EWorkshopFileTypeSoftware = 7, // Greenlight software entry
  83. k_EWorkshopFileTypeConcept = 8, // Greenlight concept
  84. k_EWorkshopFileTypeWebGuide = 9, // Steam web guide
  85. k_EWorkshopFileTypeIntegratedGuide = 10, // application integrated guide
  86. k_EWorkshopFileTypeMerch = 11, // Workshop merchandise meant to be voted on for the purpose of being sold
  87. k_EWorkshopFileTypeControllerBinding = 12, // Steam Controller bindings
  88. k_EWorkshopFileTypeSteamworksAccessInvite = 13, // internal
  89. k_EWorkshopFileTypeSteamVideo = 14, // Steam video
  90. k_EWorkshopFileTypeGameManagedItem = 15, // managed completely by the game, not the user, and not shown on the web
  91. // Update k_EWorkshopFileTypeMax if you add values.
  92. k_EWorkshopFileTypeMax = 16
  93. };
  94. enum EWorkshopVote
  95. {
  96. k_EWorkshopVoteUnvoted = 0,
  97. k_EWorkshopVoteFor = 1,
  98. k_EWorkshopVoteAgainst = 2,
  99. k_EWorkshopVoteLater = 3,
  100. };
  101. enum EWorkshopFileAction
  102. {
  103. k_EWorkshopFileActionPlayed = 0,
  104. k_EWorkshopFileActionCompleted = 1,
  105. };
  106. enum EWorkshopEnumerationType
  107. {
  108. k_EWorkshopEnumerationTypeRankedByVote = 0,
  109. k_EWorkshopEnumerationTypeRecent = 1,
  110. k_EWorkshopEnumerationTypeTrending = 2,
  111. k_EWorkshopEnumerationTypeFavoritesOfFriends = 3,
  112. k_EWorkshopEnumerationTypeVotedByFriends = 4,
  113. k_EWorkshopEnumerationTypeContentByFriends = 5,
  114. k_EWorkshopEnumerationTypeRecentFromFollowedUsers = 6,
  115. };
  116. enum EWorkshopVideoProvider
  117. {
  118. k_EWorkshopVideoProviderNone = 0,
  119. k_EWorkshopVideoProviderYoutube = 1
  120. };
  121. enum EUGCReadAction
  122. {
  123. // Keeps the file handle open unless the last byte is read. You can use this when reading large files (over 100MB) in sequential chunks.
  124. // If the last byte is read, this will behave the same as k_EUGCRead_Close. Otherwise, it behaves the same as k_EUGCRead_ContinueReading.
  125. // This value maintains the same behavior as before the EUGCReadAction parameter was introduced.
  126. k_EUGCRead_ContinueReadingUntilFinished = 0,
  127. // Keeps the file handle open. Use this when using UGCRead to seek to different parts of the file.
  128. // When you are done seeking around the file, make a final call with k_EUGCRead_Close to close it.
  129. k_EUGCRead_ContinueReading = 1,
  130. // Frees the file handle. Use this when you're done reading the content.
  131. // To read the file from Steam again you will need to call UGCDownload again.
  132. k_EUGCRead_Close = 2,
  133. };
  134. //-----------------------------------------------------------------------------
  135. // Purpose: Functions for accessing, reading and writing files stored remotely
  136. // and cached locally
  137. //-----------------------------------------------------------------------------
  138. class ISteamRemoteStorage
  139. {
  140. public:
  141. // NOTE
  142. //
  143. // Filenames are case-insensitive, and will be converted to lowercase automatically.
  144. // So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.bar" then
  145. // iterate the files, the filename returned will be "foo.bar".
  146. //
  147. // file operations
  148. virtual bool FileWrite( const char *pchFile, const void *pvData, int32 cubData ) = 0;
  149. virtual int32 FileRead( const char *pchFile, void *pvData, int32 cubDataToRead ) = 0;
  150. virtual SteamAPICall_t FileWriteAsync( const char *pchFile, const void *pvData, uint32 cubData ) = 0;
  151. virtual SteamAPICall_t FileReadAsync( const char *pchFile, uint32 nOffset, uint32 cubToRead ) = 0;
  152. virtual bool FileReadAsyncComplete( SteamAPICall_t hReadCall, void *pvBuffer, uint32 cubToRead ) = 0;
  153. virtual bool FileForget( const char *pchFile ) = 0;
  154. virtual bool FileDelete( const char *pchFile ) = 0;
  155. virtual SteamAPICall_t FileShare( const char *pchFile ) = 0;
  156. virtual bool SetSyncPlatforms( const char *pchFile, ERemoteStoragePlatform eRemoteStoragePlatform ) = 0;
  157. // file operations that cause network IO
  158. virtual UGCFileWriteStreamHandle_t FileWriteStreamOpen( const char *pchFile ) = 0;
  159. virtual bool FileWriteStreamWriteChunk( UGCFileWriteStreamHandle_t writeHandle, const void *pvData, int32 cubData ) = 0;
  160. virtual bool FileWriteStreamClose( UGCFileWriteStreamHandle_t writeHandle ) = 0;
  161. virtual bool FileWriteStreamCancel( UGCFileWriteStreamHandle_t writeHandle ) = 0;
  162. // file information
  163. virtual bool FileExists( const char *pchFile ) = 0;
  164. virtual bool FilePersisted( const char *pchFile ) = 0;
  165. virtual int32 GetFileSize( const char *pchFile ) = 0;
  166. virtual int64 GetFileTimestamp( const char *pchFile ) = 0;
  167. virtual ERemoteStoragePlatform GetSyncPlatforms( const char *pchFile ) = 0;
  168. // iteration
  169. virtual int32 GetFileCount() = 0;
  170. virtual const char *GetFileNameAndSize( int iFile, int32 *pnFileSizeInBytes ) = 0;
  171. // configuration management
  172. virtual bool GetQuota( int32 *pnTotalBytes, int32 *puAvailableBytes ) = 0;
  173. virtual bool IsCloudEnabledForAccount() = 0;
  174. virtual bool IsCloudEnabledForApp() = 0;
  175. virtual void SetCloudEnabledForApp( bool bEnabled ) = 0;
  176. // user generated content
  177. // Downloads a UGC file. A priority value of 0 will download the file immediately,
  178. // otherwise it will wait to download the file until all downloads with a lower priority
  179. // value are completed. Downloads with equal priority will occur simultaneously.
  180. virtual SteamAPICall_t UGCDownload( UGCHandle_t hContent, uint32 unPriority ) = 0;
  181. // Gets the amount of data downloaded so far for a piece of content. pnBytesExpected can be 0 if function returns false
  182. // or if the transfer hasn't started yet, so be careful to check for that before dividing to get a percentage
  183. virtual bool GetUGCDownloadProgress( UGCHandle_t hContent, int32 *pnBytesDownloaded, int32 *pnBytesExpected ) = 0;
  184. // Gets metadata for a file after it has been downloaded. This is the same metadata given in the RemoteStorageDownloadUGCResult_t call result
  185. virtual bool GetUGCDetails( UGCHandle_t hContent, AppId_t *pnAppID, char **ppchName, int32 *pnFileSizeInBytes, OUT_STRUCT() CSteamID *pSteamIDOwner ) = 0;
  186. // After download, gets the content of the file.
  187. // Small files can be read all at once by calling this function with an offset of 0 and cubDataToRead equal to the size of the file.
  188. // Larger files can be read in chunks to reduce memory usage (since both sides of the IPC client and the game itself must allocate
  189. // enough memory for each chunk). Once the last byte is read, the file is implicitly closed and further calls to UGCRead will fail
  190. // unless UGCDownload is called again.
  191. // For especially large files (anything over 100MB) it is a requirement that the file is read in chunks.
  192. virtual int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 cOffset, EUGCReadAction eAction ) = 0;
  193. // Functions to iterate through UGC that has finished downloading but has not yet been read via UGCRead()
  194. virtual int32 GetCachedUGCCount() = 0;
  195. virtual UGCHandle_t GetCachedUGCHandle( int32 iCachedContent ) = 0;
  196. // The following functions are only necessary on the Playstation 3. On PC & Mac, the Steam client will handle these operations for you
  197. // On Playstation 3, the game controls which files are stored in the cloud, via FilePersist, FileFetch, and FileForget.
  198. #if defined(_PS3) || defined(_SERVER)
  199. // Connect to Steam and get a list of files in the Cloud - results in a RemoteStorageAppSyncStatusCheck_t callback
  200. virtual void GetFileListFromServer() = 0;
  201. // Indicate this file should be downloaded in the next sync
  202. virtual bool FileFetch( const char *pchFile ) = 0;
  203. // Indicate this file should be persisted in the next sync
  204. virtual bool FilePersist( const char *pchFile ) = 0;
  205. // Pull any requested files down from the Cloud - results in a RemoteStorageAppSyncedClient_t callback
  206. virtual bool SynchronizeToClient() = 0;
  207. // Upload any requested files to the Cloud - results in a RemoteStorageAppSyncedServer_t callback
  208. virtual bool SynchronizeToServer() = 0;
  209. // Reset any fetch/persist/etc requests
  210. virtual bool ResetFileRequestState() = 0;
  211. #endif
  212. // publishing UGC
  213. virtual SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags, EWorkshopFileType eWorkshopFileType ) = 0;
  214. virtual PublishedFileUpdateHandle_t CreatePublishedFileUpdateRequest( PublishedFileId_t unPublishedFileId ) = 0;
  215. virtual bool UpdatePublishedFileFile( PublishedFileUpdateHandle_t updateHandle, const char *pchFile ) = 0;
  216. virtual bool UpdatePublishedFilePreviewFile( PublishedFileUpdateHandle_t updateHandle, const char *pchPreviewFile ) = 0;
  217. virtual bool UpdatePublishedFileTitle( PublishedFileUpdateHandle_t updateHandle, const char *pchTitle ) = 0;
  218. virtual bool UpdatePublishedFileDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchDescription ) = 0;
  219. virtual bool UpdatePublishedFileVisibility( PublishedFileUpdateHandle_t updateHandle, ERemoteStoragePublishedFileVisibility eVisibility ) = 0;
  220. virtual bool UpdatePublishedFileTags( PublishedFileUpdateHandle_t updateHandle, SteamParamStringArray_t *pTags ) = 0;
  221. virtual SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHandle ) = 0;
  222. // Gets published file details for the given publishedfileid. If unMaxSecondsOld is greater than 0,
  223. // cached data may be returned, depending on how long ago it was cached. A value of 0 will force a refresh.
  224. // A value of k_WorkshopForceLoadPublishedFileDetailsFromCache will use cached data if it exists, no matter how old it is.
  225. virtual SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId, uint32 unMaxSecondsOld ) = 0;
  226. virtual SteamAPICall_t DeletePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
  227. // enumerate the files that the current user published with this app
  228. virtual SteamAPICall_t EnumerateUserPublishedFiles( uint32 unStartIndex ) = 0;
  229. virtual SteamAPICall_t SubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
  230. virtual SteamAPICall_t EnumerateUserSubscribedFiles( uint32 unStartIndex ) = 0;
  231. virtual SteamAPICall_t UnsubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
  232. virtual bool UpdatePublishedFileSetChangeDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchChangeDescription ) = 0;
  233. virtual SteamAPICall_t GetPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0;
  234. virtual SteamAPICall_t UpdateUserPublishedItemVote( PublishedFileId_t unPublishedFileId, bool bVoteUp ) = 0;
  235. virtual SteamAPICall_t GetUserPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0;
  236. virtual SteamAPICall_t EnumerateUserSharedWorkshopFiles( CSteamID steamId, uint32 unStartIndex, SteamParamStringArray_t *pRequiredTags, SteamParamStringArray_t *pExcludedTags ) = 0;
  237. virtual SteamAPICall_t PublishVideo( EWorkshopVideoProvider eVideoProvider, const char *pchVideoAccount, const char *pchVideoIdentifier, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags ) = 0;
  238. virtual SteamAPICall_t SetUserPublishedFileAction( PublishedFileId_t unPublishedFileId, EWorkshopFileAction eAction ) = 0;
  239. virtual SteamAPICall_t EnumeratePublishedFilesByUserAction( EWorkshopFileAction eAction, uint32 unStartIndex ) = 0;
  240. // this method enumerates the public view of workshop files
  241. virtual SteamAPICall_t EnumeratePublishedWorkshopFiles( EWorkshopEnumerationType eEnumerationType, uint32 unStartIndex, uint32 unCount, uint32 unDays, SteamParamStringArray_t *pTags, SteamParamStringArray_t *pUserTags ) = 0;
  242. virtual SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocation, uint32 unPriority ) = 0;
  243. };
  244. #define STEAMREMOTESTORAGE_INTERFACE_VERSION "STEAMREMOTESTORAGE_INTERFACE_VERSION013"
  245. // callbacks
  246. #if defined( VALVE_CALLBACK_PACK_SMALL )
  247. #pragma pack( push, 4 )
  248. #elif defined( VALVE_CALLBACK_PACK_LARGE )
  249. #pragma pack( push, 8 )
  250. #else
  251. #error isteamclient.h must be included
  252. #endif
  253. //-----------------------------------------------------------------------------
  254. // Purpose: sent when the local file cache is fully synced with the server for an app
  255. // That means that an application can be started and has all latest files
  256. //-----------------------------------------------------------------------------
  257. struct RemoteStorageAppSyncedClient_t
  258. {
  259. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 1 };
  260. AppId_t m_nAppID;
  261. EResult m_eResult;
  262. int m_unNumDownloads;
  263. };
  264. //-----------------------------------------------------------------------------
  265. // Purpose: sent when the server is fully synced with the local file cache for an app
  266. // That means that we can shutdown Steam and our data is stored on the server
  267. //-----------------------------------------------------------------------------
  268. struct RemoteStorageAppSyncedServer_t
  269. {
  270. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 2 };
  271. AppId_t m_nAppID;
  272. EResult m_eResult;
  273. int m_unNumUploads;
  274. };
  275. //-----------------------------------------------------------------------------
  276. // Purpose: Status of up and downloads during a sync session
  277. //
  278. //-----------------------------------------------------------------------------
  279. struct RemoteStorageAppSyncProgress_t
  280. {
  281. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 3 };
  282. char m_rgchCurrentFile[k_cchFilenameMax]; // Current file being transferred
  283. AppId_t m_nAppID; // App this info relates to
  284. uint32 m_uBytesTransferredThisChunk; // Bytes transferred this chunk
  285. double m_dAppPercentComplete; // Percent complete that this app's transfers are
  286. bool m_bUploading; // if false, downloading
  287. };
  288. //
  289. // IMPORTANT! k_iClientRemoteStorageCallbacks + 4 is used, see iclientremotestorage.h
  290. //
  291. //-----------------------------------------------------------------------------
  292. // Purpose: Sent after we've determined the list of files that are out of sync
  293. // with the server.
  294. //-----------------------------------------------------------------------------
  295. struct RemoteStorageAppSyncStatusCheck_t
  296. {
  297. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 5 };
  298. AppId_t m_nAppID;
  299. EResult m_eResult;
  300. };
  301. //-----------------------------------------------------------------------------
  302. // Purpose: Sent after a conflict resolution attempt.
  303. //-----------------------------------------------------------------------------
  304. struct RemoteStorageConflictResolution_t
  305. {
  306. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 6 };
  307. AppId_t m_nAppID;
  308. EResult m_eResult;
  309. };
  310. //-----------------------------------------------------------------------------
  311. // Purpose: The result of a call to FileShare()
  312. //-----------------------------------------------------------------------------
  313. struct RemoteStorageFileShareResult_t
  314. {
  315. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 7 };
  316. EResult m_eResult; // The result of the operation
  317. UGCHandle_t m_hFile; // The handle that can be shared with users and features
  318. char m_rgchFilename[k_cchFilenameMax]; // The name of the file that was shared
  319. };
  320. // k_iClientRemoteStorageCallbacks + 8 is deprecated! Do not reuse
  321. //-----------------------------------------------------------------------------
  322. // Purpose: The result of a call to PublishFile()
  323. //-----------------------------------------------------------------------------
  324. struct RemoteStoragePublishFileResult_t
  325. {
  326. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 9 };
  327. EResult m_eResult; // The result of the operation.
  328. PublishedFileId_t m_nPublishedFileId;
  329. bool m_bUserNeedsToAcceptWorkshopLegalAgreement;
  330. };
  331. //-----------------------------------------------------------------------------
  332. // Purpose: The result of a call to DeletePublishedFile()
  333. //-----------------------------------------------------------------------------
  334. struct RemoteStorageDeletePublishedFileResult_t
  335. {
  336. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 11 };
  337. EResult m_eResult; // The result of the operation.
  338. PublishedFileId_t m_nPublishedFileId;
  339. };
  340. //-----------------------------------------------------------------------------
  341. // Purpose: The result of a call to EnumerateUserPublishedFiles()
  342. //-----------------------------------------------------------------------------
  343. struct RemoteStorageEnumerateUserPublishedFilesResult_t
  344. {
  345. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 12 };
  346. EResult m_eResult; // The result of the operation.
  347. int32 m_nResultsReturned;
  348. int32 m_nTotalResultCount;
  349. PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
  350. };
  351. //-----------------------------------------------------------------------------
  352. // Purpose: The result of a call to SubscribePublishedFile()
  353. //-----------------------------------------------------------------------------
  354. struct RemoteStorageSubscribePublishedFileResult_t
  355. {
  356. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 13 };
  357. EResult m_eResult; // The result of the operation.
  358. PublishedFileId_t m_nPublishedFileId;
  359. };
  360. //-----------------------------------------------------------------------------
  361. // Purpose: The result of a call to EnumerateSubscribePublishedFiles()
  362. //-----------------------------------------------------------------------------
  363. struct RemoteStorageEnumerateUserSubscribedFilesResult_t
  364. {
  365. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 14 };
  366. EResult m_eResult; // The result of the operation.
  367. int32 m_nResultsReturned;
  368. int32 m_nTotalResultCount;
  369. PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
  370. uint32 m_rgRTimeSubscribed[ k_unEnumeratePublishedFilesMaxResults ];
  371. };
  372. #if defined(VALVE_CALLBACK_PACK_SMALL)
  373. VALVE_COMPILE_TIME_ASSERT( sizeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) == (1 + 1 + 1 + 50 + 100) * 4 );
  374. #elif defined(VALVE_CALLBACK_PACK_LARGE)
  375. VALVE_COMPILE_TIME_ASSERT( sizeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) == (1 + 1 + 1 + 50 + 100) * 4 + 4 );
  376. #else
  377. #warning You must first include isteamclient.h
  378. #endif
  379. //-----------------------------------------------------------------------------
  380. // Purpose: The result of a call to UnsubscribePublishedFile()
  381. //-----------------------------------------------------------------------------
  382. struct RemoteStorageUnsubscribePublishedFileResult_t
  383. {
  384. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 15 };
  385. EResult m_eResult; // The result of the operation.
  386. PublishedFileId_t m_nPublishedFileId;
  387. };
  388. //-----------------------------------------------------------------------------
  389. // Purpose: The result of a call to CommitPublishedFileUpdate()
  390. //-----------------------------------------------------------------------------
  391. struct RemoteStorageUpdatePublishedFileResult_t
  392. {
  393. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 16 };
  394. EResult m_eResult; // The result of the operation.
  395. PublishedFileId_t m_nPublishedFileId;
  396. bool m_bUserNeedsToAcceptWorkshopLegalAgreement;
  397. };
  398. //-----------------------------------------------------------------------------
  399. // Purpose: The result of a call to UGCDownload()
  400. //-----------------------------------------------------------------------------
  401. struct RemoteStorageDownloadUGCResult_t
  402. {
  403. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 17 };
  404. EResult m_eResult; // The result of the operation.
  405. UGCHandle_t m_hFile; // The handle to the file that was attempted to be downloaded.
  406. AppId_t m_nAppID; // ID of the app that created this file.
  407. int32 m_nSizeInBytes; // The size of the file that was downloaded, in bytes.
  408. char m_pchFileName[k_cchFilenameMax]; // The name of the file that was downloaded.
  409. uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content.
  410. };
  411. //-----------------------------------------------------------------------------
  412. // Purpose: The result of a call to GetPublishedFileDetails()
  413. //-----------------------------------------------------------------------------
  414. struct RemoteStorageGetPublishedFileDetailsResult_t
  415. {
  416. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 18 };
  417. EResult m_eResult; // The result of the operation.
  418. PublishedFileId_t m_nPublishedFileId;
  419. AppId_t m_nCreatorAppID; // ID of the app that created this file.
  420. AppId_t m_nConsumerAppID; // ID of the app that will consume this file.
  421. char m_rgchTitle[k_cchPublishedDocumentTitleMax]; // title of document
  422. char m_rgchDescription[k_cchPublishedDocumentDescriptionMax]; // description of document
  423. UGCHandle_t m_hFile; // The handle of the primary file
  424. UGCHandle_t m_hPreviewFile; // The handle of the preview file
  425. uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content.
  426. uint32 m_rtimeCreated; // time when the published file was created
  427. uint32 m_rtimeUpdated; // time when the published file was last updated
  428. ERemoteStoragePublishedFileVisibility m_eVisibility;
  429. bool m_bBanned;
  430. char m_rgchTags[k_cchTagListMax]; // comma separated list of all tags associated with this file
  431. bool m_bTagsTruncated; // whether the list of tags was too long to be returned in the provided buffer
  432. char m_pchFileName[k_cchFilenameMax]; // The name of the primary file
  433. int32 m_nFileSize; // Size of the primary file
  434. int32 m_nPreviewFileSize; // Size of the preview file
  435. char m_rgchURL[k_cchPublishedFileURLMax]; // URL (for a video or a website)
  436. EWorkshopFileType m_eFileType; // Type of the file
  437. bool m_bAcceptedForUse; // developer has specifically flagged this item as accepted in the Workshop
  438. };
  439. struct RemoteStorageEnumerateWorkshopFilesResult_t
  440. {
  441. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 19 };
  442. EResult m_eResult;
  443. int32 m_nResultsReturned;
  444. int32 m_nTotalResultCount;
  445. PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
  446. float m_rgScore[ k_unEnumeratePublishedFilesMaxResults ];
  447. AppId_t m_nAppId;
  448. uint32 m_unStartIndex;
  449. };
  450. //-----------------------------------------------------------------------------
  451. // Purpose: The result of GetPublishedItemVoteDetails
  452. //-----------------------------------------------------------------------------
  453. struct RemoteStorageGetPublishedItemVoteDetailsResult_t
  454. {
  455. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 20 };
  456. EResult m_eResult;
  457. PublishedFileId_t m_unPublishedFileId;
  458. int32 m_nVotesFor;
  459. int32 m_nVotesAgainst;
  460. int32 m_nReports;
  461. float m_fScore;
  462. };
  463. //-----------------------------------------------------------------------------
  464. // Purpose: User subscribed to a file for the app (from within the app or on the web)
  465. //-----------------------------------------------------------------------------
  466. struct RemoteStoragePublishedFileSubscribed_t
  467. {
  468. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 21 };
  469. PublishedFileId_t m_nPublishedFileId; // The published file id
  470. AppId_t m_nAppID; // ID of the app that will consume this file.
  471. };
  472. //-----------------------------------------------------------------------------
  473. // Purpose: User unsubscribed from a file for the app (from within the app or on the web)
  474. //-----------------------------------------------------------------------------
  475. struct RemoteStoragePublishedFileUnsubscribed_t
  476. {
  477. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 22 };
  478. PublishedFileId_t m_nPublishedFileId; // The published file id
  479. AppId_t m_nAppID; // ID of the app that will consume this file.
  480. };
  481. //-----------------------------------------------------------------------------
  482. // Purpose: Published file that a user owns was deleted (from within the app or the web)
  483. //-----------------------------------------------------------------------------
  484. struct RemoteStoragePublishedFileDeleted_t
  485. {
  486. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 23 };
  487. PublishedFileId_t m_nPublishedFileId; // The published file id
  488. AppId_t m_nAppID; // ID of the app that will consume this file.
  489. };
  490. //-----------------------------------------------------------------------------
  491. // Purpose: The result of a call to UpdateUserPublishedItemVote()
  492. //-----------------------------------------------------------------------------
  493. struct RemoteStorageUpdateUserPublishedItemVoteResult_t
  494. {
  495. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 24 };
  496. EResult m_eResult; // The result of the operation.
  497. PublishedFileId_t m_nPublishedFileId; // The published file id
  498. };
  499. //-----------------------------------------------------------------------------
  500. // Purpose: The result of a call to GetUserPublishedItemVoteDetails()
  501. //-----------------------------------------------------------------------------
  502. struct RemoteStorageUserVoteDetails_t
  503. {
  504. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 25 };
  505. EResult m_eResult; // The result of the operation.
  506. PublishedFileId_t m_nPublishedFileId; // The published file id
  507. EWorkshopVote m_eVote; // what the user voted
  508. };
  509. struct RemoteStorageEnumerateUserSharedWorkshopFilesResult_t
  510. {
  511. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 26 };
  512. EResult m_eResult; // The result of the operation.
  513. int32 m_nResultsReturned;
  514. int32 m_nTotalResultCount;
  515. PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
  516. };
  517. struct RemoteStorageSetUserPublishedFileActionResult_t
  518. {
  519. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 27 };
  520. EResult m_eResult; // The result of the operation.
  521. PublishedFileId_t m_nPublishedFileId; // The published file id
  522. EWorkshopFileAction m_eAction; // the action that was attempted
  523. };
  524. struct RemoteStorageEnumeratePublishedFilesByUserActionResult_t
  525. {
  526. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 28 };
  527. EResult m_eResult; // The result of the operation.
  528. EWorkshopFileAction m_eAction; // the action that was filtered on
  529. int32 m_nResultsReturned;
  530. int32 m_nTotalResultCount;
  531. PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
  532. uint32 m_rgRTimeUpdated[ k_unEnumeratePublishedFilesMaxResults ];
  533. };
  534. //-----------------------------------------------------------------------------
  535. // Purpose: Called periodically while a PublishWorkshopFile is in progress
  536. //-----------------------------------------------------------------------------
  537. struct RemoteStoragePublishFileProgress_t
  538. {
  539. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 29 };
  540. double m_dPercentFile;
  541. bool m_bPreview;
  542. };
  543. //-----------------------------------------------------------------------------
  544. // Purpose: Called when the content for a published file is updated
  545. //-----------------------------------------------------------------------------
  546. struct RemoteStoragePublishedFileUpdated_t
  547. {
  548. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 30 };
  549. PublishedFileId_t m_nPublishedFileId; // The published file id
  550. AppId_t m_nAppID; // ID of the app that will consume this file.
  551. UGCHandle_t m_hFile; // The new content
  552. };
  553. //-----------------------------------------------------------------------------
  554. // Purpose: Called when a FileWriteAsync completes
  555. //-----------------------------------------------------------------------------
  556. struct RemoteStorageFileWriteAsyncComplete_t
  557. {
  558. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 31 };
  559. EResult m_eResult; // result
  560. };
  561. //-----------------------------------------------------------------------------
  562. // Purpose: Called when a FileReadAsync completes
  563. //-----------------------------------------------------------------------------
  564. struct RemoteStorageFileReadAsyncComplete_t
  565. {
  566. enum { k_iCallback = k_iClientRemoteStorageCallbacks + 32 };
  567. SteamAPICall_t m_hFileReadAsync; // call handle of the async read which was made
  568. EResult m_eResult; // result
  569. uint32 m_nOffset; // offset in the file this read was at
  570. uint32 m_cubRead; // amount read - will the <= the amount requested
  571. };
  572. #pragma pack( pop )
  573. #endif // ISTEAMREMOTESTORAGE_H