//
// cocos2d::CCDirector::popToSceneStackLevel from 0x1800c25a0 to 0x1800c269b (251 bytes)
//
// 6 xrefs:
// > cocos2d::CCDirector::popToRootScene @ 0x1800c2525
// > cocos2d::CCDirector::popToSceneInStack @ 0x1800c2591
// > ??> @ 0x18014b268
// > ??> @ 0x18014b278
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c3504
//
// 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 11:22:25 +0000
//
void __fastcall cocos2d::CCDirector::popToSceneStackLevel(cocos2d::CCArray **this, int a2)
{
int v4; // eax
__int64 v5; // rsi
struct cocos2d::CCObject *Object; // rdi
v4 = cocos2d::CCArray::count(*(this + 37));
if ( a2 )
{
if ( a2 < v4 )
{
v5 = (unsigned int)(v4 - a2);
do
{
Object = cocos2d::CCArray::lastObject(*(this + 37));
if ( (*(unsigned __int8 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)Object + 672LL))(Object) )
{
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)Object + 720LL))(Object);
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)Object + 712LL))(Object);
}
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)Object + 728LL))(Object);
if ( *(this + 12) )
{
if ( *(this + 12) == cocos2d::CCArray::lastObject(*(this + 37)) )
*(this + 12) = nullptr;
}
cocos2d::CCArray::removeLastObject(*(this + 37), 1u);
--v5;
}
while ( v5 );
*(this + 35) = cocos2d::CCArray::lastObject(*(this + 37));
*((_BYTE *)this + 288) = 0;
}
}
else
{
*((_BYTE *)this + 184) = 1;
}
}