//
// GameStatsManager::unlockSpecialChest from 0x8ead64 to 0x8eaed4 (368 bytes)
//
// 12 xrefs:
// > GameManager::rewardedVideoHidden @ 0x718b34
// > GameStatsManager::unlockGauntletChest @ 0x8eaf34
// > GameStatsManager::unlockPathChest @ 0x8eb048
// > GameStatsManager::unlockOnlineChest @ 0x8eb144
// > SupportLayer::onGetReward @ 0x90122c
// > GJShopLayer::dialogClosed @ 0xa7d098
// > SecretLayer3::onChest01 @ 0xa8c280
// > SecretLayer3::onChest02 @ 0xa8c3a8
// > SecretLayer4::onChest01 @ 0xa947dc
// > FollowRewardPage::onSpecialItem @ 0xaaaf98
// > SecretRewardsLayer::onSpecialItem @ 0xb9e88c
// > ??> @ 0x84178
//
// 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 12:56:55 +0000
//
GJRewardItem *__fastcall GameStatsManager::unlockSpecialChest(GameStatsManager *a1, char *a2)
{
char v4; // w0
__int64 v5; // x0
__int64 v6; // x1
_BOOL4 isSpecialChestUnlocked; // w23
char v8; // w0
__int64 v9; // x0
__int64 v10; // x1
GJRewardItem *RewardForSpecialChest; // x20
char v13[8]; // [xsp+40h] [xbp+40h] BYREF
__int64 v14; // [xsp+48h] [xbp+48h]
void *v15; // [xsp+50h] [xbp+50h]
*(_QWORD *)v13 = 0;
v4 = *a2;
v14 = 0;
v15 = nullptr;
if ( (v4 & 1) != 0 )
{
std::string::__init((__int64 *)v13, *((void **)a2 + 2), *((_QWORD *)a2 + 1));
}
else
{
v5 = *(_QWORD *)a2;
v6 = *((_QWORD *)a2 + 1);
v15 = *((void **)a2 + 2);
*(_QWORD *)v13 = v5;
v14 = v6;
}
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked((__int64)a1, v13);
if ( (v13[0] & 1) != 0 )
{
operator delete(v15);
if ( isSpecialChestUnlocked )
return nullptr;
}
else if ( isSpecialChestUnlocked )
{
return nullptr;
}
v8 = *a2;
*(_QWORD *)v13 = 0;
v14 = 0;
v15 = nullptr;
if ( (v8 & 1) != 0 )
{
std::string::__init((__int64 *)v13, *((void **)a2 + 2), *((_QWORD *)a2 + 1));
}
else
{
v9 = *(_QWORD *)a2;
v10 = *((_QWORD *)a2 + 1);
v15 = *((void **)a2 + 2);
*(_QWORD *)v13 = v9;
v14 = v10;
}
RewardForSpecialChest = (GJRewardItem *)GameStatsManager::getRewardForSpecialChest((__int64)a1, (__int64)v13);
if ( (v13[0] & 1) != 0 )
operator delete(v15);
if ( RewardForSpecialChest )
{
GameStatsManager::preProcessReward(a1, RewardForSpecialChest);
GameStatsManager::registerRewardsFromItem(a1, RewardForSpecialChest);
cocos2d::CCDictionary::setObject(*((_QWORD *)a1 + 98), RewardForSpecialChest);
return RewardForSpecialChest;
}
return nullptr;
}