//
// FriendRequestPopup::loadFromGJFriendRequest from 0x140296180 to 0x140296a95 (2325 bytes)
//
// 2 xrefs:
// > FriendRequestPopup::init @ 0x1402960dd
// > ??> @ 0x1406d1be0
//
// 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=9
void FriendRequestPopup::loadFromGJFriendRequest(FriendRequestPopup *a1, GJFriendRequest *a2)
{
__int64 v3; // rcx
__int64 v4; // rax
cocos2d::CCDirector *v5; // rax
bool v6; // bl
void *v7; // rcx
size_t v8; // r13
unsigned __int64 i; // rbx
void **v10; // r15
unsigned __int64 v11; // r12
char *v12; // rsi
int v13; // r14d
char *v14; // rbx
float v15; // xmm6_4
unsigned __int64 v16; // rbx
char *v17; // r9
void **v18; // rdx
size_t v19; // r8
const struct cocos2d::CCPoint *v20; // rax
char *v21; // rbx
FriendRequestPopup *v22; // rsi
float v23; // xmm0_4
double v24; // xmm0_8
const char *v25; // rdx
cocos2d::CCString *v26; // rax
const char *CString; // rax
struct cocos2d::CCLabelBMFont *v28; // rdi
float v29; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v30; // rbx
const cocos2d::CCPoint *v31; // rax
__int64 v32; // rdx
float v33; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v34; // rbx
__int64 v35; // rax
ButtonSprite *v36; // rbx
CCMenuItemSpriteExtra *v37; // rdi
float v38; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v39; // rbx
struct cocos2d::CCPoint v40; // rax
ButtonSprite *v41; // rbx
CCMenuItemSpriteExtra *v42; // rdi
CCMenuItemSpriteExtra_vtbl *v43; // rbx
struct cocos2d::CCPoint v44; // rax
ButtonSprite *v45; // rbx
CCMenuItemSpriteExtra *v46; // rdi
float v47; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v48; // rbx
struct cocos2d::CCPoint v49; // rax
void *v50; // rcx
void *v51; // rcx
ButtonSprite *v52; // [rsp+60h] [rbp-A8h] BYREF
__int64 v53; // [rsp+68h] [rbp-A0h]
FriendRequestPopup *v54; // [rsp+70h] [rbp-98h] BYREF
__int128 *v55; // [rsp+78h] [rbp-90h] BYREF
char v56[8]; // [rsp+80h] [rbp-88h] BYREF
char v57[8]; // [rsp+88h] [rbp-80h] BYREF
__int128 v58; // [rsp+90h] [rbp-78h] BYREF
__int128 v59; // [rsp+A0h] [rbp-68h]
void *v60[2]; // [rsp+B0h] [rbp-58h] BYREF
__int128 v61; // [rsp+C0h] [rbp-48h]
void *Block[2]; // [rsp+D0h] [rbp-38h] BYREF
size_t v63; // [rsp+E0h] [rbp-28h]
unsigned __int64 v64; // [rsp+E8h] [rbp-20h]
void *Buf2[2]; // [rsp+F0h] [rbp-18h] BYREF
__int64 v66; // [rsp+100h] [rbp-8h]
__int64 v67; // [rsp+108h] [rbp+0h]
v54 = a1;
if ( a1->m_request || !a2 )
return;
a1->m_request = a2;
cocos2d::CCObject::retain(a2);
v4 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v55 = (__int128 *)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v4 = qword_1406C2EC0;
}
*(_QWORD *)(v4 + 808) = &a1->UploadActionDelegate;
v5 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v3);
cocos2d::CCDirector::getWinSize(v5);
v60[1] = (void *)25959;
*(_QWORD *)&v61 = 10;
*((_QWORD *)&v61 + 1) = 15;
v60[0] = (void *)0x617373656D206F4ELL;
sub_14003BDB0((__int64)&v58, (__int64)&a1->m_request->m_message);
v6 = (_QWORD)v59 != 0;
sub_14003A830((__int64)&v58);
if ( v6 )
{
sub_14003BDB0((__int64)&v58, (__int64)&a1->m_request->m_message);
if ( *((_QWORD *)&v61 + 1) > 0xFu )
{
v7 = v60[0];
if ( (unsigned __int64)(*((_QWORD *)&v61 + 1) + 1LL) >= 0x1000 )
{
v7 = *((void **)v60[0] - 1);
if ( (unsigned __int64)((char *)v60[0] - (char *)v7 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v7);
}
*(_OWORD *)v60 = v58;
v61 = v59;
*(_QWORD *)&v59 = 0;
*((_QWORD *)&v59 + 1) = 15;
LOBYTE(v58) = 0;
sub_14003A830((__int64)&v58);
}
*(_OWORD *)Buf2 = 0;
v66 = 1;
v67 = 15;
LOWORD(Buf2[0]) = 160;
*(_OWORD *)Block = 0;
v8 = 0;
v63 = 0;
v64 = 15;
LOBYTE(Block[0]) = 0;
for ( i = 0; ; i = v63 + v16 )
{
v10 = v60;
if ( *((_QWORD *)&v61 + 1) > 0xFu )
v10 = (void **)v60[0];
v11 = v61;
if ( !(_QWORD)v61 )
break;
if ( i > (__int64)v61 - 1 )
break;
v12 = (char *)v10 + v61 - 1;
v13 = SLOBYTE(Buf2[0]);
v14 = (char *)memchr((char *)v10 + i, SLOBYTE(Buf2[0]), v61 - i);
if ( !v14 )
break;
while ( memcmp(v14, Buf2, 1u) )
{
v14 = (char *)memchr(v14 + 1, v13, v12 - v14);
if ( !v14 )
goto LABEL_19;
}
v16 = v14 - (char *)v10;
if ( v16 == -1 )
break;
v17 = (char *)Block;
if ( v64 > 0xF )
v17 = (char *)Block[0];
sub_140041FF0(v60, v16, 1u, v17, v8);
v8 = v63;
}
LABEL_19:
v15 = 1.0;
if ( v11 >= 0xB4 )
{
LODWORD(v11) = 180;
LABEL_27:
v15 = (float)((float)((float)(180 - (int)v11) / 180.0) * 0.30000001) + 0.69999999;
goto LABEL_28;
}
if ( (int)v11 > 70 )
goto LABEL_27;
LABEL_28:
cocos2d::CCPoint::CCPoint(0.0, *(float *)&v53 * 0.5);
v55 = &v58;
v18 = v60;
if ( *((_QWORD *)&v61 + 1) > 0xFu )
v18 = (void **)v60[0];
v58 = 0;
v59 = 0u;
v19 = -1;
do
++v19;
while ( *((_BYTE *)v18 + v19) );
sub_14003A930(&v58, v18, v19);
cocos2d::CCPoint::CCPoint(0.0, 0.5);
v21 = TextArea::create((__int64)&v58, "chatFont.fnt", 1.0, 210.0 / v15, v20, 1101004800, 1);
v22 = v54;
v23 = ((float (__fastcall *)(cocos2d::CCLayer *, char *))v54->m_mainLayer->addChild_1)(v54->m_mainLayer, v21);
cocos2d::CCPoint::CCPoint(v23, 0.0);
cocos2d::CCPoint::operator+(v57, &v54);
v24 = (*(double (__fastcall **)(char *, FriendRequestPopup **))(*(_QWORD *)v21 + 184LL))(v21, &v54);
(*(void (__fastcall **)(char *))(*(_QWORD *)v21 + 160LL))(v21);
sub_14003BDB0((__int64)&v58, (__int64)&v22->m_request->m_uploadDate);
LOBYTE(v21) = (_QWORD)v59 != 0;
sub_14003A830((__int64)&v58);
if ( (_BYTE)v21 )
{
sub_14003BDB0((__int64)&v58, (__int64)&v22->m_request->m_uploadDate);
v25 = (const char *)&v58;
if ( *((_QWORD *)&v59 + 1) > 0xFu )
v25 = (const char *)v58;
v26 = cocos2d::CCString::createWithFormat("%s ago", v25);
CString = cocos2d::CCString::getCString(v26);
v28 = cocos2d::CCLabelBMFont::create(CString, "chatFont.fnt");
sub_14003A830((__int64)&v58);
v29 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::CCLabelBMFont *, __int64))v22->m_mainLayer->addChild_0)(
v22->m_mainLayer,
v28,
1);
v30 = v28->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v29, 1.0);
v30->setAnchorPoint(v28, v31);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v28->setScale_0)(v28);
v28->setColor(&v28->cocos2d::CCRGBAProtocol, &stru_140529AD4);
LOBYTE(v32) = -31;
v33 = ((float (__fastcall *)(cocos2d::CCRGBAProtocol *, __int64))v28->setOpacity)(
&v28->cocos2d::CCRGBAProtocol,
v32);
v34 = v28->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v33, (float)((float)(*(float *)&v53 * 0.5) + 170.0) - 8.0);
*(float *)&v24 = ((float (__fastcall *)(struct cocos2d::CCLabelBMFont *, __int64))v34->setPosition_0)(v28, v35);
}
cocos2d::CCPoint::CCPoint(*(float *)&v24, *(float *)&v53 * 0.5);
v52 = (ButtonSprite *)operator new(0x2C0u);
v36 = ButtonSprite::ButtonSprite(v52);
if ( v36 )
{
if ( ButtonSprite::init_1(
v36,
"Accept",
65,
0,
0.55000001,
1,
(const char *)&qword_14052A4D8,
"GJ_button_01.png",
26.0) )
{
cocos2d::CCObject::autorelease(v36);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v36->~ButtonSprite)(v36, 1);
v36 = nullptr;
}
}
v37 = CCMenuItemSpriteExtra::create(v36, nullptr, v22, (cocos2d::SEL_MenuHandler *)FriendRequestPopup::onAccept);
v38 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v22->m_buttonMenu->addChild_1)(
v22->m_buttonMenu,
v37);
cocos2d::CCPoint::CCPoint(v38, -120.0);
cocos2d::CCPoint::operator+(v56, &v54);
v39 = v37->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v40 = cocos2d::CCNode::convertToNodeSpace(v22->m_buttonMenu, (const struct cocos2d::CCPoint *)&v55);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v39->setPosition_0)(v37, v40);
v52 = (ButtonSprite *)operator new(0x2C0u);
v41 = ButtonSprite::ButtonSprite(v52);
if ( v41 )
{
if ( ButtonSprite::init_1(
v41,
"Remove",
65,
0,
0.55000001,
1,
(const char *)&qword_14052A4D8,
"GJ_button_04.png",
26.0) )
{
cocos2d::CCObject::autorelease(v41);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v41->~ButtonSprite)(v41, 1);
v41 = nullptr;
}
}
v42 = CCMenuItemSpriteExtra::create(v41, nullptr, v22, (cocos2d::SEL_MenuHandler *)FriendRequestPopup::onRemove);
v22->m_buttonMenu->addChild_1(v22->m_buttonMenu, v42);
v43 = v42->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v44 = cocos2d::CCNode::convertToNodeSpace(v22->m_buttonMenu, (const struct cocos2d::CCPoint *)&v52);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v43->setPosition_0)(v42, v44);
v52 = (ButtonSprite *)operator new(0x2C0u);
v45 = ButtonSprite::ButtonSprite(v52);
if ( v45 )
{
if ( ButtonSprite::init_1(
v45,
"Block",
65,
0,
0.55000001,
1,
(const char *)&qword_14052A4D8,
"GJ_button_06.png",
26.0) )
{
cocos2d::CCObject::autorelease(v45);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v45->~ButtonSprite)(v45, 1);
v45 = nullptr;
}
}
v46 = CCMenuItemSpriteExtra::create(v45, nullptr, v22, (cocos2d::SEL_MenuHandler *)FriendRequestPopup::onBlock);
v47 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v22->m_buttonMenu->addChild_1)(
v22->m_buttonMenu,
v46);
cocos2d::CCPoint::CCPoint(v47, 120.0);
cocos2d::CCPoint::operator+(v56, &v54);
v48 = v46->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v49 = cocos2d::CCNode::convertToNodeSpace(v22->m_buttonMenu, (const struct cocos2d::CCPoint *)&v55);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v48->setPosition_0)(v46, v49);
if ( v64 > 0xF )
{
v50 = Block[0];
if ( v64 + 1 >= 0x1000 )
{
v50 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v50 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v50);
}
if ( *((_QWORD *)&v61 + 1) > 0xFu )
{
v51 = v60[0];
if ( (unsigned __int64)(*((_QWORD *)&v61 + 1) + 1LL) >= 0x1000 )
{
v51 = *((void **)v60[0] - 1);
if ( (unsigned __int64)((char *)v60[0] - (char *)v51 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v51);
}
}