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

Incorrect way of getting the target Steam Leaderboards #2365

Open
k0T0z opened this issue Nov 15, 2023 · 0 comments
Open

Incorrect way of getting the target Steam Leaderboards #2365

k0T0z opened this issue Nov 15, 2023 · 0 comments

Comments

@k0T0z
Copy link
Contributor

k0T0z commented Nov 15, 2023

Regarding the leaderboard API, when you call functions like steam_upload_score(), the function starts to find the leaderboard at first as in line 233

steamworks_gc::GCMain::get_gameclient()->get_gc_leaderboards()->find_leaderboard(find_id, lb_name);
.

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

if (GCLeaderboards::current_leaderboard_ == INVALID_LEADERBOARD) return false;
will exit the function).

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.

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

No branches or pull requests

1 participant