//
// GameLevelManager::onGetUserListCompleted from 0x140162ba0 to 0x140163091 (1265 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x140143885
// > ??> @ 0x1406cac14
//
// 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
//
// Hidden C++ exception states: #wind=4
void __fastcall GameLevelManager::onGetUserListCompleted(GameLevelManager *a1, const void **a2, _QWORD *a3)
{
_BYTE *v4; // r15
size_t v5; // rdi
size_t v6; // r8
void **v7; // rcx
char *v8; // rbx
unsigned __int64 v9; // r13
unsigned __int64 v10; // rsi
size_t v11; // r8
int v12; // r14d
char *v13; // rax
_BYTE *v14; // rcx
unsigned __int64 v15; // rsi
unsigned __int64 v16; // rbx
size_t v17; // r8
UserListDelegate *m_userListDelegate; // rcx
const char *v19; // rcx
__int64 v20; // rcx
UserListDelegate *v21; // rcx
cocos2d::CCArray *v22; // rbx
_BYTE *v23; // rdx
size_t v24; // r8
cocos2d::CCArray *v25; // r13
void *v26; // rcx
unsigned int v27; // esi
GameLevelManager *v28; // r14
cocos2d::CCString *v29; // rax
const char *CString; // rax
size_t v31; // r8
__int64 v32; // rax
cocos2d::CCDictionary *v33; // rax
GJUserScore *v34; // rbx
void *v35; // rcx
void *v36; // rcx
UserListDelegate *v37; // rcx
BOOL v38; // [rsp+20h] [rbp-99h]
int v39; // [rsp+24h] [rbp-95h]
cocos2d::CCArray *v41; // [rsp+30h] [rbp-89h]
_QWORD v43[4]; // [rsp+40h] [rbp-79h] BYREF
char v44[32]; // [rsp+60h] [rbp-59h] BYREF
const void **v45; // [rsp+80h] [rbp-39h]
_QWORD *v46; // [rsp+88h] [rbp-31h]
__int128 Buf2; // [rsp+90h] [rbp-29h] BYREF
__m128i si128; // [rsp+A0h] [rbp-19h]
void *Buf1[2]; // [rsp+B0h] [rbp-9h] BYREF
unsigned __int64 v50; // [rsp+C0h] [rbp+7h]
unsigned __int64 v51; // [rsp+C8h] [rbp+Fh]
v45 = a2;
v46 = a3;
v4 = a3;
if ( a3[3] > 0xFu )
v4 = (_BYTE *)*a3;
HIWORD(Buf2) = 0;
si128.m128i_i64[0] = 11;
si128.m128i_i64[1] = 15;
qmemcpy(&Buf2, "get_friend", 10);
*(_DWORD *)((char *)&Buf2 + 10) = (unsigned __int8)aGetFriends[10];
*(_OWORD *)Buf1 = 0;
v50 = 0;
v51 = 0;
v5 = -1;
v6 = -1;
do
++v6;
while ( v4[v6] );
sub_14003A930(Buf1, v4, v6);
v7 = Buf1;
v8 = (char *)Buf1[0];
v9 = v51;
if ( v51 > 0xF )
v7 = (void **)Buf1[0];
v10 = v50;
v11 = v50;
if ( v50 > 0xB )
v11 = 11;
v12 = memcmp(v7, &Buf2, v11);
if ( !v12 )
{
if ( v10 >= 0xB )
v12 = v10 > 0xB;
else
v12 = -1;
}
v38 = v12 != 0;
if ( v9 > 0xF )
{
v13 = v8;
if ( v9 + 1 >= 0x1000 )
{
v8 = *((char **)v8 - 1);
if ( (unsigned __int64)(v13 - v8 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v8);
}
GameLevelManager::removeDLFromActive(a1, v4);
Buf2 = 0;
si128.m128i_i64[0] = 2;
si128.m128i_i64[1] = 15;
strcpy((char *)&Buf2, "-1");
v14 = a2;
v15 = (unsigned __int64)a2[3];
if ( v15 > 0xF )
v14 = *a2;
v16 = (unsigned __int64)a2[2];
v17 = v16;
if ( v16 > 2 )
v17 = 2;
if ( !memcmp(v14, &Buf2, v17) && v16 == 2 )
{
m_userListDelegate = a1->m_userListDelegate;
goto LABEL_58;
}
v19 = (const char *)a2;
if ( v15 > 0xF )
v19 = (const char *)*a2;
if ( atoi(v19) >= 0 )
{
v22 = (cocos2d::CCArray *)cocos2d::CCArray::create(v20);
v41 = v22;
v23 = a2;
if ( (unsigned __int64)a2[3] > 0xF )
v23 = *a2;
Buf2 = 0;
si128 = 0;
v24 = -1;
do
++v24;
while ( v23[v24] );
sub_14003A930(&Buf2, v23, v24);
v25 = sub_140140F70((__int64 *)&Buf2, "|");
if ( si128.m128i_i64[1] > 0xFuLL )
{
v26 = (void *)Buf2;
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v26 = *(void **)(Buf2 - 8);
if ( (unsigned __int64)(Buf2 - (_QWORD)v26 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v26);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Buf2) = 0;
v27 = 0;
if ( cocos2d::CCArray::count(v25) )
{
v39 = (v12 != 0) + 1;
v28 = a1;
do
{
v29 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v25, v27);
CString = cocos2d::CCString::getCString(v29);
*(_OWORD *)Buf1 = 0;
v50 = 0;
v51 = 0;
v31 = -1;
do
++v31;
while ( CString[v31] );
sub_14003A930(Buf1, CString, v31);
v32 = sub_14003BDB0((__int64)v44, (__int64)Buf1);
v33 = (cocos2d::CCDictionary *)GameLevelManager::responseToDict(v32, 0);
v34 = GJUserScore::create(v33);
v34->m_friendReqStatus = v39;
if ( v34 && v34->m_accountID > 0 && v34->m_userID > 0 )
{
cocos2d::CCArray::addObject(v41, v34);
sub_14003BDB0((__int64)v43, (__int64)&v34->m_userName);
GameLevelManager::storeUserName((__int64)a1, v34->m_userID, v34->m_accountID, v43);
}
if ( v51 > 0xF )
{
v35 = Buf1[0];
if ( v51 + 1 >= 0x1000 )
{
v35 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v35 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v35);
}
++v27;
}
while ( v27 < cocos2d::CCArray::count(v25) );
v22 = v41;
}
else
{
v28 = a1;
}
if ( !cocos2d::CCArray::count(v22) )
{
m_userListDelegate = v28->m_userListDelegate;
LABEL_58:
if ( m_userListDelegate )
m_userListDelegate->getUserListFailed(m_userListDelegate, (UserListType)v38, (GJErrorCode)0xFFFFFFFFLL);
goto LABEL_69;
}
Buf2 = 0;
si128 = 0;
do
++v5;
while ( v4[v5] );
sub_14003A930(&Buf2, v4, v5);
cocos2d::CCDictionary::setObject(v28->m_storedLevels, v22, &Buf2);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v36 = (void *)Buf2;
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v36 = *(void **)(Buf2 - 8);
if ( (unsigned __int64)(Buf2 - (_QWORD)v36 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v36);
}
v37 = v28->m_userListDelegate;
if ( v37 )
v37->getUserListFinished(v37, v22, (UserListType)v38);
}
else
{
v21 = a1->m_userListDelegate;
if ( v21 )
v21->getUserListFailed(v21, (UserListType)(v12 != 0), NotFound);
}
LABEL_69:
sub_14003A830((__int64)a2);
sub_14003A830((__int64)a3);
}