//
// GameLevelManager::getDemonLevelsString from 0x3d5374 to 0x3d546e (250 bytes)
//
// 1 xrefs:
// > GameLevelManager::updateUserScore @ 0x3d5eac
//
// 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
//
GameLevelManager *__fastcall GameLevelManager::getDemonLevelsString(GameLevelManager *this, int a2)
{
int v3; // r3
GameLevelManager *v4; // r0
char *v5; // r1
int v6; // r3
int v7; // r5
int v8; // r7
const void *v9; // r0
GJGameLevel *v10; // r0
GJGameLevel *v11; // r11
GameStatsManager *v12; // r0
int v13; // r2
unsigned int v15[3]; // [sp+Ch] [bp-208h] BYREF
char v16; // [sp+18h] [bp-1FCh] BYREF
v15[0] = 0;
v15[1] = 500;
v15[2] = (unsigned int)&v16;
v3 = *(_DWORD *)(a2 + 296);
if ( !v3 )
goto LABEL_2;
v6 = *(_DWORD *)(v3 + 52);
v7 = v6 ? *(_DWORD *)(v6 + 272) : 0;
v8 = 1;
while ( v6 )
{
v9 = *(const void **)(v6 + 260);
if ( v9 )
{
v10 = (GJGameLevel *)_dynamic_cast(
v9,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'GJGameLevel,
0);
v11 = v10;
if ( v10 )
{
if ( v10->m_stars.random - v10->m_stars.seed == 10 && GJGameLevel::getNormalPercent(v10) == 100 )
{
v12 = GameStatsManager::sharedState();
if ( GameStatsManager::hasCompletedLevel(v12, v11) )
{
if ( !v8 )
fmt::BasicWriter::operator<<(v15, ",", 0);
fmt::BasicWriter::operator<<(v15, v11->m_levelID.random - v11->m_levelID.seed);
v8 = 0;
}
}
}
}
if ( v7 )
v13 = *(_DWORD *)(v7 + 272);
else
v13 = 0;
v6 = v7;
v7 = v13;
}
if ( v8 )
{
LABEL_2:
v4 = this;
v5 = (char *)&unk_939830;
}
else
{
v5 = (char *)fmt::BasicWriter::c_str((int *)v15);
v4 = this;
}
sub_776584((int)v4, v5);
fmt::internal::Array::free((int)v15);
return this;
}