//
// AccountLayer::updatePage from 0x1001661a8 to 0x100166540 (920 bytes)
//
// 5 xrefs:
// > AccountLayer::customSetup @ 0x100165c34
// > AccountLayer::doBackup @ 0x1001665b0
// > AccountLayer::doSync @ 0x100166638
// > AccountLayer::accountStatusChanged @ 0x1001666b0
// > sub_1001666B4 @ 0x1001666bc
//
// 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)
{
_BOOL4 v2; // w20
GJAccountManager *v4; // x0
TextArea **p_m_textArea; // x22
GJAccountManager *v6; // x0
__int64 v7; // x21
cocos2d::CCLabelBMFont *v8; // x21
GJAccountManager *v9; // x0
GJAccountManager *v10; // x0
cocos2d::CCLabelBMFont *m_linkedAccountTitle; // x21
__int64 v12; // x21
__int64 v13; // x21
const void **v14; // x8
GJAccountManager *v15; // x0
const char *p_dst; // x8
cocos2d::CCString *v17; // x0
const char *CString; // x0
__int64 v19; // x21
const char *v20; // x8
cocos2d::CCString *v21; // x0
const char *v22; // x0
__int64 v23; // x21
CCMenuItemSpriteExtra *m_registerButton; // x22
GJAccountManager *v25; // x0
CCMenuItemSpriteExtra *m_moreButton; // x21
GJAccountManager *v27; // x0
__int64 v28; // x19
__int64 v29; // x0
__int64 v30; // x0
const void *v31[2]; // [xsp+8h] [xbp-88h] BYREF
char v32; // [xsp+1Fh] [xbp-71h]
const void *v33[2]; // [xsp+20h] [xbp-70h] BYREF
char v34; // [xsp+37h] [xbp-59h]
const void *v35[2]; // [xsp+38h] [xbp-58h] BYREF
char v36; // [xsp+4Fh] [xbp-41h]
__int128 __dst; // [xsp+50h] [xbp-40h] BYREF
char *longStorage; // [xsp+60h] [xbp-30h]
v2 = a2;
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_14;
}
v6 = GJAccountManager::sharedState();
if ( v6->m_GJP2.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(&__dst, (void *)v6->m_GJP2.m_data.m_long.capacitym1, v6->m_GJP2.m_data.m_long.size);
}
else
{
__dst = *(_OWORD *)&v6->m_GJP2.m_data.m_short.sizex2;
longStorage = v6->m_GJP2.m_data.m_long.longStorage;
}
if ( SHIBYTE(longStorage) >= 0 )
v7 = SHIBYTE(longStorage);
else
v7 = *((_QWORD *)&__dst + 1);
if ( (SHIBYTE(longStorage) & 0x8000000000000000LL) != 0 )
operator delete((void *)__dst);
p_m_textArea = &a1->m_textArea;
TextArea::colorAllCharactersTo(a1->m_textArea, (cocos2d::ccColor3B)-1);
if ( !v7 )
{
LABEL_14:
v10 = GJAccountManager::sharedState();
m_linkedAccountTitle = a1->m_linkedAccountTitle;
if ( v10->m_accountID == v10->m_unkInt1 )
{
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))m_linkedAccountTitle->setString)(
a1->m_linkedAccountTitle,
"Not logged in");
v12 = (__int64)*p_m_textArea;
sub_100009900(v31, "Create an account to back up\nand load your data from the cloud");
TextArea::setString(v12, v31);
v13 = 0;
if ( (v32 & 0x80000000) == 0 )
goto LABEL_34;
v14 = v31;
goto LABEL_33;
}
v15 = GJAccountManager::sharedState();
if ( v15->m_username.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(&__dst, (void *)v15->m_username.m_data.m_long.capacitym1, v15->m_username.m_data.m_long.size);
}
else
{
__dst = *(_OWORD *)&v15->m_username.m_data.m_short.sizex2;
longStorage = v15->m_username.m_data.m_long.longStorage;
}
p_dst = (const char *)&__dst;
if ( SHIBYTE(longStorage) < 0 )
p_dst = (const char *)__dst;
v17 = (cocos2d::CCString *)sub_100268F4C("Linked to account: %s", p_dst);
CString = cocos2d::CCString::getCString(v17);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))m_linkedAccountTitle->setString)(
m_linkedAccountTitle,
CString);
if ( SHIBYTE(longStorage) < 0 )
operator delete((void *)__dst);
v19 = (__int64)*p_m_textArea;
sub_100009900(v33, "Login required");
TextArea::setString(v19, v33);
v13 = 0;
if ( v34 < 0 )
{
v14 = v33;
LABEL_33:
operator delete((void *)*v14);
goto LABEL_34;
}
goto LABEL_34;
}
v8 = a1->m_linkedAccountTitle;
v9 = GJAccountManager::sharedState();
if ( v9->m_username.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(&__dst, (void *)v9->m_username.m_data.m_long.capacitym1, v9->m_username.m_data.m_long.size);
}
else
{
__dst = *(_OWORD *)&v9->m_username.m_data.m_short.sizex2;
longStorage = v9->m_username.m_data.m_long.longStorage;
}
v20 = (const char *)&__dst;
if ( SHIBYTE(longStorage) < 0 )
v20 = (const char *)__dst;
v21 = (cocos2d::CCString *)sub_100268F4C("Linked to account: %s", v20);
v22 = cocos2d::CCString::getCString(v21);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))v8->setString)(v8, v22);
if ( SHIBYTE(longStorage) < 0 )
operator delete((void *)__dst);
v23 = (__int64)*p_m_textArea;
sub_100009900(v35, "");
TextArea::setString(v23, v35);
v13 = 1;
if ( v36 < 0 )
{
v14 = v35;
goto LABEL_33;
}
LABEL_34:
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_loginButton->setVisible)(
a1->m_loginButton,
(unsigned int)v13 ^ 1);
m_registerButton = a1->m_registerButton;
v25 = GJAccountManager::sharedState();
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))m_registerButton->setVisible)(
m_registerButton,
v25->m_accountID == v25->m_unkInt1);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_backupButton->setVisible)(a1->m_backupButton, v13);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_syncButton->setVisible)(a1->m_syncButton, v13);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_helpButton->setVisible)(
a1->m_helpButton,
(unsigned int)v13 ^ 1);
m_moreButton = a1->m_moreButton;
v27 = GJAccountManager::sharedState();
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))m_moreButton->setVisible)(
m_moreButton,
v27->m_accountID != v27->m_unkInt1);
if ( v2 && !a1->m_isLoggedIn )
{
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_backupButton->setEnabled)(a1->m_backupButton, 0);
v28 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_backupButton->getNormalImage)(a1->m_backupButton);
v29 = *(_QWORD *)(v28 + 648);
memset(&__dst, 125, 3);
(*(void (__fastcall **)(__int64, __int128 *))(*(_QWORD *)v29 + 944LL))(v29, &__dst);
v30 = *(_QWORD *)(v28 + 624);
memset(&__dst, 125, 3);
(*(void (__fastcall **)(__int64, __int128 *))(*(_QWORD *)v30 + 1056LL))(v30, &__dst);
}
}