//
// ProfilePage::init from 0x4c7464 to 0x4c7c58 (2036 bytes)
//
// 1 xrefs:
// > ProfilePage::create @ 0x4c7d60
//
// 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 ProfilePage::init(ProfilePage *a1, int a2, bool a3)
{
_BOOL4 v5; // r5
cocos2d::CCArray *v6; // r0
bool v7; // r8
int v8; // r2
UserListType m_nTag_low; // r5
cocos2d::CCArray *v10; // r0
cocos2d::CCDirector *v11; // r0
cocos2d::CCNode *v12; // r6
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r7
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
GJAccountManager *v15; // r0
GameLevelManager *v16; // r9
GameManager *v17; // r0
const char *v18; // r7
GJAccountManager *v19; // r0
const char *v20; // r6
GameLevelManager *v21; // r0
int v22; // r3
cocos2d::CCLabelBMFont *v23; // r0
cocos2d::CCLabelBMFont *m_usernameLabel; // r6
void (__fastcall *v25)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCSprite *v26; // r6
void (__fastcall *v27)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
const cocos2d::CCPoint *v28; // r11
void (__fastcall *setBlendFunc)(cocos2d::CCSprite *__hidden, cocos2d::ccBlendFunc); // r12
GJCommentListLayer *v30; // r6
cocos2d::CCDirector *v31; // r0
cocos2d::CCTouchDispatcher *v32; // r0
void (__fastcall *v33)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
cocos2d::CCSprite *v34; // r0
CCMenuItemSpriteExtra *v35; // r5
cocos2d::CCMenu *v36; // r0
cocos2d::CCMenu_vtbl *v37; // r3
cocos2d::CCMenu *v38; // r6
void (__fastcall *v39)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCArray *v40; // r0
cocos2d::CCArray *v41; // r0
cocos2d::CCLabelBMFont *v42; // r0
cocos2d::CCLabelBMFont *m_somethingWentWrong; // r6
void (__fastcall *v44)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
GJAccountManager *v45; // r0
GameLevelManager *v46; // r0
_BOOL4 isFollowingUser; // r11
const char *v48; // r0
cocos2d::CCSprite *v49; // r0
CCMenuItemSpriteExtra *v50; // r0
CCMenuItemSpriteExtra *m_followBtn; // r10
cocos2d::CCSprite *v52; // r10
void (__fastcall *v53)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r11
LoadingCircle *v54; // r0
cocos2d::CCLayer *m_mainLayer; // r3
LoadingCircle *m_circle; // r0
cocos2d::CCSprite *m_sprite; // r10
void (__fastcall *v58)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r11
cocos2d::CCSprite *v59; // r0
CCMenuItemSpriteExtra *v60; // r0
CCMenuItemSpriteExtra *m_refreshBtn; // r5
cocos2d::CCMenu *m_buttonMenu; // r11
void (__fastcall *v63)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
GameManager *v64; // r0
GameLevelManager *v65; // r0
GameLevelManager *v67; // r6
GJAccountManager *v68; // r0
GameLevelManager *v69; // r0
GameLevelManager *v70; // r0
GameLevelManager *v71; // r0
GameLevelManager *v72; // r0
GameLevelManager *v73; // r0
GameLevelManager *v74; // r0
GameLevelManager *v75; // r0
GJUserScore *v76; // r0
GameLevelManager *v77; // r0
float v78; // r2
float v79; // r3
void (__fastcall *v80)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+8h] [bp-64h]
cocos2d::CCLabelBMFont *v81[2]; // [sp+14h] [bp-58h] BYREF
cocos2d::CCSize v82; // [sp+1Ch] [bp-50h] BYREF
_DWORD v83[2]; // [sp+24h] [bp-48h] BYREF
cocos2d::CCPoint v84; // [sp+2Ch] [bp-40h] BYREF
cocos2d::CCPoint v85; // [sp+34h] [bp-38h] BYREF
cocos2d::CCPoint v86; // [sp+3Ch] [bp-30h] BYREF
void (*v87)(ProfilePage *, cocos2d::CCObject *); // [sp+44h] [bp-28h]
int v88; // [sp+48h] [bp-24h]
cocos2d::CCPoint v89; // [sp+4Ch] [bp-20h] BYREF
cocos2d::CCRect v90; // [sp+54h] [bp-18h] BYREF
cocos2d::CCSize v91; // 0:^0.8
cocos2d::CCRect v92; // 0:kr00_16.16
v5 = a3;
v6 = (cocos2d::CCArray *)FLAlertLayer::init(a1, (cocos2d::_ccColor4B)150);
v7 = (char)v6;
if ( v6 )
{
a1->m_accountID = a2;
if ( v5 )
{
v6 = (cocos2d::CCArray *)GJAccountManager::sharedState();
v8 = (int)v6[4].data
+ (a2 == v6[4].m_unknown5 - (unsigned int)v6[4].data)
+ v6[4].m_unknown5
- (unsigned int)v6[4].data
- v6[4].m_unknown5;
}
else
{
v8 = 0;
}
a1->m_ownProfile = v8;
if ( v8 )
{
v6 = (cocos2d::CCArray *)GameManager::sharedState();
m_nTag_low = LOBYTE(v6[7].m_nTag);
if ( !LOBYTE(v6[7].m_nTag) )
{
v67 = GameLevelManager::sharedState();
v68 = GJAccountManager::sharedState();
GameLevelManager::resetStoredUserInfo(v67, v68->m_accountID - v68->m_unkInt1);
v69 = GameLevelManager::sharedState();
GameLevelManager::invalidateMessages(v69, 1, m_nTag_low);
v70 = GameLevelManager::sharedState();
GameLevelManager::invalidateMessages(v70, m_nTag_low, m_nTag_low);
v71 = GameLevelManager::sharedState();
GameLevelManager::invalidateRequests(v71, 1, m_nTag_low);
v72 = GameLevelManager::sharedState();
GameLevelManager::invalidateRequests(v72, m_nTag_low, m_nTag_low);
v73 = GameLevelManager::sharedState();
GameLevelManager::invalidateUserList(v73, m_nTag_low, m_nTag_low);
v74 = GameLevelManager::sharedState();
GameLevelManager::invalidateUserList(v74, Blocked, m_nTag_low);
}
}
v10 = (cocos2d::CCArray *)cocos2d::CCArray::create(v6);
a1->m_arrayWithUsernameLabel = v10;
cocos2d::CCObject::retain(v10);
v11 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v82, v11);
cocos2d::CCRect::CCRect(&v90, 0.0, 0.0, 80.0, 80.0);
v92.origin.x = v78;
v92.origin.y = v79;
v92.size = v91;
v12 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square01.png",
(const char *)&v90,
v92);
((void (__fastcall *)(cocos2d::CCNode *, int))v12->__vftable[1].~CCNode_0)(v12, 255);
setContentSize = v12->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v90, 440.0, 290.0);
setContentSize(v12, (const cocos2d::CCSize *)&v90);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v12, -1);
setPosition = v12->setPosition;
cocos2d::CCPoint::CCPoint(&v90.origin, v82.width * 0.5, v82.height * 0.5);
setPosition(v12, &v90.origin);
v15 = GJAccountManager::sharedState();
if ( a2 == v15->m_accountID - v15->m_unkInt1 )
{
v16 = GameLevelManager::sharedState();
v17 = GameManager::sharedState();
v18 = (const char *)(v17->m_playerUserID.random - v17->m_playerUserID.seed);
v19 = GJAccountManager::sharedState();
v20 = (const char *)(v19->m_accountID - v19->m_unkInt1);
GJAccountManager::sharedState();
sub_775C20(&v90);
GameLevelManager::storeUserName(v16, v18, v20, (char **)&v90);
sub_774008(&v90);
}
v21 = GameLevelManager::sharedState();
GameLevelManager::tryGetUsername((GameLevelManager *)v81, (GameLevelManager_vtbl *)v21, a2, v22);
v23 = cocos2d::CCLabelBMFont::create();
a1->m_usernameLabel = v23;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v23, 20);
m_usernameLabel = a1->m_usernameLabel;
v25 = m_usernameLabel->setPosition;
cocos2d::CCPoint::CCPoint(&v90.origin, v82.width * 0.5, (float)((float)(v82.height * 0.5) + 145.0) - 20.0);
v25(m_usernameLabel, &v90.origin);
if ( ProfilePage::isOnWatchlist(a1, a1->m_accountID) )
a1->m_usernameLabel->setColor(a1->m_usernameLabel, &stru_9AC55C);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_usernameLabel, 160.0, 0.8, 0.0);
cocos2d::CCArray::addObject(a1->m_arrayWithUsernameLabel, a1->m_usernameLabel);
v26 = cocos2d::CCSprite::createWithSpriteFrameName("floorLine_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v26->setScaleX)(v26, 1061997773);
((void (__fastcall *)(cocos2d::CCSprite *, int))v26->setScaleY)(v26, 1065353216);
v26->setOpacity(v26, 100);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v26, 0);
v27 = v26->setPosition;
v28 = a1->m_usernameLabel->getPosition(a1->m_usernameLabel);
cocos2d::CCPoint::CCPoint(&v89, 0.0, -21.0);
cocos2d::CCPoint::operator+(&v90, v28, &v89);
v27(v26, &v90.origin);
setBlendFunc = v26->setBlendFunc;
v83[0] = 770;
v83[1] = 1;
((void (__fastcall *)(cocos2d::CCSprite *, int, int, _DWORD *))setBlendFunc)(v26, 770, 1, v83);
cocos2d::CCArray::addObject(a1->m_arrayWithUsernameLabel, v26);
cocos2d::CCPoint::CCPoint(&v84, v82.width * 0.5, (float)(v82.height * 0.5) + 40.0);
v81[1] = (cocos2d::CCLabelBMFont *)-12684609;
v30 = GJCommentListLayer::create(nullptr, " ", (cocos2d::ccColor4B)-12684609, 340.0, 45.0, 0);
v31 = cocos2d::CCDirector::sharedDirector();
v32 = v31->getTouchDispatcher(v31);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v32, v30);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v30, 1);
v33 = v30->setPosition;
cocos2d::CCPoint::CCPoint(&v89, -170.0, -22.5);
cocos2d::CCPoint::operator+(&v90, &v84, &v89);
v33(v30, &v90.origin);
cocos2d::CCArray::addObject(a1->m_arrayWithUsernameLabel, v30);
v34 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v88 = 0;
v87 = ProfilePage::onClose;
v35 = CCMenuItemSpriteExtra::create(
v34,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(ProfilePage::onClose, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v35, 1.6);
v36 = (cocos2d::CCMenu *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v35, nullptr);
v37 = v36->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_buttonMenu = v36;
v38 = v36;
v39 = v37->setPosition;
cocos2d::CCPoint::CCPoint(
&v90.origin,
(float)((float)(v82.width * 0.5) - 220.0) + 10.0,
(float)((float)(v82.height * 0.5) + 145.0) - 10.0);
v39(v38, &v90.origin);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, a1->m_buttonMenu, 10);
ProfilePage::setupComments(a1);
v41 = (cocos2d::CCArray *)cocos2d::CCArray::create(v40);
a1->m_buttons = v41;
cocos2d::CCObject::retain(v41);
v42 = cocos2d::CCLabelBMFont::create();
a1->m_somethingWentWrong = v42;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v42, 10);
m_somethingWentWrong = a1->m_somethingWentWrong;
v44 = m_somethingWentWrong->setPosition;
cocos2d::CCPoint::CCPoint(&v90.origin, v82.width * 0.5, (float)(v82.height * 0.5) - 53.0);
v44(m_somethingWentWrong, &v90.origin);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))a1->m_somethingWentWrong->setScale)(
a1->m_somethingWentWrong,
1058642330);
a1->m_somethingWentWrong->setVisible(a1->m_somethingWentWrong, 0);
v45 = GJAccountManager::sharedState();
if ( v45->m_accountID - v45->m_unkInt1 != a1->m_accountID )
{
v46 = GameLevelManager::sharedState();
isFollowingUser = GameLevelManager::isFollowingUser(v46, a1->m_accountID);
cocos2d::CCPoint::CCPoint(&v85, (float)(v82.width * 0.5) - 158.0, (float)(v82.height * 0.5) - 123.0);
v48 = isFollowingUser ? "gj_heartOn_001.png" : "gj_heartOff_001.png";
v49 = cocos2d::CCSprite::createWithSpriteFrameName(v48);
v89.y = 0.0;
LODWORD(v89.x) = ProfilePage::onFollow;
v50 = CCMenuItemSpriteExtra::create(
v49,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(ProfilePage::onFollow, (unsigned int)a1));
a1->m_followBtn = v50;
CCMenuItemSpriteExtra::setSizeMult(v50, 1.1);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, a1->m_followBtn);
m_followBtn = a1->m_followBtn;
v80 = m_followBtn->setPosition;
cocos2d::CCNode::convertToNodeSpace(&v90.origin, a1->m_buttonMenu, &v85);
v80(m_followBtn, &v90.origin);
if ( !isFollowingUser )
{
v52 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_followTxt_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v52, 2);
v53 = v52->setPosition;
cocos2d::CCPoint::CCPoint(&v86, 48.0, -2.0);
cocos2d::CCPoint::operator+(&v90, &v85, &v86);
v53(v52, &v90.origin);
}
}
v54 = LoadingCircle::create();
m_mainLayer = a1->m_mainLayer;
a1->m_circle = v54;
v54->m_parentLayer = m_mainLayer;
m_circle = a1->m_circle;
m_circle->m_fade = 0;
cocos2d::CCObject::retain(m_circle);
LoadingCircle::show(a1->m_circle);
a1->m_circle->setVisible(a1->m_circle, 0);
m_sprite = a1->m_circle->m_sprite;
v58 = m_sprite->setPosition;
cocos2d::CCPoint::CCPoint(&v90.origin, v82.width * 0.5, (float)(v82.height * 0.5) - 53.0);
v58(m_sprite, &v90.origin);
v59 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png");
v90.origin.y = 0.0;
LODWORD(v90.origin.x) = ProfilePage::onUpdate;
v60 = CCMenuItemSpriteExtra::create(
v59,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(ProfilePage::onUpdate, (unsigned int)a1));
a1->m_refreshBtn = v60;
CCMenuItemSpriteExtra::setSizeMult(v60, 1.5);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, a1->m_refreshBtn);
m_refreshBtn = a1->m_refreshBtn;
m_buttonMenu = a1->m_buttonMenu;
v63 = m_refreshBtn->setPosition;
cocos2d::CCPoint::CCPoint(
&v85,
(float)((float)(v82.width * 0.5) - 220.0) + 10.0,
(float)((float)((float)(v82.height * 0.5) - 145.0) + 10.0) + 1.0);
cocos2d::CCNode::convertToNodeSpace(&v86, m_buttonMenu, &v85);
v63(m_refreshBtn, &v86);
a1->m_refreshBtn->setVisible(a1->m_refreshBtn, 0);
GameLevelManager::sharedState()->m_userInfoDelegate = &a1->UserInfoDelegate;
if ( !a1->m_ownProfile || (v64 = GameManager::sharedState(), v64->m_scoreValid) )
{
v75 = GameLevelManager::sharedState();
v76 = GameLevelManager::userInfoForAccountID(v75, a1->m_accountID);
if ( v76 )
{
if ( v76->m_friendReqStatus == 2 )
ProfilePage::setupCommentsBrowser(a1, nullptr);
else
a1->getUserInfoFinished(a1, v76);
}
else
{
a1->m_circle->setVisible(a1->m_circle, 1);
a1->m_refreshBtn->setVisible(a1->m_refreshBtn, 0);
ProfilePage::setupCommentsBrowser(a1, nullptr);
v77 = GameLevelManager::sharedState();
GameLevelManager::getGJUserInfo(v77, a1->m_accountID);
}
}
else
{
ProfilePage::setupCommentsBrowser(a1, (cocos2d::CCArray *)v64->m_scoreValid);
GameLevelManager::sharedState()->m_leaderboardManagerDelegate = &a1->LeaderboardManagerDelegate;
a1->m_circle->setVisible(a1->m_circle, 1);
a1->m_refreshBtn->setVisible(a1->m_refreshBtn, 0);
v65 = GameLevelManager::sharedState();
GameLevelManager::updateUserScore(v65);
}
sub_774008(v81);
}
return v7;
}