//
// FriendRequestPopup::init from 0xa316d4 to 0xa31e60 (1932 bytes)
//
// 2 xrefs:
// > FriendRequestPopup::create @ 0xa31ff4
// > ??> @ 0x7da58
//
// 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:59:48 +0000
//
__int64 __fastcall FriendRequestPopup::init(cocos2d::CCNode ***this, GJFriendRequest *a2, char a3)
{
unsigned __int8 v5; // w0
unsigned int v6; // w23
cocos2d::CCDirector *v8; // x0
cocos2d::CCDirector *v9; // x0
cocos2d::CCLayer *WinSize; // x0
__int64 v11; // x0
__int64 v12; // x22
void (__fastcall *v13)(__int64, __int64 *); // x25
__int64 (__fastcall *v14)(__int64, __int64 *); // x25
cocos2d::CCMenu *v15; // x0
__int64 v16; // x0
const char *v17; // x2
int v18; // w0
char *v19; // x0
__int64 v20; // x22
void (__fastcall *v21)(__int64, __int64 *); // x25
GameLevelManager *v22; // x0
cocos2d::CCDictionary **v23; // x0
const char *v24; // x1
size_t v25; // x0
char *v26; // x1
size_t v27; // x2
const char *v28; // x2
cocos2d::CCLabelBMFont *v29; // x0
__int64 v30; // x25
void (__fastcall *v31)(__int64, __int64 *); // x26
__int64 v32; // x27
LoadingCircle *v33; // x0
__int64 v34; // x0
cocos2d::CCNode *v35; // x25
void (__fastcall *v36)(cocos2d::CCNode *, __int64 *); // x26
const char *v37; // x1
__int64 v38; // x25
__int64 v39; // x0
__int64 v40; // x25
cocos2d::CCNode *v41; // x27
void (__fastcall *v42)(__int64, __int64 *); // x26
__int64 v43; // x22
void (__fastcall *v44)(__int64, __int64 *); // x2
char v45; // w0
__int64 v46; // x0
const char *v47; // x1
_BOOL4 v48; // w22
__int64 v49; // x22
__int64 v50; // x22
void (__fastcall *v51)(__int64, __int64 *); // x26
cocos2d::CCNode *v52; // x27
char *v53; // [xsp+88h] [xbp+88h]
__int64 v54; // [xsp+90h] [xbp+90h] BYREF
_BYTE v55[8]; // [xsp+98h] [xbp+98h] BYREF
_BYTE v56[8]; // [xsp+A0h] [xbp+A0h] BYREF
_BYTE v57[8]; // [xsp+A8h] [xbp+A8h] BYREF
_BYTE v58[16]; // [xsp+B0h] [xbp+B0h] BYREF
__int64 v59[2]; // [xsp+C0h] [xbp+C0h] BYREF
__int64 v60[2]; // [xsp+D0h] [xbp+D0h] BYREF
void *v61; // [xsp+E0h] [xbp+E0h]
__int64 v62[2]; // [xsp+E8h] [xbp+E8h] BYREF
cocos2d::CCLabelBMFont *v63; // [xsp+F8h] [xbp+F8h]
__int64 v64; // [xsp+100h] [xbp+100h] BYREF
const char *v65; // [xsp+108h] [xbp+108h]
void *v66; // [xsp+110h] [xbp+110h]
if ( a2
&& (*((_BYTE *)this + 689) = a3,
LODWORD(v59[0]) = -1778384896,
v5 = cocos2d::CCLayerColor::initWithColor(this, v59),
(v6 = v5) != 0) )
{
FLAlertLayer::incrementForcePrio((cocos2d::CCObject *)this);
((void (__fastcall *)(cocos2d::CCNode ***, __int64))(*this)[125])(this, 1);
v8 = (cocos2d::CCDirector *)((__int64 (__fastcall *)(cocos2d::CCNode ***, __int64))(*this)[134])(this, 1);
v9 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v8);
WinSize = (cocos2d::CCLayer *)cocos2d::CCDirector::getWinSize(&v54, v9);
v11 = cocos2d::CCLayer::create(WinSize);
*(this + 73) = (cocos2d::CCNode **)v11;
((void (__fastcall *)(cocos2d::CCNode ***, __int64))(*this)[57])(this, v11);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v59, 0.0, 0.0, 80.0, 80.0);
v12 = cocos2d::extension::CCScale9Sprite::create("GJ_square02.png", v59);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v12 + 912LL))(v12, 0xFFFFFFFFLL);
v13 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v12 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v59, 340.0, 190.0);
v13(v12, v59);
(*((void (__fastcall **)(_QWORD, __int64, __int64))**(this + 73) + 58))(*(this + 73), v12, 0xFFFFFFFFLL);
v14 = *(__int64 (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v12 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v59, *(float *)&v54 * 0.5, *((float *)&v54 + 1) * 0.5);
v15 = (cocos2d::CCMenu *)v14(v12, v59);
v16 = cocos2d::CCMenu::create(v15);
*(this + 69) = (cocos2d::CCNode **)v16;
(*((void (__fastcall **)(_QWORD, __int64, __int64))**(this + 73) + 58))(*(this + 73), v16, 10);
v18 = *((unsigned __int8 *)this + 689);
*((_DWORD *)this + 160) = -1;
if ( v18 )
v19 = "Sent Request";
else
v19 = "Friend Request";
v20 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)v19, "bigFont.fnt", v17);
v21 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v20 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v59,
*(float *)&v54 * 0.5,
(float)((float)(*((float *)&v54 + 1) * 0.5) + 95.0) - 16.0);
v21(v20, v59);
(*((void (__fastcall **)(_QWORD, __int64))**(this + 73) + 57))(*(this + 73), v20);
v22 = (GameLevelManager *)(*(__int64 (__fastcall **)(__int64, float))(*(_QWORD *)v20 + 160LL))(v20, 0.6);
v23 = (cocos2d::CCDictionary **)GameLevelManager::sharedState(v22);
GameLevelManager::tryGetUsername(v60, v23, *((_DWORD *)a2 + 80));
if ( *((_BYTE *)this + 689) )
v24 = "To: ";
else
v24 = "From: ";
v53 = (char *)v24;
v62[0] = 0;
v62[1] = 0;
v63 = nullptr;
v25 = strlen(v24);
std::string::__init(v62, v53, v25);
if ( (v60[0] & 1) != 0 )
{
v26 = (char *)v61;
v27 = v60[1];
}
else
{
v27 = LOBYTE(v60[0]) >> 1;
v26 = (char *)v60 + 1;
}
std::string::append((__int64)v62, v26, v27);
v29 = (cocos2d::CCLabelBMFont *)((char *)v62 + 1);
if ( (v62[0] & 1) != 0 )
v29 = v63;
v30 = cocos2d::CCLabelBMFont::create(v29, "goldFont.fnt", v28);
v31 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v30 + 184LL);
v32 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v20 + 192LL))(v20);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v58, 0.0, -20.0);
cocos2d::CCPoint::operator+(v59, v32);
v31(v30, v59);
(*((void (__fastcall **)(_QWORD, __int64))**(this + 73) + 57))(*(this + 73), v30);
v33 = (LoadingCircle *)(*(__int64 (__fastcall **)(__int64, float))(*(_QWORD *)v30 + 160LL))(v30, 0.6);
v34 = LoadingCircle::create(v33);
*(this + 88) = (cocos2d::CCNode **)v34;
*(_QWORD *)(v34 + 552) = *(this + 73);
*((_BYTE *)*(this + 88) + 560) = 0;
(*((void (__fastcall **)(_QWORD, float))**(this + 88) + 20))(*(this + 88), 0.8);
LoadingCircle::show(*(this + 88));
v35 = (*(this + 88))[68];
v36 = *(void (__fastcall **)(cocos2d::CCNode *, __int64 *))(*(_QWORD *)v35 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v59, *(float *)&v54 * 0.5, (float)(*((float *)&v54 + 1) * 0.5) + -4.0);
v36(v35, v59);
(*((void (__fastcall **)(_QWORD, _QWORD))**(this + 88) + 43))(*(this + 88), 0);
v38 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v37);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v38 + 160LL))(v38, 0.8);
v39 = CCMenuItemSpriteExtra::create(v38, 0, (__int64)this, (__int64)FriendRequestPopup::onClose, 0);
*(this + 89) = (cocos2d::CCNode **)v39;
CCMenuItemSpriteExtra::setSizeMult(v39, 1.6);
(*((void (__fastcall **)(_QWORD, _QWORD))**(this + 69) + 57))(*(this + 69), *(this + 89));
v40 = (__int64)*(this + 89);
v41 = (cocos2d::CCNode *)*(this + 69);
v42 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v40 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v58,
(float)((float)(*(float *)&v54 * 0.5) + -170.0) + 5.0,
(float)((float)(*((float *)&v54 + 1) * 0.5) + 95.0) - 5.0);
cocos2d::CCNode::convertToNodeSpace(v59, v41, (const cocos2d::CCPoint *)v58);
v42(v40, v59);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v55, *(float *)&v54 * 0.5, (float)(*((float *)&v54 + 1) * 0.5) + -4.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v58, 0.0, 0.0, 80.0, 80.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v59, (const cocos2d::CCRect *)v58);
v43 = cocos2d::extension::CCScale9Sprite::create("square02b_001.png", v59);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v56, 290.0, 80.0);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v43 + 320LL))(v43, v56);
(*((void (__fastcall **)(_QWORD, __int64, __int64))**(this + 73) + 58))(*(this + 73), v43, 0xFFFFFFFFLL);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v43 + 184LL))(v43, v55);
v44 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v43 + 960LL);
LOWORD(v59[0]) = 16514;
BYTE2(v59[0]) = 33;
v44(v43, v59);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v43 + 960LL))(v43, &unk_116D890);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v43 + 912LL))(v43, 75);
if ( !*((_BYTE *)this + 689) )
{
v45 = *((_BYTE *)a2 + 328);
v64 = 0;
v65 = nullptr;
v66 = nullptr;
if ( (v45 & 1) != 0 )
{
std::string::__init(&v64, *((void **)a2 + 43), *((_QWORD *)a2 + 42));
}
else
{
v46 = *((_QWORD *)a2 + 41);
v47 = *((const char **)a2 + 42);
v66 = *((void **)a2 + 43);
v64 = v46;
v65 = v47;
}
if ( (v64 & 1) != 0 )
{
v48 = v65 != nullptr;
operator delete(v66);
}
else
{
v48 = (int)(unsigned __int8)v64 >> 1 != 0;
}
if ( v48 )
{
v49 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_reportBtn_001.png", v47);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v49 + 160LL))(v49, 0.6);
v50 = CCMenuItemSpriteExtra::create(v49, 0, (__int64)this, (__int64)FriendRequestPopup::onReport, 0);
CCMenuItemSpriteExtra::setSizeMult(v50, 1.2);
(*((void (__fastcall **)(_QWORD, __int64))**(this + 69) + 57))(*(this + 69), v50);
v51 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v50 + 184LL);
v52 = (cocos2d::CCNode *)*(this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v57,
(float)((float)(*(float *)&v54 * 0.5) + -170.0) + 5.0,
(float)((float)(*((float *)&v54 + 1) * 0.5) + -95.0) + 8.0);
cocos2d::CCNode::convertToNodeSpace(v59, v52, (const cocos2d::CCPoint *)v57);
v51(v50, v59);
}
}
FriendRequestPopup::loadFromGJFriendRequest((FriendRequestPopup *)this, a2);
if ( (v62[0] & 1) != 0 )
operator delete(v63);
if ( (v60[0] & 1) != 0 )
operator delete(v61);
}
else
{
return 0;
}
return v6;
}