//
// GJShopLayer::dialogClosed from 0x1402ae620 to 0x1402ae94e (814 bytes)
//
// 2 xrefs:
// > ??> @ 0x14057e240
// > ??> @ 0x1406d227c
//
// 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
//
// Hidden C++ exception states: #wind=5
void GJShopLayer::dialogClosed(GJShopLayer *a1, DialogLayer *a2)
{
__int64 v4; // r8
__int64 v5; // r9
int v6; // ecx
struct cocos2d::CCLayerColor *v7; // rax
__int64 v8; // rbx
__int64 v9; // rcx
__int64 v10; // rax
cocos2d::CCTouchDispatcher *v11; // rax
struct cocos2d::CCScene *v12; // rax
struct cocos2d::CCTransitionFade *v13; // rbx
__int64 v14; // rcx
cocos2d::CCDirector *v15; // rax
GameStatsManager *v16; // rcx
GJRewardItem *v17; // rax
GJRewardItem *v18; // rdi
RewardUnlockLayer *v19; // rbx
cocos2d::CCObject *m_rewardItem; // rcx
__int128 v21; // [rsp+30h] [rbp-28h] BYREF
__int64 v22; // [rsp+40h] [rbp-18h]
__int64 v23; // [rsp+48h] [rbp-10h]
FMODAudioEngine *v24; // [rsp+68h] [rbp+10h] BYREF
FMODAudioEngine *v25; // [rsp+70h] [rbp+18h]
if ( a2->getTag(a2) == 1 )
{
v24 = (FMODAudioEngine *)&v21;
v22 = 11;
v23 = 15;
*(_QWORD *)&v21 = 0x2E313030726F6F64LL;
*((_QWORD *)&v21 + 1) = 6776687;
v6 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v25 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v25);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v6 = qword_1406C2E88;
}
FMODAudioEngine::playEffect(v6, (__int64)&v21, v4, v5, 1061997773);
LODWORD(v24) = -16777216;
v7 = cocos2d::CCLayerColor::create((const struct cocos2d::_ccColor4B *)&v24);
(*(void (__fastcall **)(float *, struct cocos2d::CCLayerColor *, __int64))(*(_QWORD *)&a1[-1].m_sAdditionalTransform.b
+ 440LL))(
&a1[-1].m_sAdditionalTransform.b,
v7,
1000);
v8 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v24 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v24);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v8 = qword_1406C2E88;
}
if ( *(_QWORD *)(v8 + 552) )
FMOD::ChannelControl::stop(*(FMOD::ChannelControl **)(v8 + 552));
sub_14005E0D0((_QWORD *)(v8 + 1064));
sub_14005E0D0((_QWORD *)(v8 + 1128));
sub_14005E0D0((_QWORD *)(v8 + 1192));
v10 = cocos2d::CCDirector::sharedDirector(v9);
v11 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v10 + 144LL))(v10);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v11, (GJShopLayer *)((char *)a1 - 416));
v12 = GJGarageLayer::scene();
v13 = cocos2d::CCTransitionFade::create(1.0, v12);
v15 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v14);
cocos2d::CCDirector::replaceScene(v15, v13);
}
else if ( a2->getTag(a2) == 2 )
{
v24 = (FMODAudioEngine *)&v21;
v21 = 0;
v22 = 4;
v23 = 15;
strcpy((char *)&v21, "0022");
v16 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v25 = (FMODAudioEngine *)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v25);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v16 = (GameStatsManager *)qword_1406C2EE8;
}
v17 = GameStatsManager::unlockSpecialChest(v16, (__int64)&v21);
v18 = v17;
if ( v17 )
{
v19 = RewardUnlockLayer::create(v17->m_rewardType, nullptr);
(*(void (__fastcall **)(float *, RewardUnlockLayer *, __int64))(*(_QWORD *)&a1[-1].m_sAdditionalTransform.b + 440LL))(
&a1[-1].m_sAdditionalTransform.b,
v19,
100);
m_rewardItem = v19->m_rewardItem;
if ( m_rewardItem )
cocos2d::CCObject::release(m_rewardItem);
v19->m_rewardItem = v18;
cocos2d::CCObject::retain(v18);
if ( !v18->m_unk || v18->m_rewardType == v19->m_chestType )
{
v19->m_closeBtn->setVisible(v19->m_closeBtn, 0);
v19->m_closeBtn->setEnabled(v19->m_closeBtn, 0);
v19->m_wrongLabel->setVisible(v19->m_wrongLabel, 0);
v19->m_rewardCollected = 1;
if ( v19->m_animationPlayed )
RewardUnlockLayer::playRewardEffect(v19);
}
}
}
}