//
// AccountHelpLayer::updatePage from 0x1001675a4 to 0x10016783c (664 bytes)
//
// 3 xrefs:
// > AccountHelpLayer::customSetup @ 0x1001672f0
// > AccountHelpLayer::accountStatusChanged @ 0x10016795c
// > sub_100167960 @ 0x100167964
//
// 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 AccountHelpLayer::updatePage(AccountHelpLayer *a1)
{
GJAccountManager *v2; // x0
TextArea **p_m_textArea; // x21
GJAccountManager *v4; // x0
__int64 v5; // x20
cocos2d::CCLabelBMFont *m_loginStatusLabel; // x20
GJAccountManager *v7; // x0
GJAccountManager *v8; // x0
cocos2d::CCLabelBMFont *v9; // x20
__int64 v10; // x20
const void **v11; // x8
GJAccountManager *v12; // x0
const char *v13; // x8
cocos2d::CCString *v14; // x0
const char *v15; // x0
__int64 v16; // x20
const char *p_dst; // x8
cocos2d::CCString *v18; // x0
const char *CString; // x0
__int64 v20; // x20
CCMenuItemSpriteExtra *m_unlinkAccountButton; // x19
GJAccountManager *v22; // x0
const void *v23[2]; // [xsp+8h] [xbp-88h] BYREF
char v24; // [xsp+1Fh] [xbp-71h]
const void *v25[2]; // [xsp+20h] [xbp-70h] BYREF
char v26; // [xsp+37h] [xbp-59h]
const void *v27[2]; // [xsp+38h] [xbp-58h] BYREF
char v28; // [xsp+4Fh] [xbp-41h]
__int128 __dst; // [xsp+50h] [xbp-40h] BYREF
char *longStorage; // [xsp+60h] [xbp-30h]
v2 = GJAccountManager::sharedState();
if ( v2->m_accountID == v2->m_unkInt1 )
{
p_m_textArea = &a1->m_textArea;
TextArea::colorAllCharactersTo(a1->m_textArea, (cocos2d::ccColor3B)-1);
}
else
{
v4 = GJAccountManager::sharedState();
if ( v4->m_GJP2.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(&__dst, (void *)v4->m_GJP2.m_data.m_long.capacitym1, v4->m_GJP2.m_data.m_long.size);
}
else
{
__dst = *(_OWORD *)&v4->m_GJP2.m_data.m_short.sizex2;
longStorage = v4->m_GJP2.m_data.m_long.longStorage;
}
if ( SHIBYTE(longStorage) >= 0 )
v5 = SHIBYTE(longStorage);
else
v5 = *((_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 ( v5 )
{
m_loginStatusLabel = a1->m_loginStatusLabel;
v7 = GJAccountManager::sharedState();
if ( v7->m_username.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(&__dst, (void *)v7->m_username.m_data.m_long.capacitym1, v7->m_username.m_data.m_long.size);
}
else
{
__dst = *(_OWORD *)&v7->m_username.m_data.m_short.sizex2;
longStorage = v7->m_username.m_data.m_long.longStorage;
}
p_dst = (const char *)&__dst;
if ( SHIBYTE(longStorage) < 0 )
p_dst = (const char *)__dst;
v18 = (cocos2d::CCString *)sub_100268F4C("Linked to account: %s", p_dst);
CString = cocos2d::CCString::getCString(v18);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))m_loginStatusLabel->setString)(
m_loginStatusLabel,
CString);
if ( SHIBYTE(longStorage) < 0 )
operator delete((void *)__dst);
v20 = (__int64)*p_m_textArea;
sub_100009900(v27, "");
TextArea::setString(v20, v27);
if ( v28 < 0 )
{
v11 = v27;
goto LABEL_33;
}
goto LABEL_34;
}
}
v8 = GJAccountManager::sharedState();
v9 = a1->m_loginStatusLabel;
if ( v8->m_accountID == v8->m_unkInt1 )
{
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))v9->setString)(
a1->m_loginStatusLabel,
"Not logged in");
v10 = (__int64)*p_m_textArea;
sub_100009900(v23, "Create an account to backup\nand sync your data");
TextArea::setString(v10, v23);
if ( v24 < 0 )
{
v11 = v23;
LABEL_33:
operator delete((void *)*v11);
}
}
else
{
v12 = GJAccountManager::sharedState();
if ( v12->m_username.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(&__dst, (void *)v12->m_username.m_data.m_long.capacitym1, v12->m_username.m_data.m_long.size);
}
else
{
__dst = *(_OWORD *)&v12->m_username.m_data.m_short.sizex2;
longStorage = v12->m_username.m_data.m_long.longStorage;
}
v13 = (const char *)&__dst;
if ( SHIBYTE(longStorage) < 0 )
v13 = (const char *)__dst;
v14 = (cocos2d::CCString *)sub_100268F4C("Linked to account: %s", v13);
v15 = cocos2d::CCString::getCString(v14);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))v9->setString)(v9, v15);
if ( SHIBYTE(longStorage) < 0 )
operator delete((void *)__dst);
v16 = (__int64)*p_m_textArea;
sub_100009900(v25, "Login required");
TextArea::setString(v16, v25);
if ( v26 < 0 )
{
v11 = v25;
goto LABEL_33;
}
}
LABEL_34:
m_unlinkAccountButton = a1->m_unlinkAccountButton;
v22 = GJAccountManager::sharedState();
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))m_unlinkAccountButton->setVisible)(
m_unlinkAccountButton,
v22->m_accountID != v22->m_unkInt1);
}