//
// GameLevelManager::onGetLevelLeaderboardCompleted from 0x1005294e0 to 0x1005296d5 (501 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10051d407
//
// 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 GameLevelManager::onGetLevelLeaderboardCompleted(__int64 a1, char *a2, __int128 *a3, __m128 a4)
{
const char *v5; // r14
char v6; // r14
int v7; // r13d
__int64 v8; // rax
__int64 v9; // rdi
__int64 Scores; // rax
const char *v11; // r14
__int64 v12; // r15
__int64 v13; // rdi
__int16 v14; // [rsp+0h] [rbp-90h] BYREF
char v15; // [rsp+2h] [rbp-8Eh]
char v16[4]; // [rsp+1Ch] [rbp-74h] BYREF
__int128 v17; // [rsp+20h] [rbp-70h] BYREF
void *__p; // [rsp+30h] [rbp-60h]
__int128 v19; // [rsp+40h] [rbp-50h] BYREF
void *v20; // [rsp+50h] [rbp-40h]
const char *v21; // [rsp+58h] [rbp-38h]
int v22; // [rsp+60h] [rbp-30h] BYREF
int v23[11]; // [rsp+64h] [rbp-2Ch] BYREF
if ( (*(_BYTE *)a3 & 1) != 0 )
v5 = *((const char **)a3 + 2);
else
v5 = (char *)a3 + 1;
GameLevelManager::removeDLFromActive((GameLevelManager *)a1, v5);
v22 = 0;
v23[0] = 0;
if ( (*(_BYTE *)a3 & 1) != 0 )
{
sub_100006B70(&v17, *((const void **)a3 + 2), *((_QWORD *)a3 + 1), *(double *)a4.i64);
}
else
{
__p = *((void **)a3 + 2);
a4 = (__m128)*a3;
v17 = *a3;
}
sub_10054AEF0(&v17, v16, &v22, v23);
v21 = v5;
if ( (v17 & 1) != 0 )
operator delete(__p);
v6 = *a2;
if ( (*a2 & 1) != 0 )
{
v7 = atoi(*((const char **)a2 + 2));
if ( v22 != 4 )
{
LABEL_11:
if ( v7 < 0 )
{
v9 = *(_QWORD *)(a1 + 776);
if ( v9 )
(*(void (__fastcall **)(__int64, const char *))(*(_QWORD *)v9 + 24LL))(v9, v21);
}
else
{
if ( (v6 & 1) != 0 )
{
sub_100006B70(&v19, *((const void **)a2 + 2), *((_QWORD *)a2 + 1), *(double *)a4.i64);
}
else
{
v20 = *((void **)a2 + 2);
v19 = *(_OWORD *)a2;
}
Scores = GameLevelManager::createAndGetScores(a1, &v19, 3);
v11 = v21;
v12 = Scores;
if ( (v19 & 1) != 0 )
operator delete(v20);
v14 = 8194;
v15 = 0;
GameLevelManager::storeSearchResult(a1, v12, &v14, v11);
v13 = *(_QWORD *)(a1 + 776);
if ( v13 )
(*(void (__fastcall **)(__int64, __int64, const char *))(*(_QWORD *)v13 + 16LL))(v13, v12, v11);
}
return;
}
}
else
{
v7 = atoi(a2 + 1);
if ( v22 != 4 )
goto LABEL_11;
}
v8 = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1 + 648), (char *)a3);
if ( v8 != 0 && v7 >= 0 )
{
if ( v23[0] == 1 )
{
*(_BYTE *)(v8 + 1321) = 0;
}
else if ( !v23[0] )
{
*(_BYTE *)(v8 + 1320) = 0;
}
}
cocos2d::CCDictionary::removeObjectForKey_1(*(_QWORD *)(a1 + 648), (char *)a3);
}