//
// GameLevelManager::storeUserNames from 0x10053f7e0 to 0x10053fb8a (938 bytes)
//
// 4 xrefs:
// > GameLevelManager::onGetOnlineLevelsCompleted @ 0x100523803
// > GameLevelManager::onGetLevelListsCompleted @ 0x10052f701
// > sub_10052FE70 @ 0x1005301f5
// > sub_10055F180 @ 0x10055f6f6
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:31:56 +0000
//
__int64 __fastcall GameLevelManager::storeUserNames(__int64 a1, unsigned __int8 *a2)
{
__int64 result; // rax
const char *v3; // rbx
size_t v4; // rax
size_t v5; // r14
char *v6; // r15
size_t v7; // r12
__int64 v8; // r12
unsigned int v9; // r15d
__int64 v10; // rax
const char *CString; // r14
size_t v12; // rax
size_t v13; // rbx
char *v14; // r12
const char *v15; // rbx
size_t v16; // rax
size_t v17; // r14
char *v18; // r12
__int64 v19; // rax
size_t v20; // r13
size_t v21; // r13
__int64 v22; // r14
__int64 v23; // rax
__int64 v24; // rbx
__int64 v25; // rax
const char *v26; // r13
size_t v27; // rax
size_t v28; // r14
char *v29; // rbx
__int64 v30; // rax
size_t v31; // r12
_QWORD v32[2]; // [rsp+10h] [rbp-80h] BYREF
void *v33; // [rsp+20h] [rbp-70h]
_QWORD v34[2]; // [rsp+28h] [rbp-68h] BYREF
void *v35; // [rsp+38h] [rbp-58h]
unsigned int v36; // [rsp+40h] [rbp-50h]
unsigned int v37; // [rsp+44h] [rbp-4Ch]
__int64 v38; // [rsp+48h] [rbp-48h]
size_t __dst; // [rsp+50h] [rbp-40h] BYREF
size_t v40; // [rsp+58h] [rbp-38h]
void *__p; // [rsp+60h] [rbp-30h]
result = *a2;
if ( (result & 1) != 0 )
{
if ( !*((_QWORD *)a2 + 1) )
return result;
v3 = *((const char **)a2 + 2);
}
else
{
if ( !(_BYTE)result )
return result;
v3 = (const char *)(a2 + 1);
}
v4 = strlen(v3);
if ( v4 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_53:
sub_100003630();
v5 = v4;
if ( v4 >= 0x17 )
{
v7 = 26;
if ( (v4 | 7) != 0x17 )
v7 = (v4 | 7) + 1;
v6 = (char *)operator new(v7);
__p = v6;
__dst = v7 + 1;
v40 = v5;
goto LABEL_13;
}
LOBYTE(__dst) = 2 * v4;
v6 = (char *)&__dst + 1;
if ( v4 )
LABEL_13:
memmove(v6, v3, v5);
v6[v5] = 0;
v8 = sub_10053FBE0(&__dst, "|");
if ( (__dst & 1) != 0 )
operator delete(__p);
result = sub_1007FEF90(v8);
if ( (_DWORD)result )
{
v9 = 0;
v38 = v8;
do
{
v10 = sub_1007FEFE0(v8, v9);
CString = (const char *)cocos2d::CCString::getCString(v10);
v12 = strlen(CString);
if ( v12 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_53;
v13 = v12;
if ( v12 >= 0x17 )
{
v19 = v12 | 7;
v20 = 26;
if ( (v13 | 7) != 0x17 )
v20 = v19 + 1;
v14 = (char *)operator new(v20);
__p = v14;
__dst = v20 + 1;
v40 = v13;
}
else
{
LOBYTE(__dst) = 2 * v12;
v14 = (char *)&__dst + 1;
if ( !v12 )
{
BYTE1(__dst) = 0;
v15 = (char *)&__dst + 1;
if ( (__dst & 1) == 0 )
goto LABEL_24;
LABEL_23:
v15 = (const char *)__p;
goto LABEL_24;
}
}
memmove(v14, CString, v13);
v14[v13] = 0;
v15 = (char *)&__dst + 1;
if ( (__dst & 1) != 0 )
goto LABEL_23;
LABEL_24:
v16 = strlen(v15);
if ( v16 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v17 = v16;
if ( v16 >= 0x17 )
{
v21 = (v16 | 7) + 1;
if ( (v16 | 7) == 0x17 )
v21 = 26;
v18 = (char *)operator new(v21);
v33 = v18;
v32[0] = v21 | 1;
v32[1] = v17;
LABEL_36:
memmove(v18, v15, v17);
goto LABEL_37;
}
LOBYTE(v32[0]) = 2 * v16;
v18 = (char *)v32 + 1;
if ( v16 )
goto LABEL_36;
LABEL_37:
v18[v17] = 0;
v22 = sub_10053FBE0(v32, ":");
v8 = v38;
if ( (v32[0] & 1) != 0 )
operator delete(v33);
if ( (unsigned int)sub_1007FEF90(v22) < 3 )
goto LABEL_50;
v23 = cocos2d::CCArray::stringAtIndex(v22, 0);
v36 = cocos2d::CCString::intValue(v23);
v24 = cocos2d::CCArray::stringAtIndex(v22, 1);
v25 = cocos2d::CCArray::stringAtIndex(v22, 2);
v37 = cocos2d::CCString::intValue(v25);
v26 = (const char *)cocos2d::CCString::getCString(v24);
v27 = strlen(v26);
if ( v27 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v28 = v27;
if ( v27 >= 0x17 )
{
v30 = v27 | 7;
v31 = 26;
if ( (v28 | 7) != 0x17 )
v31 = v30 + 1;
v29 = (char *)operator new(v31);
v35 = v29;
v34[0] = v31 | 1;
v34[1] = v28;
v8 = v38;
LABEL_47:
memmove(v29, v26, v28);
goto LABEL_48;
}
LOBYTE(v34[0]) = 2 * v27;
v29 = (char *)v34 + 1;
v8 = v38;
if ( v27 )
goto LABEL_47;
LABEL_48:
v29[v28] = 0;
GameLevelManager::storeUserName(a1, v36, v37, v34);
if ( (v34[0] & 1) != 0 )
operator delete(v35);
LABEL_50:
if ( (__dst & 1) != 0 )
operator delete(__p);
++v9;
result = sub_1007FEF90(v8);
}
while ( v9 < (unsigned int)result );
}
return result;
}