//
// SecretLayer3::onChest01 from 0x140581150 to 0x1405812cc (380 bytes)
//
// 2 xrefs:
// > SecretLayer3::init @ 0x140580b09
// > ??> @ 0x14092c96c
//
// 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 11:34:26 +0000
//
// Hidden C++ exception states: #wind=2
void __fastcall SecretLayer3::onChest01(_BYTE *a1, __int64 a2)
{
__int64 v4; // rcx
__int64 v5; // rax
__int64 v6; // rbx
_QWORD *v7; // rdi
cocos2d::CCObject *v8; // rcx
__int128 v9; // [rsp+20h] [rbp-28h] BYREF
__int64 v10; // [rsp+30h] [rbp-18h]
__int64 v11; // [rsp+38h] [rbp-10h]
void *v12; // [rsp+60h] [rbp+18h]
if ( !a1[424] )
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a2 + 936LL))(a2, 0);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a2 + 336LL))(a2, 0);
v9 = 0;
v10 = 4;
v11 = 15;
strcpy((char *)&v9, "0001");
v4 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v12 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v4 = qword_14090BFE0;
}
v5 = GameStatsManager::unlockSpecialChest(v4, (__int64)&v9);
v6 = v5;
if ( v5 )
{
v7 = RewardUnlockLayer::create(*(_DWORD *)(v5 + 64), 0);
(*(void (__fastcall **)(_BYTE *, _QWORD *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v7, 100);
v8 = (cocos2d::CCObject *)v7[88];
if ( v8 )
cocos2d::CCObject::release(v8);
v7[88] = v6;
cocos2d::CCObject::retain((cocos2d::CCObject *)v6);
if ( !*(_BYTE *)(v6 + 80) || *(_DWORD *)(v6 + 64) == *((_DWORD *)v7 + 174) )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)v7[90] + 336LL))(v7[90], 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)v7[90] + 936LL))(v7[90], 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)v7[89] + 336LL))(v7[89], 0);
*((_BYTE *)v7 + 700) = 1;
if ( *((_BYTE *)v7 + 701) )
RewardUnlockLayer::playRewardEffect((cocos2d::CCNode *)v7);
}
}
}
}