//
// SecretRewardsLayer::updateUnlockedLabel from 0x10070ee80 to 0x10070f092 (530 bytes)
//
// 3 xrefs:
// > SecretRewardsLayer::init @ 0x10070dfb6
// > SecretRewardsLayer::createSecondaryLayer @ 0x1007105c3
// > SecretRewardsLayer::onSelectItem @ 0x100711616
//
// This function is hookable on this platform (idp: pc, 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:36:05 +0000
//
void __fastcall SecretRewardsLayer::updateUnlockedLabel(__int64 a1)
{
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // r15
__int64 v5; // rax
__int64 CString; // rax
__int64 v7; // rax
int v8; // r15d
__int64 v9; // rax
char v10; // al
__int64 v11; // rax
const char *v12; // r13
size_t v13; // rax
size_t v14; // r12
char *v15; // r14
__int64 v16; // rdi
size_t v17; // r15
char *v18; // rsi
__int64 v19; // r12
char *v20; // rsi
__int64 v21; // rdi
char v22; // [rsp+0h] [rbp-50h]
int v23; // [rsp+0h] [rbp-50h]
int v24; // [rsp+4h] [rbp-4Ch]
_QWORD __dst[2]; // [rsp+8h] [rbp-48h] BYREF
void *__p; // [rsp+18h] [rbp-38h]
__int16 v27; // [rsp+24h] [rbp-2Ch] BYREF
char v28; // [rsp+26h] [rbp-2Ah]
v2 = GameStatsManager::sharedState();
GameStatsManager::countUnlockedSecretChests(v2, 0);
v3 = GameStatsManager::sharedState();
GameStatsManager::countSecretChests(v3, 0);
v4 = *(_QWORD *)(a1 + 440);
v5 = sub_10088E820("%i/%i", v22);
CString = cocos2d::CCString::getCString(v5);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v4 + 928LL))(v4, CString);
if ( *(_BYTE *)(a1 + 584) )
return;
v7 = GameStatsManager::sharedState();
v8 = GameStatsManager::countUnlockedSecretChests(v7, *(_DWORD *)(a1 + 588));
v9 = GameStatsManager::sharedState();
v10 = GameStatsManager::countSecretChests(v9, *(_DWORD *)(a1 + 588));
v11 = sub_10088E820("%i/%i", v10);
v12 = (const char *)cocos2d::CCString::getCString(v11);
v13 = strlen(v12);
if ( v13 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v14 = v13;
if ( v13 >= 0x17 )
{
v24 = v8;
v17 = 26;
if ( (v13 | 7) != 0x17 )
v17 = (v13 | 7) + 1;
v15 = (char *)operator new(v17);
__p = v15;
__dst[0] = v17 + 1;
v8 = v24;
__dst[1] = v14;
}
else
{
LOBYTE(__dst[0]) = 2 * v13;
v15 = (char *)__dst + 1;
if ( !v13 )
{
BYTE1(__dst[0]) = 0;
v16 = *(_QWORD *)(a1 + 448);
if ( !v16 )
goto LABEL_15;
LABEL_11:
if ( (__dst[0] & 1) != 0 )
v18 = (char *)__p;
else
v18 = (char *)__dst + 1;
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)v16 + 928LL))(v16, v18);
goto LABEL_15;
}
}
memmove(v15, v12, v14);
v15[v14] = 0;
v16 = *(_QWORD *)(a1 + 448);
if ( v16 )
goto LABEL_11;
LABEL_15:
v19 = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1 + 464), *(int *)(a1 + 588));
if ( v19 )
{
if ( (__dst[0] & 1) != 0 )
v20 = (char *)__p;
else
v20 = (char *)__dst + 1;
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)v19 + 928LL))(v19, v20);
}
if ( v8 >= v23 )
{
v21 = *(_QWORD *)(a1 + 448);
if ( v21 )
{
v28 = -1;
v27 = -256;
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v21 + 1072LL))(v21, &v27);
}
if ( v19 )
{
v28 = 50;
v27 = -206;
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v19 + 1072LL))(v19, &v27);
}
}
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
}