//
// GameLevelManager::tryGetUsername from 0x10052e500 to 0x10052e9d4 (1236 bytes)
//
// 10 xrefs:
// > CommentCell::loadFromComment @ 0x1002478df
// > FriendRequestPopup::init @ 0x1002a512f
// > FriendRequestPopup::onBlock @ 0x1002a605d
// > GJWriteMessagePopup::init @ 0x1002a8f9e
// > LevelBrowserLayer::getSearchTitle @ 0x10049038d
// > GJGameLevel::create @ 0x1005301b1
// > ShareCommentLayer::init @ 0x1005dfcf0
// > ProfilePage::init @ 0x1007b8a17
// > ProfilePage::onInfo @ 0x1007bcfde
// > ProfilePage::onCopyName @ 0x1007bd813
//
// 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
//
std::string *__fastcall GameLevelManager::tryGetUsername(std::string *this, __int64 a2, int a3, double a4)
{
intptr_t v5; // r15
cocos2d::CCString *v6; // rax
int v7; // eax
__int64 v8; // rsi
int v9; // r13d
char *v10; // r12
unsigned int v11; // eax
__int64 v12; // rax
char *v13; // r12
cocos2d::CCObject *v14; // rax
std::string::size_type v15; // rax
char v16; // cl
std::string::size_type size; // rdx
unsigned __int64 v18; // rsi
GameStatsManager *v19; // rax
std::string v21; // [rsp+0h] [rbp-40h] BYREF
if ( !a3 )
{
*(_WORD *)&this->__r_.__value_.__l.0 = 11522;
this->__r_.__value_.__s.__data_[1] = 0;
return this;
}
v5 = a3;
v6 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(cocos2d::CCDictionary **)(a2 + 544), a3);
v7 = cocos2d::CCString::intValue(v6);
v8 = qword_1009A28E0;
if ( !qword_1009A28E0 )
{
v9 = v7;
v10 = (char *)operator new(0x3C8u);
cocos2d::CCNode::CCNode((__int64)v10);
*(_QWORD *)v10 = off_100960890;
a4 = 0.0;
*(_OWORD *)(v10 + 328) = 0;
*((_QWORD *)v10 + 40) = v10 + 328;
*((_QWORD *)v10 + 62) = 0;
*((_OWORD *)v10 + 32) = 0;
*(_OWORD *)(v10 + 344) = 0;
*(_OWORD *)(v10 + 360) = 0;
*(_OWORD *)(v10 + 376) = 0;
*(_OWORD *)(v10 + 392) = 0;
*(_OWORD *)(v10 + 408) = 0;
*(_OWORD *)(v10 + 424) = 0;
*(_OWORD *)(v10 + 440) = 0;
*(_OWORD *)(v10 + 456) = 0;
*(_OWORD *)(v10 + 472) = 0;
*((_DWORD *)v10 + 122) = 0;
*((_QWORD *)v10 + 63) = v10 + 512;
*((_OWORD *)v10 + 33) = 0;
*((_OWORD *)v10 + 34) = 0;
*((_OWORD *)v10 + 35) = 0;
*((_OWORD *)v10 + 36) = 0;
*(_OWORD *)(v10 + 696) = 0;
*(_OWORD *)(v10 + 680) = 0;
*(_OWORD *)(v10 + 664) = 0;
*(_OWORD *)(v10 + 648) = 0;
*(_OWORD *)(v10 + 632) = 0;
*(_OWORD *)(v10 + 616) = 0;
*(_OWORD *)(v10 + 600) = 0;
v10[712] = 0;
*((_OWORD *)v10 + 48) = 0;
*((_OWORD *)v10 + 47) = 0;
*((_OWORD *)v10 + 46) = 0;
*((_OWORD *)v10 + 45) = 0;
*(_OWORD *)(v10 + 945) = 0;
*(_OWORD *)(v10 + 936) = 0;
*(_OWORD *)(v10 + 920) = 0;
*(_OWORD *)(v10 + 904) = 0;
*(_OWORD *)(v10 + 888) = 0;
*(_OWORD *)(v10 + 872) = 0;
*(_OWORD *)(v10 + 856) = 0;
*(_OWORD *)(v10 + 840) = 0;
*(_OWORD *)(v10 + 824) = 0;
*(_OWORD *)(v10 + 808) = 0;
*(_OWORD *)(v10 + 792) = 0;
qword_1009A28E0 = (__int64)v10;
GameLevelManager::init((GameLevelManager *)v10);
v8 = qword_1009A28E0;
v7 = v9;
}
GameLevelManager::userNameForUserID(this, v8, v7, a4);
v11 = (unsigned int)this->__r_.__value_.__l.0;
if ( (v11 & 1) != 0 )
{
if ( this->__r_.__value_.__l.__size_ > 1 )
goto LABEL_13;
LABEL_9:
v12 = qword_1009A28E0;
if ( !qword_1009A28E0 )
{
v13 = (char *)operator new(0x3C8u);
cocos2d::CCNode::CCNode((__int64)v13);
*(_QWORD *)v13 = off_100960890;
a4 = 0.0;
*(_OWORD *)(v13 + 328) = 0;
*((_QWORD *)v13 + 40) = v13 + 328;
*((_QWORD *)v13 + 62) = 0;
*((_OWORD *)v13 + 32) = 0;
*(_OWORD *)(v13 + 344) = 0;
*(_OWORD *)(v13 + 360) = 0;
*(_OWORD *)(v13 + 376) = 0;
*(_OWORD *)(v13 + 392) = 0;
*(_OWORD *)(v13 + 408) = 0;
*(_OWORD *)(v13 + 424) = 0;
*(_OWORD *)(v13 + 440) = 0;
*(_OWORD *)(v13 + 456) = 0;
*(_OWORD *)(v13 + 472) = 0;
*((_DWORD *)v13 + 122) = 0;
*((_QWORD *)v13 + 63) = v13 + 512;
*((_OWORD *)v13 + 33) = 0;
*((_OWORD *)v13 + 34) = 0;
*((_OWORD *)v13 + 35) = 0;
*((_OWORD *)v13 + 36) = 0;
*(_OWORD *)(v13 + 696) = 0;
*(_OWORD *)(v13 + 680) = 0;
*(_OWORD *)(v13 + 664) = 0;
*(_OWORD *)(v13 + 648) = 0;
*(_OWORD *)(v13 + 632) = 0;
*(_OWORD *)(v13 + 616) = 0;
*(_OWORD *)(v13 + 600) = 0;
v13[712] = 0;
*((_OWORD *)v13 + 48) = 0;
*((_OWORD *)v13 + 47) = 0;
*((_OWORD *)v13 + 46) = 0;
*((_OWORD *)v13 + 45) = 0;
*(_OWORD *)(v13 + 945) = 0;
*(_OWORD *)(v13 + 936) = 0;
*(_OWORD *)(v13 + 920) = 0;
*(_OWORD *)(v13 + 904) = 0;
*(_OWORD *)(v13 + 888) = 0;
*(_OWORD *)(v13 + 872) = 0;
*(_OWORD *)(v13 + 856) = 0;
*(_OWORD *)(v13 + 840) = 0;
*(_OWORD *)(v13 + 824) = 0;
*(_OWORD *)(v13 + 808) = 0;
*(_OWORD *)(v13 + 792) = 0;
qword_1009A28E0 = (__int64)v13;
GameLevelManager::init((GameLevelManager *)v13);
v12 = qword_1009A28E0;
}
v14 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(v12 + 616), v5);
if ( v14 )
std::string::operator=(this, (const std::string *)&v14[5].m_unknown2);
goto LABEL_13;
}
if ( v11 >> 1 <= 1uLL )
goto LABEL_9;
LABEL_13:
v15 = *(_BYTE *)&this->__r_.__value_.__l.0 >> 1;
v16 = *(_BYTE *)&this->__r_.__value_.__s.0 & 1;
size = this->__r_.__value_.__l.__size_;
v18 = size;
if ( !v16 )
v18 = *(_BYTE *)&this->__r_.__value_.__l.0 >> 1;
if ( v18 <= 1 )
{
v19 = GameStatsManager::sharedState();
GameStatsManager::usernameForAccountID(&v21, (__int64)v19, a3, a4);
if ( (*(_BYTE *)&this->__r_.__value_.__s.0 & 1) != 0 )
operator delete(this->__r_.__value_.__l.__data_);
*this = v21;
size = this->__r_.__value_.__l.__size_;
v16 = *(_BYTE *)&this->__r_.__value_.__s.0 & 1;
v15 = *(_BYTE *)&this->__r_.__value_.__l.0 >> 1;
}
if ( v16 )
v15 = size;
if ( !v15 )
std::string::assign(this, "-");
return this;
}