//
// GameLevelManager::tryGetUsername from 0x6f6f20 to 0x6f70f8 (472 bytes)
//
// 11 xrefs:
// > CommentCell::loadFromComment @ 0x617a4c
// > LevelBrowserLayer::getSearchTitle @ 0x6e85d0
// > GJGameLevel::create @ 0x7034d0
// > ShareCommentLayer::init @ 0x7e750c
// > FriendRequestPopup::onBlock @ 0x8c5a34
// > FriendRequestPopup::init @ 0x8cd658
// > GJWriteMessagePopup::init @ 0x8cfe1c
// > ProfilePage::onInfo @ 0x8f9078
// > ProfilePage::onCopyName @ 0x8f9c7c
// > ProfilePage::init @ 0x8fdfec
// > ??> @ 0x78ed0
//
// 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
//
GameLevelManager **__usercall GameLevelManager::tryGetUsername@(
GameLevelManager **__return_ptr a1@,
GameLevelManager *this@,
int a3@)
{
GameLevelManager *v5; // x0
GameLevelManager *v6; // x0
GameLevelManager *v8; // x0
GJUserScore *v9; // x1
GameStatsManager *v10; // x0
void *v11; // x0
unsigned int *v12; // x1
int v13; // w2
const char *v14; // [xsp+48h] [xbp+48h]
GameLevelManager *v15; // [xsp+58h] [xbp+58h] BYREF
__int64 v16; // [xsp+60h] [xbp+60h] BYREF
if ( a3 )
{
v14 = (const char *)(unsigned int)GameLevelManager::userIDForAccountID(this, a3);
v5 = GameLevelManager::sharedState();
GameLevelManager::userNameForUserID((__int64 *)&v15, v5, v14);
v6 = v15;
if ( v15[-1].m_smartTemplates <= (cocos2d::CCArray *)((char *)&dword_0 + 1) )
{
v8 = GameLevelManager::sharedState();
v9 = GameLevelManager::userInfoForAccountID(v8, a3);
if ( v9 )
sub_D18EA8(&v15, &v9->m_userName);
v6 = v15;
if ( v15[-1].m_smartTemplates <= (cocos2d::CCArray *)((char *)&dword_0 + 1) )
{
v10 = GameStatsManager::sharedState();
GameStatsManager::usernameForAccountID(&v16, v10, a3);
sub_D163D4(&v15, &v16);
v11 = (void *)(v16 - 24);
if ( (__int64 *)(v16 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v16 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *(_DWORD *)(v16 - 8);
*(_DWORD *)(v16 - 8) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v11);
}
v6 = v15;
if ( !v15[-1].m_smartTemplates )
{
sub_D1798C(&v15, &byte_F10E40, 1);
v6 = v15;
}
}
}
*a1 = v6;
}
else
{
sub_D153B8((int)a1, &byte_F10E40);
}
return a1;
}