//
// FriendRequestPopup::init from 0x5df08c to 0x5df5e6 (1370 bytes)
//
// 1 xrefs:
// > FriendRequestPopup::create @ 0x5df6c4
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:54:14 +0000
//
int __fastcall FriendRequestPopup::init(FriendRequestPopup *this, GJFriendRequest *a2, bool a3)
{
int v5; // r6
cocos2d::CCDirector *v6; // r0
cocos2d::CCLayer *WinSize; // r0
int v8; // r0
int v9; // r3
int v10; // r9
void (__fastcall *v11)(int, _DWORD *); // r8
int (__fastcall *v12)(int, _DWORD *); // r8
cocos2d::CCMenu *v13; // r0
int v14; // r0
const char *v15; // r2
char *v16; // r0
int v17; // r9
void (__fastcall *v18)(int, _DWORD *); // r8
GameLevelManager *v19; // r0
cocos2d::CCDictionary **v20; // r0
const char *v21; // r10
size_t v22; // r0
char *v23; // r1
size_t v24; // r2
cocos2d::CCLabelBMFont *v25; // r0
int v26; // r8
void (__fastcall *v27)(int, _DWORD *); // r11
int v28; // r10
LoadingCircle *v29; // r0
cocos2d::CCLayerColor *v30; // r0
int v31; // r3
int v32; // r8
void (__fastcall *v33)(int, _DWORD *); // r9
const char *v34; // r1
int v35; // r8
int v36; // r0
int v37; // r9
const cocos2d::CCPoint *v38; // r11
void (__fastcall *v39)(int, _DWORD *); // r10
int v40; // r7
void (__fastcall *v41)(int, _DWORD *); // r3
int v42; // r7
const char *v43; // r1
int v44; // r7
int v45; // r7
const cocos2d::CCPoint *v46; // r11
void (__fastcall *v47)(int, _BYTE *); // r10
float v49; // [sp+10h] [bp-7Ch] BYREF
float v50; // [sp+14h] [bp-78h]
_BYTE v51[8]; // [sp+18h] [bp-74h] BYREF
_BYTE v52[8]; // [sp+20h] [bp-6Ch] BYREF
_BYTE v53[8]; // [sp+28h] [bp-64h] BYREF
_BYTE v54[8]; // [sp+30h] [bp-5Ch] BYREF
int (__fastcall *v55)(FriendRequestPopup *, cocos2d::CCObject *); // [sp+38h] [bp-54h]
int v56; // [sp+3Ch] [bp-50h]
unsigned __int8 v57; // [sp+40h] [bp-4Ch] BYREF
char v58; // [sp+41h] [bp-4Bh] BYREF
size_t v59; // [sp+44h] [bp-48h]
char *v60; // [sp+48h] [bp-44h]
int v61[2]; // [sp+4Ch] [bp-40h] BYREF
cocos2d::CCLabelBMFont *v62; // [sp+54h] [bp-38h]
int v63[3]; // [sp+58h] [bp-34h] BYREF
_BYTE v64[16]; // [sp+64h] [bp-28h] BYREF
_DWORD v65[4]; // [sp+74h] [bp-18h] BYREF
if ( !a2 )
return 0;
*((_BYTE *)this + 533) = a3;
v65[0] = -1778384896;
v5 = cocos2d::CCLayerColor::initWithColor(this, v65);
if ( !v5 )
return 0;
FLAlertLayer::incrementForcePrio(this);
(*(void (__fastcall **)(FriendRequestPopup *, int))(*(_DWORD *)this + 500))(this, 1);
v6 = (cocos2d::CCDirector *)(*(int (__fastcall **)(FriendRequestPopup *, int))(*(_DWORD *)this + 536))(this, 1);
cocos2d::CCDirector::sharedDirector(v6);
WinSize = (cocos2d::CCLayer *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v49);
v8 = cocos2d::CCLayer::create(WinSize);
v9 = *(_DWORD *)this;
*((_DWORD *)this + 115) = v8;
(*(void (__fastcall **)(FriendRequestPopup *, int))(v9 + 228))(this, v8);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v65, 0.0, 0.0, 80.0, 80.0);
v10 = cocos2d::extension::CCScale9Sprite::create("GJ_square02.png", v65);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v10 + 456))(v10, 255);
v11 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v10 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v65, 340.0, 190.0);
v11(v10, v65);
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v10, -1);
v12 = *(int (__fastcall **)(int, _DWORD *))(*(_DWORD *)v10 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, v49 * 0.5, v50 * 0.5);
v13 = (cocos2d::CCMenu *)v12(v10, v65);
v14 = cocos2d::CCMenu::create(v13);
*((_DWORD *)this + 111) = v14;
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v14, 10);
*((_DWORD *)this + 125) = -1;
if ( *((_BYTE *)this + 533) )
v16 = "Sent Request";
else
v16 = "Friend Request";
v17 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)v16, "bigFont.fnt", v15);
v18 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v17 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, v49 * 0.5, (float)((float)(v50 * 0.5) + 95.0) - 16.0);
v18(v17, v65);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 115) + 228))(*((_DWORD *)this + 115), v17);
v19 = (GameLevelManager *)(*(int (__fastcall **)(int, int))(*(_DWORD *)v17 + 80))(v17, 1058642330);
v20 = (cocos2d::CCDictionary **)GameLevelManager::sharedState(v19);
GameLevelManager::tryGetUsername((GameLevelManager *)&v57, v20, *((_DWORD *)a2 + 67));
if ( *((_BYTE *)this + 533) )
v21 = "To: ";
else
v21 = "From: ";
v61[0] = 0;
v61[1] = 0;
v62 = nullptr;
v22 = strlen(v21);
std::string::__init(v61, v21, v22);
if ( (v57 & 1) != 0 )
{
v23 = v60;
v24 = v59;
}
else
{
v24 = (int)v57 >> 1;
v23 = &v58;
}
std::string::append(v61, v23, v24);
if ( (v61[0] & 1) != 0 )
v25 = v62;
else
v25 = (cocos2d::CCLabelBMFont *)((char *)v61 + 1);
v26 = cocos2d::CCLabelBMFont::create(v25, "goldFont.fnt", (const char *)(LOBYTE(v61[0]) << 31));
v27 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v26 + 92);
v28 = (*(int (__fastcall **)(int))(*(_DWORD *)v17 + 96))(v17);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v64, 0.0, -20.0);
cocos2d::CCPoint::operator+(v65, v28, v64);
v27(v26, v65);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 115) + 228))(*((_DWORD *)this + 115), v26);
v29 = (LoadingCircle *)(*(int (__fastcall **)(int, int))(*(_DWORD *)v26 + 80))(v26, 1058642330);
v30 = LoadingCircle::create(v29);
v31 = *((_DWORD *)this + 115);
*((_DWORD *)this + 135) = v30;
*((_DWORD *)v30 + 111) = v31;
*(_BYTE *)(*((_DWORD *)this + 135) + 448) = 0;
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 135) + 80))(*((_DWORD *)this + 135), 1061997773);
LoadingCircle::show(*((cocos2d::CCNode ***)this + 135));
v32 = *(_DWORD *)(*((_DWORD *)this + 135) + 440);
v33 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v32 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, v49 * 0.5, (float)(v50 * 0.5) - 4.0);
v33(v32, v65);
(*(void (__fastcall **)(_DWORD, _DWORD))(**((_DWORD **)this + 135) + 172))(*((_DWORD *)this + 135), 0);
v35 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v34);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v35 + 80))(v35, 1061997773);
v55 = FriendRequestPopup::onClose;
v56 = 0;
v36 = CCMenuItemSpriteExtra::create(v35, 0, (int)this, (int)FriendRequestPopup::onClose, 0);
*((_DWORD *)this + 136) = v36;
CCMenuItemSpriteExtra::setSizeMult(v36, 1.6);
(*(void (__fastcall **)(_DWORD, _DWORD))(**((_DWORD **)this + 111) + 228))(
*((_DWORD *)this + 111),
*((_DWORD *)this + 136));
v37 = *((_DWORD *)this + 136);
v38 = *((const cocos2d::CCPoint **)this + 111);
v39 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v37 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v64,
(float)((float)(v49 * 0.5) - 170.0) + 5.0,
(float)((float)(v50 * 0.5) + 95.0) - 5.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v65, v38);
v39(v37, v65);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v51, v49 * 0.5, (float)(v50 * 0.5) - 4.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v64, 0.0, 0.0, 80.0, 80.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v65, (const cocos2d::CCRect *)v64);
v40 = cocos2d::extension::CCScale9Sprite::create("square02b_001.png", v65);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v52, 290.0, 80.0);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v40 + 160))(v40, v52);
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v40, -1);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v40 + 92))(v40, v51);
v41 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v40 + 480);
LOWORD(v65[0]) = 16514;
BYTE2(v65[0]) = 33;
v41(v40, v65);
(*(void (__fastcall **)(int, void *))(*(_DWORD *)v40 + 480))(v40, &unk_BEE20E);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v40 + 456))(v40, 75);
if ( !*((_BYTE *)this + 533) )
{
std::string::basic_string(v63, (int)a2 + 276);
if ( (v63[0] & 1) != 0 )
v42 = v63[1];
else
v42 = (int)LOBYTE(v63[0]) >> 1;
std::string::~string((int)v63);
if ( v42 )
{
v44 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_reportBtn_001.png", v43);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v44 + 80))(v44, 1058642330);
v65[0] = FriendRequestPopup::onReport;
v65[1] = 0;
v45 = CCMenuItemSpriteExtra::create(v44, 0, (int)this, (int)FriendRequestPopup::onReport, 0);
CCMenuItemSpriteExtra::setSizeMult(v45, 1.2);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v45);
v46 = *((const cocos2d::CCPoint **)this + 111);
v47 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v45 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v53,
(float)((float)(v49 * 0.5) - 170.0) + 5.0,
(float)((float)(v50 * 0.5) - 95.0) + 8.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v54, v46);
v47(v45, v54);
}
}
FriendRequestPopup::loadFromGJFriendRequest((int)this, a2);
std::string::~string((int)v61);
std::string::~string((int)&v57);
return v5;
}