//
// ProfilePage::init from 0x1007b8780 to 0x1007b91d6 (2646 bytes)
//
// 1 xrefs:
// > ProfilePage::create @ 0x1007b8732
//
// 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)
{
bool inited; // al
bool v6; // r12
GJAccountManager *v7; // rax
int v8; // ecx
GameLevelManager *v9; // rbx
GJAccountManager *v10; // rax
GameLevelManager *v11; // rax
GameLevelManager *v12; // rax
GameLevelManager *v13; // rax
GameLevelManager *v14; // rax
GameLevelManager *v15; // rax
GameLevelManager *v16; // rax
cocos2d::CCArray *v17; // rax
cocos2d::extension::CCScale9Sprite *v18; // r12
__int128 v19; // xmm0
GJAccountManager *v20; // rax
GameLevelManager *v21; // r12
GameManager *v22; // rax
int v23; // r13d
GJAccountManager *v24; // rax
int v25; // ebx
GJAccountManager *v26; // rax
std::string *p_m_username; // rax
GameLevelManager *v28; // rax
const char *data; // rdi
cocos2d::CCLabelBMFont *v30; // rax
cocos2d::CCLabelBMFont *m_usernameLabel; // rbx
cocos2d::CCSprite *v32; // r15
unsigned __int64 *v33; // rbx
GJCommentListLayer *v34; // r15
cocos2d::CCDirector *v35; // rax
cocos2d::CCTouchDispatcher *v36; // rax
cocos2d::CCSprite *v37; // rax
CCMenuItemSpriteExtra *v38; // rbx
cocos2d::CCMenu *v39; // rbx
cocos2d::CCArray *v40; // rax
cocos2d::CCLabelBMFont *v41; // rax
cocos2d::CCLabelBMFont *m_somethingWentWrong; // rbx
GJAccountManager *v43; // rax
GameLevelManager *v44; // rax
bool isFollowingUser; // r15
const char *v46; // rdi
cocos2d::CCSprite *v47; // rax
CCMenuItemSpriteExtra *v48; // rax
CCMenuItemSpriteExtra *m_followBtn; // rbx
cocos2d::CCSprite *v50; // r15
LoadingCircle *v51; // rax
cocos2d::CCSprite *m_sprite; // rbx
cocos2d::CCSprite *v53; // rax
CCMenuItemSpriteExtra *v54; // rax
CCMenuItemSpriteExtra *m_refreshBtn; // r15
cocos2d::CCMenu *m_buttonMenu; // rbx
GameLevelManager *v57; // rax
GJUserScore *v58; // rax
GameLevelManager *v59; // rax
GameLevelManager *v60; // rax
unsigned __int64 v62; // [rsp+8h] [rbp-88h] BYREF
__int128 v63; // [rsp+10h] [rbp-80h] BYREF
void *__p; // [rsp+20h] [rbp-70h]
std::string v65; // [rsp+28h] [rbp-68h] BYREF
unsigned __int64 v66; // [rsp+44h] [rbp-4Ch] BYREF
unsigned __int64 v67; // [rsp+4Ch] [rbp-44h] BYREF
unsigned __int64 v68; // [rsp+54h] [rbp-3Ch] BYREF
float v69; // [rsp+5Ch] [rbp-34h] BYREF
float v70; // [rsp+60h] [rbp-30h]
bool v71; // [rsp+67h] [rbp-29h]
double v72; // 0:xmm0_8.8
double v73; // 0:xmm0_8.8
cocos2d::CCRect v74; // 0:xmm0_8.8,8:xmm1_8.8
inited = FLAlertLayer::init_1(a1, 150);
v6 = inited;
if ( inited )
{
a1->m_accountID = a2;
v71 = inited;
if ( a3 )
{
v7 = GJAccountManager::sharedState();
v8 = v7->m_accountID - v7->m_unkInt1;
a1->m_ownProfile = v8 == a2;
if ( v8 == a2 && !GameManager::sharedState()->m_scoreValid )
{
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_10071F9E0();
a1->m_arrayWithUsernameLabel = v17;
cocos2d::CCObject::retain(v17);
cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v69);
v74.origin = 0;
v74.size = 0;
sub_10028CC00((__int64)&v65, 0.0, 0.0, (__m128)0x42A00000u, (__m128)0x42A00000u);
v18 = cocos2d::extension::CCScale9Sprite::create_2("GJ_square01.png", v74);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v18->setOpacity)(v18, 255);
sub_10028CBF0((float *)&v65, 440.0, 290.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, std::string *))v18->setContentSize)(v18, &v65);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v18,
0xFFFFFFFFLL);
*(_QWORD *)&v19 = LODWORD(v69);
*(float *)&v19 = v69 * 0.5;
sub_10028CBE0((float *)&v65, v69 * 0.5, v70 * 0.5);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, std::string *))v18->setPosition)(v18, &v65);
v20 = GJAccountManager::sharedState();
if ( v20->m_accountID - v20->m_unkInt1 == a2 )
{
v21 = GameLevelManager::sharedState();
v22 = GameManager::sharedState();
v23 = v22->m_playerUserID.random - v22->m_playerUserID.seed;
v24 = GJAccountManager::sharedState();
v25 = v24->m_accountID - v24->m_unkInt1;
v26 = GJAccountManager::sharedState();
if ( (v26->m_username.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(
&v63,
v26->m_username.m_data.m_long.longStorage,
v26->m_username.m_data.m_long.size,
*(double *)&v19);
}
else
{
p_m_username = &v26->m_username;
__p = p_m_username->m_data.m_long.longStorage;
v19 = *(_OWORD *)&p_m_username->m_data.m_short.sizex2;
v63 = *(_OWORD *)&p_m_username->m_data.m_short.sizex2;
}
GameLevelManager::storeUserName((__int64)v21, v23, v25, (__int64)&v63, *(double *)&v19);
if ( (v63 & 1) != 0 )
operator delete(__p);
}
v28 = GameLevelManager::sharedState();
GameLevelManager::tryGetUsername(&v65, (__int64)v28, a2, *(double *)&v19);
if ( (*(_BYTE *)&v65.__r_.__value_.__s.0 & 1) != 0 )
data = v65.__r_.__value_.__l.__data_;
else
data = v65.__r_.__value_.__s.__data_;
v6 = v71;
v30 = cocos2d::CCLabelBMFont::create_3(data, "bigFont.fnt");
a1->m_usernameLabel = v30;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v30,
20);
m_usernameLabel = a1->m_usernameLabel;
sub_10028CBE0((float *)&v66, v69 * 0.5, (float)((float)(v70 * 0.5) + 145.0) + -20.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, unsigned __int64 *))m_usernameLabel->setPosition)(
m_usernameLabel,
&v66);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_usernameLabel, 160.0, 0.80000001, 0.0);
sub_10071FCD0((__int64)a1->m_arrayWithUsernameLabel, a1->m_usernameLabel);
v32 = cocos2d::CCSprite::createWithSpriteFrameName("floorLine_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v32->setScaleX)(v32, 0.80000001);
((void (__fastcall *)(cocos2d::CCSprite *, float))v32->setScaleY)(v32, 1.0);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v32->setOpacity)(v32, 100);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, _QWORD))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v32,
0);
v33 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_usernameLabel->getPosition)(a1->m_usernameLabel);
sub_10028CBE0((float *)&v68, 0.0, -21.0);
sub_10028CCE0((double *)&v66, v33, &v68);
((void (__fastcall *)(cocos2d::CCSprite *, unsigned __int64 *))v32->setPosition)(v32, &v66);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v32->setBlendFunc)(v32, 0x100000302LL);
sub_10071FCD0((__int64)a1->m_arrayWithUsernameLabel, v32);
sub_10028CBE0((float *)&v66, v69 * 0.5, (float)(v70 * 0.5) + 40.0);
v34 = GJCommentListLayer::create(nullptr, " ", (cocos2d::ccColor4B)-12684609, 340.0, 45.0, 0);
v35 = cocos2d::CCDirector::sharedDirector();
v36 = (cocos2d::CCTouchDispatcher *)((__int64 (__fastcall *)(cocos2d::CCDirector *))v35->getTouchDispatcher)(v35);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v36, v34);
((void (__fastcall *)(cocos2d::CCLayer *, GJCommentListLayer *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v34,
1);
sub_10028CBE0((float *)&v67, -170.0, -22.5);
sub_10028CCE0((double *)&v68, &v66, &v67);
((void (__fastcall *)(GJCommentListLayer *, unsigned __int64 *))v34->setPosition)(v34, &v68);
sub_10071FCD0((__int64)a1->m_arrayWithUsernameLabel, v34);
v37 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v38 = CCMenuItemSpriteExtra::create(
v37,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)ProfilePage::onClose);
CCMenuItemSpriteExtra::setSizeMult(v38, 1.6);
v39 = sub_100792C50(v38, 0);
a1->m_buttonMenu = v39;
sub_10028CBE0(
(float *)&v68,
(float)((float)(v69 * 0.5) + -220.0) + 10.0,
(float)((float)(v70 * 0.5) + 145.0) + -10.0);
((void (__fastcall *)(cocos2d::CCMenu *, unsigned __int64 *))v39->setPosition)(v39, &v68);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
a1->m_buttonMenu,
10);
ProfilePage::setupComments(a1);
v40 = (cocos2d::CCArray *)sub_10071F9E0();
a1->m_buttons = v40;
cocos2d::CCObject::retain(v40);
v41 = cocos2d::CCLabelBMFont::create_3("Something went wrong...", "goldFont.fnt");
a1->m_somethingWentWrong = v41;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v41,
10);
m_somethingWentWrong = a1->m_somethingWentWrong;
sub_10028CBE0((float *)&v68, v69 * 0.5, (float)(v70 * 0.5) + -53.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, unsigned __int64 *))m_somethingWentWrong->setPosition)(
m_somethingWentWrong,
&v68);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))a1->m_somethingWentWrong->setScale)(
a1->m_somethingWentWrong,
0.60000002);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _QWORD))a1->m_somethingWentWrong->setVisible)(
a1->m_somethingWentWrong,
0);
v43 = GJAccountManager::sharedState();
if ( v43->m_accountID - v43->m_unkInt1 != a1->m_accountID )
{
v44 = GameLevelManager::sharedState();
isFollowingUser = GameLevelManager::isFollowingUser(v44, a1->m_accountID);
sub_10028CBE0((float *)&v68, (float)(v69 * 0.5) + -158.0, (float)(v70 * 0.5) + -123.0);
v46 = "gj_heartOff_001.png";
if ( isFollowingUser )
v46 = "gj_heartOn_001.png";
v47 = cocos2d::CCSprite::createWithSpriteFrameName(v46);
v48 = CCMenuItemSpriteExtra::create(
v47,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)ProfilePage::onFollow);
a1->m_followBtn = v48;
CCMenuItemSpriteExtra::setSizeMult(v48, 1.1);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
a1->m_followBtn);
m_followBtn = a1->m_followBtn;
*(cocos2d::CCPoint *)&v72 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)&v67,
(const cocos2d::CCPoint *)a1->m_buttonMenu);
((void (__fastcall *)(CCMenuItemSpriteExtra *, unsigned __int64 *, double))m_followBtn->setPosition)(
m_followBtn,
&v67,
v72);
if ( !isFollowingUser )
{
v50 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_followTxt_001.png");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v50,
2);
sub_10028CBE0((float *)&v62, 48.0, -2.0);
sub_10028CCE0((double *)&v67, &v68, &v62);
((void (__fastcall *)(cocos2d::CCSprite *, unsigned __int64 *))v50->setPosition)(v50, &v67);
}
}
v51 = LoadingCircle::create();
a1->m_circle = v51;
v51->m_parentLayer = a1->m_mainLayer;
v51->m_fade = 0;
cocos2d::CCObject::retain(v51);
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 *)&v68, v69 * 0.5, (float)(v70 * 0.5) + -53.0);
((void (__fastcall *)(cocos2d::CCSprite *, unsigned __int64 *))m_sprite->setPosition)(m_sprite, &v68);
v53 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png");
v54 = CCMenuItemSpriteExtra::create(
v53,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)ProfilePage::onUpdate);
a1->m_refreshBtn = v54;
CCMenuItemSpriteExtra::setSizeMult(v54, 1.5);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
a1->m_refreshBtn);
m_refreshBtn = a1->m_refreshBtn;
m_buttonMenu = a1->m_buttonMenu;
sub_10028CBE0(
(float *)&v67,
(float)((float)(v69 * 0.5) + -220.0) + 10.0,
(float)((float)((float)(0.5 * v70) + -145.0) + 10.0) + 1.0);
*(cocos2d::CCPoint *)&v73 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)&v68,
(const cocos2d::CCPoint *)m_buttonMenu);
((void (__fastcall *)(CCMenuItemSpriteExtra *, unsigned __int64 *, double))m_refreshBtn->setPosition)(
m_refreshBtn,
&v68,
v73);
((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);
v60 = GameLevelManager::sharedState();
GameLevelManager::updateUserScore(v60);
}
else
{
v57 = GameLevelManager::sharedState();
v58 = GameLevelManager::userInfoForAccountID(v57, a1->m_accountID);
if ( v58 )
{
if ( v58->m_friendReqStatus == 2 )
ProfilePage::setupCommentsBrowser(a1, nullptr);
else
((void (__fastcall *)(ProfilePage *, GJUserScore *))a1->getUserInfoFinished)(a1, v58);
}
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);
v59 = GameLevelManager::sharedState();
GameLevelManager::getGJUserInfo(v59, a1->m_accountID);
}
}
if ( (*(_BYTE *)&v65.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v65.__r_.__value_.__l.__data_);
}
return v6;
}