//
// FriendRequestPopup::loadFromGJFriendRequest from 0x4ace50 to 0x4ad310 (1216 bytes)
//
// 1 xrefs:
// > FriendRequestPopup::init @ 0x4ad782
//
// 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
//
void FriendRequestPopup::loadFromGJFriendRequest(FriendRequestPopup *a1, GJFriendRequest *a2)
{
cocos2d::CCDirector *v3; // r0
int v4; // r8
int i; // r2
int v6; // r6
unsigned int v7; // r3
float v8; // s17
cocos2d::CCNode *v9; // r8
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
int v11; // r10
cocos2d::CCString *v12; // r0
cocos2d::CCLabelBMFont *v13; // r8
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r10
void (__fastcall *v15)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
ButtonSprite *v16; // r0
CCMenuItemSpriteExtra *v17; // r8
cocos2d::CCMenu *m_buttonMenu; // r10
ButtonSprite *v19; // r0
CCMenuItemSpriteExtra *v20; // r8
void (__fastcall *v21)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
ButtonSprite *v22; // r0
CCMenuItemSpriteExtra *v23; // r5
cocos2d::CCMenu *v24; // r10
void (__fastcall *v25)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
float v26; // [sp+10h] [bp-74h]
float v27; // [sp+10h] [bp-74h]
void (__fastcall *v28)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+18h] [bp-6Ch]
char *v29; // [sp+20h] [bp-64h] BYREF
int v30; // [sp+24h] [bp-60h] BYREF
_BYTE v31[4]; // [sp+28h] [bp-5Ch] BYREF
int v32; // [sp+2Ch] [bp-58h] BYREF
int v33; // [sp+30h] [bp-54h] BYREF
cocos2d::CCSize v34; // [sp+34h] [bp-50h] BYREF
cocos2d::CCPoint v35; // [sp+3Ch] [bp-48h] BYREF
cocos2d::CCPoint v36; // [sp+44h] [bp-40h] BYREF
cocos2d::CCPoint v37; // [sp+4Ch] [bp-38h] BYREF
cocos2d::CCPoint v38; // [sp+54h] [bp-30h] BYREF
cocos2d::CCPoint v39; // [sp+5Ch] [bp-28h] BYREF
void (*v40)(FriendRequestPopup *, cocos2d::CCObject *); // [sp+64h] [bp-20h]
int v41; // [sp+68h] [bp-1Ch]
cocos2d::CCPoint v42; // [sp+6Ch] [bp-18h] BYREF
cocos2d::CCPoint v43; // [sp+74h] [bp-10h] BYREF
if ( a1->m_request || !a2 )
return;
a1->m_request = a2;
cocos2d::CCObject::retain(a2);
GameLevelManager::sharedState()->m_uploadActionDelegate = &a1->UploadActionDelegate;
v3 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v34, v3);
sub_776584((int)&v29, "No message");
sub_775C20(&v30);
v4 = *(_DWORD *)(v30 - 12);
sub_774008(&v30);
if ( v4 )
{
sub_775C20(v31);
sub_774794(&v29, v31);
sub_774008(v31);
}
sub_776584((int)&v32, byte_965AA5);
sub_776584((int)&v33, (char *)&unk_939830);
for ( i = 0; ; i = *(_DWORD *)(v33 - 12) + v6 )
{
v6 = sub_774834(&v29, &v32, i);
if ( v6 == -1 )
break;
sub_776454(&v29, v6, *(_DWORD *)(v32 - 12), &v33);
}
v7 = *((_DWORD *)v29 - 3);
if ( v7 > 0xB4 )
{
v7 = 180;
}
else if ( v7 <= 0x46 )
{
v8 = 1.0;
goto LABEL_14;
}
v8 = (float)((float)((float)(int)(180 - v7) / 180.0) * 0.3) + 0.7;
LABEL_14:
cocos2d::CCPoint::CCPoint(&v35, v34.width * 0.5, (float)(v34.height * 0.5) - 4.0);
sub_776584((int)&v37, v29);
cocos2d::CCPoint::CCPoint(&v43, 0.5, 0.5);
v9 = (cocos2d::CCNode *)TextArea::create(
(TextArea *)&v37,
(std::string)"chatFont.fnt",
(const char *)0x3F800000,
COERCE_INT(210.0 / v8),
&v43,
(cocos2d::CCPoint)0x141A00000LL);
sub_774008(&v37);
a1->m_mainLayer->addChild(a1->m_mainLayer, v9);
setPosition = v9->setPosition;
cocos2d::CCPoint::CCPoint(&v42, 0.0, 1.0);
cocos2d::CCPoint::operator+(&v43, &v35, &v42);
setPosition(v9, &v43);
v9->setScale(v9, COERCE_FLOAT(LODWORD(v8)));
sub_775C20(&v38);
v11 = *(_DWORD *)(LODWORD(v38.x) - 12);
sub_774008(&v38);
if ( v11 )
{
sub_775C20(&v39);
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s ago",
(const char *)LODWORD(v39.x));
cocos2d::CCString::getCString(v12);
v13 = cocos2d::CCLabelBMFont::create();
sub_774008(&v39);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v13, 1);
setAnchorPoint = v13->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v43, 1.0, 0.5);
setAnchorPoint(v13, &v43);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v13->setScale)(v13, 1058642330);
v13->setColor(v13, &stru_9AC15C);
v13->setOpacity(v13, 225);
v15 = v13->setPosition;
cocos2d::CCPoint::CCPoint(
&v43,
(float)((float)(v34.width * 0.5) + 170.0) - 8.0,
(float)((float)(v34.height * 0.5) + 95.0) - 12.0);
v15(v13, &v43);
}
cocos2d::CCPoint::CCPoint(&v36, v34.width * 0.5, (float)((float)(v34.height * 0.5) - 95.0) + 22.0);
v16 = ButtonSprite::create(
(ButtonSprite *)"Accept",
(const char *)&dword_40 + 1,
0,
0.55,
1,
"bigFont.fnt",
"GJ_button_01.png",
(const char *)0x41D00000,
COERCE_FLOAT(&v32));
v41 = 0;
v40 = FriendRequestPopup::onAccept;
v17 = CCMenuItemSpriteExtra::create(
v16,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(FriendRequestPopup::onAccept, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v17);
m_buttonMenu = a1->m_buttonMenu;
v28 = v17->setPosition;
cocos2d::CCPoint::CCPoint(&v39, -120.0, 0.0);
cocos2d::CCPoint::operator+(&v42, &v36, &v39);
cocos2d::CCNode::convertToNodeSpace(&v43, m_buttonMenu, &v42);
v28(v17, &v43);
v19 = ButtonSprite::create(
(ButtonSprite *)"Remove",
(const char *)&dword_40 + 1,
0,
0.55,
1,
"bigFont.fnt",
"GJ_button_04.png",
(const char *)0x41D00000,
v26);
v42.y = 0.0;
LODWORD(v42.x) = FriendRequestPopup::onRemove;
v20 = CCMenuItemSpriteExtra::create(
v19,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(FriendRequestPopup::onRemove, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v20);
v21 = v20->setPosition;
cocos2d::CCNode::convertToNodeSpace(&v43, a1->m_buttonMenu, &v36);
v21(v20, &v43);
v22 = ButtonSprite::create(
(ButtonSprite *)"Block",
(const char *)&dword_40 + 1,
0,
0.55,
1,
"bigFont.fnt",
"GJ_button_06.png",
(const char *)0x41D00000,
v27);
v43.y = 0.0;
LODWORD(v43.x) = FriendRequestPopup::onBlock;
v23 = CCMenuItemSpriteExtra::create(
v22,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(FriendRequestPopup::onBlock, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v23);
v24 = a1->m_buttonMenu;
v25 = v23->setPosition;
cocos2d::CCPoint::CCPoint(&v37, 120.0, 0.0);
cocos2d::CCPoint::operator+(&v38, &v36, &v37);
cocos2d::CCNode::convertToNodeSpace(&v39, v24, &v38);
v25(v23, &v39);
sub_774008(&v33);
sub_774008(&v32);
sub_774008(&v29);
}