//
// MenuLayer::updateUserProfileButton from 0x5c2458 to 0x5c25d4 (380 bytes)
//
// 3 xrefs:
// > MenuLayer::init @ 0x5c3930
// > GameManager::accountStatusChanged @ 0x5eda10
// > ??> @ 0x6d4d0
//
// 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 MenuLayer::updateUserProfileButton(MenuLayer *a1)
{
GJAccountManager *v2; // x0
int m_accountID; // w1
int m_unkInt1; // w3
_BOOL4 v5; // w21
cocos2d::CCSprite *m_viewProfileSprite; // x0
cocos2d::CCLabelBMFont *m_profileLabel; // x21
void (__fastcall *setString)(cocos2d::CCLabelBMFont *__hidden, const unsigned __int8 *); // x22
GJAccountManager *v9; // x0
long double v10; // q0
void *v11; // x0
unsigned int *v12; // x2
int v13; // w1
__int64 v14; // [xsp+40h] [xbp+40h] BYREF
v2 = GJAccountManager::sharedState();
m_accountID = v2->m_accountID;
m_unkInt1 = v2->m_unkInt1;
v5 = m_accountID - m_unkInt1 > 0;
a1->m_profileButton->setVisible(a1->m_profileButton, m_accountID - m_unkInt1 > 0);
a1->m_profileLabel->setVisible(a1->m_profileLabel, v5);
m_viewProfileSprite = a1->m_viewProfileSprite;
if ( m_viewProfileSprite )
m_viewProfileSprite->setVisible(m_viewProfileSprite, v5);
if ( v5 )
{
m_profileLabel = a1->m_profileLabel;
setString = m_profileLabel->setString;
v9 = GJAccountManager::sharedState();
*(__n128 *)&v10 = sub_D18D28(&v14, &v9->m_username);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int64, long double))setString)(m_profileLabel, v14, v10);
v11 = (void *)(v14 - 24);
if ( (__int64 *)(v14 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v14 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *(_DWORD *)(v14 - 8);
*(_DWORD *)(v14 - 8) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v11);
}
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_profileLabel, 70.0, 0.7, 0.0);
}
}