//
// GameStatsManager::countSecretChests from 0x40e4f4 to 0x40e534 (64 bytes)
//
// 4 xrefs:
// > SecretRewardsLayer::updateUnlockedLabel @ 0x585aa6
// > SecretRewardsLayer::updateUnlockedLabel @ 0x585aec
// > SecretRewardsLayer::updateUnlockedGoldLabel @ 0x585df2
// > SecretRewardsLayer::init @ 0x58691a
//
// 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
//
int GameStatsManager::countSecretChests(GameStatsManager *a1, GJRewardType a2)
{
int result; // r0
int v3; // r3
int v4; // r2
int v5; // r4
result = (int)a1->m_allTreasureRoomChests;
if ( !a2 )
return cocos2d::CCDictionary::count((cocos2d::CCDictionary *)result);
if ( result )
{
v3 = *(_DWORD *)(result + 52);
if ( v3 )
v4 = *(_DWORD *)(v3 + 272);
else
v4 = 0;
result = 0;
while ( v3 )
{
if ( *(_DWORD *)(*(_DWORD *)(v3 + 260) + 60) == a2 )
++result;
if ( v4 )
v5 = *(_DWORD *)(v4 + 272);
else
v5 = 0;
v3 = v4;
v4 = v5;
}
}
return result;
}