//
// RewardUnlockLayer::step2 from 0x937ad4 to 0x937c20 (332 bytes)
//
// 3 xrefs:
// > ??> @ 0x31ea8
// > RewardUnlockLayer::init @ 0x938428
// > ??> @ 0x12297d0
//
// 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 RewardUnlockLayer::step2(RewardUnlockLayer *a1)
{
FMODAudioEngine *v2; // x22
void *v3; // x0
cocos2d::CCSequence *v4; // x20
cocos2d::CCFiniteTimeAction *v5; // x0
cocos2d::CCAction *v6; // x0
unsigned int *v7; // x2
int v8; // w1
__int64 v9; // [xsp+40h] [xbp+40h] BYREF
v2 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v9, "chestOpen01.ogg");
FMODAudioEngine::playEffect((__int64)v2, (__int64)&v9);
v3 = (void *)(v9 - 24);
if ( (__int64 *)(v9 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v7 = (unsigned int *)(v9 - 8);
do
v8 = __ldaxr(v7);
while ( __stlxr(v8 - 1, v7) );
}
else
{
v8 = *(_DWORD *)(v9 - 8);
*(_DWORD *)(v9 - 8) = v8 - 1;
}
if ( v8 <= 0 )
operator delete(v3);
}
GJChestSprite::switchToState(a1->m_chestSprite, Opening, 0);
v4 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(0.3);
v5 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(a1, RewardUnlockLayer::step3, 0);
v6 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v4, v5, 0);
cocos2d::CCNode::runAction(a1, v6);
}