//
// ProfilePage::init from 0x100196a28 to 0x1001973d4 (2476 bytes)
//
// 1 xrefs:
// > ProfilePage::create @ 0x1001969d8
//
// 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 ProfilePage::init(ProfilePage *a1, int a2, bool a3)
{
void *inited; // x0
bool v7; // w19
bool v8; // zf
GameLevelManager *v9; // x22
GJAccountManager *v10; // x0
GameLevelManager *v11; // x0
GameLevelManager *v12; // x0
GameLevelManager *v13; // x0
GameLevelManager *v14; // x0
GameLevelManager *v15; // x0
GameLevelManager *v16; // x0
cocos2d::CCArray *v17; // x0
cocos2d::CCDirector *v18; // x0
cocos2d::extension::CCScale9Sprite *v19; // x22
__n128 v20; // q0
__n128 v21; // q1
GJAccountManager *v22; // x0
GameLevelManager *v23; // x22
GameManager *v24; // x0
int v25; // w23
GJAccountManager *v26; // x0
int v27; // w24
GJAccountManager *v28; // x0
GameLevelManager *v29; // x0
void **v30; // x0
__n128 v31; // q0
cocos2d::CCLabelBMFont *m_usernameLabel; // x21
__n128 v33; // q1
cocos2d::CCSprite *v34; // x21
float32x2_t *v35; // x22
__n128 v36; // q0
__n128 v37; // q1
double v38; // d0
__n128 v39; // q0
__n128 v40; // q1
GJCommentListLayer *v41; // x21
cocos2d::CCDirector *v42; // x0
cocos2d::CCTouchDispatcher *v43; // x0
__n128 v44; // q0
__n128 v45; // q1
double v46; // d0
cocos2d::CCSprite *v47; // x0
CCMenuItemSpriteExtra *v48; // x21
cocos2d::CCMenu *v49; // x21
float v50; // s2
__n128 v51; // q0
__n128 v52; // q1
__int64 v53; // x0
cocos2d::CCArray *v54; // x0
__n128 v55; // q0
cocos2d::CCLabelBMFont *m_somethingWentWrong; // x21
__n128 v57; // q1
GJAccountManager *v58; // x0
GameLevelManager *v59; // x0
_BOOL4 isFollowingUser; // w21
__n128 v61; // q1
__n128 v62; // q0
const char *v63; // x0
cocos2d::CCSprite *v64; // x0
CCMenuItemSpriteExtra *v65; // x0
CCMenuItemSpriteExtra *m_followBtn; // x22
cocos2d::CCSprite *v67; // x21
__n128 v68; // q0
__n128 v69; // q1
double v70; // d0
LoadingCircle *v71; // x0
__n128 v72; // q0
cocos2d::CCSprite *m_sprite; // x21
__n128 v74; // q1
cocos2d::CCSprite *v75; // x0
CCMenuItemSpriteExtra *v76; // x0
__n128 v77; // q0
CCMenuItemSpriteExtra *m_refreshBtn; // x21
cocos2d::CCMenu *m_buttonMenu; // x22
__n128 v80; // q1
GameLevelManager *v81; // x0
GJUserScore *v82; // x0
GameLevelManager *v83; // x0
GameLevelManager *v84; // x0
float32x2_t v86; // [xsp+8h] [xbp-A8h] BYREF
float32x2_t v87; // [xsp+10h] [xbp-A0h] BYREF
float32x2_t v88; // [xsp+18h] [xbp-98h] BYREF
float32x2_t v89; // [xsp+20h] [xbp-90h] BYREF
void *v90[2]; // [xsp+28h] [xbp-88h] BYREF
char v91; // [xsp+3Fh] [xbp-71h]
void *__p[2]; // [xsp+40h] [xbp-70h] BYREF
char *longStorage; // [xsp+50h] [xbp-60h]
float v94; // [xsp+58h] [xbp-58h]
float v95; // [xsp+5Ch] [xbp-54h]
cocos2d::CCPoint v96; // 0:kr08_8.8
cocos2d::CCPoint v97; // 0:kr10_8.8
cocos2d::SEL_MenuHandler v98; // 0:x3.16
cocos2d::SEL_MenuHandler v99; // 0:x3.16
cocos2d::SEL_MenuHandler v100; // 0:x3.16
cocos2d::CCRect v101; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
inited = (void *)FLAlertLayer::init_1(a1, 150);
v7 = (char)inited;
if ( (_DWORD)inited )
{
a1->m_accountID = a2;
if ( a3 )
{
inited = GJAccountManager::sharedState();
v8 = *((_DWORD *)inited + 88) - *((_DWORD *)inited + 89) == a2;
a1->m_ownProfile = v8;
if ( v8 )
{
inited = GameManager::sharedState();
if ( (*((_BYTE *)inited + 616) & 1) == 0 )
{
v9 = GameLevelManager::sharedState();
v10 = GJAccountManager::sharedState();
GameLevelManager::resetStoredUserInfo(v9, v10->m_accountID - v10->m_unkInt1);
v11 = GameLevelManager::sharedState();
GameLevelManager::invalidateMessages(v11, 1, 0);
v12 = GameLevelManager::sharedState();
GameLevelManager::invalidateMessages(v12, 0, 0);
v13 = GameLevelManager::sharedState();
GameLevelManager::invalidateRequests(v13, 1, 0);
v14 = GameLevelManager::sharedState();
GameLevelManager::invalidateRequests(v14, 0, 0);
v15 = GameLevelManager::sharedState();
GameLevelManager::invalidateUserList(v15, (UserListType)0, 0);
v16 = GameLevelManager::sharedState();
GameLevelManager::invalidateUserList(v16, Blocked, 0);
}
}
}
else
{
a1->m_ownProfile = 0;
}
v17 = (cocos2d::CCArray *)sub_10024A15C(inited);
a1->m_arrayWithUsernameLabel = v17;
cocos2d::CCObject::retain(v17);
v18 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v18);
sub_100022990((float *)v90, 0.0, 0.0, 80.0, 80.0);
v19 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v101);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v19->setOpacity)(v19, 255);
sub_100022988((float *)v90, 440.0, 290.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, void **))v19->setContentSize)(v19, v90);
v20 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v19,
0xFFFFFFFFLL);
v20.n128_f32[0] = v94 * 0.5;
v21.n128_f32[0] = v95 * 0.5;
sub_100022980(v20, v21, v90);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, void **))v19->setPosition)(v19, v90);
v22 = GJAccountManager::sharedState();
if ( v22->m_accountID - v22->m_unkInt1 == a2 )
{
v23 = GameLevelManager::sharedState();
v24 = GameManager::sharedState();
v25 = v24->m_playerUserID.random - v24->m_playerUserID.seed;
v26 = GJAccountManager::sharedState();
v27 = v26->m_accountID - v26->m_unkInt1;
v28 = GJAccountManager::sharedState();
if ( v28->m_username.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(__p, (void *)v28->m_username.m_data.m_long.capacitym1, v28->m_username.m_data.m_long.size);
}
else
{
*(_OWORD *)__p = *(_OWORD *)&v28->m_username.m_data.m_short.sizex2;
longStorage = v28->m_username.m_data.m_long.longStorage;
}
GameLevelManager::storeUserName(v23, v25, v27, (char *)__p);
if ( SHIBYTE(longStorage) < 0 )
operator delete(__p[0]);
}
v29 = GameLevelManager::sharedState();
GameLevelManager::tryGetUsername((__int64)v29, a2, (__int64)v90);
if ( v91 >= 0 )
v30 = v90;
else
v30 = (void **)v90[0];
a1->m_usernameLabel = cocos2d::CCLabelBMFont::create_1((const char *)v30, "bigFont.fnt");
v31 = ((__n128 (__fastcall *)(cocos2d::CCLayer *))a1->m_mainLayer->addChild_0)(a1->m_mainLayer);
m_usernameLabel = a1->m_usernameLabel;
v31.n128_f32[0] = v94 * 0.5;
v33.n128_f32[0] = (float)((float)(v95 * 0.5) + 145.0) + -20.0;
sub_100022980(v31, v33, &v89);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))m_usernameLabel->setPosition)(m_usernameLabel, &v89);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_usernameLabel, 160.0, 0.8, 0.0);
sub_10024A2D0(a1->m_arrayWithUsernameLabel, a1->m_usernameLabel);
v34 = cocos2d::CCSprite::createWithSpriteFrameName("floorLine_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v34->setScaleX)(v34, 0.8);
((void (__fastcall *)(cocos2d::CCSprite *, float))v34->setScaleY)(v34, 1.0);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v34->setOpacity)(v34, 100);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, _QWORD))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v34,
0);
v35 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_usernameLabel->getPosition)(a1->m_usernameLabel);
v36.n128_u32[0] = 0;
v37.n128_u32[0] = -21.0;
sub_100022980(v36, v37, &v88);
*(float32x2_t *)&v38 = sub_1000229DC(v35, &v88, &v89);
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *, double))v34->setPosition)(v34, &v89, v38);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v34->setBlendFunc)(v34, 0x100000302LL);
v39 = sub_10024A2D0(a1->m_arrayWithUsernameLabel, v34);
v39.n128_f32[0] = v94 * 0.5;
v40.n128_f32[0] = (float)(v95 * 0.5) + 40.0;
sub_100022980(v39, v40, &v89);
v41 = GJCommentListLayer::create(nullptr, " ", (cocos2d::ccColor4B)-12684609, 340.0, 45.0, 0);
v42 = cocos2d::CCDirector::sharedDirector();
v43 = (cocos2d::CCTouchDispatcher *)((__int64 (__fastcall *)(cocos2d::CCDirector *))v42->getTouchDispatcher)(v42);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v43, v41);
v44 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, GJCommentListLayer *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v41,
1);
v44.n128_u32[0] = -1020657664;
v45.n128_u32[0] = -1045168128;
sub_100022980(v44, v45, &v87);
*(float32x2_t *)&v46 = sub_1000229DC(&v89, &v87, &v88);
((void (__fastcall *)(GJCommentListLayer *, float32x2_t *, double))v41->setPosition)(v41, &v88, v46);
sub_10024A2D0(a1->m_arrayWithUsernameLabel, v41);
v47 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v98.ptr = (void (__cdecl *)(cocos2d::CCObject *))ProfilePage::onClose;
v98.adj = 0;
v48 = CCMenuItemSpriteExtra::create(v47, nullptr, a1, v98);
CCMenuItemSpriteExtra::setSizeMult(v48, 1.6);
v49 = (cocos2d::CCMenu *)sub_1001D7ED0(v48);
v50 = v95;
v51.n128_f32[0] = (float)((float)(v94 * 0.5) + -220.0) + 10.0;
a1->m_buttonMenu = v49;
v52.n128_f32[0] = (float)((float)(v50 * 0.5) + 145.0) + -10.0;
sub_100022980(v51, v52, &v88);
((void (__fastcall *)(cocos2d::CCMenu *, float32x2_t *))v49->setPosition)(v49, &v88);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
a1->m_buttonMenu,
10);
ProfilePage::setupComments(a1);
v54 = (cocos2d::CCArray *)sub_10024A15C(v53);
a1->m_buttons = v54;
cocos2d::CCObject::retain(v54);
a1->m_somethingWentWrong = cocos2d::CCLabelBMFont::create_1("Something went wrong...", "goldFont.fnt");
v55 = ((__n128 (__fastcall *)(cocos2d::CCLayer *))a1->m_mainLayer->addChild_0)(a1->m_mainLayer);
m_somethingWentWrong = a1->m_somethingWentWrong;
v55.n128_f32[0] = v94 * 0.5;
v57.n128_f32[0] = (float)(v95 * 0.5) + -53.0;
sub_100022980(v55, v57, &v88);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))m_somethingWentWrong->setPosition)(
m_somethingWentWrong,
&v88);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))a1->m_somethingWentWrong->setScale)(
a1->m_somethingWentWrong,
0.6);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _QWORD))a1->m_somethingWentWrong->setVisible)(
a1->m_somethingWentWrong,
0);
v58 = GJAccountManager::sharedState();
if ( v58->m_accountID - v58->m_unkInt1 != a1->m_accountID )
{
v59 = GameLevelManager::sharedState();
isFollowingUser = GameLevelManager::isFollowingUser(v59, a1->m_accountID);
v61.n128_f32[0] = (float)(v95 * 0.5) + -123.0;
v62.n128_f32[0] = (float)(v94 * 0.5) + -158.0;
sub_100022980(v62, v61, &v88);
v63 = isFollowingUser ? "gj_heartOn_001.png" : "gj_heartOff_001.png";
v64 = cocos2d::CCSprite::createWithSpriteFrameName(v63);
v99.ptr = (void (__cdecl *)(cocos2d::CCObject *))ProfilePage::onFollow;
v99.adj = 0;
v65 = CCMenuItemSpriteExtra::create(v64, nullptr, a1, v99);
a1->m_followBtn = v65;
CCMenuItemSpriteExtra::setSizeMult(v65, 1.1);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
a1->m_followBtn);
m_followBtn = a1->m_followBtn;
v96 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const cocos2d::CCPoint *)&v88);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, float, float))m_followBtn->setPosition)(
m_followBtn,
&v87,
v96.x,
v96.y);
if ( !isFollowingUser )
{
v67 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_followTxt_001.png");
v68 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v67,
2);
v68.n128_u32[0] = 1111490560;
v69.n128_u32[0] = -2.0;
sub_100022980(v68, v69, &v86);
*(float32x2_t *)&v70 = sub_1000229DC(&v88, &v86, &v87);
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *, double))v67->setPosition)(v67, &v87, v70);
}
}
v71 = LoadingCircle::create();
a1->m_circle = v71;
v71->m_parentLayer = a1->m_mainLayer;
v71->m_fade = 0;
cocos2d::CCObject::retain(v71);
LoadingCircle::show(a1->m_circle);
v72 = ((__n128 (__fastcall *)(LoadingCircle *, _QWORD))a1->m_circle->setVisible)(a1->m_circle, 0);
m_sprite = a1->m_circle->m_sprite;
v72.n128_f32[0] = v94 * 0.5;
v74.n128_f32[0] = (float)(v95 * 0.5) + -53.0;
sub_100022980(v72, v74, &v88);
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *))m_sprite->setPosition)(m_sprite, &v88);
v75 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png");
v100.ptr = (void (__cdecl *)(cocos2d::CCObject *))ProfilePage::onUpdate;
v100.adj = 0;
v76 = CCMenuItemSpriteExtra::create(v75, nullptr, a1, v100);
a1->m_refreshBtn = v76;
CCMenuItemSpriteExtra::setSizeMult(v76, 1.5);
v77 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
a1->m_refreshBtn);
m_refreshBtn = a1->m_refreshBtn;
m_buttonMenu = a1->m_buttonMenu;
v77.n128_f32[0] = (float)((float)(v94 * 0.5) + -220.0) + 10.0;
v80.n128_f32[0] = (float)((float)((float)(v95 * 0.5) + -145.0) + 10.0) + 1.0;
sub_100022980(v77, v80, &v87);
v97 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, (const cocos2d::CCPoint *)&v87);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, float, float))m_refreshBtn->setPosition)(
m_refreshBtn,
&v88,
v97.x,
v97.y);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_refreshBtn->setVisible)(a1->m_refreshBtn, 0);
GameLevelManager::sharedState()->m_userInfoDelegate = &a1->UserInfoDelegate;
if ( a1->m_ownProfile && !GameManager::sharedState()->m_scoreValid )
{
ProfilePage::setupCommentsBrowser(a1, nullptr);
GameLevelManager::sharedState()->m_leaderboardManagerDelegate = &a1->LeaderboardManagerDelegate;
((void (__fastcall *)(LoadingCircle *, __int64))a1->m_circle->setVisible)(a1->m_circle, 1);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_refreshBtn->setVisible)(a1->m_refreshBtn, 0);
v84 = GameLevelManager::sharedState();
GameLevelManager::updateUserScore(v84);
}
else
{
v81 = GameLevelManager::sharedState();
v82 = GameLevelManager::userInfoForAccountID(v81, a1->m_accountID);
if ( v82 )
{
if ( v82->m_friendReqStatus == 2 )
ProfilePage::setupCommentsBrowser(a1, nullptr);
else
((void (__fastcall *)(ProfilePage *))a1->getUserInfoFinished)(a1);
}
else
{
((void (__fastcall *)(LoadingCircle *, __int64))a1->m_circle->setVisible)(a1->m_circle, 1);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_refreshBtn->setVisible)(a1->m_refreshBtn, 0);
ProfilePage::setupCommentsBrowser(a1, nullptr);
v83 = GameLevelManager::sharedState();
GameLevelManager::getGJUserInfo(v83, a1->m_accountID);
}
}
if ( v91 < 0 )
operator delete(v90[0]);
}
return v7;
}