//
// SecretRewardsLayer::updateUnlockedLabel from 0x6cd718 to 0x6cd85c (324 bytes)
//
// 3 xrefs:
// > SecretRewardsLayer::onSelectItem @ 0x6cdf02
// > SecretRewardsLayer::init @ 0x6cebee
// > SecretRewardsLayer::createSecondaryLayer @ 0x6cfcfa
//
// 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:57:00 +0000
//
GameStatsManager *__fastcall SecretRewardsLayer::updateUnlockedLabel(SecretRewardsLayer *this)
{
int v2; // r0
GameStatsManager *v3; // r9
int v4; // r0
_DWORD *v5; // r0
int v6; // r5
int (__fastcall *v7)(int, int); // r8
cocos2d::CCString *v8; // r0
int CString; // r0
GameStatsManager *result; // r0
int v11; // r5
int v12; // r0
GameStatsManager *v13; // r8
int v14; // r0
GameStatsManager *v15; // r9
cocos2d::CCString *v16; // r0
const char *v17; // r10
size_t v18; // r0
int v19; // r0
int v20; // r0
int v21; // r5
char *v22; // r1
char *v23; // r1
int v24; // r0
void (__fastcall *v25)(int, char *); // r2
void (__fastcall *v26)(int, char *); // r2
char v27; // [sp+4h] [bp-14h] BYREF
char v28; // [sp+5h] [bp-13h]
char v29; // [sp+6h] [bp-12h]
int v30[2]; // [sp+8h] [bp-10h] BYREF
char *v31; // [sp+10h] [bp-8h]
v2 = GameStatsManager::sharedState(this);
v3 = (GameStatsManager *)GameStatsManager::countUnlockedSecretChests(v2, 0);
v4 = GameStatsManager::sharedState(v3);
v5 = GameStatsManager::countSecretChests(v4, 0);
v6 = *((_DWORD *)this + 83);
v7 = *(int (__fastcall **)(int, int))(*(_DWORD *)v6 + 464);
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i/%i", (const char *)v3, v5);
CString = cocos2d::CCString::getCString(v8);
result = (GameStatsManager *)v7(v6, CString);
v11 = *((unsigned __int8 *)this + 416);
if ( !*((_BYTE *)this + 416) )
{
v12 = GameStatsManager::sharedState(result);
v13 = (GameStatsManager *)GameStatsManager::countUnlockedSecretChests(v12, *((_DWORD *)this + 105));
v14 = GameStatsManager::sharedState(v13);
v15 = (GameStatsManager *)GameStatsManager::countSecretChests(v14, *((_DWORD *)this + 105));
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i/%i", (const char *)v13, v15);
v30[0] = v11;
v30[1] = v11;
v31 = (char *)v11;
v17 = (const char *)cocos2d::CCString::getCString(v16);
v18 = strlen(v17);
std::string::__init(v30, v17, v18);
v19 = *((_DWORD *)this + 84);
if ( v19 )
{
if ( (v30[0] & 1) != 0 )
v22 = v31;
else
v22 = (char *)v30 + 1;
(*(void (__fastcall **)(int, char *))(*(_DWORD *)v19 + 464))(v19, v22);
}
v20 = cocos2d::CCDictionary::objectForKey(*((cocos2d::CCDictionary **)this + 86), *((_DWORD *)this + 105));
v21 = v20;
if ( v20 )
{
if ( (v30[0] & 1) != 0 )
v23 = v31;
else
v23 = (char *)v30 + 1;
(*(void (__fastcall **)(int, char *, int))(*(_DWORD *)v20 + 464))(v20, v23, LOBYTE(v30[0]) << 31);
}
if ( (int)v13 >= (int)v15 )
{
v24 = *((_DWORD *)this + 84);
if ( v24 )
{
v25 = *(void (__fastcall **)(int, char *))(*(_DWORD *)v24 + 536);
v27 = 0;
v28 = -1;
v29 = -1;
v25(v24, &v27);
}
if ( v21 )
{
v26 = *(void (__fastcall **)(int, char *))(*(_DWORD *)v21 + 536);
v28 = -1;
v27 = 50;
v29 = 50;
v26(v21, &v27);
}
}
return (GameStatsManager *)std::string::~string((int)v30);
}
return result;
}