//
// cocos2d::CCDirector::replaceScene from 0x100478be0 to 0x100478cf2 (274 bytes)
//
// 121 xrefs:
// > cocos2d::CCTransitionScene::setNewScene @ 0x1000a378f
// > GJGameLoadingLayer::transitionToLoadingLayer @ 0x1001449a6
// > GJGameLoadingLayer::loadLevel @ 0x100144e88
// > EditLevelLayer::onEdit @ 0x1001de5c9
// > EditLevelLayer::onBack @ 0x1001dfbeb
// > EditLevelLayer::playStep3 @ 0x1001e0796
// > sub_1001E09D0 @ 0x1001e0c01
// > EditLevelLayer::onClone @ 0x1001e1071
// > LevelListCell::onClick @ 0x100243295
// > MapSelectLayer::onBack @ 0x100252676
// > MapSelectLayer::keyBackClicked @ 0x1002530d6
// > sub_1002530E0 @ 0x10025313b
// > LevelAreaLayer::onBack @ 0x100264d20
// > LevelAreaLayer::onEnterTower @ 0x100265efa
// > LevelAreaLayer::keyBackClicked @ 0x1002660e0
// > sub_1002660F0 @ 0x100266158
// > LevelAreaInnerLayer::onBack @ 0x100267154
// > LevelAreaInnerLayer::onOnlineVault @ 0x10026736f
// > LevelAreaInnerLayer::playStep1 @ 0x100268102
// > LevelAreaInnerLayer::keyBackClicked @ 0x1002681c4
// > sub_1002681D0 @ 0x10026821c
// > UploadPopup::onReturnToLevel @ 0x10026edcf
// > CreatorLayer::onSecretVault @ 0x100283ef2
// > CreatorLayer::onTreasureRoom @ 0x100284138
// > CreatorLayer::onBack @ 0x1002846ef
// > CreatorLayer::keyBackClicked @ 0x1002849ef
// > sub_100284A20 @ 0x100284a4f
// > LevelInfoLayer::onEdit @ 0x1002acedc
// > LevelInfoLayer::onBack @ 0x1002aef48
// > LevelInfoLayer::playStep4 @ 0x1002b10c2
// > sub_1002B10F0 @ 0x1002b11eb
// > LevelInfoLayer::onClone @ 0x1002b1529
// > GJShopLayer::onBack @ 0x1003100be
// > GJShopLayer::dialogClosed @ 0x1003128ae
// > LevelListLayer::onBack @ 0x10034b361
// > LevelListLayer::cloneList @ 0x10034b800
// > sub_10034F940 @ 0x10034f987
// > UploadListPopup::onReturnToList @ 0x10034fb83
// > GJGarageLayer::onBack @ 0x100355499
// > GJGarageLayer::onShop @ 0x1003554cf
// > GameManager::returnToLastScene @ 0x100376a1d
// > GameManager::returnToLastScene @ 0x100376c1a
// > GameManager::safePopScene @ 0x100376d16
// > GameManager::reloadMenu @ 0x100376dd4
// > GameManager::switchScreenMode @ 0x100376e3e
// > GameManager::reloadAll @ 0x100376eec
// > GameManager::reloadAllStep5 @ 0x100377168
// > MenuLayer::onPlay @ 0x10037c28e
// > MenuLayer::onGarage @ 0x10037c319
// > MenuLayer::onCreator @ 0x10037c399
// > GauntletLayer::onBack @ 0x10037e0ac
// > GauntletLayer::keyBackClicked @ 0x10037fbcc
// > sub_10037FBE0 @ 0x10037fc27
// > MultiplayerLayer::onBtn1 @ 0x100384a6c
// > MultiplayerLayer::onBtn2 @ 0x100384abf
// > MultiplayerLayer::onBack @ 0x100384b0a
// > MultiplayerLayer::keyBackClicked @ 0x100384b4a
// > sub_100384B50 @ 0x100384b95
// > LoadingLayer::loadAssets @ 0x10038c861
// > LoadingLayer::loadingFinished @ 0x10038cca7
// > SecretLayer4::onBack @ 0x10039b4ef
// > SecretLayer4::keyBackClicked @ 0x10039e4af
// > sub_10039E4C0 @ 0x10039e527
// > WorldSelectLayer::onBack @ 0x1003aba98
// > WorldSelectLayer::keyBackClicked @ 0x1003acdf8
// > sub_1003ACE00 @ 0x1003ace60
// > sub_1003AE2B0 @ 0x1003ae349
// > LevelSelectLayer::onBack @ 0x10042028c
// > LevelSelectLayer::keyBackClicked @ 0x10042212c
// > sub_100422140 @ 0x100422187
// > LevelPage::onTheTower @ 0x100423abe
// > LevelPage::onSecretDoor @ 0x1004246c3
// > LevelPage::playStep3 @ 0x1004250a9
// > SecretLayer5::onBack @ 0x10046fd9e
// > SecretLayer5::keyBackClicked @ 0x1004731de
// > sub_1004731F0 @ 0x100473259
// > SecretLayer6::onBack @ 0x1004739e9
// > SecretLayer6::keyBackClicked @ 0x100474189
// > sub_100474190 @ 0x1004741e4
// > LevelBrowserLayer::onNew @ 0x100482ffb
// > LevelBrowserLayer::onMyOnlineLevels @ 0x100483242
// > LevelBrowserLayer::onLocalMode @ 0x1004833f7
// > LevelBrowserLayer::onSavedMode @ 0x1004836d7
// > sub_1004836E0 @ 0x1004837cd
// > sub_100483800 @ 0x1004838ed
// > LevelBrowserLayer::createNewList @ 0x100487548
// > LevelBrowserLayer::createNewLevel @ 0x1004875d9
// > LevelBrowserLayer::FLAlert_Clicked @ 0x100488443
// > MPLobbyLayer::onBack @ 0x10048af5a
// > MPLobbyLayer::keyBackClicked @ 0x10048af9a
// > sub_10048AFA0 @ 0x10048afe5
// > MPLobbyLayer::uploadActionFinished @ 0x10048b952
// > MPLobbyLayer::onClosePopup @ 0x10048bbfc
// > sub_10048BC30 @ 0x10048bc9d
// > SecretLayer2::onBack @ 0x1004973ea
// > SecretLayer2::onDoor @ 0x100498b31
// > SecretLayer2::onSecretLevel @ 0x100498d8f
// > SecretLayer2::keyBackClicked @ 0x10049c09a
// > sub_10049C0B0 @ 0x10049c112
// > SecretLayer3::onBack @ 0x10049ef15
// > GameLevelManager::gotoLevelPage @ 0x100549ede
// > GauntletSelectLayer::onBack @ 0x10059f1fb
// > GauntletSelectLayer::onPlay @ 0x10059fe0c
// > GauntletSelectLayer::keyBackClicked @ 0x1005a055b
// > sub_1005A0560 @ 0x1005a05d6
// > SecretLayer::onBack @ 0x1006d2751
// > SecretLayer::keyBackClicked @ 0x1006d5661
// > sub_1006D5670 @ 0x1006d56d8
// > LevelSearchLayer::onSearchMode @ 0x100706d2c
// > SecretRewardsLayer::onBack @ 0x10070ed76
// > SecretRewardsLayer::onShop @ 0x10070f552
// > SecretRewardsLayer::showShop @ 0x100716d66
// > SecretRewardsLayer::dialogClosed @ 0x100716ea1
// > SecretRewardsLayer::keyBackClicked @ 0x100716fe6
// > sub_100716FF0 @ 0x10071704a
// > OptionsLayer::onSecretVault @ 0x10087bbc2
// > VideoOptionsLayer::onApply @ 0x1008815d6
// > VideoOptionsLayer::reloadMenu @ 0x100881c74
// > GraphicsReloadLayer::performReload @ 0x1008882f3
// > InfoLayer::onOriginal @ 0x100893a03
// > InfoLayer::onSimilar @ 0x100895cc6
//
// 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 12:30:36 +0000
//
__int64 __fastcall cocos2d::CCDirector::replaceScene(__int64 a1, _QWORD *a2)
{
unsigned int v2; // r15d
bool v3; // r13
bool v4; // r12
int v5; // r15d
void (__fastcall ***v6)(_QWORD, _QWORD *); // rdi
void (__fastcall ***v7)(_QWORD); // rdi
bool *v9; // [rsp+0h] [rbp-30h]
if ( a2 )
{
v2 = 0;
v3 = __dynamic_cast(
a2,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCScene,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCTransitionScene,
0) != nullptr;
if ( (v3 & *(_BYTE *)(a1 + 176)) != 0 )
return v2;
v9 = (bool *)(a1 + 176);
v4 = v3;
}
else
{
v9 = (bool *)(a1 + 176);
v4 = 0;
v3 = 0;
}
v5 = sub_1007FEF90(*(_QWORD *)(a1 + 296));
*(_BYTE *)(a1 + 288) = 1;
if ( *(_QWORD *)(a1 + 96) && *(_QWORD *)(a1 + 96) == sub_1007FF000(*(_QWORD *)(a1 + 296)) )
*(_QWORD *)(a1 + 96) = 0;
v2 = v5 - 1;
sub_1007FF250(*(_QWORD *)(a1 + 296), v2, a2, 1);
*(_QWORD *)(a1 + 280) = a2;
if ( !v3 && !*(_BYTE *)(a1 + 404) )
{
v6 = *(void (__fastcall ****)(_QWORD, _QWORD *))(a1 + 360);
if ( v6 )
(**v6)(v6, a2);
v7 = (void (__fastcall ***)(_QWORD))a2[40];
if ( v7 )
(**v7)(v7);
}
*v9 = v4;
LOBYTE(v2) = 1;
return v2;
}