//
// FriendsProfilePage::init from 0x100657c00 to 0x1006582cf (1743 bytes)
//
// 1 xrefs:
// > FriendsProfilePage::create @ 0x100657bbb
//
// 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 FriendsProfilePage::init(FriendsProfilePage *a1, UserListType a2)
{
bool result; // al
cocos2d::extension::CCScale9Sprite *v4; // r14
_BOOL8 v5; // rax
const char *v6; // rdi
cocos2d::CCLabelBMFont *v7; // r14
cocos2d::CCLabelBMFont *v8; // r15
unsigned __int64 *v9; // r14
cocos2d::CCLabelBMFont *v10; // rax
cocos2d::CCLabelBMFont *m_totalFriends; // r14
cocos2d::CCSprite *v12; // rax
CCMenuItemSpriteExtra *v13; // rax
int v14; // edx
int v15; // ecx
int v16; // r8d
int v17; // r9d
cocos2d::CCMenu *v18; // r14
cocos2d::CCSprite *v19; // rax
CCMenuItemSpriteExtra *v20; // r14
cocos2d::CCMenu *m_buttonMenu; // r15
cocos2d::CCLabelBMFont *v22; // rax
cocos2d::CCLabelBMFont *m_noInternet; // r14
LoadingCircle *v24; // rax
cocos2d::CCSprite *m_sprite; // r14
cocos2d::CCSprite *v26; // rax
CCMenuItemSpriteExtra *v27; // rax
CCMenuItemSpriteExtra *m_refreshBtn; // r14
cocos2d::CCMenu *v29; // r15
GameLevelManager *v30; // rax
cocos2d::CCArray *StoredUserList; // rax
GameLevelManager *v32; // rax
unsigned __int64 v33; // [rsp+0h] [rbp-50h] BYREF
float v34; // [rsp+8h] [rbp-48h]
double v35[2]; // [rsp+Ch] [rbp-44h] BYREF
bool v36; // [rsp+1Fh] [rbp-31h]
float v37; // [rsp+20h] [rbp-30h] BYREF
float v38; // [rsp+24h] [rbp-2Ch]
double v39; // 0:xmm0_8.8
double v40; // 0:xmm0_8.8
cocos2d::CCRect v41; // 0:xmm0_8.8,8:xmm1_8.8
result = FLAlertLayer::init_1(a1, 150);
if ( result )
{
v36 = result;
a1->m_type = a2;
a1->m_noElasticity = 1;
cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v37);
v41.origin = 0;
v41.size = 0;
sub_10028CC00((__int64)v35, 0.0, 0.0, (__m128)0x42A00000u, (__m128)0x42A00000u);
v4 = cocos2d::extension::CCScale9Sprite::create_2("GJ_square01.png", v41);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v4->setOpacity)(v4, 255);
sub_10028CBF0((float *)v35, 440.0, 290.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, double *))v4->setContentSize)(v4, v35);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v4,
0xFFFFFFFFLL);
sub_10028CBE0((float *)v35, v37 * 0.5, v38 * 0.5);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, double *))v4->setPosition)(v4, v35);
v5 = a1->m_type != Blocked;
v6 = "Friends";
if ( a1->m_type == Blocked )
v6 = "Blocked";
v34 = (float)((3 * v5) | 0xFFFFFFEC);
v7 = cocos2d::CCLabelBMFont::create_3(v6, "bigFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v7,
20);
sub_10028CBE0((float *)v35, v37 * 0.5, (float)((float)(v38 * 0.5) + 145.0) + v34);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, double *))v7->setPosition)(v7, v35);
cocos2d::CCLabelBMFont::limitLabelWidth(v7, 185.0, 0.80000001, 0.0);
if ( a1->m_type != Blocked )
{
v8 = cocos2d::CCLabelBMFont::create_3("Tap on a user to view their profile", "chatFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v8,
10);
v9 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v7->getPosition)(v7);
sub_10028CBE0((float *)&v33, 0.0, -21.0);
sub_10028CCE0(v35, v9, &v33);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, double *))v8->setPosition)(v8, v35);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v8->setScale)(v8, 0.60000002);
}
v10 = cocos2d::CCLabelBMFont::create_3(" ", "goldFont.fnt");
a1->m_totalFriends = v10;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v10,
10);
m_totalFriends = a1->m_totalFriends;
sub_10028CBE0((float *)v35, v37 * 0.5, (float)((float)(v38 * 0.5) + -145.0) + 25.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, double *))m_totalFriends->setPosition)(m_totalFriends, v35);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))a1->m_totalFriends->setScale)(a1->m_totalFriends, 0.69999999);
v12 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_backBtn_001.png");
v13 = CCMenuItemSpriteExtra::create(
v12,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)FriendsProfilePage::onClose);
LODWORD(m_totalFriends) = (_DWORD)v13;
CCMenuItemSpriteExtra::setSizeMult(v13, 1.6);
v18 = (cocos2d::CCMenu *)sub_100792C50((_DWORD)m_totalFriends, 0, v14, v15, v16, v17);
a1->m_buttonMenu = v18;
sub_10028CBE0(
(float *)v35,
(float)((float)(v37 * 0.5) + -220.0) + 10.0,
(float)((float)(v38 * 0.5) + 145.0) + -10.0);
((void (__fastcall *)(cocos2d::CCMenu *, double *))v18->setPosition)(v18, v35);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
a1->m_buttonMenu,
10);
if ( !a1->m_type )
{
v19 = cocos2d::CCSprite::createWithSpriteFrameName("accountBtn_blocked_001.png");
v20 = CCMenuItemSpriteExtra::create(
v19,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)FriendsProfilePage::onBlocked);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v20);
m_buttonMenu = a1->m_buttonMenu;
sub_10028CBE0(
(float *)&v33,
(float)((float)(v37 * 0.5) + 220.0) + -10.0,
(float)((float)(v38 * 0.5) + 145.0) + -10.0);
*(cocos2d::CCPoint *)&v39 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)v35,
(const cocos2d::CCPoint *)m_buttonMenu);
((void (__fastcall *)(CCMenuItemSpriteExtra *, double *, double))v20->setPosition)(v20, v35, v39);
}
v22 = cocos2d::CCLabelBMFont::create_3("Something went wrong...", "goldFont.fnt");
a1->m_noInternet = v22;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v22,
10);
m_noInternet = a1->m_noInternet;
sub_10028CBE0((float *)v35, v37 * 0.5, v38 * 0.5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, double *))m_noInternet->setPosition)(m_noInternet, v35);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))a1->m_noInternet->setScale)(a1->m_noInternet, 0.60000002);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _QWORD))a1->m_noInternet->setVisible)(a1->m_noInternet, 0);
v24 = LoadingCircle::create();
a1->m_circle = v24;
v24->m_parentLayer = a1->m_mainLayer;
v24->m_fade = 0;
cocos2d::CCObject::retain(v24);
LoadingCircle::show(a1->m_circle);
((void (__fastcall *)(LoadingCircle *, _QWORD))a1->m_circle->setVisible)(a1->m_circle, 0);
m_sprite = a1->m_circle->m_sprite;
sub_10028CBE0((float *)v35, v37 * 0.5, v38 * 0.5);
((void (__fastcall *)(cocos2d::CCSprite *, double *))m_sprite->setPosition)(m_sprite, v35);
v26 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png");
v27 = CCMenuItemSpriteExtra::create(
v26,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)FriendsProfilePage::onUpdate);
a1->m_refreshBtn = v27;
CCMenuItemSpriteExtra::setSizeMult(v27, 1.5);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
a1->m_refreshBtn);
m_refreshBtn = a1->m_refreshBtn;
v29 = a1->m_buttonMenu;
sub_10028CBE0(
(float *)&v33,
(float)((float)(v37 * 0.5) + 220.0) + -10.0,
(float)((float)((float)(0.5 * v38) + -145.0) + 10.0) + 1.0);
*(cocos2d::CCPoint *)&v40 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)v35,
(const cocos2d::CCPoint *)v29);
((void (__fastcall *)(CCMenuItemSpriteExtra *, double *, double))m_refreshBtn->setPosition)(m_refreshBtn, v35, v40);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_refreshBtn->setVisible)(a1->m_refreshBtn, 0);
GameLevelManager::sharedState()->m_userListDelegate = &a1->UserListDelegate;
v30 = GameLevelManager::sharedState();
StoredUserList = GameLevelManager::getStoredUserList(v30, a1->m_type);
if ( StoredUserList )
{
((void (__fastcall *)(FriendsProfilePage *, cocos2d::CCArray *, _QWORD))a1->getUserListFinished)(
a1,
StoredUserList,
(unsigned int)a1->m_type);
}
else
{
((void (__fastcall *)(LoadingCircle *, __int64))a1->m_circle->setVisible)(a1->m_circle, 1);
FriendsProfilePage::setupUsersBrowser(a1, nullptr, a1->m_type);
v32 = GameLevelManager::sharedState();
GameLevelManager::getUserList(v32, a1->m_type);
}
return v36;
}
return result;
}