//
// ProfilePage::onFollow from 0x1403c4520 to 0x1403c4ae8 (1480 bytes)
//
// 2 xrefs:
// > ProfilePage::init @ 0x1403bf32d
// > ??> @ 0x1406d77cc
//
// 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
//
// Hidden C++ exception states: #wind=11
void ProfilePage::onFollow(ProfilePage *a1, cocos2d::CCObject *a2)
{
bool v2; // r9
GameManager *v4; // rcx
GameLevelManager *v5; // rcx
bool isFollowingUser; // r14
__int64 v7; // rcx
int v8; // edi
float v9; // xmm6_4
int v10; // ebx
bool v11; // r9
GameManager *v12; // rcx
GameManager *v13; // rbx
float v14; // xmm0_4
bool v15; // r9
GameManager *v16; // rbx
float v17; // xmm0_4
bool v18; // r9
cocos2d::CCString *v19; // rax
const char *v20; // rax
size_t v21; // r8
__int64 v22; // rax
FLAlertLayer *v23; // rbx
__int64 v24; // rdi
cocos2d::CCString *v25; // rax
const char *v26; // rax
size_t v27; // r8
__int64 v28; // rax
void *v29; // rcx
void *v30; // rcx
__int64 v31; // rdi
cocos2d::CCString *v32; // rax
const char *CString; // rax
size_t v34; // r8
__int64 v35; // rcx
cocos2d::CCNode *v36; // rdi
cocos2d::CCNode_vtbl *v37; // rsi
const char *v38; // rbx
cocos2d::CCSpriteFrameCache *v39; // rax
struct cocos2d::CCSpriteFrame *v40; // rax
void *v41; // [rsp+58h] [rbp-29h]
void *v42; // [rsp+58h] [rbp-29h]
void *v43; // [rsp+58h] [rbp-29h]
void *v44; // [rsp+58h] [rbp-29h]
void *v45; // [rsp+58h] [rbp-29h]
void *v46; // [rsp+58h] [rbp-29h]
void *v47; // [rsp+60h] [rbp-21h]
void *v48; // [rsp+60h] [rbp-21h]
void *Block[2]; // [rsp+68h] [rbp-19h] BYREF
__int64 v50; // [rsp+78h] [rbp-9h]
unsigned __int64 v51; // [rsp+80h] [rbp-1h]
void *v52[2]; // [rsp+88h] [rbp+7h] BYREF
__int64 v53; // [rsp+98h] [rbp+17h]
unsigned __int64 v54; // [rsp+A0h] [rbp+1Fh]
v4 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v41 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v41);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v4 = (GameManager *)qword_1406C2ED8;
}
GameManager::reportAchievementWithID(v4, "geometry.ach.followCreator", 100, v2);
v5 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v42 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v42);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v5 = (GameLevelManager *)qword_1406C2EC0;
}
isFollowingUser = GameLevelManager::isFollowingUser(v5, a1->m_accountID);
if ( isFollowingUser )
{
v31 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v48 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v48);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v31 = qword_1406C2EC0;
}
v32 = cocos2d::CCString::createWithFormat("%i", a1->m_accountID);
CString = cocos2d::CCString::getCString(v32);
*(_OWORD *)v52 = 0;
v53 = 0;
v54 = 0;
v34 = -1;
do
++v34;
while ( CString[v34] );
sub_14003A930(v52, CString, v34);
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(v31 + 368), v52);
if ( v54 <= 0xF )
goto LABEL_40;
v30 = v52[0];
if ( v54 + 1 >= 0x1000 )
{
v30 = *((void **)v52[0] - 1);
if ( (unsigned __int64)((char *)v52[0] - (char *)v30 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
goto LABEL_39;
}
v7 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v43 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v43);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v7 = qword_1406C2EC0;
}
v8 = cocos2d::CCDictionary::count(*(cocos2d::CCDictionary **)(v7 + 368));
v9 = (float)(v8 + 1);
v10 = (int)floorf((float)(v9 / 10.0) * 100.0);
v12 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v12 = (GameManager *)qword_1406C2ED8;
}
GameManager::reportAchievementWithID(v12, "geometry.ach.followCreator02", v10, v11);
v13 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v45 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v13 = (GameManager *)qword_1406C2ED8;
}
v14 = floorf((float)(v9 / 25.0) * 100.0);
GameManager::reportAchievementWithID(v13, "geometry.ach.followCreator03", (int)v14, v15);
v16 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v46 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v46);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v16 = (GameManager *)qword_1406C2ED8;
}
v17 = floorf((float)(v9 / 50.0) * 100.0);
GameManager::reportAchievementWithID(v16, "geometry.ach.followCreator04", (int)v17, v18);
if ( v8 >= 100 )
{
v19 = cocos2d::CCString::createWithFormat("You can only follow %i users at the same time.", 100);
v20 = cocos2d::CCString::getCString(v19);
*(_OWORD *)Block = 0;
v50 = 0;
v51 = 0;
v21 = -1;
do
++v21;
while ( v20[v21] );
sub_14003A930(Block, v20, v21);
v22 = sub_14003BDB0((__int64)v52, (__int64)Block);
v23 = FLAlertLayer::create(0, (int)"Max Followed", v22, (__int64)"OK", 0, 1132068864, 0, 0, 1065353216);
sub_14003A830((__int64)Block);
v23->show(v23);
return;
}
v24 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v47 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v47);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v24 = qword_1406C2EC0;
}
v25 = cocos2d::CCString::createWithFormat("%i", a1->m_accountID);
v26 = cocos2d::CCString::getCString(v25);
*(_OWORD *)v52 = 0;
v53 = 0;
v54 = 0;
v27 = -1;
do
++v27;
while ( v26[v27] );
sub_14003A930(v52, v26, v27);
*(_OWORD *)Block = 0;
v50 = 1;
v51 = 15;
LOWORD(Block[0]) = 49;
v28 = cocos2d::CCString::create(Block);
cocos2d::CCDictionary::setObject(*(_QWORD *)(v24 + 368), v28, v52);
if ( v51 > 0xF )
{
v29 = Block[0];
if ( v51 + 1 >= 0x1000 )
{
v29 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v29 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v29);
}
v50 = 0;
v51 = 15;
LOBYTE(Block[0]) = 0;
if ( v54 > 0xF )
{
v30 = v52[0];
if ( v54 + 1 >= 0x1000 )
{
v30 = *((void **)v52[0] - 1);
if ( (unsigned __int64)((char *)v52[0] - (char *)v30 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
LABEL_39:
j_j_free(v30);
}
LABEL_40:
v36 = a1->m_followBtn->getNormalImage(a1->m_followBtn);
v37 = v36->__vftable;
v38 = "gj_heartOff_001.png";
if ( !isFollowingUser )
v38 = "gj_heartOn_001.png";
v39 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v35);
v40 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v39, v38);
((void (__fastcall *)(cocos2d::CCNode *, struct cocos2d::CCSpriteFrame *))v37[1].setScaleX)(v36, v40);
}