//
// MenuLayer::updateUserProfileButton from 0x100391a50 to 0x100391b6a (282 bytes)
//
// 2 xrefs:
// > GameManager::accountStatusChanged @ 0x100384e31
// > MenuLayer::init @ 0x100391344
//
// 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 MenuLayer::updateUserProfileButton(MenuLayer *a1)
{
double v1; // xmm0_8
GJAccountManager *v3; // rax
int m_accountID; // r15d
int m_unkInt1; // r12d
cocos2d::CCSprite *m_viewProfileSprite; // rdi
cocos2d::CCLabelBMFont *m_profileLabel; // r14
GJAccountManager *v8; // rax
std::string *p_m_username; // rax
char *v10; // rsi
__int128 v11; // [rsp+0h] [rbp-40h] BYREF
void *__p; // [rsp+10h] [rbp-30h]
v3 = GJAccountManager::sharedState();
m_accountID = v3->m_accountID;
m_unkInt1 = v3->m_unkInt1;
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_profileButton->setVisible)(
a1->m_profileButton,
m_accountID > m_unkInt1);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, bool))a1->m_profileLabel->setVisible)(
a1->m_profileLabel,
m_accountID > m_unkInt1);
m_viewProfileSprite = a1->m_viewProfileSprite;
if ( m_viewProfileSprite )
((void (__fastcall *)(cocos2d::CCSprite *, bool))m_viewProfileSprite->setVisible)(
m_viewProfileSprite,
m_accountID > m_unkInt1);
if ( m_accountID > m_unkInt1 )
{
m_profileLabel = a1->m_profileLabel;
v8 = GJAccountManager::sharedState();
if ( (v8->m_username.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(&v11, v8->m_username.m_data.m_long.longStorage, v8->m_username.m_data.m_long.size, v1);
if ( (v11 & 1) == 0 )
goto LABEL_6;
}
else
{
p_m_username = &v8->m_username;
__p = p_m_username->m_data.m_long.longStorage;
v11 = *(_OWORD *)&p_m_username->m_data.m_short.sizex2;
if ( (v11 & 1) == 0 )
{
LABEL_6:
v10 = (char *)&v11 + 1;
LABEL_9:
((void (__fastcall *)(cocos2d::CCLabelBMFont *, char *))m_profileLabel->setString)(m_profileLabel, v10);
if ( (v11 & 1) != 0 )
operator delete(__p);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_profileLabel, 70.0, 0.69999999, 0.0);
return;
}
}
v10 = (char *)__p;
goto LABEL_9;
}
}