//
// AccountLayer::updatePage from 0x46693c to 0x466b80 (580 bytes)
//
// 4 xrefs:
// > AccountLayer::customSetup @ 0x467016
// > AccountLayer::accountStatusChanged @ 0x4670ce
// > AccountLayer::doBackup @ 0x46711e
// > AccountLayer::doSync @ 0x467150
//
// 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; // r10
GJAccountManager *v4; // r0
_BOOL4 v5; // r6
cocos2d::CCLabelBMFont *m_linkedAccountTitle; // r7
void (__fastcall *setString)(cocos2d::CCLabelBMFont *__hidden, const unsigned __int8 *); // r11
cocos2d::CCString *v8; // r0
const char *CString; // r0
TextArea *m_textArea; // r7
GJAccountManager *v11; // r0
cocos2d::CCLabelBMFont *v12; // r7
cocos2d::CCLabelBMFont_vtbl *v13; // r3
void (__fastcall *v14)(cocos2d::CCLabelBMFont *__hidden, const unsigned __int8 *); // r11
cocos2d::CCString *v15; // r0
const char *v16; // r0
TextArea *v17; // r7
CCMenuItemSpriteExtra *m_registerButton; // r9
void (__fastcall *setVisible)(cocos2d::CCNode *__hidden, bool); // r11
GJAccountManager *v20; // r0
CCMenuItemSpriteExtra *m_moreButton; // r6
void (__fastcall *v22)(cocos2d::CCNode *__hidden, bool); // r7
GJAccountManager *v23; // r0
cocos2d::CCNode *v24; // r5
unsigned int m_uReference; // r0
void (__fastcall *v26)(unsigned int, char **); // r3
unsigned int m_uID; // r0
void (__fastcall *v28)(unsigned int, char **); // r3
char *v29; // [sp+8h] [bp-Ch] BYREF
v3 = a2;
v4 = GJAccountManager::sharedState();
if ( v4->m_accountID == v4->m_unkInt1 )
{
v5 = 0;
}
else
{
GJAccountManager::sharedState();
sub_775C20(&v29);
v5 = *((_DWORD *)v29 - 3) != 0;
sub_774008(&v29);
}
TextArea::colorAllCharactersTo(a1->m_textArea, (cocos2d::ccColor3B)-1);
if ( v5 )
{
m_linkedAccountTitle = a1->m_linkedAccountTitle;
setString = m_linkedAccountTitle->setString;
GJAccountManager::sharedState();
sub_775C20(&v29);
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Linked to account: %s", v29);
CString = cocos2d::CCString::getCString(v8);
setString(m_linkedAccountTitle, (const unsigned __int8 *)CString);
sub_774008(&v29);
m_textArea = a1->m_textArea;
sub_776584((int)&v29, (char *)&unk_939830);
TextArea::setString((int)m_textArea, &v29);
}
else
{
v11 = GJAccountManager::sharedState();
v12 = a1->m_linkedAccountTitle;
v13 = v12->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v11->m_accountID == v11->m_unkInt1 )
{
v13->setString(a1->m_linkedAccountTitle, "Not logged in");
v17 = a1->m_textArea;
sub_776584((int)&v29, "Create an account to back up\nand load your data from the cloud");
}
else
{
v14 = v13->setString;
GJAccountManager::sharedState();
sub_775C20(&v29);
v15 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Linked to account: %s", v29);
v16 = cocos2d::CCString::getCString(v15);
v14(v12, (const unsigned __int8 *)v16);
sub_774008(&v29);
v17 = a1->m_textArea;
sub_776584((int)&v29, "Login required");
}
TextArea::setString((int)v17, &v29);
}
sub_774008(&v29);
a1->m_loginButton->setVisible(a1->m_loginButton, !v5);
m_registerButton = a1->m_registerButton;
setVisible = m_registerButton->setVisible;
v20 = GJAccountManager::sharedState();
setVisible(m_registerButton, v20->m_accountID == v20->m_unkInt1);
a1->m_backupButton->setVisible(a1->m_backupButton, v5);
a1->m_syncButton->setVisible(a1->m_syncButton, v5);
a1->m_helpButton->setVisible(a1->m_helpButton, !v5);
m_moreButton = a1->m_moreButton;
v22 = m_moreButton->setVisible;
v23 = GJAccountManager::sharedState();
v22(m_moreButton, v23->m_accountID != v23->m_unkInt1);
if ( v3 && !a1->m_isLoggedIn )
{
((void (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_backupButton->setEnabled)(a1->m_backupButton);
v24 = a1->m_backupButton->getNormalImage(a1->m_backupButton);
m_uReference = v24[2].m_uReference;
v26 = *(void (__fastcall **)(unsigned int, char **))(*(_DWORD *)m_uReference + 472);
memset(&v29, 125, 3);
v26(m_uReference, &v29);
m_uID = v24[2].m_uID;
v28 = *(void (__fastcall **)(unsigned int, char **))(*(_DWORD *)m_uID + 528);
memset(&v29, 125, 3);
v28(m_uID, &v29);
}
}