//
// GameLevelManager::storeUserNames from 0x10052d930 to 0x10052dcda (938 bytes)
//
// 3 xrefs:
// > GameLevelManager::onGetOnlineLevelsCompleted @ 0x10051ebe3
// > GameLevelManager::onGetLevelListsCompleted @ 0x10052a8b1
// > GameLevelManager::processOnDownloadLevelCompleted @ 0x100544ab5
//
// 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
//
__int64 __fastcall GameLevelManager::storeUserNames(__int64 a1, unsigned __int8 *a2, double a3)
{
__int64 result; // rax
const char *v4; // rbx
size_t v5; // rax
size_t v6; // r14
char *v7; // r15
size_t v8; // r12
__int64 v9; // r12
unsigned int v10; // r15d
cocos2d::CCString *v11; // rax
const char *CString; // r14
size_t v13; // rax
size_t v14; // rbx
char *v15; // r12
const char *v16; // rbx
size_t v17; // rax
size_t v18; // r14
char *v19; // r12
__int64 v20; // rax
size_t v21; // r13
size_t v22; // r13
cocos2d::CCArray *v23; // r14
cocos2d::CCString *v24; // rax
cocos2d::CCString *v25; // rbx
cocos2d::CCString *v26; // rax
const char *v27; // r13
size_t v28; // rax
size_t v29; // r14
char *v30; // rbx
__int64 v31; // rax
size_t v32; // r12
_QWORD v33[2]; // [rsp+10h] [rbp-80h] BYREF
void *v34; // [rsp+20h] [rbp-70h]
_QWORD v35[2]; // [rsp+28h] [rbp-68h] BYREF
void *v36; // [rsp+38h] [rbp-58h]
unsigned int v37; // [rsp+40h] [rbp-50h]
unsigned int v38; // [rsp+44h] [rbp-4Ch]
__int64 v39; // [rsp+48h] [rbp-48h]
size_t __dst; // [rsp+50h] [rbp-40h] BYREF
size_t v41; // [rsp+58h] [rbp-38h]
void *__p; // [rsp+60h] [rbp-30h]
result = *a2;
if ( (result & 1) != 0 )
{
if ( !*((_QWORD *)a2 + 1) )
return result;
v4 = *((const char **)a2 + 2);
}
else
{
if ( !(_BYTE)result )
return result;
v4 = (const char *)(a2 + 1);
}
v5 = strlen(v4);
if ( v5 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_53:
sub_100006BF0(a3);
v6 = v5;
if ( v5 >= 0x17 )
{
v8 = 26;
if ( (v5 | 7) != 0x17 )
v8 = (v5 | 7) + 1;
v7 = (char *)operator new(v8);
__p = v7;
__dst = v8 + 1;
v41 = v6;
goto LABEL_13;
}
LOBYTE(__dst) = 2 * v5;
v7 = (char *)&__dst + 1;
if ( v5 )
LABEL_13:
memmove(v7, v4, v6);
v7[v6] = 0;
v9 = sub_10052DD30(&__dst, "|");
if ( (__dst & 1) != 0 )
operator delete(__p);
result = sub_100720070(v9);
if ( (_DWORD)result )
{
v10 = 0;
v39 = v9;
do
{
v11 = (cocos2d::CCString *)sub_1007200C0(v9, v10);
CString = cocos2d::CCString::getCString(v11);
v13 = strlen(CString);
if ( v13 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_53;
v14 = v13;
if ( v13 >= 0x17 )
{
v20 = v13 | 7;
v21 = 26;
if ( (v14 | 7) != 0x17 )
v21 = v20 + 1;
v15 = (char *)operator new(v21);
__p = v15;
__dst = v21 + 1;
v41 = v14;
}
else
{
LOBYTE(__dst) = 2 * v13;
v15 = (char *)&__dst + 1;
if ( !v13 )
{
BYTE1(__dst) = 0;
v16 = (char *)&__dst + 1;
if ( (__dst & 1) == 0 )
goto LABEL_24;
LABEL_23:
v16 = (const char *)__p;
goto LABEL_24;
}
}
memmove(v15, CString, v14);
v15[v14] = 0;
v16 = (char *)&__dst + 1;
if ( (__dst & 1) != 0 )
goto LABEL_23;
LABEL_24:
v17 = strlen(v16);
if ( v17 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a3);
v18 = v17;
if ( v17 >= 0x17 )
{
v22 = (v17 | 7) + 1;
if ( (v17 | 7) == 0x17 )
v22 = 26;
v19 = (char *)operator new(v22);
v34 = v19;
v33[0] = v22 | 1;
v33[1] = v18;
LABEL_36:
memmove(v19, v16, v18);
goto LABEL_37;
}
LOBYTE(v33[0]) = 2 * v17;
v19 = (char *)v33 + 1;
if ( v17 )
goto LABEL_36;
LABEL_37:
v19[v18] = 0;
v23 = (cocos2d::CCArray *)sub_10052DD30(v33, ":");
v9 = v39;
if ( (v33[0] & 1) != 0 )
operator delete(v34);
if ( (unsigned int)sub_100720070(v23) < 3 )
goto LABEL_50;
v24 = cocos2d::CCArray::stringAtIndex(v23, 0);
v37 = cocos2d::CCString::intValue(v24);
v25 = cocos2d::CCArray::stringAtIndex(v23, 1u);
v26 = cocos2d::CCArray::stringAtIndex(v23, 2u);
v38 = cocos2d::CCString::intValue(v26);
v27 = cocos2d::CCString::getCString(v25);
v28 = strlen(v27);
if ( v28 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a3);
v29 = v28;
if ( v28 >= 0x17 )
{
v31 = v28 | 7;
v32 = 26;
if ( (v29 | 7) != 0x17 )
v32 = v31 + 1;
v30 = (char *)operator new(v32);
v36 = v30;
v35[0] = v32 | 1;
v35[1] = v29;
v9 = v39;
LABEL_47:
memmove(v30, v27, v29);
goto LABEL_48;
}
LOBYTE(v35[0]) = 2 * v28;
v30 = (char *)v35 + 1;
v9 = v39;
if ( v28 )
goto LABEL_47;
LABEL_48:
v30[v29] = 0;
GameLevelManager::storeUserName(a1, v37, v38, v35);
if ( (v35[0] & 1) != 0 )
operator delete(v36);
LABEL_50:
if ( (__dst & 1) != 0 )
operator delete(__p);
++v10;
result = sub_100720070(v9);
}
while ( v10 < (unsigned int)result );
}
return result;
}