Closed schmurger closed 1 month ago
Thank you a lot for your contributions.
To tap into Steam_User_Stats::IndicateAchievementProgress
you can as you said listen/register for the triggered callback, but it would look quite clunky since you have to create a mini-class and inherit from and implement CCallbackImpl
https://github.com/otavepto/gbe_fork/blob/0b55a69a4e257ac650adb92c4f099e16a93a4f46/sdk/steam/steam_api_common.h#L172-L187
And register this class instance via this function
https://github.com/otavepto/gbe_fork/blob/0b55a69a4e257ac650adb92c4f099e16a93a4f46/dll/dll/callsystem.h#L105
Example
callbacks->addCallBack(data.iCallback, &your_class_instance);
Steam callbacks are a mechanism to notify the game, randomly at any time, that some unplanned event occurred, like for example when the overlay was opened, so the game can pause or something, check their example: https://partner.steamgames.com/doc/sdk/api#callbacks.
A much easier and simpler approach, is to create some function in the overlay like void update_ach_progress(nlohmann::json const& ach)
(I'm using lower case to indicate that this is an emu-defined function, not part of the public API) then call it exactly after this line save_achievements();
https://github.com/otavepto/gbe_fork/blob/0b55a69a4e257ac650adb92c4f099e16a93a4f46/dll/steam_user_stats.cpp#L1149-L1153
A similar approach is actually done here https://github.com/otavepto/gbe_fork/blob/0b55a69a4e257ac650adb92c4f099e16a93a4f46/dll/steam_user_stats.cpp#L598-L608
I hope this helps
Thanks for the detailed review and comments. I'll address them tomorrow, after-tomorrow. It's night here already :)
It turned out easier to create a new function in the Steam_Overlay class, thanks for pointing that out. This new function is now called from Steam_User_Stats::IndicateAchievementProgress. I've fixed a small bug in Steam_Overlay::AddAchievementNotification. The achievement notification was displayed on progress update even though the achievement was not earned.
Edit: I've removed update_achievement_progress and reused AddAchievementNotification for achievement progress update.
On a totally unrelated topic, why did the workflows finish too fast this time! Almost 3min compared to the usual 6min, 50% reduction. The logs are pretty fine and the compilation is as usual. Github is full of wonders :/
Thank you, let me know when you want to merge this.
Feel free to merge, I've finished adding changes. No idea about why github workflows run faster, maybe it was just one time thing, the workflow was allocated a faster node :)
Thank you so much
Add progress bar for achievements yet to be earned in the achievements table.
@otavepto I can't figure out how to hook into the callback from Steam_User_Stats::IndicateAchievementProgress when achievement progress has been updated. Is it possible to refresh the achievement data, found in std::vector achievements{}; steam_overlay.h, when the event from IndicateAchievementProgress is triggered?