//
// GameStatsManager::unlockSpecialChest from 0x1401ea5e0 to 0x1401ea6b2 (210 bytes)
//
// 11 xrefs:
// > FollowRewardPage::onSpecialItem @ 0x14013cf30
// > GameStatsManager::unlockOnlineChest @ 0x1401ea7dc
// > GauntletSelectLayer::onPlay @ 0x1401fadf9
// > GJPathRewardPopup::onClaim @ 0x14028a486
// > GJShopLayer::dialogClosed @ 0x1402ae885
// > SecretRewardsLayer::onSpecialItem @ 0x1403d6dfc
// > SecretLayer3::onChest01 @ 0x1403eb5a1
// > SecretLayer3::onChest02 @ 0x1403eb721
// > SecretLayer4::onChest01 @ 0x1403f0c84
// > SupportLayer::onGetReward @ 0x1404c99f5
// > ??> @ 0x1406cc66c
//
// 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=2
GJRewardItem *__fastcall GameStatsManager::unlockSpecialChest(GameStatsManager *a1, __int64 a2)
{
_QWORD *v4; // rax
GJRewardItem *v5; // rsi
__int64 v7; // [rsp+20h] [rbp-58h]
_BYTE v8[32]; // [rsp+28h] [rbp-50h] BYREF
__int64 v9; // [rsp+48h] [rbp-30h]
v9 = a2;
v4 = (_QWORD *)sub_14003BDB0((__int64)v8, a2);
if ( GameStatsManager::isSpecialChestUnlocked((__int64)a1, v4)
|| (v7 = sub_14003BDB0((__int64)v8, a2),
v5 = (GJRewardItem *)cocos2d::CCDictionary::objectForKey(a1->m_allSpecialChests, v7),
sub_14003A830(v7),
!v5) )
{
sub_14003A830(a2);
return nullptr;
}
else
{
GameStatsManager::preProcessReward(a1, v5);
GameStatsManager::registerRewardsFromItem(a1, v5);
cocos2d::CCDictionary::setObject(a1->m_miscChests, v5, a2);
sub_14003A830(a2);
return v5;
}
}