Skip to content

Add UGC download and read functionality from SteamRemoteStorage#825

Open
kellydornhaus wants to merge 3 commits intoFacepunch:masterfrom
kellydornhaus:ugc-download
Open

Add UGC download and read functionality from SteamRemoteStorage#825
kellydornhaus wants to merge 3 commits intoFacepunch:masterfrom
kellydornhaus:ugc-download

Conversation

@kellydornhaus
Copy link
Copy Markdown

Description:

Summary

  • Implements complete UGC workflow for downloading and reading user-generated content
  • Enables full workflow: FileShare → UGC handle → Download → Read → Attach to leaderboards

New Methods

  • UgcDownloadAsync() - Downloads UGC to Steam cache with progress tracking
  • UgcDownloadToLocationAsync() - Downloads UGC to specific file path
  • UgcRead() - Reads downloaded UGC content into byte array
  • GetUgcDownloadProgress() - Tracks download progress and completion

Usage

// Share a file and get UGC handle
var ugc = await SteamRemoteStorage.FileShareAsync("myfile.txt");

// Download the UGC content
var result = await SteamRemoteStorage.UgcDownloadAsync(ugc.Value);

// Read the downloaded content
var data = SteamRemoteStorage.UgcRead(ugc.Value);

// Attach to leaderboard
await leaderboard.AttachUgc(ugc.Value);

Implements GetNumBetas, GetBetaInfo, and SetActiveBeta Steam APIs that were missing from the library. These APIs allow applications to query available beta branches and programmatically switch between them.

New APIs added:
- SteamApps.GetBetaCount() - Get total number of beta branches with breakdown of available/private counts
- SteamApps.GetBetaInfo() - Get detailed information about a specific beta branch by index
- SteamApps.GetBetaInformation() - Get enumerable of all available beta branches
- SteamApps.SetActiveBeta() - Set the active beta branch for the application

Also adds BetaInformation struct with convenient property accessors for beta branch flags (IsDefault, IsAvailable, IsPrivate, IsSelected, IsInstalled).

The low-level Steam API bindings were already generated, this change adds the high-level C# wrapper methods following existing code patterns in SteamApps.cs.
Implements SteamRemoteStorage.FileShareAsync() method to share Steam Cloud files with the community, returning a UGC handle that can be used with leaderboard attachments.

- Add FileShareAsync method to SteamRemoteStorage class
- Enhance Ugc struct with public constructors and implicit conversions
- Enable creation of Ugc objects from shared file handles
Implements complete UGC workflow for downloading and reading user-generated content:

- UgcDownloadAsync() - Downloads UGC to Steam cache with progress tracking
- UgcDownloadToLocationAsync() - Downloads UGC to specific file path
- UgcRead() - Reads downloaded UGC content into byte array
- GetUgcDownloadProgress() - Tracks download progress and completion

UgcDownloadResult contains all metadata (filename, size, owner, appId).

Enables full workflow: FileShare -> UGC handle -> Download -> Read -> Attach to leaderboards
@Derek-R-S
Copy link
Copy Markdown

+1

I made my own fork just for this purpose before I seen this PR. Nice feature to have in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants