//
// cocos2d::CCDirector::popToSceneStackLevel from 0x100176244 to 0x10017632c (232 bytes)
//
// 2 xrefs:
// > cocos2d::CCDirector::popToRootScene @ 0x100176240
// > cocos2d::CCDirector::popToSceneInStack @ 0x100176380
//
// 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
//
void __fastcall cocos2d::CCDirector::popToSceneStackLevel(cocos2d::CCDirector *a1, int a2)
{
int v4; // w0
int v5; // w21
__int64 v6; // x22
cocos2d::CCScene *v7; // x0
char v8; // w8
__int64 v9; // x9
v4 = sub_10024A36C(a1->m_pobScenesStack);
if ( a2 )
{
v5 = v4;
if ( v4 <= a2 )
return;
do
{
v6 = sub_10024A398(a1->m_pobScenesStack);
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v6 + 664LL))(v6) )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v6 + 712LL))(v6);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v6 + 704LL))(v6);
}
(*(void (__fastcall **)(__int64))(*(_QWORD *)v6 + 720LL))(v6);
if ( a1->m_pSceneReference )
{
if ( a1->m_pSceneReference == (cocos2d::CCScene *)sub_10024A398(a1->m_pobScenesStack) )
a1->m_pSceneReference = nullptr;
}
sub_10024A430(a1->m_pobScenesStack, 1);
--v5;
}
while ( v5 > a2 );
v7 = (cocos2d::CCScene *)sub_10024A398(a1->m_pobScenesStack);
v8 = 0;
a1->m_pNextScene = v7;
v9 = 280;
}
else
{
v8 = 1;
v9 = 176;
}
*((_BYTE *)&a1->cocos2d::CCObject::cocos2d::CCCopying::__vftable + v9) = v8;
}