Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Rubberduckycooly
GitHub Repository: Rubberduckycooly/RSDKv5-Decompilation
Path: blob/master/RSDKv5/RSDK/User/Dummy/DummyLeaderboards.hpp
1187 views
1
#if RETRO_REV02
2
3
struct DummyLeaderboardCallback {
4
uint8 type;
5
int32 loadTime;
6
bool32 isUser;
7
LeaderboardLoadInfo *info;
8
int32 trackScore;
9
int32 trackRank;
10
void (*trackCB)(bool32 success, int32 rank);
11
};
12
13
// This is the "dummy" struct, it serves as the base in the event a suitable API isn't loaded (such as in this decomp)
14
// This struct should never be removed, other structs such as "SteamLeaderboards" would be added and "leaderboards" would be set to that instead
15
struct DummyLeaderboards : UserLeaderboards {
16
void FrameInit()
17
{
18
UserLeaderboards::FrameInit();
19
20
for (int32 i = callbackList.Count() - 1; i >= 0; --i) {
21
DummyLeaderboardCallback *item = callbackList.At(i);
22
23
if (item) {
24
if (item->loadTime) {
25
item->loadTime--;
26
}
27
else {
28
switch (item->type) {
29
case 0: FinishLeaderboardFetch(item); break;
30
case 1: FinishLeaderboardLoad(item); break;
31
case 2:
32
if (item->trackCB)
33
item->trackCB(true, item->trackRank);
34
break;
35
}
36
37
callbackList.Remove(i);
38
}
39
}
40
}
41
}
42
43
void FetchLeaderboard(LeaderboardID *leaderboard, bool32 isUser);
44
void LoadLeaderboards(LeaderboardLoadInfo *info);
45
void TrackScore(LeaderboardID *leaderboard, int32 score, void (*callback)(bool32 success, int32 rank));
46
47
void FillLeaderboardEntries(LeaderboardLoadInfo *info);
48
void FinishLeaderboardFetch(DummyLeaderboardCallback *callback);
49
void FinishLeaderboardLoad(DummyLeaderboardCallback *callback);
50
51
List<DummyLeaderboardCallback> callbackList;
52
};
53
#endif
54
55