//
// GJShopLayer::dialogClosed from 0x92bf4c to 0x92c1d8 (652 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'GJShopLayer::dialogClosed @ 0x92c1e0
// > ??> @ 0x76608
// > ??> @ 0x11af870
//
// 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
//
void GJShopLayer::dialogClosed(GJShopLayer *a1, DialogLayer *a2)
{
FMODAudioEngine *v3; // x22
CCMenuItemSpriteExtra **p_m_rightChest; // x0
cocos2d::CCLayerColor *v5; // x0
FMODAudioEngine *v6; // x0
cocos2d::CCDirector *v7; // x0
cocos2d::CCTouchDispatcher *v8; // x0
cocos2d::CCDirector *v9; // x20
cocos2d::CCScene *v10; // x0
cocos2d::CCTransitionFade *v11; // x0
GameStatsManager *v12; // x22
GJRewardItem *v13; // x21
CCMenuItemSpriteExtra **v14; // x0
RewardUnlockLayer *v15; // x22
unsigned int *v16; // x2
int v17; // w1
unsigned int *p_m_openLayer; // x2
int m_openLayer; // w1
RewardsPage *v21; // [xsp+50h] [xbp+50h] BYREF
if ( a2->getTag(a2) == 1 )
{
v3 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v21, "door001.ogg");
FMODAudioEngine::playEffect((__int64)v3, (__int64)&v21, 1.0, 0.0, 0.8);
p_m_rightChest = &v21[-1].m_rightChest;
if ( &v21[-1].m_rightChest != (CCMenuItemSpriteExtra **)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_m_openLayer = (unsigned int *)&v21[-1].m_openLayer;
do
m_openLayer = __ldaxr(p_m_openLayer);
while ( __stlxr(m_openLayer - 1, p_m_openLayer) );
}
else
{
m_openLayer = (int)v21[-1].m_openLayer;
LODWORD(v21[-1].m_openLayer) = m_openLayer - 1;
}
if ( m_openLayer <= 0 )
operator delete(p_m_rightChest);
}
LODWORD(v21) = -16777216;
v5 = cocos2d::CCLayerColor::create();
a1->addChild_0(a1, v5, 1000);
v6 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllMusic(v6, 1);
v7 = cocos2d::CCDirector::sharedDirector();
v8 = v7->getTouchDispatcher(v7);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v8, a1);
v9 = cocos2d::CCDirector::sharedDirector();
v10 = GJGarageLayer::scene();
v11 = cocos2d::CCTransitionFade::create(1.0, v10);
cocos2d::CCDirector::replaceScene(v9, v11);
}
else if ( a2->getTag(a2) == 2 )
{
v12 = GameStatsManager::sharedState();
sub_D153B8((int)&v21, "0022");
v13 = GameStatsManager::unlockSpecialChest(v12);
v14 = &v21[-1].m_rightChest;
if ( &v21[-1].m_rightChest != (CCMenuItemSpriteExtra **)&qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)&v21[-1].m_openLayer;
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = (int)v21[-1].m_openLayer;
LODWORD(v21[-1].m_openLayer) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v14);
}
if ( v13 )
{
v15 = RewardUnlockLayer::create(v13->m_rewardType, nullptr);
a1->addChild_0(a1, v15, 100);
RewardUnlockLayer::showCollectReward(v15, v13);
}
}
}