//
// FriendRequestPopup::init from 0x1002d8c04 to 0x1002d916c (1384 bytes)
//
// 1 xrefs:
// > FriendRequestPopup::create @ 0x1002d8bb8
//
// 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
//
bool __fastcall FriendRequestPopup::init(FriendRequestPopup *a1, GJFriendRequest *a2)
{
_BOOL4 v4; // w0
cocos2d::CCDirector *v5; // x0
cocos2d::CCLayer *v6; // x0
cocos2d::extension::CCScale9Sprite *v7; // x21
__n128 v8; // q0
__n128 v9; // q1
cocos2d::CCMenu *v10; // x0
cocos2d::CCLabelBMFont *v11; // x21
__n128 v12; // q0
__n128 v13; // q1
GameLevelManager *v14; // x0
void **v15; // x1
std::string::size_type v16; // x2
std::string *v17; // x0
cocos2d::CCLabelBMFont *v18; // x22
float32x2_t *v19; // x21
__n128 v20; // q0
__n128 v21; // q1
double v22; // d0
LoadingCircle *v23; // x0
cocos2d::CCSprite *m_sprite; // x21
__n128 v25; // q0
__n128 v26; // q1
cocos2d::CCSprite *v27; // x21
CCMenuItemSpriteExtra *v28; // x0
__n128 v29; // q0
CCMenuItemSpriteExtra *m_closeBtn; // x21
cocos2d::CCMenu *m_buttonMenu; // x22
__n128 v32; // q1
__n128 v33; // q0
__n128 v34; // q1
double v35; // d0
cocos2d::extension::CCScale9Sprite *v36; // x21
float v37; // s1
float v38; // s2
float v39; // s3
__int16 v41; // [xsp+Ch] [xbp-94h] BYREF
char v42; // [xsp+Eh] [xbp-92h]
float32x2_t v43[2]; // [xsp+10h] [xbp-90h] BYREF
float32x2_t v44[2]; // [xsp+20h] [xbp-80h] BYREF
int v45; // [xsp+30h] [xbp-70h] BYREF
std::string v46; // [xsp+38h] [xbp-68h] BYREF
void *__p[2]; // [xsp+50h] [xbp-50h] BYREF
unsigned __int8 v48; // [xsp+67h] [xbp-39h]
float v49; // [xsp+68h] [xbp-38h]
float v50; // [xsp+6Ch] [xbp-34h]
cocos2d::CCPoint v51; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v52; // 0:x3.16
cocos2d::CCRect v53; // 0:kr10_16.16
cocos2d::CCRect v54; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
if ( a2 )
{
LODWORD(__p[0]) = -1778384896;
v4 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::ccColor4B *)__p);
if ( v4 )
{
FLAlertLayer::incrementForcePrio(a1);
((void (__fastcall *)(FriendRequestPopup *, __int64))a1->setTouchEnabled)(a1, 1);
((void (__fastcall *)(FriendRequestPopup *, __int64))a1->setKeypadEnabled)(a1, 1);
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
v6 = cocos2d::CCLayer::create();
a1->m_mainLayer = v6;
((void (__fastcall *)(FriendRequestPopup *, cocos2d::CCLayer *))a1->addChild)(a1, v6);
sub_100022990((float *)__p, 0.0, 0.0, 80.0, 80.0);
v7 = cocos2d::extension::CCScale9Sprite::create("GJ_square02.png", v54);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v7->setOpacity)(v7, 255);
sub_100022988((float *)__p, 340.0, 190.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, void **))v7->setContentSize)(v7, __p);
v8 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v7,
0xFFFFFFFFLL);
v8.n128_f32[0] = v49 * 0.5;
v9.n128_f32[0] = v50 * 0.5;
sub_100022980(v8, v9, __p);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, void **))v7->setPosition)(v7, __p);
v10 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v10;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v10,
10);
a1->m_joystickConnected = -1;
v11 = cocos2d::CCLabelBMFont::create_1("Friend Request", "bigFont.fnt");
v12.n128_f32[0] = v49 * 0.5;
v13.n128_f32[0] = (float)((float)(v50 * 0.5) + 95.0) + -16.0;
sub_100022980(v12, v13, __p);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void **))v11->setPosition)(v11, __p);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(
a1->m_mainLayer,
v11);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v11->setScale)(v11, 0.6);
v14 = GameLevelManager::sharedState();
GameLevelManager::tryGetUsername((__int64)v14, a2->m_accountID, (__int64)__p);
sub_100009900(&v46, "From: ");
if ( (v48 & 0x80u) == 0 )
v15 = __p;
else
v15 = (void **)__p[0];
if ( (v48 & 0x80u) == 0 )
v16 = v48;
else
v16 = (std::string::size_type)__p[1];
std::string::append(&v46, (const std::string::value_type *)v15, v16);
if ( (v46.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v17 = &v46;
else
v17 = (std::string *)v46.__r_.__value_.__r.__words[0];
v18 = cocos2d::CCLabelBMFont::create_1((const char *)v17, "goldFont.fnt");
v19 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v11->getPosition)(v11);
v20.n128_u32[0] = 0;
v21.n128_u32[0] = -20.0;
sub_100022980(v20, v21, v43);
*(float32x2_t *)&v22 = sub_1000229DC(v19, v43, v44);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *, double))v18->setPosition)(v18, v44, v22);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(
a1->m_mainLayer,
v18);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v18->setScale)(v18, 0.6);
v23 = LoadingCircle::create();
a1->m_circle = v23;
v23->m_parentLayer = a1->m_mainLayer;
v23->m_fade = 0;
((void (__fastcall *)(LoadingCircle *, float))v23->setScale)(v23, 0.8);
LoadingCircle::show(a1->m_circle);
m_sprite = a1->m_circle->m_sprite;
v25.n128_f32[0] = v49 * 0.5;
v26.n128_f32[0] = (float)(v50 * 0.5) + -4.0;
sub_100022980(v25, v26, v44);
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *))m_sprite->setPosition)(m_sprite, v44);
((void (__fastcall *)(LoadingCircle *, _QWORD))a1->m_circle->setVisible)(a1->m_circle, 0);
v27 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v27->setScale)(v27, 0.8);
v52.ptr = (void (__cdecl *)(cocos2d::CCObject *))FriendRequestPopup::onClose;
v52.adj = 0;
v28 = CCMenuItemSpriteExtra::create(v27, nullptr, a1, v52);
a1->m_closeBtn = v28;
CCMenuItemSpriteExtra::setSizeMult(v28, 1.6);
v29 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
a1->m_closeBtn);
v29.n128_f32[0] = (float)((float)(v49 * 0.5) + -170.0) + 5.0;
m_closeBtn = a1->m_closeBtn;
m_buttonMenu = a1->m_buttonMenu;
v32.n128_f32[0] = (float)((float)(v50 * 0.5) + 95.0) + -5.0;
sub_100022980(v29, v32, v43);
v51 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, (const cocos2d::CCPoint *)v43);
v33 = ((__n128 (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, float, float))m_closeBtn->setPosition)(
m_closeBtn,
v44,
v51.x,
v51.y);
v33.n128_f32[0] = v49 * 0.5;
v34.n128_f32[0] = (float)(v50 * 0.5) + -4.0;
sub_100022980(v33, v34, &v45);
sub_100022990((float *)v44, 0.0, 0.0, 80.0, 80.0);
v35 = sub_100022B98(v43, (__int64)v44);
v53.origin.x = *(float *)&v35;
v53.origin.y = v37;
v53.size.width = v38;
v53.size.height = v39;
v36 = cocos2d::extension::CCScale9Sprite::create("square02b_001.png", v53);
sub_100022988((float *)v43, 290.0, 80.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *))v36->setContentSize)(v36, v43);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v36,
0xFFFFFFFFLL);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, int *))v36->setPosition)(v36, &v45);
v42 = 33;
v41 = 16514;
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int16 *))v36->setColor)(v36, &v41);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, void *))v36->setColor)(v36, &unk_100644748);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v36->setOpacity)(v36, 75);
FriendRequestPopup::loadFromGJFriendRequest(a1, a2);
if ( SHIBYTE(v46.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v46.__r_.__value_.__l.__data_);
if ( (char)v48 < 0 )
operator delete(__p[0]);
LOBYTE(v4) = 1;
}
}
else
{
LOBYTE(v4) = 0;
}
return v4;
}