//
// GameLevelManager::storeUserNames from 0x6f1120 to 0x6f149c (892 bytes)
//
// 4 xrefs:
// > GameLevelManager::onGetOnlineLevelsCompleted @ 0x70535c
// > GameLevelManager::processOnDownloadLevelCompleted @ 0x707598
// > GameLevelManager::onGetLevelListsCompleted @ 0x730070
// > ??> @ 0x9b388
//
// 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::storeUserNames(_QWORD *a1, char **a2)
{
char *v2; // x1
cocos2d::CCArray *v4; // x24
char *v5; // x0
unsigned int v6; // w19
cocos2d::CCString *v7; // x0
char *CString; // x0
cocos2d::CCArray *v9; // x22
void *v10; // x0
char *v11; // x0
unsigned int *v12; // x1
int v13; // w2
cocos2d::CCString *v14; // x0
cocos2d::CCString *v15; // x28
cocos2d::CCString *v16; // x0
int v17; // w22
char *v18; // x0
char *v19; // x0
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x1
int v23; // w2
unsigned int *v24; // x1
int v25; // w2
_QWORD v26[2]; // [xsp+0h] [xbp+0h] BYREF
_QWORD *v27; // [xsp+60h] [xbp+60h]
int v28; // [xsp+6Ch] [xbp+6Ch]
char *v29; // [xsp+80h] [xbp+80h]
__int64 v30; // [xsp+88h] [xbp+88h] BYREF
char *v31; // [xsp+90h] [xbp+90h] BYREF
v2 = *a2;
v27 = a1;
if ( *((_QWORD *)v2 - 3) )
{
sub_D153B8((int)&v31, v2);
v4 = sub_6F004C(&v31, "|");
v5 = v31 - 24;
if ( v31 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v31 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *((_DWORD *)v31 - 2);
*((_DWORD *)v31 - 2) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v5);
}
v6 = 0;
while ( v6 < (unsigned int)cocos2d::CCArray::count(v4) )
{
v7 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v4, v6);
CString = (char *)cocos2d::CCString::getCString(v7);
sub_D153B8((unsigned int)v26 + 128, CString);
sub_D153B8((unsigned int)v26 + 136, v29);
v9 = sub_6F004C(&v30, ":");
v10 = (void *)(v30 - 24);
if ( (__int64 *)(v30 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v30 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *(_DWORD *)(v30 - 8);
*(_DWORD *)(v30 - 8) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v10);
}
if ( (unsigned int)cocos2d::CCArray::count(v9) > 2 )
{
v14 = cocos2d::CCArray::stringAtIndex(v9, 0);
v28 = cocos2d::CCString::intValue(v14);
v15 = cocos2d::CCArray::stringAtIndex(v9, 1u);
v16 = cocos2d::CCArray::stringAtIndex(v9, 2u);
v17 = cocos2d::CCString::intValue(v16);
v18 = (char *)cocos2d::CCString::getCString(v15);
sub_D153B8((unsigned int)v26 + 144, v18);
GameLevelManager::storeUserName(v27, v28, v17, &v31);
v19 = v31 - 24;
if ( v31 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v31 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v31 - 2);
*((_DWORD *)v31 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v19);
}
}
v11 = v29 - 24;
if ( v29 - 24 == (char *)&qword_124B6B0 )
goto LABEL_9;
if ( &pthread_create )
{
v12 = (unsigned int *)(v29 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *((_DWORD *)v29 - 2);
*((_DWORD *)v29 - 2) = v13 - 1;
}
if ( v13 > 0 )
{
LABEL_9:
++v6;
}
else
{
++v6;
operator delete(v11);
}
}
}
return _stack_chk_guard;
}