//
// LeaderboardsLayer::loadLeaderboardFinished from 0x100513cf0 to 0x100513e2c (316 bytes)
//
// 2 xrefs:
// > sub_100513F20 @ 0x100513f2c
// > ??> @ 0x10095ecb0
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall LeaderboardsLayer::loadLeaderboardFinished(LeaderboardsLayer *a1, cocos2d::CCArray *a2, const char *a3)
{
double v3; // xmm0_8
cocos2d::CCArray *v5; // r14
size_t v7; // rax
size_t v8; // r12
char *v9; // r13
size_t v10; // r14
char isCorrect; // r15
cocos2d::CCArray *m_userScores; // rdi
_QWORD __dst[2]; // [rsp+10h] [rbp-40h] BYREF
void *__p; // [rsp+20h] [rbp-30h]
v5 = a2;
v7 = strlen(a3);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v3);
v8 = v7;
if ( v7 >= 0x17 )
{
v10 = 26;
if ( (v7 | 7) != 0x17 )
v10 = (v7 | 7) + 1;
v9 = (char *)operator new(v10);
__p = v9;
__dst[0] = v10 + 1;
v5 = a2;
__dst[1] = v8;
goto LABEL_8;
}
LOBYTE(__dst[0]) = 2 * v7;
v9 = (char *)__dst + 1;
if ( v7 )
LABEL_8:
memcpy(v9, a3, v8);
v9[v8] = 0;
isCorrect = LeaderboardsLayer::isCorrect(a1, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
if ( isCorrect )
{
m_userScores = a1->m_userScores;
if ( m_userScores )
{
cocos2d::CCObject::release(m_userScores);
a1->m_userScores = nullptr;
}
a1->m_userScores = v5;
cocos2d::CCObject::retain(v5);
LeaderboardsLayer::setupLevelBrowser(a1, a1->m_userScores);
((void (__fastcall *)(LoadingCircle *, _QWORD))a1->m_circle->setVisible)(a1->m_circle, 0);
((void (__fastcall *)(TextArea *, _QWORD))a1->m_noInternet->setVisible)(a1->m_noInternet, 0);
}
}