//
// GameStatsManager::countUnlockedSecretChests from 0x5164f2 to 0x516532 (64 bytes)
//
// 4 xrefs:
// > SecretRewardsLayer::updateUnlockedGoldLabel @ 0x6cac5e
// > SecretRewardsLayer::updateUnlockedLabel @ 0x6cd734
// > SecretRewardsLayer::updateUnlockedLabel @ 0x6cd772
// > SecretRewardsLayer::init @ 0x6cea3a
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:51:40 +0000
//
_DWORD *__fastcall GameStatsManager::countUnlockedSecretChests(int a1, int a2)
{
_DWORD *result; // r0
int v3; // r3
int v4; // r2
int v5; // r4
result = *(_DWORD **)(a1 + 488);
if ( !a2 )
return (_DWORD *)cocos2d::CCDictionary::count((cocos2d::CCDictionary *)result);
if ( result )
{
v3 = result[13];
if ( v3 )
v4 = *(_DWORD *)(v3 + 272);
else
v4 = 0;
result = nullptr;
while ( v3 )
{
if ( *(_DWORD *)(*(_DWORD *)(v3 + 260) + 60) == a2 )
result = (_DWORD *)((char *)result + 1);
if ( v4 )
v5 = *(_DWORD *)(v4 + 272);
else
v5 = 0;
v3 = v4;
v4 = v5;
}
}
return result;
}