//
// ProfilePage::onUpdate from 0x1403bf7f0 to 0x1403bfe7a (1674 bytes)
//
// 2 xrefs:
// > ProfilePage::init @ 0x1403bf4a5
// > ??> @ 0x1406d7730
//
// 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=15
void ProfilePage::onUpdate(ProfilePage *a1, cocos2d::CCObject *a2)
{
bool v3; // zf
GameLevelManager *v4; // rcx
GameLevelManager *v5; // rcx
__int64 v6; // rbx
GJAccountManager *v7; // rax
GJAccountManager *v8; // rax
int v9; // r15d
GameLevelManager *v10; // r14
char v11; // di
int v12; // ebx
cocos2d::CCString *v13; // rax
const char *CString; // rax
size_t v15; // r8
void **v16; // rdx
void *v17; // rcx
void *v18; // rcx
GJAccountManager *v19; // rax
int v20; // ebx
GameLevelManager *v21; // rcx
GameLevelManager *v22; // rcx
GameLevelManager *v23; // rcx
GameLevelManager *v24; // rcx
GameLevelManager *v25; // rcx
GameLevelManager *v26; // rcx
GameLevelManager *v27; // rcx
__int64 v28; // rcx
cocos2d::CCDirector *v29; // rax
cocos2d::CCSprite *m_sprite; // rbx
cocos2d::CCSprite_vtbl *v31; // rdi
const cocos2d::CCPoint *v32; // rax
_BOOL8 v33; // rdx
GameLevelManager *v34; // rcx
_BOOL8 v35; // rdx
void *v36; // [rsp+20h] [rbp-40h]
void *v37; // [rsp+28h] [rbp-38h]
void *v38; // [rsp+28h] [rbp-38h]
void *v39; // [rsp+28h] [rbp-38h]
void *Block[2]; // [rsp+30h] [rbp-30h] BYREF
__int64 v41; // [rsp+40h] [rbp-20h]
unsigned __int64 v42; // [rsp+48h] [rbp-18h]
v3 = !a1->m_ownProfile;
v4 = (GameLevelManager *)qword_1406C2EC0;
if ( v3 )
{
if ( !qword_1406C2EC0 )
{
v38 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v38);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v4 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::resetCommentTimersForAccountID(v4, a1->m_accountID);
LOBYTE(v35) = 1;
a1->m_circle->setVisible(a1->m_circle, v35);
a1->m_leftArrow->setVisible(a1->m_leftArrow, 0);
a1->m_rightArrow->setVisible(a1->m_rightArrow, 0);
a1->m_refreshBtn->setVisible(a1->m_refreshBtn, 0);
ProfilePage::setupCommentsBrowser(a1, nullptr);
v34 = (GameLevelManager *)qword_1406C2EC0;
if ( qword_1406C2EC0 )
goto LABEL_54;
v39 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v39);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
LABEL_53:
v34 = (GameLevelManager *)qword_1406C2EC0;
LABEL_54:
GameLevelManager::getGJUserInfo(v34, a1->m_accountID);
return;
}
if ( !qword_1406C2EC0 )
{
v36 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v4 = (GameLevelManager *)qword_1406C2EC0;
}
if ( (unsigned int)(GameLevelManager::getTimeLeft(v4, "upd_profile", 5.0) - 1) > 4 )
{
v5 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v36 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v5 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::makeTimeStamp(v5, "upd_profile");
v6 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v36 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v6 = qword_1406C2EC0;
}
v7 = GJAccountManager::sharedState();
cocos2d::CCDictionary::removeObjectForKey(*(cocos2d::CCDictionary **)(v6 + 600), v7->m_accountID - v7->m_unkInt1);
v8 = GJAccountManager::sharedState();
v9 = v8->m_accountID - v8->m_unkInt1;
v10 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v36 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v10 = (GameLevelManager *)qword_1406C2EC0;
}
v11 = 1;
v12 = 0;
while ( 1 )
{
v13 = cocos2d::CCString::createWithFormat("a_%i_%i", v9, v12);
CString = cocos2d::CCString::getCString(v13);
*(_OWORD *)Block = 0;
v41 = 0;
v42 = 0;
v15 = -1;
do
++v15;
while ( CString[v15] );
sub_14003A930(Block, CString, v15);
v16 = Block;
if ( v42 > 0xF )
v16 = (void **)Block[0];
if ( GameLevelManager::getStoredOnlineLevels(v10, (const char *)v16) )
cocos2d::CCDictionary::removeObjectForKey(v10->m_storedLevels, Block);
else
v11 = 0;
if ( ++v12 > 100 )
break;
if ( v42 > 0xF )
{
v17 = Block[0];
if ( v42 + 1 >= 0x1000 )
{
v17 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v17 - 8) > 0x1F )
goto LABEL_29;
}
j_j_free(v17);
}
if ( !v11 )
goto LABEL_31;
}
if ( v42 > 0xF )
{
v18 = Block[0];
if ( v42 + 1 >= 0x1000 )
{
v18 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v18 - 8) > 0x1F )
LABEL_29:
invalid_parameter_noinfo_noreturn();
}
j_j_free(v18);
}
LABEL_31:
v19 = GJAccountManager::sharedState();
v20 = v19->m_accountID - v19->m_unkInt1;
v21 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v36 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v21 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::resetCommentTimersForAccountID(v21, v20);
v22 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v36 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v22 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::invalidateMessages(v22, 1, 0);
v23 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v36 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v23 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::invalidateMessages(v23, 0, 0);
v24 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v36 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v24 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::invalidateRequests(v24, 1, 0);
v25 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v36 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v25 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::invalidateRequests(v25, 0, 0);
v26 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v36 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v26 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::resetStoredUserList(v26, (UserListType)0);
v27 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v36 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v27 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::resetStoredUserList(v27, Blocked);
if ( a1->m_score )
{
v29 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v28);
cocos2d::CCDirector::getWinSize(v29);
m_sprite = a1->m_circle->m_sprite;
v31 = m_sprite->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(0.0, (float)((float)(*(float *)&v36 * 0.5) - 220.0) + 10.0);
v31->setPosition_0(m_sprite, v32);
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_circle->m_sprite->setScale_0)(a1->m_circle->m_sprite);
}
a1->m_somethingWentWrong->setVisible(a1->m_somethingWentWrong, 0);
LOBYTE(v33) = 1;
a1->m_circle->setVisible(a1->m_circle, v33);
a1->m_refreshBtn->setVisible(a1->m_refreshBtn, 0);
v34 = (GameLevelManager *)qword_1406C2EC0;
if ( qword_1406C2EC0 )
goto LABEL_54;
v37 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v37);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
goto LABEL_53;
}
}