//
// sub_10057AC30 from 0x10057ac30 to 0x10057adca (410 bytes)
//
// 6 xrefs:
// > sub_100528690 @ 0x100528864
// > sub_100870B70 @ 0x100870c0f
// > ProfilePage::init @ 0x10089dc32
// > ProfilePage::init @ 0x10089dc43
// > ProfilePage::onUpdate @ 0x10089eeb4
// > ProfilePage::onUpdate @ 0x10089eec5
//
// 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:32:18 +0000
//
void __fastcall sub_10057AC30(__int64 a1, int a2, char a3)
{
__int64 v3; // rbx
int v4; // r14d
__int64 v5; // rax
const char *CString; // r13
size_t v7; // rax
size_t v8; // r12
char *v9; // r15
const char *v10; // rsi
__int64 StoredOnlineLevels; // r12
__int64 v12; // rax
size_t v13; // rbx
unsigned int v14; // r14d
__int64 v15; // rdi
char v16; // [rsp+0h] [rbp-60h]
_QWORD __dst[2]; // [rsp+18h] [rbp-48h] BYREF
void *__p; // [rsp+28h] [rbp-38h]
int v20; // [rsp+34h] [rbp-2Ch]
v20 = a2;
v3 = a1;
v4 = 0;
do
{
v5 = sub_10088E820("%s_%i_%i", v16);
CString = (const char *)cocos2d::CCString::getCString(v5);
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v8 = v7;
if ( v7 >= 0x17 )
{
v12 = v7 | 7;
v13 = 26;
if ( (v8 | 7) != 0x17 )
v13 = v12 + 1;
v9 = (char *)operator new(v13);
__p = v9;
__dst[0] = v13 + 1;
__dst[1] = v8;
v3 = a1;
}
else
{
LOBYTE(__dst[0]) = 2 * v7;
v9 = (char *)__dst + 1;
if ( !v7 )
{
BYTE1(__dst[0]) = 0;
v10 = (char *)__dst + 1;
if ( (__dst[0] & 1) == 0 )
goto LABEL_8;
LABEL_7:
v10 = (const char *)__p;
goto LABEL_8;
}
}
memmove(v9, CString, v8);
v9[v8] = 0;
v10 = (char *)__dst + 1;
if ( (__dst[0] & 1) != 0 )
goto LABEL_7;
LABEL_8:
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v3, v10);
if ( StoredOnlineLevels )
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(v3 + 1040), (char *)__dst);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
++v4;
}
while ( StoredOnlineLevels );
v14 = (unsigned __int8)v20;
sub_10057CF10(v3, (unsigned __int8)v20, 0);
if ( !(_BYTE)v14 )
sub_10056BC50(v3);
if ( a3 )
{
v15 = *(_QWORD *)(v3 + 1376);
if ( v15 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v15 + 24LL))(v15, v14);
}
}