//
// GauntletSelectLayer::onPlay from 0xa73710 to 0xa73bf4 (1252 bytes)
//
// 3 xrefs:
// > ??> @ 0x4d608
// > GauntletSelectLayer::setupGauntlets @ 0xa76670
// > ??> @ 0x1541968
//
// This function is hookable on this platform (idp: arm, 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 13:00:24 +0000
//
__int64 __fastcall GauntletSelectLayer::onPlay(GauntletSelectLayer *this, cocos2d::CCObject *a2)
{
unsigned __int64 isItemUnlocked; // x0
unsigned int v6; // w22
GameLevelManager *v7; // x0
GameStatsManager *SavedGauntlet; // x23
GameStatsManager *v9; // x0
AdToolbox *isGauntletUnlocked; // x0
GameManager *v11; // x0
AdToolbox *v12; // x0
GameStatsManager *hasCompletedMapPack; // x0
__int64 v14; // x20
cocos2d::CCDirector *v15; // x0
cocos2d::CCDirector *v16; // x20
__int64 v17; // x0
cocos2d::CCTransitionFade *v18; // x0
cocos2d::CCScene *v19; // x1
cocos2d::CCScene *v20; // x0
GameStatsManager *v21; // x0
cocos2d::CCDelayTime *v22; // x21
cocos2d::CCSequence *v23; // x23
cocos2d::CCFiniteTimeAction *v24; // x0
cocos2d::CCAction *v25; // x0
GameStatsManager *v26; // x0
GameStatsManager *v27; // x0
GJRewardItem *v28; // x0
RewardsPage *v29; // x2
GJRewardItem *v30; // x21
RewardUnlockLayer *v31; // x22
__int64 v32; // x20
__int64 v33; // x0
cocos2d::CCArray *v34; // x23
cocos2d::CCObject *v35; // x0
cocos2d::CCObject *v36; // x0
cocos2d::CCObject *v37; // x0
DialogLayer *v38; // x21
__int64 v39; // [xsp+58h] [xbp+58h] BYREF
__int64 v40; // [xsp+60h] [xbp+60h]
void *v41; // [xsp+68h] [xbp+68h]
__int64 v42; // [xsp+70h] [xbp+70h] BYREF
__int64 v43; // [xsp+78h] [xbp+78h]
void *v44; // [xsp+80h] [xbp+80h]
if ( !*((_BYTE *)this + 473) && !*((_BYTE *)this + 504) && !*((_BYTE *)this + 513) )
{
isItemUnlocked = (*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)a2 + 64LL))(a2);
v6 = isItemUnlocked;
if ( (_DWORD)isItemUnlocked != 8
|| (v33 = GameStatsManager::sharedState((GameStatsManager *)isItemUnlocked),
isItemUnlocked = (unsigned __int8)GameStatsManager::isItemUnlocked(v33, 0xCu, 5u),
(_BYTE)isItemUnlocked) )
{
v7 = (GameLevelManager *)GameLevelManager::sharedState((GameLevelManager *)isItemUnlocked);
SavedGauntlet = (GameStatsManager *)GameLevelManager::getSavedGauntlet(v7, (const char *)v6);
v9 = (GameStatsManager *)GameStatsManager::sharedState(SavedGauntlet);
isGauntletUnlocked = (AdToolbox *)(unsigned __int8)GameStatsManager::isGauntletUnlocked(v9);
if ( (_BYTE)isGauntletUnlocked )
{
hasCompletedMapPack = (GameStatsManager *)(unsigned __int8)GJMapPack::hasCompletedMapPack(SavedGauntlet);
if ( !(_BYTE)hasCompletedMapPack
|| (v21 = (GameStatsManager *)GameStatsManager::sharedState(hasCompletedMapPack),
GameStatsManager::isGauntletChestUnlocked(v21, v6)) )
{
*((_BYTE *)this + 473) = (unsigned __int8)&dword_0 + 1;
v14 = GameManager::sharedState((GameManager *)((char *)&dword_0 + 1));
v15 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)a2 + 64LL))(a2);
*(_DWORD *)(v14 + 1084) = (_DWORD)v15;
v16 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v15);
v17 = (*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)a2 + 64LL))(a2);
v18 = (cocos2d::CCTransitionFade *)GauntletLayer::scene(v17);
v20 = (cocos2d::CCScene *)cocos2d::CCTransitionFade::create(v18, 0.5, v19);
cocos2d::CCDirector::replaceScene(v16, v20);
}
else
{
v22 = (cocos2d::CCDelayTime *)cocos2d::CCDictionary::objectForKey(*((cocos2d::CCDictionary **)this + 62), v6);
v23 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(v22, 0.5);
v24 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(v22, GauntletNode::onClaimReward, 0);
v25 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v23, v24, 0);
v26 = (GameStatsManager *)cocos2d::CCNode::runAction(v22, v25);
v27 = (GameStatsManager *)GameStatsManager::sharedState(v26);
v28 = GameStatsManager::unlockGauntletChest(v27, v6);
v30 = v28;
if ( v28 )
{
v31 = (RewardUnlockLayer *)RewardUnlockLayer::create(
(RewardUnlockLayer *)*((unsigned int *)v28 + 16),
0,
v29);
(*(void (__fastcall **)(GauntletSelectLayer *, RewardUnlockLayer *, __int64))(*(_QWORD *)this + 464LL))(
this,
v31,
100);
RewardUnlockLayer::showCollectReward(v31, v30);
}
}
}
else if ( AdToolbox::hasCachedRewardedVideo(isGauntletUnlocked) )
{
if ( !*((_BYTE *)this + 512) )
{
*((_BYTE *)this + 512) = (unsigned __int8)&dword_0 + 1;
v11 = (GameManager *)GameManager::sharedState((GameManager *)((char *)&dword_0 + 1));
*((_QWORD *)v11 + 162) = (char *)this + 424;
v12 = (AdToolbox *)GameManager::sharedState(v11);
*((_DWORD *)v12 + 429) = v6;
*((_DWORD *)this + 127) = v6;
AdToolbox::showRewardedVideo(v12);
}
}
else
{
v42 = 0;
v43 = 0;
v44 = nullptr;
std::string::__init(&v42, "The Gauntlet cannot be unlocked right now.\nPlease try again later.", 0x4Au);
v32 = FLAlertLayer::create(
0,
(cocos2d::CCLabelBMFont *)"Unlock Gauntlet",
(char *)&v42,
(ButtonSprite *)"OK",
nullptr,
380.0);
if ( (v42 & 1) != 0 )
operator delete(v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v32 + 1312LL))(v32);
}
}
else
{
v34 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)isItemUnlocked);
v39 = 0;
v40 = 0;
v41 = nullptr;
std::string::__init(&v39, "...", 3u);
v42 = 0;
v43 = 0;
v44 = nullptr;
std::string::__init(&v42, "It's no use, that Gauntlet is locked.", 0x35u);
v35 = (cocos2d::CCObject *)DialogObject::create((char *)&v39, (char *)&v42, 2, 0, 0xFFFFFF, 1.0);
cocos2d::CCArray::addObject(v34, v35);
if ( (v42 & 1) != 0 )
operator delete(v44);
if ( (v39 & 1) != 0 )
operator delete(v41);
v39 = 0;
v40 = 0;
v41 = nullptr;
std::string::__init(&v39, "...", 3u);
v42 = 0;
v43 = 0;
v44 = nullptr;
std::string::__init(&v42, "The Demon Guardian was the only one who could open it.", 0x3Eu);
v36 = (cocos2d::CCObject *)DialogObject::create((char *)&v39, (char *)&v42, 2, 0, 0xFFFFFF, 0.8);
cocos2d::CCArray::addObject(v34, v36);
if ( (v42 & 1) != 0 )
operator delete(v44);
if ( (v39 & 1) != 0 )
operator delete(v41);
v39 = 0;
v40 = 0;
v41 = nullptr;
std::string::__init(&v39, "...", 3u);
v42 = 0;
v43 = 0;
v44 = nullptr;
std::string::__init(&v42, "Not sure what happened to him. He always was a bit crazy.", 0x39u);
v37 = (cocos2d::CCObject *)DialogObject::create((char *)&v39, (char *)&v42, 2, 0, 0xFFFFFF, 1.0);
cocos2d::CCArray::addObject(v34, v37);
if ( (v42 & 1) != 0 )
operator delete(v44);
if ( (v39 & 1) != 0 )
operator delete(v41);
v38 = (DialogLayer *)DialogLayer::createWithObjects(v34, (cocos2d::CCArray *)((char *)&dword_0 + 2));
(*(void (__fastcall **)(GauntletSelectLayer *, DialogLayer *, __int64))(*(_QWORD *)this + 464LL))(this, v38, 100);
DialogLayer::updateChatPlacement((__int64)v38, 0);
DialogLayer::animateInRandomSide(v38);
}
}
return _stack_chk_guard;
}