//
// GameLevelManager::storeUserName from 0x10052e100 to 0x10052e30c (524 bytes)
//
// 8 xrefs:
// > GameLevelManager::onGetUserListCompleted @ 0x1005242c5
// > GameLevelManager::onGetFriendRequestsCompleted @ 0x100524a8c
// > GameLevelManager::onGetUserMessagesCompleted @ 0x1005252aa
// > GameLevelManager::storeUserNames @ 0x10052dc8c
// > GameLevelManager::createAndGetScores @ 0x100532f97
// > GameLevelManager::updateUsernames @ 0x10053a022
// > GameLevelManager::createAndGetCommentsFull @ 0x1005508ae
// > ProfilePage::init @ 0x1007b89f4
//
// 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 GameLevelManager::storeUserName(__int64 a1, int a2, int a3, __int64 a4, double a5)
{
const char *v6; // r13
__int64 v7; // r12
size_t v8; // rax
size_t v9; // rbx
char *v10; // r15
size_t v11; // r12
cocos2d::CCString *v12; // rax
const char *CString; // r12
size_t v14; // rax
size_t v15; // rbx
char *v16; // r15
cocos2d::CCObject *v17; // r13
size_t v18; // r13
int v19; // r12d
__int64 v20; // rax
cocos2d::CCDictionary *v21; // rbx
__int64 v22; // r13
cocos2d::CCObject *v23; // rax
cocos2d::CCDictionary *v24; // rbx
cocos2d::CCObject *v25; // rax
char v26; // [rsp+0h] [rbp-80h]
char v27; // [rsp+0h] [rbp-80h]
char v28; // [rsp+0h] [rbp-80h]
__int64 v29; // [rsp+10h] [rbp-70h]
__int64 v30; // [rsp+18h] [rbp-68h]
_QWORD __dst[2]; // [rsp+20h] [rbp-60h] BYREF
void *v32; // [rsp+30h] [rbp-50h]
_QWORD v33[2]; // [rsp+38h] [rbp-48h] BYREF
void *__p; // [rsp+48h] [rbp-38h]
int v35; // [rsp+54h] [rbp-2Ch]
if ( a2 <= 0 )
return;
if ( (*(_BYTE *)a4 & 1) != 0 )
v6 = *(const char **)(a4 + 16);
else
v6 = (const char *)(a4 + 1);
v7 = *(_QWORD *)(a1 + 536);
v8 = strlen(v6);
if ( v8 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a5);
v9 = v8;
v35 = a3;
v29 = v7;
if ( v8 >= 0x17 )
{
v11 = 26;
if ( (v8 | 7) != 0x17 )
v11 = (v8 | 7) + 1;
v10 = (char *)operator new(v11);
v32 = v10;
__dst[0] = v11 + 1;
__dst[1] = v9;
goto LABEL_12;
}
LOBYTE(__dst[0]) = 2 * v8;
v10 = (char *)__dst + 1;
if ( v8 )
LABEL_12:
memmove(v10, v6, v9);
v10[v9] = 0;
v30 = sub_1007AB360(__dst);
v12 = (cocos2d::CCString *)sub_1007AB580("%i", v26);
CString = cocos2d::CCString::getCString(v12);
v14 = strlen(CString);
if ( v14 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a5);
v15 = v14;
if ( v14 >= 0x17 )
{
v18 = 26;
if ( (v14 | 7) != 0x17 )
v18 = (v14 | 7) + 1;
v16 = (char *)operator new(v18);
__p = v16;
v33[0] = v18 | 1;
v33[1] = v15;
v17 = (cocos2d::CCObject *)v30;
}
else
{
LOBYTE(v33[0]) = 2 * v14;
v16 = (char *)v33 + 1;
v17 = (cocos2d::CCObject *)v30;
if ( !v14 )
goto LABEL_21;
}
memmove(v16, CString, v15);
LABEL_21:
v16[v15] = 0;
cocos2d::CCDictionary::setObject_1(v29, v17, (char *)v33);
v19 = v35;
if ( (v33[0] & 1) != 0 )
{
operator delete(__p);
if ( (__dst[0] & 1) == 0 )
{
LABEL_23:
v20 = a1;
if ( v19 <= 0 )
return;
goto LABEL_24;
}
}
else if ( (__dst[0] & 1) == 0 )
{
goto LABEL_23;
}
operator delete(v32);
v20 = a1;
if ( v19 > 0 )
{
LABEL_24:
v21 = *(cocos2d::CCDictionary **)(v20 + 552);
v22 = v20;
v23 = (cocos2d::CCObject *)sub_1007AB580("%i", v27);
cocos2d::CCDictionary::setObject(v21, v23, (unsigned int)a2);
v24 = *(cocos2d::CCDictionary **)(v22 + 544);
v25 = (cocos2d::CCObject *)sub_1007AB580("%i", v28);
cocos2d::CCDictionary::setObject(v24, v25, (unsigned int)v19);
}
}