//
// FriendRequestPopup::loadFromGJFriendRequest from 0x1403a1ed0 to 0x1403a2718 (2120 bytes)
//
// 2 xrefs:
// > FriendRequestPopup::init @ 0x1403a1e19
// > ??> @ 0x140923618
//
// 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=8
void __fastcall FriendRequestPopup::loadFromGJFriendRequest(__int64 a1, cocos2d::CCObject *a2, __int64 a3, double a4)
{
__int64 v5; // rcx
__int64 v6; // rax
__int64 v7; // rax
size_t v8; // rbx
char *v9; // rdx
size_t v10; // r8
float v11; // xmm6_4
__int64 v12; // rdx
__int64 v13; // rcx
__int64 v14; // r8
__int64 v15; // r8
__int64 v16; // rdx
__int64 v17; // rcx
__int64 v18; // r8
__int64 v19; // r8
int v20; // eax
void **v21; // rdx
__int64 v22; // rdx
__int64 v23; // rcx
__int64 v24; // r8
int v25; // ebx
const struct cocos2d::CCPoint *v26; // rax
char *v27; // rbx
__int64 v28; // rax
float v29; // xmm8_4
const char *v30; // rdx
cocos2d::CCString *v31; // rax
const char *CString; // rax
struct cocos2d::CCLabelBMFont *v33; // rdi
__int64 v34; // rbx
__int64 v35; // rax
__int64 v36; // rdx
__int64 v37; // rbx
__int64 v38; // rax
cocos2d::CCObject *v39; // rbx
cocos2d::CCObject *v40; // rdi
__int128 **v41; // r8
void **v42; // rdx
char v43; // r15
cocos2d::CCObject *v44; // rbx
cocos2d::CCObject *v45; // rdi
__int64 v46; // rax
__int64 v47; // rbx
__int64 v48; // rax
cocos2d::CCObject *v49; // rbx
cocos2d::CCObject *v50; // rdi
__int64 v51; // rbx
__int64 v52; // rax
cocos2d::CCObject *v53; // rbx
__int64 v54; // rax
__int64 v55; // rbx
__int64 v56; // rax
void *v57; // [rsp+58h] [rbp-B0h] BYREF
float v58; // [rsp+60h] [rbp-A8h] BYREF
float v59; // [rsp+64h] [rbp-A4h]
__int128 *v60; // [rsp+68h] [rbp-A0h] BYREF
_BYTE v61[8]; // [rsp+70h] [rbp-98h] BYREF
_BYTE v62[8]; // [rsp+78h] [rbp-90h] BYREF
_BYTE v63[8]; // [rsp+80h] [rbp-88h] BYREF
__int128 v64; // [rsp+88h] [rbp-80h] BYREF
__int64 v65; // [rsp+98h] [rbp-70h]
unsigned __int64 v66; // [rsp+A0h] [rbp-68h]
void *v67[4]; // [rsp+A8h] [rbp-60h] BYREF
if ( *(_QWORD *)(a1 + 696) || !a2 )
return;
*(_QWORD *)(a1 + 696) = a2;
cocos2d::CCObject::retain(a2);
v6 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v60 = (__int128 *)operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v60);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v6 = *(_QWORD *)&qword_14090BFB0;
}
*(_QWORD *)(v6 + 1488) = a1 + 664;
v7 = cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(v7, &v58);
sub_14003F4F0((__int64)v67, *(_QWORD *)(a1 + 696) + 336LL);
v8 = -1;
if ( !v67[2] )
{
v9 = "Sent you a friend request";
if ( *(_BYTE *)(a1 + 689) )
v9 = "Friend request sent";
v10 = -1;
do
++v10;
while ( v9[v10] );
sub_1400405A0(v67, v9, v10);
}
GameToolbox::stripNonBreakingSpaces((unsigned __int64 *)v67);
v11 = 1.0;
ensureEmotesAreLoaded(v13, v12, v14, a4);
if ( (int)EmoteSprite::effectiveLength(v67, dword_1408FE3A4, v15, a4) >= 180 )
{
v20 = 180;
LABEL_15:
v11 = (float)((float)((float)(180 - v20) / 180.0) * 0.30000001) + 0.69999999;
goto LABEL_16;
}
ensureEmotesAreLoaded(v17, v16, v18, a4);
v20 = EmoteSprite::effectiveLength(v67, dword_1408FE3A4, v19, a4);
if ( v20 > 70 )
goto LABEL_15;
LABEL_16:
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v63, v58 * 0.5, (float)(v59 * 0.5) - 4.0);
v60 = &v64;
v21 = v67;
if ( v67[3] > (void *)0xF )
v21 = (void **)v67[0];
v64 = 0;
v65 = 0;
v66 = 0;
do
++v8;
while ( *((_BYTE *)v21 + v8) );
sub_14003D230(&v64, v21, v8);
ensureEmotesAreLoaded(v23, v22, v24, a4);
v25 = dword_1408FE3A4;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v62, 0.5, 0.5);
v27 = TextArea::create((__int64)&v64, "chatFont.fnt", 1.0, 231.0 / v11, v26, 1101004800, 1, v25);
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v27);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v57, 0.0, 1.0);
cocos2d::CCPoint::operator+(v63, &v60, v28);
(*(void (__fastcall **)(char *, __int128 **))(*(_QWORD *)v27 + 184LL))(v27, &v60);
(*(void (__fastcall **)(char *))(*(_QWORD *)v27 + 160LL))(v27);
sub_14003F4F0((__int64)&v64, *(_QWORD *)(a1 + 696) + 368LL);
LOBYTE(v27) = v65 != 0;
sub_14003D310((__int64)&v64);
v29 = 95.0;
if ( (_BYTE)v27 )
{
sub_14003F4F0((__int64)&v64, *(_QWORD *)(a1 + 696) + 368LL);
v30 = (const char *)&v64;
if ( v66 > 0xF )
v30 = (const char *)v64;
v31 = cocos2d::CCString::createWithFormat("%s ago", v30);
CString = cocos2d::CCString::getCString(v31);
v33 = cocos2d::CCLabelBMFont::create(CString, "chatFont.fnt");
sub_14003D310((__int64)&v64);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v33,
1);
v34 = *(_QWORD *)v33;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v57, 1.0, 0.5);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v34 + 288))(v33, v35);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v33 + 160LL))(v33);
(**((void (__fastcall ***)(__int64, void *))v33 + 46))((__int64)v33 + 368, &unk_1407034A8);
LOBYTE(v36) = -31;
(*(void (__fastcall **)(__int64, __int64))(*((_QWORD *)v33 + 46) + 40LL))((__int64)v33 + 368, v36);
v37 = *(_QWORD *)v33;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v57,
(float)((float)(v58 * 0.5) + 170.0) - 8.0,
(float)((float)(v59 * 0.5) + 95.0) - 12.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v37 + 184))(v33, v38);
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v61, v58 * 0.5, (float)((float)(v59 * 0.5) - 95.0) + 22.0);
if ( *(_BYTE *)(a1 + 689) )
{
v57 = operator new(0x2C8u);
v39 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v57);
if ( v39 )
{
if ( ButtonSprite::init_1(
(__int64)v39,
(__int64)"Cancel",
65,
0,
1057803469,
1,
&qword_140704F78,
(__int64)"GJ_button_06.png",
1104150528) )
{
cocos2d::CCObject::autorelease(v39);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v39 + 8LL))(v39, 1);
LODWORD(v39) = 0;
}
}
v40 = CCMenuItemSpriteExtra::create((int)v39, 0, a1, (__int64)FriendRequestPopup::onRemove);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v40);
v41 = (__int128 **)v61;
v42 = &v57;
}
else
{
v43 = *(_BYTE *)(*(_QWORD *)(a1 + 696) + 401LL);
if ( v43 )
v29 = 50.0;
v57 = operator new(0x2C8u);
v44 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v57);
if ( v44 )
{
if ( ButtonSprite::init_1(
(__int64)v44,
(__int64)"Accept",
65,
0,
1057803469,
1,
&qword_140704F78,
(__int64)"GJ_button_01.png",
1104150528) )
{
cocos2d::CCObject::autorelease(v44);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v44 + 8LL))(v44, 1);
LODWORD(v44) = 0;
}
}
v45 = CCMenuItemSpriteExtra::create((int)v44, 0, a1, (__int64)FriendRequestPopup::onAccept);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v45);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v57, -v29, 0.0);
cocos2d::CCPoint::operator+(v61, &v60, v46);
v47 = *(_QWORD *)v45;
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 552), v62, &v60);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v47 + 184))(v45, v48);
if ( !v43 )
{
v57 = operator new(0x2C8u);
v49 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v57);
if ( v49 )
{
if ( ButtonSprite::init_1(
(__int64)v49,
(__int64)"Ignore",
65,
0,
1057803469,
1,
&qword_140704F78,
(__int64)"GJ_button_04.png",
1104150528) )
{
cocos2d::CCObject::autorelease(v49);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v49 + 8LL))(v49, 1);
LODWORD(v49) = 0;
}
}
v50 = CCMenuItemSpriteExtra::create((int)v49, 0, a1, (__int64)FriendRequestPopup::onIgnore);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v50);
v51 = *(_QWORD *)v50;
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 552), &v57, v61);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v51 + 184))(v50, v52);
}
v57 = operator new(0x2C8u);
v53 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v57);
if ( v53 )
{
if ( ButtonSprite::init_1(
(__int64)v53,
(__int64)"Block",
65,
0,
1057803469,
1,
&qword_140704F78,
(__int64)"GJ_button_06.png",
1104150528) )
{
cocos2d::CCObject::autorelease(v53);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v53 + 8LL))(v53, 1);
LODWORD(v53) = 0;
}
}
v40 = CCMenuItemSpriteExtra::create((int)v53, 0, a1, (__int64)FriendRequestPopup::onBlock);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v40);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v57, v29, 0.0);
cocos2d::CCPoint::operator+(v61, &v60, v54);
v41 = &v60;
v42 = (void **)v62;
}
v55 = *(_QWORD *)v40;
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 552), v42, v41);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v55 + 184))(v40, v56);
sub_14003D310((__int64)v67);
}