//
// ProfilePage::init from 0x8fdea0 to 0x8fe980 (2784 bytes)
//
// 2 xrefs:
// > ProfilePage::create @ 0x8feb1c
// > ??> @ 0xa4100
//
// 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 v3; // w20
unsigned __int64 m_scoreValid; // x0
bool v7; // w24
cocos2d::CCArray *v8; // x0
cocos2d::CCDirector *v9; // x0
cocos2d::CCNode *v10; // x21
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x26
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
GJAccountManager *v13; // x0
GameLevelManager *v14; // x0
cocos2d::CCLabelBMFont *v15; // x0
cocos2d::CCLayer *m_mainLayer; // x3
cocos2d::CCLabelBMFont *m_usernameLabel; // x21
void (__fastcall *v18)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCSprite *v19; // x21
void (__fastcall *v20)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x26
const cocos2d::CCPoint *v21; // x27
GJCommentListLayer *v22; // x21
cocos2d::CCDirector *v23; // x0
cocos2d::CCTouchDispatcher *v24; // x0
void (__fastcall *v25)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
cocos2d::CCSprite *v26; // x0
CCMenuItemSpriteExtra *v27; // x21
cocos2d::CCMenu *v28; // x21
void (__fastcall *v29)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
cocos2d::CCArray *v30; // x0
cocos2d::CCArray *v31; // x0
cocos2d::CCLabelBMFont *v32; // x0
cocos2d::CCLayer *v33; // x3
cocos2d::CCLabelBMFont *m_somethingWentWrong; // x21
void (__fastcall *v35)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
GJAccountManager *v36; // x0
GameLevelManager *v37; // x0
_BOOL4 isFollowingUser; // w26
const char *v39; // x0
cocos2d::CCSprite *v40; // x0
CCMenuItemSpriteExtra *v41; // x0
CCMenuItemSpriteExtra *m_followBtn; // x27
void (__fastcall *v43)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x28
LoadingCircle *v44; // x0
LoadingCircle *m_circle; // x0
cocos2d::CCSprite *m_sprite; // x21
void (__fastcall *v47)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x26
cocos2d::CCSprite *v48; // x0
CCMenuItemSpriteExtra *v49; // x0
CCMenuItemSpriteExtra *m_refreshBtn; // x21
cocos2d::CCMenu *m_buttonMenu; // x27
void (__fastcall *v52)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
GameLevelManager *v53; // x0
_BOOL4 m_ownProfile; // w1
GameLevelManager *v55; // x0
GJUserScore *v56; // x0
cocos2d::CCArray **p_m_pTargetArray; // x19
unsigned int *p_m_nExtraKerning; // x21
int m_nExtraKerning; // w0
GameLevelManager *v61; // x0
GJAccountManager *v62; // x0
GameLevelManager *v63; // x21
GJAccountManager *v64; // x0
GameLevelManager *v65; // x0
GameLevelManager *v66; // x0
GameLevelManager *v67; // x0
GameLevelManager *v68; // x0
GameLevelManager *v69; // x0
GameLevelManager *v70; // x0
GameLevelManager *v71; // x25
GameManager *v72; // x0
int v73; // w21
GJAccountManager *v74; // x0
void *v75; // x0
unsigned int *v76; // x1
int v77; // w2
cocos2d::CCSprite *v78; // x26
void (__fastcall *v79)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x27
GameLevelManager *v80; // x0
int v81; // [xsp+78h] [xbp+78h]
float v82; // [xsp+80h] [xbp+80h]
float v83; // [xsp+84h] [xbp+84h]
cocos2d::CCLabelBMFont *v84; // [xsp+88h] [xbp+88h] BYREF
cocos2d::CCPoint v85; // [xsp+90h] [xbp+90h] BYREF
cocos2d::CCPoint v86; // [xsp+98h] [xbp+98h] BYREF
cocos2d::CCPoint v87; // [xsp+A0h] [xbp+A0h] BYREF
cocos2d::CCRect v88; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::CCPoint v89; // 0:kr08_8.8
cocos2d::CCPoint v90; // 0:kr10_8.8
cocos2d::SEL_MenuHandler v91; // 0:x2.16
cocos2d::SEL_MenuHandler v92; // 0:x2.16
cocos2d::SEL_MenuHandler v93; // 0:x2.16
cocos2d::CCRect v94; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v3 = a3;
m_scoreValid = (unsigned __int8)FLAlertLayer::init(a1, 0x96u);
v7 = m_scoreValid;
if ( (_BYTE)m_scoreValid )
{
a1->m_accountID = a2;
if ( v3
&& (v62 = GJAccountManager::sharedState(),
m_scoreValid = (unsigned int)(v62->m_accountID - v62->m_unkInt1),
a2 == (_DWORD)m_scoreValid) )
{
a1->m_ownProfile = 1;
m_scoreValid = GameManager::sharedState()->m_scoreValid;
if ( !(_DWORD)m_scoreValid )
{
v63 = GameLevelManager::sharedState();
v64 = GJAccountManager::sharedState();
GameLevelManager::resetStoredUserInfo(v63, v64->m_accountID - v64->m_unkInt1);
v65 = GameLevelManager::sharedState();
GameLevelManager::invalidateMessages(v65, 1, 0);
v66 = GameLevelManager::sharedState();
GameLevelManager::invalidateMessages(v66, 0, 0);
v67 = GameLevelManager::sharedState();
GameLevelManager::invalidateRequests(v67, 1, 0);
v68 = GameLevelManager::sharedState();
GameLevelManager::invalidateRequests(v68, 0, 0);
v69 = GameLevelManager::sharedState();
GameLevelManager::invalidateUserList(v69, (UserListType)0, 0);
v70 = GameLevelManager::sharedState();
GameLevelManager::invalidateUserList(v70, Blocked, 0);
}
}
else
{
a1->m_ownProfile = 0;
}
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)m_scoreValid);
a1->m_arrayWithUsernameLabel = v8;
cocos2d::CCObject::retain(v8);
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v9);
cocos2d::CCRect::CCRect(&v88, 0.0, 0.0, 80.0, 80.0);
v10 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square01.png",
(const char *)&v88,
v94);
((void (__fastcall *)(cocos2d::CCNode *, __int64))v10->__vftable[1].~CCNode_0)(v10, 0xFFFFFFFFLL);
setContentSize = v10->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v88, 440.0, 290.0);
setContentSize(v10, (const cocos2d::CCSize *)&v88);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v10, -1);
setPosition = v10->setPosition;
cocos2d::CCPoint::CCPoint(&v88.origin, v82 * 0.5, v83 * 0.5);
setPosition(v10, &v88.origin);
v13 = GJAccountManager::sharedState();
if ( a2 == v13->m_accountID - v13->m_unkInt1 )
{
v71 = GameLevelManager::sharedState();
v72 = GameManager::sharedState();
v73 = v72->m_playerUserID.random - v72->m_playerUserID.seed;
v74 = GJAccountManager::sharedState();
v81 = v74->m_accountID - v74->m_unkInt1;
GJAccountManager::sharedState();
sub_D18D28(&v88);
GameLevelManager::storeUserName(v71, v73, v81, (char **)&v88);
v75 = (void *)(*(_QWORD *)&v88.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v88.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v76 = (unsigned int *)(*(_QWORD *)&v88.origin - 8LL);
do
v77 = __ldaxr(v76);
while ( __stlxr(v77 - 1, v76) );
}
else
{
v77 = *(_DWORD *)(*(_QWORD *)&v88.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v88.origin - 8LL) = v77 - 1;
}
if ( v77 <= 0 )
operator delete(v75);
}
}
v14 = GameLevelManager::sharedState();
GameLevelManager::tryGetUsername((GameLevelManager **)&v84, v14, a2);
v15 = cocos2d::CCLabelBMFont::create();
m_mainLayer = a1->m_mainLayer;
a1->m_usernameLabel = v15;
m_mainLayer->addChild_0(m_mainLayer, v15, 20);
m_usernameLabel = a1->m_usernameLabel;
v18 = m_usernameLabel->setPosition;
cocos2d::CCPoint::CCPoint(&v88.origin, v82 * 0.5, (float)((float)(v83 * 0.5) + 145.0) - 20.0);
v18(m_usernameLabel, &v88.origin);
if ( ProfilePage::isOnWatchlist(a1, a1->m_accountID) )
a1->m_usernameLabel->setColor(a1->m_usernameLabel, (const cocos2d::ccColor3B *)&unk_EF1320);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_usernameLabel, 160.0, 0.8, 0.0);
cocos2d::CCArray::addObject(a1->m_arrayWithUsernameLabel, a1->m_usernameLabel);
v19 = cocos2d::CCSprite::createWithSpriteFrameName("floorLine_001.png");
v19->setScaleX(v19, 0.8);
v19->setScaleY(v19, 1.0);
v19->setOpacity(v19, 100);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v19, 0);
v20 = v19->setPosition;
v21 = a1->m_usernameLabel->getPosition(a1->m_usernameLabel);
cocos2d::CCPoint::CCPoint(&v87, 0.0, -21.0);
cocos2d::CCPoint::operator+(&v88, v21, &v87);
v20(v19, &v88.origin);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v19->setBlendFunc)(v19, 0x100000302LL);
cocos2d::CCArray::addObject(a1->m_arrayWithUsernameLabel, v19);
cocos2d::CCPoint::CCPoint(&v85, v82 * 0.5, (float)(v83 * 0.5) + 40.0);
v22 = GJCommentListLayer::create(nullptr, " ", (cocos2d::ccColor4B)-12684609, 340.0, 45.0, 0);
v23 = cocos2d::CCDirector::sharedDirector();
v24 = v23->getTouchDispatcher(v23);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v24, v22);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v22, 1);
v25 = v22->setPosition;
cocos2d::CCPoint::CCPoint(&v87, -170.0, -22.5);
cocos2d::CCPoint::operator+(&v88, &v85, &v87);
v25(v22, &v88.origin);
cocos2d::CCArray::addObject(a1->m_arrayWithUsernameLabel, v22);
v26 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v91.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v91.adj = (size_t)ProfilePage::onClose;
v27 = CCMenuItemSpriteExtra::create(v26, nullptr, v91);
CCMenuItemSpriteExtra::setSizeMult(v27, 1.6);
v28 = (cocos2d::CCMenu *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v27, nullptr);
a1->m_buttonMenu = v28;
v29 = v28->setPosition;
cocos2d::CCPoint::CCPoint(
&v88.origin,
(float)((float)(v82 * 0.5) + -220.0) + 10.0,
(float)((float)(v83 * 0.5) + 145.0) - 10.0);
v29(v28, &v88.origin);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, a1->m_buttonMenu, 10);
ProfilePage::setupComments(a1);
v31 = (cocos2d::CCArray *)cocos2d::CCArray::create(v30);
a1->m_buttons = v31;
cocos2d::CCObject::retain(v31);
v32 = cocos2d::CCLabelBMFont::create();
v33 = a1->m_mainLayer;
a1->m_somethingWentWrong = v32;
v33->addChild_0(v33, v32, 10);
m_somethingWentWrong = a1->m_somethingWentWrong;
v35 = m_somethingWentWrong->setPosition;
cocos2d::CCPoint::CCPoint(&v88.origin, v82 * 0.5, (float)(v83 * 0.5) + -53.0);
v35(m_somethingWentWrong, &v88.origin);
a1->m_somethingWentWrong->setScale(a1->m_somethingWentWrong, 0.6);
a1->m_somethingWentWrong->setVisible(a1->m_somethingWentWrong, 0);
v36 = GJAccountManager::sharedState();
if ( v36->m_accountID - v36->m_unkInt1 != a1->m_accountID )
{
v37 = GameLevelManager::sharedState();
isFollowingUser = GameLevelManager::isFollowingUser(v37, a1->m_accountID);
cocos2d::CCPoint::CCPoint(&v86, (float)(v82 * 0.5) + -158.0, (float)(v83 * 0.5) + -123.0);
v39 = isFollowingUser ? "gj_heartOn_001.png" : "gj_heartOff_001.png";
v40 = cocos2d::CCSprite::createWithSpriteFrameName(v39);
v92.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v92.adj = (size_t)ProfilePage::onFollow;
v41 = CCMenuItemSpriteExtra::create(v40, nullptr, v92);
a1->m_followBtn = v41;
CCMenuItemSpriteExtra::setSizeMult(v41, 1.1);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, a1->m_followBtn);
m_followBtn = a1->m_followBtn;
v43 = m_followBtn->setPosition;
v89 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v86);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *, float, float))v43)(
m_followBtn,
&v88,
v89.x,
v89.y);
if ( !isFollowingUser )
{
v78 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_followTxt_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v78, 2);
v79 = v78->setPosition;
cocos2d::CCPoint::CCPoint(&v87, 48.0, -2.0);
cocos2d::CCPoint::operator+(&v88, &v86, &v87);
v79(v78, &v88.origin);
}
}
v44 = LoadingCircle::create();
a1->m_circle = v44;
v44->m_parentLayer = a1->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;
v47 = m_sprite->setPosition;
cocos2d::CCPoint::CCPoint(&v88.origin, v82 * 0.5, (float)(v83 * 0.5) + -53.0);
v47(m_sprite, &v88.origin);
v48 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png");
v93.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v93.adj = (size_t)ProfilePage::onUpdate;
v49 = CCMenuItemSpriteExtra::create(v48, nullptr, v93);
a1->m_refreshBtn = v49;
CCMenuItemSpriteExtra::setSizeMult(v49, 1.5);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, a1->m_refreshBtn);
m_refreshBtn = a1->m_refreshBtn;
m_buttonMenu = a1->m_buttonMenu;
v52 = m_refreshBtn->setPosition;
cocos2d::CCPoint::CCPoint(
&v87,
(float)((float)(v82 * 0.5) + -220.0) + 10.0,
(float)((float)((float)(v83 * 0.5) + -145.0) + 10.0) + 1.0);
v90 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v87);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *, float, float))v52)(
m_refreshBtn,
&v88,
v90.x,
v90.y);
a1->m_refreshBtn->setVisible(a1->m_refreshBtn, 0);
v53 = GameLevelManager::sharedState();
m_ownProfile = a1->m_ownProfile;
v53->m_userInfoDelegate = &a1->UserInfoDelegate;
if ( !m_ownProfile || GameManager::sharedState()->m_scoreValid )
{
v55 = GameLevelManager::sharedState();
v56 = GameLevelManager::userInfoForAccountID(v55, a1->m_accountID);
if ( v56 )
{
if ( v56->m_friendReqStatus == 2 )
ProfilePage::setupCommentsBrowser(a1, nullptr);
else
a1->getUserInfoFinished(a1, v56);
}
else
{
a1->m_circle->setVisible(a1->m_circle, 1);
a1->m_refreshBtn->setVisible(a1->m_refreshBtn, 0);
ProfilePage::setupCommentsBrowser(a1, nullptr);
v80 = GameLevelManager::sharedState();
GameLevelManager::getGJUserInfo(v80, a1->m_accountID);
}
}
else
{
ProfilePage::setupCommentsBrowser(a1, nullptr);
GameLevelManager::sharedState()->m_leaderboardManagerDelegate = &a1->LeaderboardManagerDelegate;
a1->m_circle->setVisible(a1->m_circle, 1);
a1->m_refreshBtn->setVisible(a1->m_refreshBtn, 0);
v61 = GameLevelManager::sharedState();
GameLevelManager::updateUserScore(v61);
}
p_m_pTargetArray = &v84[-1].m_pTargetArray;
if ( &v84[-1].m_pTargetArray != (cocos2d::CCArray **)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_m_nExtraKerning = (unsigned int *)&v84[-1].m_nExtraKerning;
do
m_nExtraKerning = __ldaxr(p_m_nExtraKerning);
while ( __stlxr(m_nExtraKerning - 1, p_m_nExtraKerning) );
}
else
{
m_nExtraKerning = v84[-1].m_nExtraKerning;
v84[-1].m_nExtraKerning = m_nExtraKerning - 1;
}
if ( m_nExtraKerning <= 0 )
operator delete(p_m_pTargetArray);
}
}
return v7;
}