//
// FriendRequestPopup::init from 0x1403a16e0 to 0x1403a1ec1 (2017 bytes)
//
// 2 xrefs:
// > FriendRequestPopup::create @ 0x1403a1699
// > ??> @ 0x14092360c
//
// This function is hookable on this platform (idp: pc, 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 11:31:17 +0000
//
// Hidden C++ exception states: #wind=3
char __fastcall FriendRequestPopup::init(__int64 a1, __int64 a2, char a3)
{
char v5; // r12
__int64 v6; // rdx
__int64 v7; // rdx
__int64 v8; // rcx
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rax
__int64 *v12; // rdi
__int64 v13; // rdx
__int64 v14; // rbx
__int64 v15; // rax
__int64 v16; // rbx
__int64 v17; // rax
__int64 v18; // rcx
__int64 v19; // rax
const char *v20; // rcx
struct cocos2d::CCLabelBMFont *v21; // rsi
__int64 v22; // rbx
__int64 v23; // rax
unsigned int v24; // ebx
__int64 v25; // rcx
int *v26; // rdx
size_t v27; // r8
void **v28; // rdx
void **v29; // rcx
struct cocos2d::CCLabelBMFont *v30; // rdi
__int64 v31; // rax
__int64 v32; // rbx
__int64 v33; // rax
cocos2d::CCLayerColor *v34; // rax
__int64 *v35; // rdi
__int64 v36; // rbx
__int64 v37; // rax
struct cocos2d::CCSprite *v38; // rax
cocos2d::CCObject *v39; // rax
__int64 v40; // rsi
__int64 v41; // rbx
__int64 v42; // rdi
__int64 v43; // rax
__int64 v44; // rax
__int64 v45; // rax
__int64 v46; // rbx
__int64 v47; // rdx
bool v48; // bl
struct cocos2d::CCSprite *v49; // rax
int v50; // ebx
cocos2d::CCObject *v51; // rsi
__int64 v52; // rdi
__int64 v53; // rbx
__int64 v54; // rax
__int64 v55; // rax
void *v56; // rcx
void *v58; // [rsp+38h] [rbp-A9h] BYREF
float v59; // [rsp+40h] [rbp-A1h] BYREF
float v60; // [rsp+44h] [rbp-9Dh]
_BYTE v61[8]; // [rsp+48h] [rbp-99h] BYREF
_BYTE v62[8]; // [rsp+50h] [rbp-91h] BYREF
_BYTE v63[16]; // [rsp+58h] [rbp-89h] BYREF
void *Block[2]; // [rsp+68h] [rbp-79h] BYREF
__int64 v65; // [rsp+78h] [rbp-69h]
unsigned __int64 v66; // [rsp+80h] [rbp-61h]
_BYTE v67[16]; // [rsp+88h] [rbp-59h] BYREF
__int64 v68; // [rsp+98h] [rbp-49h]
void *v69[4]; // [rsp+A8h] [rbp-39h] BYREF
v5 = 0;
LODWORD(v58) = 0;
if ( !a2 )
return 0;
*(_BYTE *)(a1 + 689) = a3;
LODWORD(v58) = -1778384896;
if ( !cocos2d::CCLayerColor::initWithColor((cocos2d::CCLayerColor *)a1, (const struct cocos2d::_ccColor4B *)&v58) )
return 0;
FLAlertLayer::incrementForcePrio((struct cocos2d::CCObject *)a1);
LOBYTE(v6) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 920LL))(a1, v6);
LOBYTE(v7) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 992LL))(a1, v7);
v9 = cocos2d::CCDirector::sharedDirector(v8);
cocos2d::CCDirector::getWinSize(v9, &v59);
v10 = cocos2d::CCLayer::create();
*(_QWORD *)(a1 + 584) = v10;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v10);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v67, 0.0, 0.0, 80.0, 80.0);
v12 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("GJ_square02.png", v11);
LOBYTE(v13) = -1;
(*(void (__fastcall **)(__int64 *, __int64))(v12[40] + 40))(v12 + 40, v13);
v14 = *v12;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v58, 340.0, 190.0);
(*(void (__fastcall **)(__int64 *, __int64))(v14 + 312))(v12, v15);
(*(void (__fastcall **)(_QWORD, __int64 *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v12,
0xFFFFFFFFLL);
v16 = *v12;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, v59 * 0.5, v60 * 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v16 + 184))(v12, v17);
v19 = cocos2d::CCMenu::create(v18);
*(_QWORD *)(a1 + 552) = v19;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v19, 10);
*(_DWORD *)(a1 + 640) = -1;
v20 = "Friend Request";
if ( *(_BYTE *)(a1 + 689) )
v20 = "Sent Request";
v21 = cocos2d::CCLabelBMFont::create(v20, (const char *)&qword_140704F78);
v22 = *(_QWORD *)v21;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, v59 * 0.5, (float)((float)(v60 * 0.5) + 95.0) - 16.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v22 + 184))(v21, v23);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v21);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v21 + 160LL))(v21);
v24 = *(_DWORD *)(a2 + 324);
v25 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v58 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v58);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v25 = *(_QWORD *)&qword_14090BFB0;
}
GameLevelManager::tryGetUsername(v25, (__int64)v69, v24);
v26 = &dword_1407285AC;
if ( *(_BYTE *)(a1 + 689) )
v26 = (int *)"To: ";
*(_OWORD *)Block = 0;
v65 = 0;
v66 = 0;
v27 = -1;
do
++v27;
while ( *((_BYTE *)v26 + v27) );
sub_14003D230(Block, v26, v27);
v28 = v69;
if ( v69[3] > (void *)0xF )
v28 = (void **)v69[0];
sub_140044D80(Block, v28, (size_t)v69[2]);
v29 = Block;
if ( v66 > 0xF )
v29 = (void **)Block[0];
v30 = cocos2d::CCLabelBMFont::create((const char *)v29, "goldFont.fnt");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v67, 0.0, -20.0);
v32 = v31;
v33 = (*(__int64 (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v21 + 200LL))(v21);
cocos2d::CCPoint::operator+(v33, &v58, v32);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, void **))(*(_QWORD *)v30 + 184LL))(v30, &v58);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v30);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v30 + 160LL))(v30);
v34 = LoadingCircle::create();
*(_QWORD *)(a1 + 704) = v34;
*((_QWORD *)v34 + 69) = *(_QWORD *)(a1 + 584);
*(_BYTE *)(*(_QWORD *)(a1 + 704) + 560LL) = 0;
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 704) + 160LL))(*(_QWORD *)(a1 + 704));
LoadingCircle::show(*(_QWORD *)(a1 + 704));
v35 = *(__int64 **)(*(_QWORD *)(a1 + 704) + 544LL);
v36 = *v35;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v67, v59 * 0.5, (float)(v60 * 0.5) - 4.0);
(*(void (__fastcall **)(__int64 *, __int64))(v36 + 184))(v35, v37);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 704) + 336LL))(*(_QWORD *)(a1 + 704), 0);
v38 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
LODWORD(v36) = (_DWORD)v38;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v38 + 160LL))(v38);
v39 = CCMenuItemSpriteExtra::create(v36, 0, a1, (__int64)FriendRequestPopup::onClose);
*(_QWORD *)(a1 + 712) = v39;
*((_DWORD *)v39 + 93) = 1070386381;
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
*(_QWORD *)(a1 + 712));
v40 = **(_QWORD **)(a1 + 712);
v41 = *(_QWORD *)(a1 + 552);
v42 = *(_QWORD *)(a1 + 712);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v67,
(float)((float)(v59 * 0.5) - 170.0) + 5.0,
(float)((float)(v60 * 0.5) + 95.0) - 5.0);
cocos2d::CCNode::convertToNodeSpace(v41, &v58, v43);
(*(void (__fastcall **)(__int64, __int64))(v40 + 184))(v42, v44);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v62, v59 * 0.5, (float)(v60 * 0.5) - 4.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v63, 0.0, 0.0, 80.0, 80.0);
v45 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)v67, (const struct cocos2d::CCRect *)v63);
v46 = cocos2d::extension::CCScale9Sprite::create("square02b_001.png", v45);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v61, 290.0, 80.0);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v46 + 312LL))(v46, v61);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v46,
0xFFFFFFFFLL);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v46 + 184LL))(v46, v62);
LOWORD(v58) = 16514;
BYTE2(v58) = 33;
v46 += 320;
(**(void (__fastcall ***)(__int64, void **))v46)(v46, &v58);
(**(void (__fastcall ***)(__int64, void *))v46)(v46, &unk_1407034A8);
LOBYTE(v47) = 75;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v46 + 40LL))(v46, v47);
v48 = false;
if ( !*(_BYTE *)(a1 + 689) )
{
sub_14003F4F0((__int64)v67, a2 + 336);
v5 = 3;
if ( v68 )
v48 = true;
}
if ( (v5 & 1) != 0 )
sub_14003D310((__int64)v67);
if ( v48 )
{
v49 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_reportBtn_001.png");
v50 = (int)v49;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v49 + 160LL))(v49);
v51 = CCMenuItemSpriteExtra::create(v50, 0, a1, (__int64)FriendRequestPopup::onReport);
*((_DWORD *)v51 + 93) = 1067030938;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v51);
v52 = *(_QWORD *)v51;
v53 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v67,
(float)((float)(v59 * 0.5) - 170.0) + 5.0,
(float)((float)(v60 * 0.5) - 95.0) + 8.0);
cocos2d::CCNode::convertToNodeSpace(v53, &v58, v54);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v52 + 184))(v51, v55);
}
FriendRequestPopup::loadFromGJFriendRequest(a1, a2);
if ( v66 > 0xF )
{
v56 = Block[0];
if ( v66 + 1 >= 0x1000 )
{
v56 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v56 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v56);
}
v65 = 0;
v66 = 15;
LOBYTE(Block[0]) = 0;
sub_14003D310((__int64)v69);
return 1;
}