//
// SecretLayer4::onChest01 from 0xa94758 to 0xa94874 (284 bytes)
//
// 3 xrefs:
// > ??> @ 0xe42e0
// > SecretLayer4::init @ 0xa975fc
// > ??> @ 0x1546db0
//
// 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:42 +0000
//
__int64 __fastcall SecretLayer4::onChest01(SecretLayer4 *this, cocos2d::CCObject *a2)
{
GameStatsManager *v4; // x0
GameStatsManager *v5; // x21
RewardsPage *v6; // x2
unsigned int *v7; // x20
RewardUnlockLayer *v8; // x21
__int64 v10[2]; // [xsp+30h] [xbp+30h] BYREF
void *v11; // [xsp+40h] [xbp+40h]
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)a2 + 1056LL))(a2, 0);
v4 = (GameStatsManager *)(*(__int64 (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)a2 + 344LL))(a2, 0);
v5 = (GameStatsManager *)GameStatsManager::sharedState(v4);
v10[0] = 0;
v10[1] = 0;
v11 = nullptr;
std::string::__init(v10, "0003", 4u);
v7 = (unsigned int *)GameStatsManager::unlockSpecialChest(v5, (char *)v10);
if ( (v10[0] & 1) != 0 )
operator delete(v11);
if ( v7 )
{
v8 = (RewardUnlockLayer *)RewardUnlockLayer::create((RewardUnlockLayer *)v7[16], nullptr, v6);
(*(void (__fastcall **)(SecretLayer4 *, RewardUnlockLayer *, __int64))(*(_QWORD *)this + 464LL))(this, v8, 100);
RewardUnlockLayer::showCollectReward(v8, (GJRewardItem *)v7);
}
return _stack_chk_guard;
}