Incorrect way of getting the target Steam Leaderboards
Reporter: k0T0z | Status: open | Last Modified: November 15, 2023, 12:00:04 amRegarding the leaderboard API, when you call functions like steam_upload_score()
, the function starts to find the leaderboard at first as in line 233
This is incorrect as the first call for this function will be useless and will fail because at first there is no leaderboard handle stored (this check
The first call to steam_upload_score()
will fail because find_leaderboard()
won't return any leaderboard, instead, it will invoke a callback that will fetch the leaderboard asynchronously. This means as long as that callback isn't here, we won't get any leaderboards, and steam_upload_score()
will keep failing.
This is the case for all of these functions:
- steam_upload_score_ext()
- steam_download_scores()
- steam_download_scores_around_user()
- steam_download_friends_scores()
As ENIGMA is single-threaded, I would like to handle this in a way such that, those functions will succeed on their first call.
A possible solution to this is to call the above functions from the callback itself as we do here. In this utils directory, we attach a payload to our callbacks in order to use it when the callback is here. You can do the same by attaching a payload containing the leaderboard name and the type of function to call.