//
// GameLevelManager::onGetUserListCompleted from 0x711fe4 to 0x71268c (1704 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x7321f4
// > ??> @ 0x7eb10
//
// 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::onGetUserListCompleted(GameLevelManager *a1, const void **a2, char **a3)
{
char *v3; // x2
_DWORD *v5; // x25
_BOOL4 v6; // w26
_DWORD *v7; // x27
unsigned __int64 v8; // x20
unsigned __int64 v9; // x21
size_t v10; // x2
unsigned __int64 v11; // x20
char *v12; // x0
char *v13; // x0
_DWORD *v14; // x27
unsigned __int64 v15; // x28
unsigned __int64 v16; // x25
size_t v17; // x2
int v18; // w20
__int64 v19; // x25
__int64 *v20; // x0
cocos2d::CCArray *v21; // x0
cocos2d::CCArray *v22; // x25
char *v23; // x0
unsigned int v24; // w20
cocos2d::CCString *v25; // x0
char *CString; // x0
GJUserScore *v27; // x19
char *v28; // x0
int m_accountID; // w0
int v30; // w1
std::string *p_m_userName; // x1
int m_userID; // w27
int v33; // w19
char *v34; // x0
void *v35; // x0
UserListDelegate *m_userListDelegate; // x0
unsigned int *v38; // x1
int v39; // w2
UserListDelegate *v40; // x0
unsigned int *v41; // x1
int v42; // w2
unsigned int *v43; // x1
int v44; // w2
unsigned int *v45; // x27
int v46; // w1
cocos2d::CCDictionary *m_storedLevels; // x19
char *v48; // x0
UserListDelegate *v49; // x0
unsigned int *v50; // x27
int v51; // w1
unsigned int *v52; // x25
int v53; // w1
unsigned int *v54; // x1
int v55; // w2
unsigned int *v56; // x19
int v57; // w1
char *v58[13]; // [xsp+0h] [xbp+0h] BYREF
char *v59; // [xsp+68h] [xbp+68h]
cocos2d::CCArray *v60; // [xsp+70h] [xbp+70h]
GameLevelManager *v61; // [xsp+78h] [xbp+78h]
char v62; // [xsp+88h] [xbp+88h] BYREF
__int64 v63; // [xsp+90h] [xbp+90h] BYREF
void *v64; // [xsp+98h] [xbp+98h] BYREF
void *v65; // [xsp+A0h] [xbp+A0h] BYREF
v3 = *a3;
v61 = a1;
v59 = v3;
v58[12] = &v62;
sub_D153B8((int)&v64, v3);
sub_D153B8((int)&v65, "get_friends");
v5 = v64;
v6 = 1;
v7 = v65;
v8 = *((_QWORD *)v64 - 3);
v9 = *((_QWORD *)v65 - 3);
if ( v9 > v8 )
v10 = *((_QWORD *)v64 - 3);
else
v10 = *((_QWORD *)v65 - 3);
if ( !memcmp(v64, v65, v10) )
{
v11 = v8 - v9;
if ( v11 + 0x80000000 <= 0xFFFFFFFF )
v6 = v11 != 0;
}
v12 = (char *)(v7 - 6);
if ( v7 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v50 = v7 - 2;
do
v51 = __ldaxr(v50);
while ( __stlxr(v51 - 1, v50) );
}
else
{
v51 = *(v7 - 2);
*(v7 - 2) = v51 - 1;
}
if ( v51 <= 0 )
operator delete(v12);
v5 = v64;
}
v13 = (char *)(v5 - 6);
if ( v5 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v52 = v5 - 2;
do
v53 = __ldaxr(v52);
while ( __stlxr(v53 - 1, v52) );
}
else
{
v53 = *(v5 - 2);
*(v5 - 2) = v53 - 1;
}
if ( v53 <= 0 )
operator delete(v13);
}
GameLevelManager::removeDLFromActive(v61, v59);
sub_D153B8((unsigned int)v58 + 160, "-1");
v14 = v65;
v15 = *((_QWORD *)v65 - 3);
v16 = *((_QWORD *)*a2 - 3);
if ( v15 > v16 )
v17 = *((_QWORD *)*a2 - 3);
else
v17 = *((_QWORD *)v65 - 3);
v18 = memcmp(*a2, v65, v17);
if ( v18 || (v18 = 0x7FFFFFFF, v19 = v16 - v15, v19 > 0x7FFFFFFF) )
{
v20 = (__int64 *)(v14 - 6);
if ( v14 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_15;
}
else
{
v20 = (__int64 *)(v14 - 6);
if ( v19 >= (__int64)0xFFFFFFFF80000000LL )
v18 = v19;
else
v18 = 0x80000000;
if ( v20 == &qword_124B6B0 )
goto LABEL_15;
}
if ( &pthread_create )
{
v45 = v14 - 2;
do
v46 = __ldaxr(v45);
while ( __stlxr(v46 - 1, v45) );
}
else
{
v46 = *(v14 - 2);
*(v14 - 2) = v46 - 1;
}
if ( v46 <= 0 )
operator delete(v20);
LABEL_15:
if ( !v18 )
{
LABEL_30:
m_userListDelegate = v61->m_userListDelegate;
if ( m_userListDelegate )
m_userListDelegate->getUserListFailed(m_userListDelegate, (UserListType)v6, (GJErrorCode)0xFFFFFFFFLL);
return _stack_chk_guard;
}
v21 = (cocos2d::CCArray *)atoi((const char *)*a2);
if ( ((unsigned int)v21 & 0x80000000) != 0 )
{
v40 = v61->m_userListDelegate;
if ( v40 )
v40->getUserListFailed(v40, (UserListType)v6, NotFound);
}
else
{
v60 = (cocos2d::CCArray *)cocos2d::CCArray::create(v21);
sub_D153B8((int)&v65, (char *)*a2);
v22 = sub_6F004C(&v65, "|");
v23 = (char *)v65 - 24;
if ( (char *)v65 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v54 = (unsigned int *)((char *)v65 - 8);
do
v55 = __ldaxr(v54);
while ( __stlxr(v55 - 1, v54) );
}
else
{
v55 = *((_DWORD *)v65 - 2);
*((_DWORD *)v65 - 2) = v55 - 1;
}
if ( v55 <= 0 )
operator delete(v23);
}
v24 = 0;
while ( v24 < (unsigned int)cocos2d::CCArray::count(v22) )
{
v25 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v22, v24);
CString = (char *)cocos2d::CCString::getCString(v25);
sub_D153B8((int)&v63, CString);
sub_D18D28(&v64, &v63);
GameLevelManager::responseToDict((char **)&v64, 0);
v27 = GJUserScore::create();
v28 = (char *)v64 - 24;
if ( (char *)v64 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)((char *)v64 - 8);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *((_DWORD *)v64 - 2);
*((_DWORD *)v64 - 2) = v42 - 1;
}
if ( v42 <= 0 )
operator delete(v28);
}
m_accountID = v27->m_accountID;
if ( v6 )
v30 = 2;
else
v30 = 1;
v27->m_friendReqStatus = v30;
if ( m_accountID > 0 && v27->m_userID > 0 )
{
cocos2d::CCArray::addObject(v60, v27);
p_m_userName = &v27->m_userName;
m_userID = v27->m_userID;
v33 = v27->m_accountID;
sub_D18D28(&v65, p_m_userName);
GameLevelManager::storeUserName(v61, m_userID, v33, (char **)&v65);
v34 = (char *)v65 - 24;
if ( (char *)v65 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v43 = (unsigned int *)((char *)v65 - 8);
do
v44 = __ldaxr(v43);
while ( __stlxr(v44 - 1, v43) );
}
else
{
v44 = *((_DWORD *)v65 - 2);
*((_DWORD *)v65 - 2) = v44 - 1;
}
if ( v44 <= 0 )
operator delete(v34);
}
}
v35 = (void *)(v63 - 24);
if ( (__int64 *)(v63 - 24) == &qword_124B6B0 )
goto LABEL_27;
if ( &pthread_create )
{
v38 = (unsigned int *)(v63 - 8);
do
v39 = __ldaxr(v38);
while ( __stlxr(v39 - 1, v38) );
}
else
{
v39 = *(_DWORD *)(v63 - 8);
*(_DWORD *)(v63 - 8) = v39 - 1;
}
if ( v39 > 0 )
{
LABEL_27:
++v24;
}
else
{
++v24;
operator delete(v35);
}
}
if ( !(unsigned int)cocos2d::CCArray::count(v60) )
goto LABEL_30;
m_storedLevels = v61->m_storedLevels;
sub_D153B8((int)&v65, v59);
cocos2d::CCDictionary::setObject((int)m_storedLevels, v60);
v48 = (char *)v65 - 24;
if ( (char *)v65 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v56 = (unsigned int *)((char *)v65 - 8);
do
v57 = __ldaxr(v56);
while ( __stlxr(v57 - 1, v56) );
}
else
{
v57 = *((_DWORD *)v65 - 2);
*((_DWORD *)v65 - 2) = v57 - 1;
}
if ( v57 <= 0 )
operator delete(v48);
}
v49 = v61->m_userListDelegate;
if ( v49 )
v49->getUserListFinished(v49, v60, (UserListType)v6);
}
return _stack_chk_guard;
}