//
// GameLevelManager::createAndGetScores from 0x711290 to 0x7115e8 (856 bytes)
//
// 4 xrefs:
// > GameLevelManager::onGetLeaderboardScoresCompleted @ 0x711780
// > GameLevelManager::onGetUsersCompleted @ 0x711c94
// > GameLevelManager::onGetLevelLeaderboardCompleted @ 0x719fe4
// > ??> @ 0x4e768
//
// 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
//
cocos2d::CCArray *__fastcall GameLevelManager::createAndGetScores(_QWORD *a1, char **a2, int a3)
{
cocos2d::CCArray *v4; // x27
cocos2d::CCArray *v5; // x25
char *v6; // x0
unsigned int v7; // w20
cocos2d::CCString *v8; // x0
char *CString; // x0
GJUserScore *v10; // x19
char *v11; // x0
std::string *p_m_userName; // x1
int m_userID; // w26
int m_accountID; // w19
char *v15; // x0
void *v16; // x0
unsigned int *v18; // x1
int v19; // w2
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x1
int v23; // w2
unsigned int *v24; // x1
int v25; // w2
__int64 v28; // [xsp+80h] [xbp+80h] BYREF
char *v29; // [xsp+88h] [xbp+88h] BYREF
char *v30; // [xsp+90h] [xbp+90h] BYREF
v4 = (cocos2d::CCArray *)cocos2d::CCArray::create(_stack_chk_guard);
sub_D153B8((int)&v30, *a2);
v5 = sub_6F004C(&v30, "|");
v6 = v30 - 24;
if ( v30 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v30 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *((_DWORD *)v30 - 2);
*((_DWORD *)v30 - 2) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v6);
}
v7 = 0;
while ( v7 < (unsigned int)cocos2d::CCArray::count(v5) )
{
v8 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v5, v7);
CString = (char *)cocos2d::CCString::getCString(v8);
sub_D153B8((int)&v28, CString);
sub_D18D28(&v29, &v28);
GameLevelManager::responseToDict(&v29, 0);
v10 = GJUserScore::create();
v11 = v29 - 24;
if ( v29 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v29 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v29 - 2);
*((_DWORD *)v29 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v11);
}
if ( v10 )
{
v10->m_scoreType = a3;
cocos2d::CCArray::addObject(v4, v10);
p_m_userName = &v10->m_userName;
m_userID = v10->m_userID;
m_accountID = v10->m_accountID;
sub_D18D28(&v30, p_m_userName);
GameLevelManager::storeUserName(a1, m_userID, m_accountID, &v30);
v15 = v30 - 24;
if ( v30 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v30 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *((_DWORD *)v30 - 2);
*((_DWORD *)v30 - 2) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v15);
}
}
v16 = (void *)(v28 - 24);
if ( (__int64 *)(v28 - 24) == &qword_124B6B0 )
goto LABEL_7;
if ( &pthread_create )
{
v18 = (unsigned int *)(v28 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(v28 - 8);
*(_DWORD *)(v28 - 8) = v19 - 1;
}
if ( v19 > 0 )
{
LABEL_7:
++v7;
}
else
{
++v7;
operator delete(v16);
}
}
return v4;
}