//
// GameLevelManager::onGetLevelLeaderboardCompleted from 0x100090868 to 0x100090a2c (452 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x100089a64
//
// 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
//
__int64 __fastcall GameLevelManager::onGetLevelLeaderboardCompleted(GameLevelManager *a1, __int64 a2, __int64 a3)
{
const char *v6; // x20
int v7; // w24
const char *v8; // x0
int v9; // w0
int v10; // w23
__int64 v11; // x0
__int64 result; // x0
__int64 Scores; // x21
void *v14[2]; // [xsp+8h] [xbp-98h] BYREF
char v15; // [xsp+1Fh] [xbp-81h]
void *__dst[2]; // [xsp+20h] [xbp-80h] BYREF
__int64 v17; // [xsp+30h] [xbp-70h]
std::string __p; // [xsp+40h] [xbp-60h] BYREF
__int64 v19; // [xsp+64h] [xbp-3Ch]
v6 = (const char *)a3;
if ( *(char *)(a3 + 23) < 0 )
v6 = *(const char **)a3;
GameLevelManager::removeDLFromActive(a1, v6);
v19 = 0;
if ( *(char *)(a3 + 23) < 0 )
sub_1000097D0(&__p, *(void **)a3, *(_QWORD *)(a3 + 8));
else
__p = *(std::string *)a3;
sub_1000A3208(&__p);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
v7 = *(char *)(a2 + 23);
v8 = (const char *)a2;
if ( v7 < 0 )
v8 = *(const char **)a2;
v9 = atoi(v8);
v10 = v9;
if ( HIDWORD(v19) == 4 )
{
v11 = cocos2d::CCDictionary::objectForKey_1(a1->m_localLeaderboardLevels, a3);
if ( v11 && (v10 & 0x80000000) == 0 )
{
if ( (_DWORD)v19 == 1 )
{
*(_BYTE *)(v11 + 1321) = 0;
}
else if ( !(_DWORD)v19 )
{
*(_BYTE *)(v11 + 1320) = 0;
}
}
return cocos2d::CCDictionary::removeObjectForKey_1((int)a1->m_localLeaderboardLevels, (char *)a3);
}
else if ( v9 < 0 )
{
result = (__int64)a1->m_leaderboardManagerDelegate;
if ( result )
return (*(__int64 (__fastcall **)(__int64, const char *))(*(_QWORD *)result + 24LL))(result, v6);
}
else
{
if ( v7 < 0 )
{
sub_1000097D0(__dst, *(void **)a2, *(_QWORD *)(a2 + 8));
}
else
{
*(_OWORD *)__dst = *(_OWORD *)a2;
v17 = *(_QWORD *)(a2 + 16);
}
Scores = GameLevelManager::createAndGetScores(a1, __dst, 3);
if ( SHIBYTE(v17) < 0 )
operator delete(__dst[0]);
sub_100009900(v14, " ");
GameLevelManager::storeSearchResult(a1, Scores, v14, v6);
if ( v15 < 0 )
operator delete(v14[0]);
result = (__int64)a1->m_leaderboardManagerDelegate;
if ( result )
return (*(__int64 (__fastcall **)(__int64, __int64, const char *))(*(_QWORD *)result + 16LL))(result, Scores, v6);
}
return result;
}