//
// cocos2d::CCDirector::replaceScene from 0x1800bf130 to 0x1800bf238 (264 bytes)
//
// 5 xrefs:
// > cocos2d::CCTransitionScene::setNewScene @ 0x1800569af
// > ??> @ 0x180141f34
// > ??> @ 0x180141f44
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b9288
//
// 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
//
char __fastcall cocos2d::CCDirector::replaceScene(cocos2d::CCDirector *this, struct cocos2d::CCScene *a2)
{
__int64 v4; // rax
__int64 v5; // rsi
bool v6; // bp
int v8; // eax
bool v9; // zf
int v10; // r14d
cocos2d::CCSceneDelegate *m_pAppDelegate; // rcx
cocos2d::CCSceneDelegate *m_pDelegate; // rcx
v4 = _RTDynamicCast(
a2,
0,
&cocos2d::CCScene `RTTI Type Descriptor',
&cocos2d::CCTransitionScene `RTTI Type Descriptor',
0);
v5 = v4;
v6 = v4 != 0;
if ( this->m_bIsTransitioning && v4 )
return 0;
v8 = cocos2d::CCArray::count(this->m_pobScenesStack);
v9 = this->m_pSceneReference == nullptr;
v10 = v8;
this->m_bSendCleanupToScene = 1;
if ( !v9 && this->m_pSceneReference == cocos2d::CCArray::lastObject(this->m_pobScenesStack) )
this->m_pSceneReference = nullptr;
cocos2d::CCArray::replaceObjectAtIndex(this->m_pobScenesStack, v10 - 1, a2);
this->m_pNextScene = a2;
if ( !v5 && !this->m_bDontCallWillSwitch )
{
m_pAppDelegate = this->m_pAppDelegate;
if ( m_pAppDelegate )
((void (__fastcall *)(cocos2d::CCSceneDelegate *, struct cocos2d::CCScene *))m_pAppDelegate->willSwitchToScene)(
m_pAppDelegate,
a2);
m_pDelegate = a2->m_pDelegate;
if ( m_pDelegate )
((void (__fastcall *)(cocos2d::CCSceneDelegate *))m_pDelegate->willSwitchToScene)(m_pDelegate);
}
this->m_bIsTransitioning = v6;
return 1;
}