//
// AccountLayer::updatePage from 0x84b1b0 to 0x84b700 (1360 bytes)
//
// 5 xrefs:
// > AccountLayer::customSetup @ 0x84bc80
// > AccountLayer::accountStatusChanged @ 0x84be48
// > AccountLayer::doBackup @ 0x84bef0
// > AccountLayer::doSync @ 0x84bf4c
// > ??> @ 0x96b28
//
// 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
//
void AccountLayer::updatePage(AccountLayer *a1, bool a2)
{
_BOOL4 v3; // w24
GJAccountManager *v4; // x0
char *v5; // x0
__int64 v6; // x23
cocos2d::CCLabelBMFont *v7; // x23
void (__fastcall *v8)(cocos2d::CCLabelBMFont *__hidden, const unsigned __int8 *); // x25
double v9; // d0
cocos2d::CCString *v10; // x0
const char *v11; // x0
char *v12; // x0
TextArea *v13; // x23
char *v14; // x0
_BOOL4 v15; // w20
CCMenuItemSpriteExtra *m_registerButton; // x25
void (__fastcall *setVisible)(cocos2d::CCNode *__hidden, bool); // x26
GJAccountManager *v18; // x1
CCMenuItemSpriteExtra *m_moreButton; // x20
void (__fastcall *v20)(cocos2d::CCNode *__hidden, bool); // x23
GJAccountManager *v21; // x1
GJAccountManager *v22; // x0
cocos2d::CCLabelBMFont *m_linkedAccountTitle; // x23
void (__fastcall *setString)(cocos2d::CCLabelBMFont *__hidden, const unsigned __int8 *); // x25
double v25; // d0
cocos2d::CCString *v26; // x0
const char *CString; // x0
char *v28; // x0
TextArea *v29; // x23
char *v30; // x1
char *v31; // x0
cocos2d::CCNode *v32; // x19
__int64 v33; // x0
void (__fastcall *v34)(__int64, char **); // x2
cocos2d::CCComponentContainer *m_pComponentContainer; // x0
bool (__fastcall *remove)(cocos2d::CCComponentContainer *__hidden, const unsigned __int8 *); // x2
TextArea *m_textArea; // x23
unsigned int *v38; // x1
int v39; // w2
unsigned int *v40; // x1
int v41; // w2
unsigned int *v42; // x1
int v43; // w2
unsigned int *v44; // x1
int v45; // w2
unsigned int *v46; // x1
unsigned int *v47; // x1
int v48; // w2
char *v49; // [xsp+60h] [xbp+60h] BYREF
v3 = a2;
v4 = GJAccountManager::sharedState();
if ( v4->m_accountID == v4->m_unkInt1 )
{
TextArea::colorAllCharactersTo(a1->m_textArea, (cocos2d::ccColor3B)&unk_FFFFFF);
goto LABEL_12;
}
GJAccountManager::sharedState();
sub_D18D28(&v49);
v5 = v49 - 24;
v6 = *((_QWORD *)v49 - 3);
if ( v49 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v40 = (unsigned int *)(v49 - 8);
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = *((_DWORD *)v49 - 2);
*((_DWORD *)v49 - 2) = v41 - 1;
}
if ( v41 <= 0 )
operator delete(v5);
}
TextArea::colorAllCharactersTo(a1->m_textArea, (cocos2d::ccColor3B)&unk_FFFFFF);
if ( !v6 )
{
LABEL_12:
v22 = GJAccountManager::sharedState();
if ( v22->m_accountID == v22->m_unkInt1 )
{
a1->m_linkedAccountTitle->setString(a1->m_linkedAccountTitle, "Not logged in");
m_textArea = a1->m_textArea;
sub_D153B8((int)&v49, "Create an account to back up\nand load your data from the cloud");
TextArea::setString((__int64)m_textArea, (const void **)&v49);
v30 = v49;
v31 = v49 - 24;
if ( v49 - 24 == (char *)&qword_124B6B0 )
goto LABEL_15;
if ( &pthread_create )
{
v38 = (unsigned int *)(v49 - 8);
do
v39 = __ldaxr(v38);
while ( __stlxr(v39 - 1, v38) );
LABEL_39:
if ( v39 <= 0 )
{
v15 = 0;
operator delete(v31);
goto LABEL_7;
}
LABEL_15:
v15 = 0;
goto LABEL_7;
}
}
else
{
m_linkedAccountTitle = a1->m_linkedAccountTitle;
setString = m_linkedAccountTitle->setString;
GJAccountManager::sharedState();
*(_QWORD *)&v25 = sub_D18D28(&v49).n128_u64[0];
v26 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Linked to account: %s",
v49,
v25);
CString = cocos2d::CCString::getCString(v26);
setString(m_linkedAccountTitle, (const unsigned __int8 *)CString);
v28 = v49 - 24;
if ( v49 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v47 = (unsigned int *)(v49 - 8);
do
v48 = __ldaxr(v47);
while ( __stlxr(v48 - 1, v47) );
}
else
{
v48 = *((_DWORD *)v49 - 2);
*((_DWORD *)v49 - 2) = v48 - 1;
}
if ( v48 <= 0 )
operator delete(v28);
}
v29 = a1->m_textArea;
sub_D153B8((int)&v49, "Login required");
TextArea::setString((__int64)v29, (const void **)&v49);
v30 = v49;
v31 = v49 - 24;
if ( v49 - 24 == (char *)&qword_124B6B0 )
goto LABEL_15;
if ( &pthread_create )
{
v46 = (unsigned int *)(v49 - 8);
do
v39 = __ldaxr(v46);
while ( __stlxr(v39 - 1, v46) );
goto LABEL_39;
}
}
v39 = *((_DWORD *)v30 - 2);
*((_DWORD *)v30 - 2) = v39 - 1;
goto LABEL_39;
}
v7 = a1->m_linkedAccountTitle;
v8 = v7->setString;
GJAccountManager::sharedState();
*(_QWORD *)&v9 = sub_D18D28(&v49).n128_u64[0];
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Linked to account: %s", v49, v9);
v11 = cocos2d::CCString::getCString(v10);
v8(v7, (const unsigned __int8 *)v11);
v12 = v49 - 24;
if ( v49 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)(v49 - 8);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *((_DWORD *)v49 - 2);
*((_DWORD *)v49 - 2) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v12);
}
v13 = a1->m_textArea;
sub_D153B8((int)&v49, &byte_F288A0);
TextArea::setString((__int64)v13, (const void **)&v49);
v14 = v49 - 24;
if ( v49 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = (unsigned int *)(v49 - 8);
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *((_DWORD *)v49 - 2);
*((_DWORD *)v49 - 2) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v14);
}
v15 = 1;
LABEL_7:
a1->m_loginButton->setVisible(a1->m_loginButton, !v15);
m_registerButton = a1->m_registerButton;
setVisible = m_registerButton->setVisible;
v18 = GJAccountManager::sharedState();
setVisible(m_registerButton, v18->m_accountID == v18->m_unkInt1);
a1->m_backupButton->setVisible(a1->m_backupButton, v15);
a1->m_syncButton->setVisible(a1->m_syncButton, v15);
a1->m_helpButton->setVisible(a1->m_helpButton, !v15);
m_moreButton = a1->m_moreButton;
v20 = m_moreButton->setVisible;
v21 = GJAccountManager::sharedState();
v20(m_moreButton, v21->m_accountID != v21->m_unkInt1);
if ( v3 && !a1->m_isLoggedIn )
{
a1->m_backupButton->setEnabled(a1->m_backupButton, 0);
v32 = a1->m_backupButton->getNormalImage(a1->m_backupButton);
v33 = *(_QWORD *)&v32[2].m_uID;
v34 = *(void (__fastcall **)(__int64, char **))(*(_QWORD *)v33 + 944LL);
memset(&v49, 125, 3);
v34(v33, &v49);
m_pComponentContainer = v32[1].m_pComponentContainer;
remove = m_pComponentContainer->__vftable[16].remove;
memset(&v49, 125, 3);
remove(m_pComponentContainer, (const unsigned __int8 *)&v49);
}
}