//
// GauntletSelectLayer::onPlay from 0x10059fcf0 to 0x1005a0212 (1314 bytes)
//
// 1 xrefs:
// > GauntletSelectLayer::setupGauntlets @ 0x10059f572
//
// 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:32:32 +0000
//
void __fastcall GauntletSelectLayer::onPlay(__int64 a1, __int64 a2)
{
unsigned int v4; // ebx
__int64 v5; // rdi
__int64 v6; // rax
__int64 v7; // r14
__int64 v8; // rsi
__int64 v9; // rax
__int64 v10; // rbx
__int64 v11; // rbx
unsigned int v12; // eax
_BYTE *v13; // rax
char *v14; // rax
__int64 v15; // rbx
char *v16; // rax
char *v17; // rax
char *v18; // rax
char *v19; // rbx
char *v20; // rbx
__int64 v21; // r12
__int64 v22; // r14
_OWORD *v23; // r15
__int64 v24; // rax
__int64 v25; // rax
__int64 v26; // rax
__int64 v27; // rax
__int64 v28; // r14
char *v29; // r15
std::string v30; // [rsp+8h] [rbp-C8h] BYREF
std::string v31; // [rsp+20h] [rbp-B0h] BYREF
std::string v32; // [rsp+38h] [rbp-98h] BYREF
std::string v33; // [rsp+50h] [rbp-80h] BYREF
std::string v34; // [rsp+68h] [rbp-68h] BYREF
std::string v35; // [rsp+80h] [rbp-50h] BYREF
_QWORD v36[2]; // [rsp+98h] [rbp-38h] BYREF
void *v37; // [rsp+A8h] [rbp-28h]
if ( !*(_BYTE *)(a1 + 473) && !*(_BYTE *)(a1 + 504) && !*(_BYTE *)(a1 + 513) )
{
v4 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 64LL))(a2);
if ( v4 == 8
&& (v5 = GameStatsManager::sharedState(), !(unsigned __int8)GameStatsManager::isItemUnlocked(v5, 12, 5u)) )
{
v15 = sub_1007FE900(v5);
v30.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)6;
*(_DWORD *)((char *)&v30.__r_.__value_.__l.0 + 1) = 3026478;
v33.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x38u);
v33.__r_.__value_.__r.__words[0] = 57;
v33.__r_.__value_.__l.__size_ = 53;
strcpy(v33.__r_.__value_.__l.__data_, "It's no use, that Gauntlet is locked.");
v16 = DialogObject::create(&v30, &v33, 2, 0, 0xFFFFFF, 1.0);
sub_1007FEBF0(v15, v16);
if ( (*(_BYTE *)&v33.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v33.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v30.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v30.__r_.__value_.__l.__data_);
v31.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)6;
*(_DWORD *)((char *)&v31.__r_.__value_.__l.0 + 1) = 3026478;
v34.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x40u);
v34.__r_.__value_.__r.__words[0] = 65;
v34.__r_.__value_.__l.__size_ = 62;
strcpy(v34.__r_.__value_.__l.__data_, "The Demon Guardian was the only one who could open it.");
v17 = DialogObject::create(&v31, &v34, 2, 0, 0xFFFFFF, 0.80000001);
sub_1007FEBF0(v15, v17);
if ( (*(_BYTE *)&v34.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v34.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v31.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v31.__r_.__value_.__l.__data_);
v32.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)6;
*(_DWORD *)((char *)&v32.__r_.__value_.__l.0 + 1) = 3026478;
v35.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x40u);
v35.__r_.__value_.__r.__words[0] = 65;
v35.__r_.__value_.__l.__size_ = 57;
strcpy(v35.__r_.__value_.__l.__data_, "Not sure what happened to him. He always was a bit crazy.");
v18 = DialogObject::create(&v32, &v35, 2, 0, 0xFFFFFF, 1.0);
sub_1007FEBF0(v15, v18);
if ( (*(_BYTE *)&v35.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v35.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v32.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v32.__r_.__value_.__l.__data_);
v19 = DialogLayer::createWithObjects(v15, 2u);
(*(void (__fastcall **)(__int64, char *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v19, 100);
DialogLayer::updateChatPlacement((__int64)v19, 0);
DialogLayer::animateInRandomSide((__int64)v19);
}
else
{
v6 = GameLevelManager::sharedState();
v7 = sub_10055E420(v6);
GameStatsManager::sharedState();
v8 = v4;
if ( GameStatsManager::isGauntletUnlocked() )
{
if ( (unsigned __int8)GJMapPack::hasCompletedMapPack(v7)
&& (v9 = GameStatsManager::sharedState(),
v8 = v4,
!(unsigned __int8)GameStatsManager::isGauntletChestUnlocked(v9, v4)) )
{
v21 = a1;
v22 = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1 + 496), v4);
v23 = cocos2d::CCDelayTime::create((__m128)0x3F000000u);
v24 = cocos2d::CCCallFunc::create(v22, GauntletNode::onClaimReward, 0);
v25 = sub_10039EB60((__int64)v23, v24, 0);
cocos2d::CCNode::runAction(v22, v25);
v26 = GameStatsManager::sharedState();
v27 = GameStatsManager::unlockGauntletChest(v26, v4, (__m128)0x3F000000u);
if ( v27 )
{
v28 = v27;
v29 = RewardUnlockLayer::create(*(_DWORD *)(v27 + 64), 0);
(*(void (__fastcall **)(__int64, char *, __int64))(*(_QWORD *)v21 + 464LL))(v21, v29, 100);
RewardUnlockLayer::showCollectReward((__int64)v29, v28);
}
}
else
{
*(_BYTE *)(a1 + 473) = 1;
v10 = GameManager::sharedState();
*(_DWORD *)(v10 + 1084) = (*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)a2 + 64LL))(a2, v8);
v11 = cocos2d::CCDirector::sharedDirector();
v12 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 64LL))(a2);
v13 = sub_10037D7F0(v12, v8);
v14 = cocos2d::CCTransitionFade::create_1((__int64)v13, 0.5);
cocos2d::CCDirector::replaceScene(v11, v14);
}
}
else if ( (unsigned __int8)AdToolbox::hasCachedRewardedVideo() )
{
if ( !*(_BYTE *)(a1 + 512) )
{
*(_BYTE *)(a1 + 512) = 1;
*(_QWORD *)(GameManager::sharedState() + 1296) = a1 + 424;
*(_DWORD *)(GameManager::sharedState() + 1716) = v4;
*(_DWORD *)(a1 + 508) = v4;
AdToolbox::showRewardedVideo();
}
}
else
{
v37 = operator new(0x50u);
v36[0] = 81;
v36[1] = 74;
strcpy((char *)v37, "The Gauntlet cannot be unlocked right now.\nPlease try again later.");
v20 = FLAlertLayer::create_1(0, (int)"Unlock Gauntlet", (__int64)v36, (int)"OK", 0, 380.0);
if ( (v36[0] & 1) != 0 )
operator delete(v37);
(*(void (__fastcall **)(char *))(*(_QWORD *)v20 + 1312LL))(v20);
}
}
}
}