//
// GameLevelManager::acceptFriendRequest from 0x140161170 to 0x14016148c (796 bytes)
//
// 2 xrefs:
// > FriendRequestPopup::onAccept @ 0x140296b9c
// > ??> @ 0x1406cab78
//
// 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
bool GameLevelManager::acceptFriendRequest(GameLevelManager *a1, int a2, int a3)
{
cocos2d::CCString *v6; // rax
const char *CString; // rax
const char *v8; // rdi
size_t v9; // rbx
size_t v10; // r8
__int64 v11; // r15
void *v12; // rcx
size_t v13; // r8
__int64 v14; // rax
__int64 v15; // rcx
void *v16; // rcx
cocos2d::CCString *v17; // rax
const char *v18; // rax
cocos2d::CCString *v19; // rax
char *v20; // rax
size_t v21; // r8
size_t v22; // r8
_QWORD *v23; // rdx
__int128 v25; // [rsp+40h] [rbp-79h] BYREF
__int64 v26; // [rsp+50h] [rbp-69h]
__int64 v27; // [rsp+58h] [rbp-61h]
__int128 v28; // [rsp+60h] [rbp-59h] BYREF
__int64 v29; // [rsp+70h] [rbp-49h]
__int64 v30; // [rsp+78h] [rbp-41h]
__int128 *v31; // [rsp+80h] [rbp-39h]
__int128 *v32; // [rsp+88h] [rbp-31h]
void *Block[2]; // [rsp+98h] [rbp-21h] BYREF
__int128 v34; // [rsp+A8h] [rbp-11h]
_QWORD Src[4]; // [rsp+B8h] [rbp-1h] BYREF
if ( a2 <= 0 || a3 <= 0 )
return 0;
v6 = cocos2d::CCString::createWithFormat("accFriendReq_%i_%i", a2, a3);
CString = cocos2d::CCString::getCString(v6);
v8 = CString;
*(_OWORD *)Block = 0;
v34 = 0;
v9 = -1;
v10 = -1;
do
++v10;
while ( CString[v10] );
sub_14003A930(Block, CString, v10);
v11 = cocos2d::CCDictionary::objectForKey(a1->m_friendReqAndUserBlocks, Block);
if ( *((_QWORD *)&v34 + 1) > 0xFu )
{
v12 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v34 + 1) + 1LL) >= 0x1000 )
{
v12 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v12 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v12);
}
if ( v11 )
return 0;
*(_OWORD *)Block = 0;
v34 = 0;
v13 = -1;
do
++v13;
while ( v8[v13] );
sub_14003A930(Block, v8, v13);
v14 = cocos2d::CCNode::create();
cocos2d::CCDictionary::setObject(a1->m_friendReqAndUserBlocks, v14, Block);
if ( *((_QWORD *)&v34 + 1) > 0xFu )
{
v16 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v34 + 1) + 1LL) >= 0x1000 )
{
v16 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v16 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v16);
}
GameLevelManager::getBasePostString(v15, Src);
v17 = cocos2d::CCString::createWithFormat("%c%s%s%c%c%s", 87, "mfd", "2893", 103, 98, (const char *)&word_140531E88);
v18 = cocos2d::CCString::getCString(v17);
v19 = cocos2d::CCString::createWithFormat("&targetAccountID=%i&requestID=%i&secret=%s", a2, a3, v18);
v20 = (char *)cocos2d::CCString::getCString(v19);
v21 = -1;
do
++v21;
while ( v20[v21] );
sub_140041270(Src, v20, v21);
v31 = &v25;
v32 = &v28;
v25 = 0;
v26 = 0;
v27 = 0;
v22 = -1;
do
++v22;
while ( v8[v22] );
sub_14003A930(&v25, v8, v22);
v23 = Src;
if ( Src[3] > 0xFu )
v23 = (_QWORD *)Src[0];
v28 = 0;
v29 = 0;
v30 = 0;
do
++v9;
while ( *((_BYTE *)v23 + v9) );
sub_14003A930(&v28, v23, v9);
*(_OWORD *)Block = 0;
*(_QWORD *)&v34 = 0;
*((_QWORD *)&v34 + 1) = 15;
Block[0] = sub_14003AA10(0x40u);
*(_QWORD *)&v34 = 62;
*((_QWORD *)&v34 + 1) = 63;
strcpy((char *)Block[0], "https://www.boomlings.com/database/acceptGJFriendRequest20.php");
GameLevelManager::ProcessHttpRequest(a1, (__int64)Block, (const char *)&v28, (const char *)&v25, 31);
sub_14003A830((__int64)Src);
return 1;
}