//
// GameLevelManager::onSetLevelStarsCompleted from 0x1005202f0 to 0x10052044f (351 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10051c1a4
//
// 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
//
char __fastcall GameLevelManager::onSetLevelStarsCompleted(__int64 a1, unsigned __int8 *a2, __int64 a3, double a4)
{
__int64 v4; // r12
const char *v5; // r15
size_t v6; // rax
size_t v7; // r13
char *v8; // rbx
size_t v9; // r12
GameLevelManager *v10; // rdi
unsigned int SplitIntFromKey; // r15d
const void *v12; // rdi
unsigned __int64 v13; // rcx
size_t v14; // rdx
bool v15; // bl
int v16; // eax
__int64 (__fastcall ***v17)(_QWORD, _QWORD, _QWORD); // rdi
char result; // al
__int64 (__fastcall **v19)(_QWORD, _QWORD, __int64); // rax
__int64 v20; // [rsp+0h] [rbp-50h]
_QWORD __dst[2]; // [rsp+10h] [rbp-40h] BYREF
void *__p; // [rsp+20h] [rbp-30h]
v4 = a1;
if ( (*(_BYTE *)a3 & 1) != 0 )
v5 = *(const char **)(a3 + 16);
else
v5 = (const char *)(a3 + 1);
v6 = strlen(v5);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a4);
v7 = v6;
v20 = *(_QWORD *)(a1 + 608);
if ( v6 >= 0x17 )
{
v9 = 26;
if ( (v6 | 7) != 0x17 )
v9 = (v6 | 7) + 1;
v8 = (char *)operator new(v9);
__p = v8;
__dst[0] = v9 + 1;
v4 = a1;
__dst[1] = v7;
goto LABEL_11;
}
v8 = (char *)__dst + 1;
LOBYTE(__dst[0]) = 2 * v6;
if ( v6 )
LABEL_11:
memmove(v8, v5, v7);
v8[v7] = 0;
v10 = (GameLevelManager *)v20;
cocos2d::CCDictionary::removeObjectForKey_1(v20, (char *)__dst);
if ( (__dst[0] & 1) != 0 )
{
v10 = (GameLevelManager *)__p;
operator delete(__p);
}
SplitIntFromKey = GameLevelManager::getSplitIntFromKey(v10, v5, 1);
*(_WORD *)((char *)__dst + 1) = 12589;
BYTE3(__dst[0]) = 0;
v12 = a2 + 1;
v13 = *a2 >> 1;
if ( (*a2 & 1) != 0 )
{
v12 = *((const void **)a2 + 2);
v13 = *((_QWORD *)a2 + 1);
}
v14 = 2;
if ( v13 < 2 )
v14 = v13;
v15 = v13 != 2;
v16 = memcmp(v12, (char *)__dst + 1, v14);
v17 = *(__int64 (__fastcall ****)(_QWORD, _QWORD, _QWORD))(v4 + 808);
result = v15 || v16 != 0;
if ( result )
{
if ( !v17 )
return result;
v19 = *v17;
}
else
{
if ( !v17 )
return result;
v19 = *v17 + 1;
}
return (*v19)(v17, SplitIntFromKey, 8);
}