Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement GetUGCDetails #104

Merged
merged 1 commit into from
Dec 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion dll/steam_remote_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,33 @@ bool Steam_Remote_Storage::GetUGCDownloadProgress( UGCHandle_t hContent, uint32
// Gets metadata for a file after it has been downloaded. This is the same metadata given in the RemoteStorageDownloadUGCResult_t call result
bool Steam_Remote_Storage::GetUGCDetails( UGCHandle_t hContent, AppId_t *pnAppID, STEAM_OUT_STRING() char **ppchName, int32 *pnFileSizeInBytes, STEAM_OUT_STRUCT() CSteamID *pSteamIDOwner )
{
PRINT_DEBUG_ENTRY();
PRINT_DEBUG("%llu", hContent);
std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (hContent == k_UGCHandleInvalid) return false;

if (pnAppID) *pnAppID = settings->get_local_game_id().AppID();
if (pSteamIDOwner) *pSteamIDOwner = k_steamIDNil;
if (pnFileSizeInBytes) *pnFileSizeInBytes = 0;
if (ppchName) *ppchName = nullptr;

if (auto query_res = ugc_bridge->get_ugc_query_result(hContent)) {
auto mod = settings->getMod(query_res.value().mod_id);
auto &mod_name = query_res.value().is_primary_file
? mod.primaryFileName
: mod.previewFileName;
int32 mod_size = query_res.value().is_primary_file
? mod.primaryFileSize
: mod.previewFileSize;

if (ppchName) {
*ppchName = new char[mod_name.size() + 1];
std::strcpy(*ppchName, mod_name.c_str());
}
if (pnFileSizeInBytes) *pnFileSizeInBytes = mod_size;
if (pSteamIDOwner) *pSteamIDOwner = mod.steamIDOwner;

return true;
}

return false;
}
Expand Down