//
// GameLevelManager::getDemonLevelsString from 0x140147a30 to 0x140147c21 (497 bytes)
//
// 3 xrefs:
// > GameLevelManager::updateUserScore @ 0x140156353
// > ??> @ 0x1406ca620
// > ??> @ 0x1406ca62c
//
// 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
//
// Hidden C++ exception states: #wind=2
_QWORD *__fastcall GameLevelManager::getDemonLevelsString(__int64 a1, _QWORD *a2)
{
char v4; // bp
__int64 v5; // rcx
__int64 v6; // rcx
__int64 i; // rdi
GJGameLevel *v8; // rax
GJGameLevel *v9; // rbx
GameStatsManager *v10; // rcx
_BYTE *v11; // rax
size_t v12; // r8
void *v14; // [rsp+38h] [rbp-270h]
__int128 v15; // [rsp+50h] [rbp-258h] BYREF
_BYTE v16[528]; // [rsp+60h] [rbp-248h] BYREF
fmt::BasicWriter::BasicWriter(v16);
v4 = 1;
v5 = *(_QWORD *)(a1 + 352);
if ( !v5 )
goto LABEL_19;
v6 = *(_QWORD *)(v5 + 56);
if ( !v6 )
goto LABEL_19;
for ( i = *(_QWORD *)(v6 + 288); ; i = *(_QWORD *)(i + 288) )
{
v8 = (GJGameLevel *)_RTDynamicCast(
*(_QWORD *)(v6 + 264),
0,
&cocos2d::CCObject `RTTI Type Descriptor',
&GJGameLevel `RTTI Type Descriptor',
0);
v9 = v8;
if ( v8
&& v8->m_stars.random - v8->m_stars.seed == 10
&& v8->m_normalPercent.random - v8->m_normalPercent.seed == 100 )
{
v10 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v14 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v10 = (GameStatsManager *)qword_1406C2EE8;
}
if ( GameStatsManager::hasCompletedLevel(v10, v9) )
{
if ( !v4 )
{
v15 = (unsigned __int64)",";
fmt::BasicWriter::operator<<(v16, &v15);
}
fmt::BasicWriter::operator<<(v16, (unsigned int)(v9->m_levelID.random - v9->m_levelID.seed));
v4 = 0;
}
}
v6 = i;
if ( !i )
break;
}
if ( !v4 )
{
v11 = (_BYTE *)fmt::BasicWriter::c_str(v16);
*(_OWORD *)a2 = 0;
a2[2] = 0;
a2[3] = 0;
v12 = -1;
do
++v12;
while ( v11[v12] );
sub_14003A930(a2, v11, v12);
}
else
{
LABEL_19:
*(_OWORD *)a2 = 0;
a2[2] = 0;
a2[3] = 15;
*(_BYTE *)a2 = 0;
}
fmt::BasicWriter::~BasicWriter(v16);
return a2;
}