//
// AccountLayer::updatePage from 0x1000ccac0 to 0x1000cceea (1066 bytes)
//
// 7 xrefs:
// > AccountLayer::customSetup @ 0x1000cc327
// > AccountLayer::doBackup @ 0x1000cd15b
// > AccountLayer::doSync @ 0x1000cd22b
// > AccountLayer::accountStatusChanged @ 0x1000cd2ba
// > sub_1000CD2C0 @ 0x1000cd2d1
// > AccountLayer::FLAlert_Clicked @ 0x1000cdcbb
// > AccountLayer::FLAlert_Clicked @ 0x1000cdcea
//
// 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 __fastcall AccountLayer::updatePage(AccountLayer *a1, bool a2)
{
__int128 v2; // xmm0
GJAccountManager *v4; // rax
TextArea **p_m_textArea; // r12
GJAccountManager *v6; // rax
std::string *p_m_GJP2; // rax
__int64 v8; // r15
cocos2d::CCLabelBMFont *v9; // r15
GJAccountManager *v10; // rax
std::string *v11; // rax
GJAccountManager *v12; // rax
cocos2d::CCLabelBMFont *m_linkedAccountTitle; // r15
TextArea *v14; // r15
unsigned __int8 v15; // r13
void **v16; // rax
GJAccountManager *v17; // rax
std::string *p_m_username; // rax
cocos2d::CCString *v19; // rax
const char *CString; // rax
TextArea *v21; // rdi
cocos2d::CCString *v22; // rax
const char *v23; // rax
TextArea *v24; // rdi
CCMenuItemSpriteExtra *m_registerButton; // r12
GJAccountManager *v26; // rax
CCMenuItemSpriteExtra *m_moreButton; // r15
GJAccountManager *v28; // rax
__int64 v29; // rbx
__int64 v30; // rdi
__int64 v31; // rdi
char v32; // [rsp+0h] [rbp-90h]
_WORD v33[8]; // [rsp+8h] [rbp-88h] BYREF
char v34; // [rsp+18h] [rbp-78h] BYREF
_QWORD v35[2]; // [rsp+20h] [rbp-70h] BYREF
char *v36; // [rsp+30h] [rbp-60h] BYREF
char v37; // [rsp+38h] [rbp-58h] BYREF
char v38[23]; // [rsp+39h] [rbp-57h] BYREF
__int128 v39; // [rsp+50h] [rbp-40h] BYREF
void *__p; // [rsp+60h] [rbp-30h]
v4 = GJAccountManager::sharedState();
if ( v4->m_accountID == v4->m_unkInt1 )
{
p_m_textArea = &a1->m_textArea;
TextArea::colorAllCharactersTo(a1->m_textArea, (cocos2d::ccColor3B)-1);
goto LABEL_11;
}
v6 = GJAccountManager::sharedState();
if ( (v6->m_GJP2.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(&v39, v6->m_GJP2.m_data.m_long.longStorage, v6->m_GJP2.m_data.m_long.size, *(double *)&v2);
}
else
{
p_m_GJP2 = &v6->m_GJP2;
__p = p_m_GJP2->m_data.m_long.longStorage;
v2 = *(_OWORD *)&p_m_GJP2->m_data.m_short.sizex2;
v39 = *(_OWORD *)&p_m_GJP2->m_data.m_short.sizex2;
}
v8 = (unsigned __int8)v39 >> 1;
if ( (v39 & 1) != 0 )
{
v8 = *((_QWORD *)&v39 + 1);
operator delete(__p);
}
p_m_textArea = &a1->m_textArea;
TextArea::colorAllCharactersTo(a1->m_textArea, (cocos2d::ccColor3B)-1);
if ( !v8 )
{
LABEL_11:
v12 = GJAccountManager::sharedState();
m_linkedAccountTitle = a1->m_linkedAccountTitle;
if ( v12->m_accountID == v12->m_unkInt1 )
{
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))m_linkedAccountTitle->setString)(
a1->m_linkedAccountTitle,
"Not logged in");
v14 = *p_m_textArea;
v36 = (char *)operator new(0x40u);
v35[0] = 65;
v35[1] = 62;
strcpy(v36, "Create an account to back up\nand load your data from the cloud");
TextArea::setString(v14, v35);
v15 = 0;
if ( (v35[0] & 1) == 0 )
goto LABEL_28;
v16 = (void **)&v36;
}
else
{
v17 = GJAccountManager::sharedState();
if ( (v17->m_username.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(
&v39,
v17->m_username.m_data.m_long.longStorage,
v17->m_username.m_data.m_long.size,
*(double *)&v2);
}
else
{
p_m_username = &v17->m_username;
__p = p_m_username->m_data.m_long.longStorage;
v39 = *(_OWORD *)&p_m_username->m_data.m_short.sizex2;
}
v19 = (cocos2d::CCString *)sub_1007AB580("Linked to account: %s", v32);
CString = cocos2d::CCString::getCString(v19);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))m_linkedAccountTitle->setString)(
m_linkedAccountTitle,
CString);
if ( (v39 & 1) != 0 )
operator delete(__p);
v21 = *p_m_textArea;
v37 = 28;
strcpy(v38, "Login required");
TextArea::setString(v21, &v37);
if ( (v37 & 1) == 0 )
{
v15 = 0;
goto LABEL_28;
}
v16 = (void **)&v38[15];
v15 = 0;
}
goto LABEL_27;
}
v9 = a1->m_linkedAccountTitle;
v10 = GJAccountManager::sharedState();
if ( (v10->m_username.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(&v39, v10->m_username.m_data.m_long.longStorage, v10->m_username.m_data.m_long.size, *(double *)&v2);
}
else
{
v11 = &v10->m_username;
__p = v11->m_data.m_long.longStorage;
v39 = *(_OWORD *)&v11->m_data.m_short.sizex2;
}
v22 = (cocos2d::CCString *)sub_1007AB580("Linked to account: %s", v32);
v23 = cocos2d::CCString::getCString(v22);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))v9->setString)(v9, v23);
if ( (v39 & 1) != 0 )
operator delete(__p);
v24 = *p_m_textArea;
v33[0] = 0;
TextArea::setString(v24, v33);
v15 = 1;
if ( (v33[0] & 1) != 0 )
{
v15 = 1;
v16 = (void **)&v34;
LABEL_27:
operator delete(*v16);
}
LABEL_28:
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_loginButton->setVisible)(a1->m_loginButton, v15 ^ 1u);
m_registerButton = a1->m_registerButton;
v26 = GJAccountManager::sharedState();
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))m_registerButton->setVisible)(
m_registerButton,
v26->m_accountID == v26->m_unkInt1);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_backupButton->setVisible)(a1->m_backupButton, v15);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_syncButton->setVisible)(a1->m_syncButton, v15);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_helpButton->setVisible)(a1->m_helpButton, v15 ^ 1u);
m_moreButton = a1->m_moreButton;
v28 = GJAccountManager::sharedState();
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))m_moreButton->setVisible)(
m_moreButton,
v28->m_accountID != v28->m_unkInt1);
if ( a2 && !a1->m_isLoggedIn )
{
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_backupButton->setEnabled)(a1->m_backupButton, 0);
v29 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_backupButton->getNormalImage)(a1->m_backupButton);
v30 = *(_QWORD *)(v29 + 648);
memset(&v39, 125, 3);
(*(void (__fastcall **)(__int64, __int128 *))(*(_QWORD *)v30 + 944LL))(v30, &v39);
v31 = *(_QWORD *)(v29 + 624);
memset(&v39, 125, 3);
(*(void (__fastcall **)(__int64, __int128 *))(*(_QWORD *)v31 + 1056LL))(v31, &v39);
}
}