//
// GameLevelManager::onGetFriendRequestsCompleted from 0x84e93c to 0x84ef78 (1596 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x85bf0c
// > ??> @ 0x76378
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:55:25 +0000
//
__int64 __fastcall GameLevelManager::onGetFriendRequestsCompleted(__int64 **this, __int64 a2, char *a3)
{
char *v5; // x27
int SplitIntFromKey; // w28
_BOOL4 v7; // w21
char *v8; // x20
size_t v9; // x0
cocos2d::CCArray *v10; // x21
cocos2d::CCString *v11; // x0
const char *CString; // x0
size_t v13; // x0
cocos2d::CCString *v14; // x0
size_t v15; // x0
unsigned __int64 v16; // x0
__int64 *v17; // x21
__int64 v18; // x1
void (__fastcall *v19)(__int64 *, cocos2d::CCArray **, char *); // x23
const char *v20; // x1
size_t v21; // x0
cocos2d::CCArray *v22; // x25
unsigned int i; // w23
cocos2d::CCString *v24; // x0
const char *v25; // x0
size_t v26; // x0
cocos2d::CCDictionary *v27; // x1
GJUserScore *v28; // x24
cocos2d::CCDictionary *v29; // x1
__int64 v30; // x21
__int64 v31; // x24
char v32; // w0
int v33; // w1
char v34; // w0
__int64 v35; // x2
int v36; // w24
int v37; // w21
__int64 v38; // x0
__int64 v39; // x1
__int64 v40; // x0
__int64 v42; // x0
void (__fastcall ***v43)(_QWORD, cocos2d::CCArray *, char *); // x0
cocos2d::CCArray *v44; // [xsp+70h] [xbp+70h]
char *v45; // [xsp+78h] [xbp+78h]
char *v46; // [xsp+78h] [xbp+78h]
char *v47; // [xsp+78h] [xbp+78h]
char *v48; // [xsp+78h] [xbp+78h]
__int64 v49[2]; // [xsp+80h] [xbp+80h] BYREF
void *v50; // [xsp+90h] [xbp+90h]
cocos2d::CCArray *v51; // [xsp+98h] [xbp+98h] BYREF
size_t v52; // [xsp+A0h] [xbp+A0h]
void *v53; // [xsp+A8h] [xbp+A8h]
cocos2d::CCArray *v54; // [xsp+B0h] [xbp+B0h] BYREF
size_t v55; // [xsp+B8h] [xbp+B8h]
void *v56; // [xsp+C0h] [xbp+C0h]
__int64 v57[2]; // [xsp+C8h] [xbp+C8h] BYREF
void *v58; // [xsp+D8h] [xbp+D8h]
__int64 v59; // [xsp+E0h] [xbp+E0h] BYREF
size_t v60; // [xsp+E8h] [xbp+E8h]
void *v61; // [xsp+F0h] [xbp+F0h]
__int64 v62; // [xsp+F8h] [xbp+F8h] BYREF
__int64 v63; // [xsp+100h] [xbp+100h]
void *v64; // [xsp+108h] [xbp+108h]
__int64 v65; // [xsp+110h] [xbp+110h] BYREF
size_t v66; // [xsp+118h] [xbp+118h]
void *v67; // [xsp+120h] [xbp+120h]
v5 = a3 + 1;
if ( (*a3 & 1) != 0 )
v5 = *((char **)a3 + 2);
SplitIntFromKey = GameLevelManager::getSplitIntFromKey((GameLevelManager *)this, v5, 1u);
GameLevelManager::removeDLFromActive((GameLevelManager *)this, v5);
v65 = 0;
v66 = 0;
v67 = nullptr;
std::string::__init(&v65, &word_117CE08, 2u);
v7 = sub_7FEA60(a2, (__int64)&v65);
if ( (v65 & 1) != 0 )
operator delete(v67);
if ( v7 )
{
LABEL_37:
v40 = (__int64)*(this + 172);
if ( v40 )
(*(void (__fastcall **)(__int64, char *, __int64))(*(_QWORD *)v40 + 8LL))(v40, v5, 0xFFFFFFFFLL);
return _stack_chk_guard;
}
if ( (*(_BYTE *)a2 & 1) != 0 )
{
v8 = *(char **)(a2 + 16);
if ( (atoi(v8) & 0x80000000) == 0 )
goto LABEL_8;
}
else
{
v8 = (char *)(a2 + 1);
if ( (atoi(v8) & 0x80000000) == 0 )
{
LABEL_8:
v65 = 0;
v66 = 0;
v67 = nullptr;
v9 = strlen(v8);
std::string::__init(&v65, v8, v9);
v10 = sub_80CFCC((unsigned __int8 *)&v65, "#");
if ( (v65 & 1) != 0 )
operator delete(v67);
if ( (unsigned int)cocos2d::CCArray::count(v10) > 1 )
{
v11 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v10, 0);
CString = (const char *)cocos2d::CCString::getCString(v11);
v49[0] = 0;
v45 = (char *)CString;
v49[1] = 0;
v50 = nullptr;
v13 = strlen(CString);
std::string::__init(v49, v45, v13);
v14 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v10, 1u);
v46 = (char *)cocos2d::CCString::getCString(v14);
v51 = nullptr;
v52 = 0;
v53 = nullptr;
v15 = strlen(v46);
v16 = std::string::__init((__int64 *)&v51, v46, v15);
v17 = *(this + 172);
if ( v17 )
{
v18 = *v17;
v54 = nullptr;
v19 = *(void (__fastcall **)(__int64 *, cocos2d::CCArray **, char *))(v18 + 16);
v55 = 0;
v56 = nullptr;
if ( ((unsigned __int8)v51 & 1) != 0 )
{
std::string::__init((__int64 *)&v54, v53, v52);
}
else
{
v56 = v53;
v54 = v51;
v55 = v52;
}
v19(v17, &v54, v5);
v16 = (unsigned __int8)v54;
if ( ((unsigned __int8)v54 & 1) != 0 )
operator delete(v56);
}
v44 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)v16);
v20 = (char *)v49 + 1;
if ( (v49[0] & 1) != 0 )
v20 = (const char *)v50;
v47 = (char *)v20;
v57[0] = 0;
v57[1] = 0;
v58 = nullptr;
v21 = strlen(v20);
std::string::__init(v57, v47, v21);
v22 = sub_80CFCC((unsigned __int8 *)v57, "|");
if ( (v57[0] & 1) != 0 )
operator delete(v58);
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(v22); ++i )
{
v24 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v22, i);
v25 = (const char *)cocos2d::CCString::getCString(v24);
v65 = 0;
v66 = 0;
v67 = nullptr;
v48 = (char *)v25;
v26 = strlen(v25);
std::string::__init(&v65, v48, v26);
v59 = 0;
v60 = 0;
v61 = nullptr;
if ( (v65 & 1) != 0 )
{
std::string::__init(&v59, v67, v66);
}
else
{
v61 = v67;
v59 = v65;
v60 = v66;
}
v28 = (GJUserScore *)GameLevelManager::responseToDict((__int64)&v59, 0);
if ( (v59 & 1) != 0 )
operator delete(v61);
v30 = GJUserScore::create(v28, v27);
if ( v30 )
{
v31 = GJFriendRequest::create(v28, v29);
if ( v31 )
{
v32 = *(_BYTE *)(v30 + 724);
if ( SplitIntFromKey )
v33 = 4;
else
v33 = 3;
*(_DWORD *)(v30 + 688) = v33;
*(_BYTE *)(v31 + 376) = v32 ^ 1;
*(_BYTE *)(v31 + 377) = strncmp(v5, "fReqI", 5u) == 0;
*(_DWORD *)(v31 + 320) = *(_DWORD *)(v30 + 376);
cocos2d::CCArray::addObject(v44, (cocos2d::CCObject *)v30);
GameLevelManager::storeFriendRequest((__int64)this, (GJFriendRequest *)v31);
v34 = *(_BYTE *)(v30 + 320);
v35 = v30 + 320;
v62 = 0;
v63 = 0;
v64 = nullptr;
v36 = *(_DWORD *)(v30 + 372);
v37 = *(_DWORD *)(v30 + 376);
if ( (v34 & 1) != 0 )
{
std::string::__init(&v62, *(void **)(v35 + 16), *(_QWORD *)(v35 + 8));
}
else
{
v38 = *(_QWORD *)v35;
v39 = *(_QWORD *)(v35 + 8);
v64 = *(void **)(v35 + 16);
v62 = v38;
v63 = v39;
}
GameLevelManager::storeUserName(this, v36, v37, (char *)&v62);
if ( (v62 & 1) != 0 )
operator delete(v64);
}
}
if ( (v65 & 1) != 0 )
operator delete(v67);
}
v65 = 0;
v66 = 0;
v67 = nullptr;
if ( ((unsigned __int8)v51 & 1) != 0 )
{
std::string::__init(&v65, v53, v52);
}
else
{
v67 = v53;
v65 = (__int64)v51;
v66 = v52;
}
GameLevelManager::storeCommentsResult((GameLevelManager *)this, v44, (__int64)&v65, v5);
if ( (v65 & 1) != 0 )
operator delete(v67);
v43 = (void (__fastcall ***)(_QWORD, cocos2d::CCArray *, char *))*(this + 172);
if ( v43 )
(**v43)(v43, v44, v5);
if ( ((unsigned __int8)v51 & 1) != 0 )
operator delete(v53);
if ( (v49[0] & 1) != 0 )
operator delete(v50);
return _stack_chk_guard;
}
goto LABEL_37;
}
}
v42 = (__int64)*(this + 172);
if ( v42 )
(*(void (__fastcall **)(__int64, char *, __int64))(*(_QWORD *)v42 + 8LL))(v42, v5, 4294967294LL);
return _stack_chk_guard;
}