//
// SecretRewardsLayer::updateUnlockedLabel from 0x1002e9b4c to 0x1002e9cd0 (388 bytes)
//
// 3 xrefs:
// > SecretRewardsLayer::init @ 0x1002e8eb4
// > SecretRewardsLayer::createSecondaryLayer @ 0x1002eac24
// > SecretRewardsLayer::onSelectItem @ 0x1002eb588
//
// 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
//
void __fastcall SecretRewardsLayer::updateUnlockedLabel(SecretRewardsLayer *a1)
{
GameStatsManager *v2; // x0
int v3; // w20
GameStatsManager *v4; // x0
int v5; // w0
cocos2d::CCLabelBMFont *m_chestLabel; // x21
cocos2d::CCString *v7; // x0
const char *CString; // x0
GameStatsManager *v9; // x0
int v10; // w20
GameStatsManager *v11; // x0
int v12; // w21
cocos2d::CCString *v13; // x0
char *v14; // x0
cocos2d::CCLabelBMFont *m_chestCounter; // x0
void **v16; // x1
cocos2d::CCObject *v17; // x0
cocos2d::CCObject *v18; // x22
void **v19; // x1
cocos2d::CCLabelBMFont *v20; // x0
__int16 v21; // [xsp+14h] [xbp-3Ch] BYREF
char v22; // [xsp+16h] [xbp-3Ah]
void *__p[2]; // [xsp+18h] [xbp-38h] BYREF
char v24; // [xsp+2Fh] [xbp-21h]
v2 = GameStatsManager::sharedState();
v3 = GameStatsManager::countUnlockedSecretChests(v2, (GJRewardType)0);
v4 = GameStatsManager::sharedState();
v5 = GameStatsManager::countSecretChests(v4, (GJRewardType)0);
m_chestLabel = a1->m_chestLabel;
v7 = (cocos2d::CCString *)sub_100268F4C("%i/%i", v3, v5);
CString = cocos2d::CCString::getCString(v7);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))m_chestLabel->setString)(m_chestLabel, CString);
if ( !a1->m_inMainLayer )
{
v9 = GameStatsManager::sharedState();
v10 = GameStatsManager::countUnlockedSecretChests(v9, a1->m_rewardType);
v11 = GameStatsManager::sharedState();
v12 = GameStatsManager::countSecretChests(v11, a1->m_rewardType);
v13 = (cocos2d::CCString *)sub_100268F4C("%i/%i", v10, v12);
v14 = (char *)cocos2d::CCString::getCString(v13);
sub_100009900(__p, v14);
m_chestCounter = a1->m_chestCounter;
if ( m_chestCounter )
{
if ( v24 >= 0 )
v16 = __p;
else
v16 = (void **)__p[0];
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void **))m_chestCounter->setString)(m_chestCounter, v16);
}
v17 = cocos2d::CCDictionary::objectForKey(a1->m_chestCounters, a1->m_rewardType);
v18 = v17;
if ( v17 )
{
if ( v24 >= 0 )
v19 = __p;
else
v19 = (void **)__p[0];
((void (__fastcall *)(cocos2d::CCObject *, void **))v17->__vftable[11].acceptVisitor)(v17, v19);
}
if ( v10 >= v12 )
{
v20 = a1->m_chestCounter;
if ( v20 )
{
v22 = -1;
v21 = -256;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int16 *))v20->setColor)(v20, &v21);
}
if ( v18 )
{
v22 = 50;
v21 = -206;
((void (__fastcall *)(cocos2d::CCObject *, __int16 *))v18->__vftable[13].~CCObject_0)(v18, &v21);
}
}
if ( v24 < 0 )
operator delete(__p[0]);
}
}