//
// cocos2d::CCDirector::purgeDirector from 0x1800bee50 to 0x1800bef83 (307 bytes)
//
// 3 xrefs:
// > cocos2d::CCDisplayLinkDirector::mainLoop @ 0x1800beaf8
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b9264
//
// 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::purgeDirector(cocos2d::CCDirector *this)
{
cocos2d::CCScheduler *v2; // rax
cocos2d::CCScene *m_pRunningScene; // rcx
cocos2d::CCArray *m_pobScenesStack; // rcx
cocos2d::CCLabelAtlas *m_pFPSLabel; // rcx
cocos2d::CCLabelAtlas *m_pSPFLabel; // rcx
cocos2d::CCLabelAtlas *m_pDrawsLabel; // rcx
cocos2d *v8; // rcx
cocos2d *v9; // rcx
v2 = (cocos2d::CCScheduler *)((__int64 (__fastcall *)(cocos2d::CCDirector *))this->getScheduler)(this);
cocos2d::CCScheduler::unscheduleAll(v2);
cocos2d::CCTouchDispatcher::removeAllDelegates(this->m_pTouchDispatcher);
m_pRunningScene = this->m_pRunningScene;
if ( m_pRunningScene )
{
((void (__fastcall *)(cocos2d::CCScene *))m_pRunningScene->onExitTransitionDidStart)(m_pRunningScene);
((void (__fastcall *)(cocos2d::CCScene *))this->m_pRunningScene->onExit)(this->m_pRunningScene);
((void (__fastcall *)(cocos2d::CCScene *))this->m_pRunningScene->cleanup)(this->m_pRunningScene);
cocos2d::CCObject::release(this->m_pRunningScene);
}
m_pobScenesStack = this->m_pobScenesStack;
this->m_pRunningScene = nullptr;
this->m_pNextScene = nullptr;
this->m_pSceneReference = nullptr;
cocos2d::CCArray::removeAllObjects(m_pobScenesStack);
((void (__fastcall *)(cocos2d::CCDirector *))this->stopAnimation)(this);
m_pFPSLabel = this->m_pFPSLabel;
if ( m_pFPSLabel )
{
cocos2d::CCObject::release(m_pFPSLabel);
this->m_pFPSLabel = nullptr;
}
m_pSPFLabel = this->m_pSPFLabel;
if ( m_pSPFLabel )
{
cocos2d::CCObject::release(m_pSPFLabel);
this->m_pSPFLabel = nullptr;
}
m_pDrawsLabel = this->m_pDrawsLabel;
if ( m_pDrawsLabel )
{
cocos2d::CCObject::release(m_pDrawsLabel);
this->m_pDrawsLabel = nullptr;
}
cocos2d::CCLabelBMFont::purgeCachedData();
cocos2d::ccDrawFree(v8);
cocos2d::CCAnimationCache::purgeSharedAnimationCache();
cocos2d::CCSpriteFrameCache::purgeSharedSpriteFrameCache();
cocos2d::CCTextureCache::purgeSharedTextureCache();
cocos2d::CCShaderCache::purgeSharedShaderCache();
cocos2d::CCFileUtils::purgeFileUtils();
cocos2d::CCConfiguration::purgeConfiguration();
cocos2d::CCUserDefault::purgeSharedUserDefault();
cocos2d::CCNotificationCenter::purgeNotificationCenter();
cocos2d::ccGLInvalidateStateCache(v9);
((void (__fastcall *)(cocos2d::CCEGLView *))this->m_pobOpenGLView->end)(this->m_pobOpenGLView);
this->m_pobOpenGLView = nullptr;
cocos2d::CCObject::release(this);
}