Skip to content

Enable user_stats module for achievements and leaderboards#3

Closed
Jasper-Bekkers wants to merge 41 commits intomasterfrom
Traverse-Research/enable-user-stats-module
Closed

Enable user_stats module for achievements and leaderboards#3
Jasper-Bekkers wants to merge 41 commits intomasterfrom
Traverse-Research/enable-user-stats-module

Conversation

@Jasper-Bekkers
Copy link
Member

Summary

  • Enables the user_stats module which was previously commented out
  • Adapts the module to use the dynamic library loading pattern established in this fork
  • Adds missing callback struct definitions required for Steam API responses

Changes

src/lib.rs

  • Uncommented mod user_stats and pub use crate::user_stats::*
  • Added CString import for string handling
  • Added user_stats() method to Client implementation

src/user_stats.rs & src/user_stats/stats.rs

  • Updated all Steam API calls to use dynamic library pattern (self.inner.lib.SteamAPI_* instead of sys::SteamAPI_*)
  • For closures that need library access, cloned the lib Arc before capturing

steamworks-sys/src/lib.rs

  • Added 8 callback struct definitions missing from auto-generated bindings:
    • UserStatsReceived_t - callback for RequestCurrentStats
    • UserStatsStored_t - callback for StoreStats
    • UserAchievementStored_t - callback for achievement storage
    • UserAchievementIconFetched_t - callback for achievement icon fetch
    • LeaderboardFindResult_t - callback for FindLeaderboard
    • LeaderboardScoreUploaded_t - callback for UploadLeaderboardScore
    • LeaderboardScoresDownloaded_t - callback for DownloadLeaderboardEntries
    • GlobalAchievementPercentagesReady_t - callback for RequestGlobalAchievementPercentages

Features Enabled

  • Achievements: get/set/clear, display attributes, icons, global unlock percentages
  • Leaderboards: find, create, upload scores, download entries, get metadata (name, entry count, sort method, display type)
  • Stats: get/set i32 and f32 stats, store stats, reset all stats

Test plan

  • cargo check passes successfully

🤖 Generated with Claude Code

maxded and others added 11 commits March 3, 2025 10:41
Co-authored-by: Marijn Suijten <marijns95@gmail.com>
Co-authored-by: Marijn Suijten <marijns95@gmail.com>
This PR includes the following changes:

    Update steamworks SDK to 1.61
    Update Rust dependencies
    Minor updates to CI
    Moved to runtime library loading through libloading
        Only ported over APIs that we require for our internal projects
    Simplified steamworks-sys's build.rs
        Copy steam sdk library to target_dir instead of out_dir

When reviewing, focus on the following files:

    steamworks/lib.rs
    steamworks-sys/build.rs
Downgrade `thiserror` to `1`

Needed by internal projects.
- Uncomment user_stats module declaration and exports in lib.rs
- Add user_stats() method to Client implementation
- Update user_stats.rs to use dynamic library pattern (self.inner.lib.*)
- Update stats.rs achievement helper to use dynamic library pattern
- Add missing callback struct definitions to steamworks-sys:
  - UserStatsReceived_t, UserStatsStored_t, UserAchievementStored_t
  - UserAchievementIconFetched_t, LeaderboardFindResult_t
  - LeaderboardScoreUploaded_t, LeaderboardScoresDownloaded_t
  - GlobalAchievementPercentagesReady_t

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Jasper-Bekkers Jasper-Bekkers force-pushed the Traverse-Research/enable-user-stats-module branch from 39ab702 to 021accb Compare February 7, 2026 08:32
@Jasper-Bekkers
Copy link
Member Author

Closing to recreate with correct base branch (for-traverse instead of master)

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