//
// GameLevelManager::readFriendRequest from 0x726fa8 to 0x72743c (1172 bytes)
//
// 2 xrefs:
// > FriendRequestPopup::onClose @ 0x8c2fcc
// > ??> @ 0x42870
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void GameLevelManager::readFriendRequest(GameLevelManager *a1, int a2)
{
cocos2d::CCString *v4; // x0
char *CString; // x25
cocos2d::CCDictionary *m_friendReqAndUserBlocks; // x23
__int64 v7; // x26
char *v8; // x0
unsigned int *v9; // x1
int v10; // w2
cocos2d::CCDictionary *v11; // x27
cocos2d::CCNode *v12; // x26
char *v13; // x0
cocos2d::CCString *v14; // x0
const char *v15; // x0
cocos2d::CCString *v16; // x0
size_t v17; // x0
char *v18; // x0
char *v19; // x0
char *v20; // x0
char *v21; // x22
unsigned int *v22; // x20
int v23; // w0
unsigned int *v24; // x1
int v25; // w2
unsigned int *v26; // x1
int v27; // w2
unsigned int *v28; // x1
int v29; // w2
unsigned int *v30; // x1
int v31; // w2
_QWORD v32[2]; // [xsp+0h] [xbp+0h] BYREF
const char *v33; // [xsp+68h] [xbp+68h]
char *v34; // [xsp+98h] [xbp+98h] BYREF
const char *v35; // [xsp+A0h] [xbp+A0h] BYREF
const char *v36; // [xsp+A8h] [xbp+A8h] BYREF
std::string v37; // [xsp+B0h] [xbp+B0h] BYREF
if ( a2 > 0 )
{
v4 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"readFriendReq_%i",
*(const char **)&a2);
CString = (char *)cocos2d::CCString::getCString(v4);
m_friendReqAndUserBlocks = a1->m_friendReqAndUserBlocks;
sub_D153B8((unsigned int)v32 + 176, CString);
v7 = cocos2d::CCDictionary::objectForKey(m_friendReqAndUserBlocks, &v37);
v8 = (char *)v37.m_data.m_data - 24;
if ( (__int64 *)v37.m_data.m_data - 3 == &qword_124B6B0 )
goto LABEL_3;
if ( &pthread_create )
{
v9 = (unsigned int *)((char *)v37.m_data.m_data - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *((_DWORD *)v37.m_data.m_data - 2);
*((_DWORD *)v37.m_data.m_data - 2) = v10 - 1;
}
if ( v10 > 0 )
{
LABEL_3:
if ( v7 )
return;
}
else
{
operator delete(v8);
if ( v7 )
return;
}
v11 = a1->m_friendReqAndUserBlocks;
v12 = cocos2d::CCNode::create();
sub_D153B8((unsigned int)v32 + 176, CString);
cocos2d::CCDictionary::setObject((int)v11, v12);
v13 = (char *)v37.m_data.m_data - 24;
if ( (__int64 *)v37.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = (unsigned int *)((char *)v37.m_data.m_data - 8);
do
v31 = __ldaxr(v30);
while ( __stlxr(v31 - 1, v30) );
}
else
{
v31 = *((_DWORD *)v37.m_data.m_data - 2);
*((_DWORD *)v37.m_data.m_data - 2) = v31 - 1;
}
if ( v31 <= 0 )
operator delete(v13);
}
GameLevelManager::getBasePostString(a1, (__int64)&v34);
v14 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)off_50 + 7,
"mfd",
"2893",
103,
98,
"7");
v15 = cocos2d::CCString::getCString(v14);
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&requestID=%i&secret=%s",
(const char *)(unsigned int)a2,
v15);
v33 = cocos2d::CCString::getCString(v16);
v17 = strlen(v33);
sub_D15FD4(&v34, v33, v17);
sub_D153B8((int)&v35, "https://www.boomlings.com/database/readGJFriendRequest20.php");
sub_D153B8((int)&v36, v34);
sub_D153B8((int)&v37, CString);
GameLevelManager::ProcessHttpRequest(a1, &v35, &v36, (cocos2d::extension::CCHttpClient **)&v37, 32);
v18 = (char *)v37.m_data.m_data - 24;
if ( (__int64 *)v37.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)((char *)v37.m_data.m_data - 8);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *((_DWORD *)v37.m_data.m_data - 2);
*((_DWORD *)v37.m_data.m_data - 2) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v18);
}
v19 = (char *)(v36 - 24);
if ( v36 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)(v36 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *((_DWORD *)v36 - 2);
*((_DWORD *)v36 - 2) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v19);
}
v20 = (char *)(v35 - 24);
if ( v35 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v35 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *((_DWORD *)v35 - 2);
*((_DWORD *)v35 - 2) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v20);
}
v21 = v34 - 24;
if ( v34 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v34 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *((_DWORD *)v34 - 2);
*((_DWORD *)v34 - 2) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v21);
}
}
}