From a69a3639c5f991f8a5915d46fa4dbf070876229f Mon Sep 17 00:00:00 2001 From: a Date: Fri, 1 Nov 2024 20:48:26 +0200 Subject: [PATCH] add different versions for `Steam_UGC::GetQueryUGCResult()` `Steam_UGC::RequestUGCDetails()` to support old and new mod details struct after `sdk 1.60` --- dll/dll/steam_ugc.h | 16 +++++- dll/flat.cpp | 18 +------ dll/settings.cpp | 1 + dll/steam_ugc.cpp | 104 ++++++++++++++++++++++++++++----------- sdk/steam/isteamugc001.h | 2 +- sdk/steam/isteamugc002.h | 4 +- sdk/steam/isteamugc003.h | 4 +- sdk/steam/isteamugc004.h | 4 +- sdk/steam/isteamugc005.h | 4 +- sdk/steam/isteamugc006.h | 4 +- sdk/steam/isteamugc007.h | 4 +- sdk/steam/isteamugc008.h | 4 +- sdk/steam/isteamugc009.h | 4 +- sdk/steam/isteamugc010.h | 4 +- sdk/steam/isteamugc011.h | 4 +- sdk/steam/isteamugc012.h | 4 +- sdk/steam/isteamugc013.h | 4 +- sdk/steam/isteamugc014.h | 4 +- sdk/steam/isteamugc015.h | 4 +- sdk/steam/isteamugc016.h | 4 +- sdk/steam/isteamugc017.h | 4 +- sdk/steam/isteamugc018.h | 46 ++++++++++++++++- 22 files changed, 171 insertions(+), 80 deletions(-) diff --git a/dll/dll/steam_ugc.h b/dll/dll/steam_ugc.h index 980c0b48..e6fd4084 100644 --- a/dll/dll/steam_ugc.h +++ b/dll/dll/steam_ugc.h @@ -54,6 +54,13 @@ public ISteamUGC017, public ISteamUGC018, public ISteamUGC { +public: + enum class IUgcItfVersion : unsigned { + v018, // sdk 1.59 + v020, // sdk 1.60 + }; + +private: constexpr static const char ugc_favorits_file[] = "favorites.txt"; class Settings *settings{}; @@ -76,12 +83,15 @@ public ISteamUGC std::optional> get_query_ugc_tags(UGCQueryHandle_t handle, uint32 index); - void set_details(PublishedFileId_t id, SteamUGCDetails_t *pDetails); + void set_details(PublishedFileId_t id, SteamUGCDetails_t *pDetails, IUgcItfVersion ver); void read_ugc_favorites(); bool write_ugc_favorites(); + bool internal_GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails, IUgcItfVersion ver ); + SteamAPICall_t internal_RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds, IUgcItfVersion ver ); + public: Steam_UGC(class Settings *settings, class Ugc_Remote_Storage_Bridge *ugc_bridge, class Local_Storage *local_storage, class SteamCallResults *callback_results, class SteamCallBacks *callbacks); @@ -107,6 +117,8 @@ public: // Retrieve an individual result after receiving the callback for querying UGC bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ); + // before SDK v1.60 + bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ); uint32 GetQueryUGCNumTags( UGCQueryHandle_t handle, uint32 index ); @@ -200,6 +212,8 @@ public: // DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead! SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ); + // before SDK v1.60 + SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ); SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID ); diff --git a/dll/flat.cpp b/dll/flat.cpp index 0c868533..6c1524b1 100644 --- a/dll/flat.cpp +++ b/dll/flat.cpp @@ -3675,14 +3675,7 @@ STEAMAPI_API SteamAPICall_t SteamAPI_ISteamUGC_SendQueryUGCRequest( ISteamUGC* s STEAMAPI_API steam_bool SteamAPI_ISteamUGC_GetQueryUGCResult( ISteamUGC* self, UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t * pDetails ) { - long long client_vftable_distance = ((char *)self - (char*)get_steam_client()->steam_ugc); - long long server_vftable_distance = ((char *)self - (char*)get_steam_client()->steam_gameserver_ugc); - auto ptr = get_steam_client()->steam_gameserver_ugc; - if (client_vftable_distance >= 0 && (server_vftable_distance < 0 || client_vftable_distance < server_vftable_distance)) { - ptr = get_steam_client()->steam_ugc; - } - - return (ptr)->GetQueryUGCResult(handle, index, pDetails); + return self->GetQueryUGCResult(handle, index, pDetails); } STEAMAPI_API uint32 SteamAPI_ISteamUGC_GetQueryUGCNumTags( ISteamUGC* self, UGCQueryHandle_t handle, uint32 index ) @@ -4143,14 +4136,7 @@ STEAMAPI_API steam_bool SteamAPI_ISteamUGC_AddRequiredKeyValueTag( ISteamUGC* se STEAMAPI_API SteamAPICall_t SteamAPI_ISteamUGC_RequestUGCDetails( ISteamUGC* self, PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) { - long long client_vftable_distance = ((char *)self - (char*)get_steam_client()->steam_ugc); - long long server_vftable_distance = ((char *)self - (char*)get_steam_client()->steam_gameserver_ugc); - auto ptr = get_steam_client()->steam_gameserver_ugc; - if (client_vftable_distance >= 0 && (server_vftable_distance < 0 || client_vftable_distance < server_vftable_distance)) { - ptr = get_steam_client()->steam_ugc; - } - - return (ptr)->RequestUGCDetails(nPublishedFileID, unMaxAgeSeconds); + return self->RequestUGCDetails(nPublishedFileID, unMaxAgeSeconds); } STEAMAPI_API SteamAPICall_t SteamAPI_ISteamUGC_CreateItem( ISteamUGC* self, AppId_t nConsumerAppId, EWorkshopFileType eFileType ) diff --git a/dll/settings.cpp b/dll/settings.cpp index 03a16254..fbabef16 100644 --- a/dll/settings.cpp +++ b/dll/settings.cpp @@ -219,6 +219,7 @@ void Settings::addModDetails(PublishedFileId_t id, const Mod_entry &details) f->score = details.score; f->numChildren = details.numChildren; f->previewURL = details.previewURL; + f->total_files_sizes = details.total_files_sizes; } } diff --git a/dll/steam_ugc.cpp b/dll/steam_ugc.cpp index 682a033c..81dd8228 100644 --- a/dll/steam_ugc.cpp +++ b/dll/steam_ugc.cpp @@ -65,7 +65,7 @@ std::optional> Steam_UGC::get_query_ugc_tags(UGCQueryHa } -void Steam_UGC::set_details(PublishedFileId_t id, SteamUGCDetails_t *pDetails) +void Steam_UGC::set_details(PublishedFileId_t id, SteamUGCDetails_t *pDetails, IUgcItfVersion ver) { if (pDetails) { memset(pDetails, 0, sizeof(SteamUGCDetails_t)); @@ -106,8 +106,10 @@ void Steam_UGC::set_details(PublishedFileId_t id, SteamUGCDetails_t *pDetails) // TODO should we enable this? // pDetails->m_unNumChildren = mod.numChildren; - // TODO make sure the filesize is good - pDetails->m_ulTotalFilesSize = mod.total_files_sizes; + if (ver >= IUgcItfVersion::v020) { + // TODO make sure the filesize is good + pDetails->m_ulTotalFilesSize = mod.total_files_sizes; + } } else { PRINT_DEBUG(" mod isn't installed, returning failure"); pDetails->m_eResult = k_EResultFail; @@ -151,6 +153,63 @@ bool Steam_UGC::write_ugc_favorites() return (size_t)stored == file_data.size(); } +bool Steam_UGC::internal_GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails, IUgcItfVersion ver ) +{ + PRINT_DEBUG("%llu [%u] %p <%u>", handle, index, pDetails, (unsigned)ver); + std::lock_guard lock(global_mutex); + + // some apps (like appid 588650) ignore the return of this function, especially for builtin mods + if (pDetails) { + pDetails->m_nPublishedFileId = k_PublishedFileIdInvalid; + pDetails->m_eResult = k_EResultFail; + pDetails->m_bAcceptedForUse = false; + pDetails->m_hFile = k_UGCHandleInvalid; + pDetails->m_hPreviewFile = k_UGCHandleInvalid; + pDetails->m_unNumChildren = 0; + } + + if (handle == k_UGCQueryHandleInvalid) return false; + + auto request = std::find_if(ugc_queries.begin(), ugc_queries.end(), [&handle](struct UGC_query const& item) { return item.handle == handle; }); + if (ugc_queries.end() == request) { + return false; + } + + if (index >= request->results.size()) { + return false; + } + + auto it = request->results.begin(); + std::advance(it, index); + PublishedFileId_t file_id = *it; + set_details(file_id, pDetails, ver); + return true; +} + +SteamAPICall_t Steam_UGC::internal_RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds, IUgcItfVersion ver ) +{ + PRINT_DEBUG("%llu %u <%u>", nPublishedFileID, unMaxAgeSeconds, (unsigned)ver); + std::lock_guard lock(global_mutex); + + if (ver <= IUgcItfVersion::v018) { // <= SDK 1.59 + SteamUGCRequestUGCDetailsResult018_t data{}; + data.m_bCachedData = false; + set_details(nPublishedFileID, reinterpret_cast(&data.m_details), ver); + + auto ret = callback_results->addCallResult(data.k_iCallback, &data, sizeof(data)); + callbacks->addCBResult(data.k_iCallback, &data, sizeof(data)); + return ret; + } else { // >= SDK 1.60 + SteamUGCRequestUGCDetailsResult_t data{}; + data.m_bCachedData = false; + set_details(nPublishedFileID, &data.m_details, ver); + + auto ret = callback_results->addCallResult(data.k_iCallback, &data, sizeof(data)); + callbacks->addCBResult(data.k_iCallback, &data, sizeof(data)); + return ret; + } +} + Steam_UGC::Steam_UGC(class Settings *settings, class Ugc_Remote_Storage_Bridge *ugc_bridge, class Local_Storage *local_storage, class SteamCallResults *callback_results, class SteamCallBacks *callbacks) { @@ -278,23 +337,13 @@ SteamAPICall_t Steam_UGC::SendQueryUGCRequest( UGCQueryHandle_t handle ) bool Steam_UGC::GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) { PRINT_DEBUG("%llu %u %p", handle, index, pDetails); - std::lock_guard lock(global_mutex); - if (handle == k_UGCQueryHandleInvalid) return false; + return internal_GetQueryUGCResult(handle, index, pDetails, IUgcItfVersion::v020); +} - auto request = std::find_if(ugc_queries.begin(), ugc_queries.end(), [&handle](struct UGC_query const& item) { return item.handle == handle; }); - if (ugc_queries.end() == request) { - return false; - } - - if (index >= request->results.size()) { - return false; - } - - auto it = request->results.begin(); - std::advance(it, index); - PublishedFileId_t file_id = *it; - set_details(file_id, pDetails); - return true; +bool Steam_UGC::GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) +{ + PRINT_DEBUG("%llu %u %p", handle, index, pDetails); + return internal_GetQueryUGCResult(handle, index, pDetails, IUgcItfVersion::v018); } std::optional Steam_UGC::get_query_ugc_tag(UGCQueryHandle_t handle, uint32 index, uint32 indexTag) @@ -841,20 +890,19 @@ bool Steam_UGC::SetTimeUpdatedDateRange( UGCQueryHandle_t handle, RTime32 rtStar SteamAPICall_t Steam_UGC::RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) { PRINT_DEBUG("%llu", nPublishedFileID); - std::lock_guard lock(global_mutex); - - SteamUGCRequestUGCDetailsResult_t data{}; - data.m_bCachedData = false; - set_details(nPublishedFileID, &(data.m_details)); - auto ret = callback_results->addCallResult(data.k_iCallback, &data, sizeof(data)); - callbacks->addCBResult(data.k_iCallback, &data, sizeof(data)); - return ret; + return internal_RequestUGCDetails(nPublishedFileID, unMaxAgeSeconds, IUgcItfVersion::v020); +} + +SteamAPICall_t Steam_UGC::RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) +{ + PRINT_DEBUG("%llu", nPublishedFileID); + return internal_RequestUGCDetails(nPublishedFileID, unMaxAgeSeconds, IUgcItfVersion::v018); } SteamAPICall_t Steam_UGC::RequestUGCDetails( PublishedFileId_t nPublishedFileID ) { PRINT_DEBUG("old"); - return RequestUGCDetails(nPublishedFileID, 0); + return RequestUGCDetails_old(nPublishedFileID, 0); } diff --git a/sdk/steam/isteamugc001.h b/sdk/steam/isteamugc001.h index 4e081f67..956c2c29 100644 --- a/sdk/steam/isteamugc001.h +++ b/sdk/steam/isteamugc001.h @@ -15,7 +15,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; // Release the request to free up memory, after retrieving results virtual bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) = 0; diff --git a/sdk/steam/isteamugc002.h b/sdk/steam/isteamugc002.h index ca5dc727..9aca06b7 100644 --- a/sdk/steam/isteamugc002.h +++ b/sdk/steam/isteamugc002.h @@ -16,7 +16,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; // Release the request to free up memory, after retrieving results virtual bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) = 0; @@ -34,7 +34,7 @@ public: virtual bool SetSearchText( UGCQueryHandle_t handle, const char *pSearchText ) = 0; virtual bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays ) = 0; - virtual SteamAPICall_t RequestUGCDetails(PublishedFileId_t nPublishedFileID, uint32 uUnk) = 0; + virtual SteamAPICall_t RequestUGCDetails_old(PublishedFileId_t nPublishedFileID, uint32 uUnk) = 0; // Steam Workshop Creator API diff --git a/sdk/steam/isteamugc003.h b/sdk/steam/isteamugc003.h index ecd9df5b..9e93c945 100644 --- a/sdk/steam/isteamugc003.h +++ b/sdk/steam/isteamugc003.h @@ -20,7 +20,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; // Retrieve an individual result after receiving the callback for querying UGC - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; // Release the request to free up memory, after retrieving results virtual bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) = 0; @@ -41,7 +41,7 @@ public: virtual bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays ) = 0; // Request full details for one piece of UGC - virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + virtual SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; // Steam Workshop Creator API virtual SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType ) = 0; // create new item for this app with no content attached yet diff --git a/sdk/steam/isteamugc004.h b/sdk/steam/isteamugc004.h index b3147796..ce808518 100644 --- a/sdk/steam/isteamugc004.h +++ b/sdk/steam/isteamugc004.h @@ -19,7 +19,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; // Retrieve an individual result after receiving the callback for querying UGC - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; // Release the request to free up memory, after retrieving results virtual bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) = 0; @@ -40,7 +40,7 @@ public: virtual bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays ) = 0; // Request full details for one piece of UGC - virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + virtual SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; // Steam Workshop Creator API virtual SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType ) = 0; // create new item for this app with no content attached yet diff --git a/sdk/steam/isteamugc005.h b/sdk/steam/isteamugc005.h index 5a440027..32da16f7 100644 --- a/sdk/steam/isteamugc005.h +++ b/sdk/steam/isteamugc005.h @@ -20,7 +20,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; // Retrieve an individual result after receiving the callback for querying UGC - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, char *pchURL, uint32 cchURLSize ) = 0; virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, char *pchMetadata, uint32 cchMetadatasize ) = 0; @@ -52,7 +52,7 @@ public: virtual bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays ) = 0; // Request full details for one piece of UGC - virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + virtual SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; // Steam Workshop Creator API virtual SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType ) = 0; // create new item for this app with no content attached yet diff --git a/sdk/steam/isteamugc006.h b/sdk/steam/isteamugc006.h index f0b10fcc..a6c61f79 100644 --- a/sdk/steam/isteamugc006.h +++ b/sdk/steam/isteamugc006.h @@ -21,7 +21,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; // Retrieve an individual result after receiving the callback for querying UGC - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, char *pchURL, uint32 cchURLSize ) = 0; virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, char *pchMetadata, uint32 cchMetadatasize ) = 0; @@ -54,7 +54,7 @@ public: virtual bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays ) = 0; // Request full details for one piece of UGC - virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + virtual SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; // Steam Workshop Creator API virtual SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType ) = 0; // create new item for this app with no content attached yet diff --git a/sdk/steam/isteamugc007.h b/sdk/steam/isteamugc007.h index b3c04a9d..a9aadcb0 100644 --- a/sdk/steam/isteamugc007.h +++ b/sdk/steam/isteamugc007.h @@ -20,7 +20,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; // Retrieve an individual result after receiving the callback for querying UGC - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, char *pchURL, uint32 cchURLSize ) = 0; virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, char *pchMetadata, uint32 cchMetadatasize ) = 0; @@ -59,7 +59,7 @@ public: virtual bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const char *pValue ) = 0; // Request full details for one piece of UGC - virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + virtual SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; // Steam Workshop Creator API virtual SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType ) = 0; // create new item for this app with no content attached yet diff --git a/sdk/steam/isteamugc008.h b/sdk/steam/isteamugc008.h index 91770482..66a67ecd 100644 --- a/sdk/steam/isteamugc008.h +++ b/sdk/steam/isteamugc008.h @@ -21,7 +21,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; // Retrieve an individual result after receiving the callback for querying UGC - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, char *pchURL, uint32 cchURLSize ) = 0; virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, char *pchMetadata, uint32 cchMetadatasize ) = 0; @@ -59,7 +59,7 @@ public: virtual bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const char *pValue ) = 0; // Request full details for one piece of UGC - virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + virtual SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; // Steam Workshop Creator API virtual SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType ) = 0; // create new item for this app with no content attached yet diff --git a/sdk/steam/isteamugc009.h b/sdk/steam/isteamugc009.h index 7d2ab483..e093b974 100644 --- a/sdk/steam/isteamugc009.h +++ b/sdk/steam/isteamugc009.h @@ -20,7 +20,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; // Retrieve an individual result after receiving the callback for querying UGC - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, char *pchURL, uint32 cchURLSize ) = 0; virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, char *pchMetadata, uint32 cchMetadatasize ) = 0; @@ -59,7 +59,7 @@ public: virtual bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const char *pValue ) = 0; // Request full details for one piece of UGC - virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + virtual SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; // Steam Workshop Creator API virtual SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType ) = 0; // create new item for this app with no content attached yet diff --git a/sdk/steam/isteamugc010.h b/sdk/steam/isteamugc010.h index 0e1b557d..e2bec62e 100644 --- a/sdk/steam/isteamugc010.h +++ b/sdk/steam/isteamugc010.h @@ -23,7 +23,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; // Retrieve an individual result after receiving the callback for querying UGC - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURL, uint32 cchURLSize ) = 0; virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchMetadatasize) char *pchMetadata, uint32 cchMetadatasize ) = 0; virtual bool GetQueryUGCChildren( UGCQueryHandle_t handle, uint32 index, PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0; @@ -60,7 +60,7 @@ public: virtual bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const char *pValue ) = 0; // DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead! - virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + virtual SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; // Steam Workshop Creator API STEAM_CALL_RESULT( CreateItemResult_t ) diff --git a/sdk/steam/isteamugc011.h b/sdk/steam/isteamugc011.h index 8b92b7eb..0f71bf04 100644 --- a/sdk/steam/isteamugc011.h +++ b/sdk/steam/isteamugc011.h @@ -25,7 +25,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; // Retrieve an individual result after receiving the callback for querying UGC - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURL, uint32 cchURLSize ) = 0; virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchMetadatasize) char *pchMetadata, uint32 cchMetadatasize ) = 0; virtual bool GetQueryUGCChildren( UGCQueryHandle_t handle, uint32 index, PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0; @@ -62,7 +62,7 @@ public: virtual bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const char *pValue ) = 0; // DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead! - virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + virtual SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; // Steam Workshop Creator API STEAM_CALL_RESULT( CreateItemResult_t ) diff --git a/sdk/steam/isteamugc012.h b/sdk/steam/isteamugc012.h index ad0d1770..77daf972 100644 --- a/sdk/steam/isteamugc012.h +++ b/sdk/steam/isteamugc012.h @@ -26,7 +26,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; // Retrieve an individual result after receiving the callback for querying UGC - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURL, uint32 cchURLSize ) = 0; virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchMetadatasize) char *pchMetadata, uint32 cchMetadatasize ) = 0; virtual bool GetQueryUGCChildren( UGCQueryHandle_t handle, uint32 index, PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0; @@ -63,7 +63,7 @@ public: virtual bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const char *pValue ) = 0; // DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead! - virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + virtual SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; // Steam Workshop Creator API STEAM_CALL_RESULT( CreateItemResult_t ) diff --git a/sdk/steam/isteamugc013.h b/sdk/steam/isteamugc013.h index 71b9c65e..29d71e3a 100644 --- a/sdk/steam/isteamugc013.h +++ b/sdk/steam/isteamugc013.h @@ -25,7 +25,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; // Retrieve an individual result after receiving the callback for querying UGC - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURL, uint32 cchURLSize ) = 0; virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchMetadatasize) char *pchMetadata, uint32 cchMetadatasize ) = 0; virtual bool GetQueryUGCChildren( UGCQueryHandle_t handle, uint32 index, PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0; @@ -64,7 +64,7 @@ public: virtual bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const char *pValue ) = 0; // DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead! - virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + virtual SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; // Steam Workshop Creator API STEAM_CALL_RESULT( CreateItemResult_t ) diff --git a/sdk/steam/isteamugc014.h b/sdk/steam/isteamugc014.h index 321ec159..871dcd4a 100644 --- a/sdk/steam/isteamugc014.h +++ b/sdk/steam/isteamugc014.h @@ -28,7 +28,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; // Retrieve an individual result after receiving the callback for querying UGC - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURL, uint32 cchURLSize ) = 0; virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchMetadatasize) char *pchMetadata, uint32 cchMetadatasize ) = 0; virtual bool GetQueryUGCChildren( UGCQueryHandle_t handle, uint32 index, PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0; @@ -72,7 +72,7 @@ public: // DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead! STEAM_CALL_RESULT( SteamUGCRequestUGCDetailsResult_t ) - virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + virtual SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; // Steam Workshop Creator API STEAM_CALL_RESULT( CreateItemResult_t ) diff --git a/sdk/steam/isteamugc015.h b/sdk/steam/isteamugc015.h index ca9090a5..18e51fe1 100644 --- a/sdk/steam/isteamugc015.h +++ b/sdk/steam/isteamugc015.h @@ -28,7 +28,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; // Retrieve an individual result after receiving the callback for querying UGC - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; virtual uint32 GetQueryUGCNumTags( UGCQueryHandle_t handle, uint32 index ) = 0; virtual bool GetQueryUGCTag( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT( cchValueSize ) char* pchValue, uint32 cchValueSize ) = 0; virtual bool GetQueryUGCTagDisplayName( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT( cchValueSize ) char* pchValue, uint32 cchValueSize ) = 0; @@ -74,7 +74,7 @@ public: // DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead! STEAM_CALL_RESULT( SteamUGCRequestUGCDetailsResult_t ) - virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + virtual SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; // Steam Workshop Creator API STEAM_CALL_RESULT( CreateItemResult_t ) diff --git a/sdk/steam/isteamugc016.h b/sdk/steam/isteamugc016.h index 0e37f77b..e4704fe6 100644 --- a/sdk/steam/isteamugc016.h +++ b/sdk/steam/isteamugc016.h @@ -27,7 +27,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; // Retrieve an individual result after receiving the callback for querying UGC - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; virtual uint32 GetQueryUGCNumTags( UGCQueryHandle_t handle, uint32 index ) = 0; virtual bool GetQueryUGCTag( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT( cchValueSize ) char* pchValue, uint32 cchValueSize ) = 0; virtual bool GetQueryUGCTagDisplayName( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT( cchValueSize ) char* pchValue, uint32 cchValueSize ) = 0; @@ -75,7 +75,7 @@ public: // DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead! STEAM_CALL_RESULT( SteamUGCRequestUGCDetailsResult_t ) - virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + virtual SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; // Steam Workshop Creator API STEAM_CALL_RESULT( CreateItemResult_t ) diff --git a/sdk/steam/isteamugc017.h b/sdk/steam/isteamugc017.h index f1b95fc0..9e3885fc 100644 --- a/sdk/steam/isteamugc017.h +++ b/sdk/steam/isteamugc017.h @@ -28,7 +28,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; // Retrieve an individual result after receiving the callback for querying UGC - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; virtual uint32 GetQueryUGCNumTags( UGCQueryHandle_t handle, uint32 index ) = 0; virtual bool GetQueryUGCTag( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT( cchValueSize ) char* pchValue, uint32 cchValueSize ) = 0; virtual bool GetQueryUGCTagDisplayName( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT( cchValueSize ) char* pchValue, uint32 cchValueSize ) = 0; @@ -78,7 +78,7 @@ public: // DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead! STEAM_CALL_RESULT( SteamUGCRequestUGCDetailsResult_t ) - virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + virtual SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; // Steam Workshop Creator API STEAM_CALL_RESULT( CreateItemResult_t ) diff --git a/sdk/steam/isteamugc018.h b/sdk/steam/isteamugc018.h index d04ebe65..9a11e52e 100644 --- a/sdk/steam/isteamugc018.h +++ b/sdk/steam/isteamugc018.h @@ -5,6 +5,48 @@ #pragma once #endif +// Details for a single published file/UGC, up until interface v018 +struct SteamUGCDetails018_t +{ + PublishedFileId_t m_nPublishedFileId; + EResult m_eResult; // The result of the operation. + EWorkshopFileType m_eFileType; // Type of the file + AppId_t m_nCreatorAppID; // ID of the app that created this file. + AppId_t m_nConsumerAppID; // ID of the app that will consume this file. + char m_rgchTitle[k_cchPublishedDocumentTitleMax]; // title of document + char m_rgchDescription[k_cchPublishedDocumentDescriptionMax]; // description of document + uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content. + uint32 m_rtimeCreated; // time when the published file was created + uint32 m_rtimeUpdated; // time when the published file was last updated + uint32 m_rtimeAddedToUserList; // time when the user added the published file to their list (not always applicable) + ERemoteStoragePublishedFileVisibility m_eVisibility; // visibility + bool m_bBanned; // whether the file was banned + bool m_bAcceptedForUse; // developer has specifically flagged this item as accepted in the Workshop + bool m_bTagsTruncated; // whether the list of tags was too long to be returned in the provided buffer + char m_rgchTags[k_cchTagListMax]; // comma separated list of all tags associated with this file + // file/url information + UGCHandle_t m_hFile; // The handle of the primary file + UGCHandle_t m_hPreviewFile; // The handle of the preview file + char m_pchFileName[k_cchFilenameMax]; // The cloud filename of the primary file + int32 m_nFileSize; // Size of the primary file + int32 m_nPreviewFileSize; // Size of the preview file + char m_rgchURL[k_cchPublishedFileURLMax]; // URL (for a video or a website) + // voting information + uint32 m_unVotesUp; // number of votes up + uint32 m_unVotesDown; // number of votes down + float m_flScore; // calculated score + // collection details + uint32 m_unNumChildren; +}; + +struct SteamUGCRequestUGCDetailsResult018_t +{ + enum { k_iCallback = k_iSteamUGCCallbacks + 2 }; + SteamUGCDetails018_t m_details; + bool m_bCachedData; // indicates whether this data was retrieved from the local on-disk cache +}; + + class ISteamUGC018 { public: @@ -28,7 +70,7 @@ public: virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; // Retrieve an individual result after receiving the callback for querying UGC - virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCResult_old( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; virtual uint32 GetQueryUGCNumTags( UGCQueryHandle_t handle, uint32 index ) = 0; virtual bool GetQueryUGCTag( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT( cchValueSize ) char* pchValue, uint32 cchValueSize ) = 0; virtual bool GetQueryUGCTagDisplayName( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT( cchValueSize ) char* pchValue, uint32 cchValueSize ) = 0; @@ -78,7 +120,7 @@ public: // DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead! STEAM_CALL_RESULT( SteamUGCRequestUGCDetailsResult_t ) - virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + virtual SteamAPICall_t RequestUGCDetails_old( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; // Steam Workshop Creator API STEAM_CALL_RESULT( CreateItemResult_t )