//
// SecretRewardsLayer::updateUnlockedLabel from 0x14056ca40 to 0x14056ce1d (989 bytes)
//
// 4 xrefs:
// > SecretRewardsLayer::init @ 0x140569675
// > SecretRewardsLayer::createSecondaryLayer @ 0x14056b03a
// > SecretRewardsLayer::onSelectItem @ 0x14056c0f6
// > ??> @ 0x14092c6c0
//
// 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 11:34:20 +0000
//
// Hidden C++ exception states: #wind=5
void __fastcall SecretRewardsLayer::updateUnlockedLabel(__int64 a1)
{
__int64 v2; // rcx
unsigned int v3; // esi
__int64 v4; // rcx
unsigned int v5; // eax
void (__fastcall **v6)(__int64, const char *); // rdi
__int64 v7; // rbx
cocos2d::CCString *v8; // rax
const char *CString; // rax
__int64 v10; // r8
int v11; // r9d
signed int v12; // edi
int v13; // r9d
signed int v14; // ebx
cocos2d::CCString *v15; // rax
const char *v16; // rax
size_t v17; // r8
__int64 v18; // rcx
void **v19; // rdx
struct cocos2d::CCObject *v20; // rax
struct cocos2d::CCObject *v21; // rsi
void **v22; // rdx
__int64 v23; // rcx
void *v24; // rcx
__int64 v25; // rax
__int64 v26; // rax
__int64 i; // rdx
signed int v28; // ecx
__int64 v29; // rax
__int64 v30; // rax
__int64 j; // rdx
signed int v32; // ecx
__int16 v33; // [rsp+30h] [rbp-40h] BYREF
char v34; // [rsp+32h] [rbp-3Eh]
void *v35; // [rsp+38h] [rbp-38h]
void *Block[2]; // [rsp+40h] [rbp-30h] BYREF
__int64 v37; // [rsp+50h] [rbp-20h]
unsigned __int64 v38; // [rsp+58h] [rbp-18h]
v2 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v35 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v35);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v2 = qword_14090BFE0;
}
v3 = cocos2d::CCDictionary::count(*(cocos2d::CCDictionary **)(v2 + 864));
v4 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v35 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v35);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v4 = qword_14090BFE0;
}
v5 = cocos2d::CCDictionary::count(*(cocos2d::CCDictionary **)(v4 + 352));
v6 = *(void (__fastcall ***)(__int64, const char *))(*(_QWORD *)(a1 + 440) + 360LL);
v7 = *(_QWORD *)(a1 + 440);
v8 = cocos2d::CCString::createWithFormat("%i/%i", v3, v5);
CString = cocos2d::CCString::getCString(v8);
(*v6)(v7 + 360, CString);
if ( !*(_BYTE *)(a1 + 584) )
{
v10 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v35 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v35);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v10 = qword_14090BFE0;
}
v11 = *(_DWORD *)(a1 + 588);
if ( v11 )
{
v12 = 0;
v25 = *(_QWORD *)(v10 + 864);
if ( v25 )
{
v26 = *(_QWORD *)(v25 + 56);
if ( v26 )
{
for ( i = *(_QWORD *)(v26 + 288); ; i = *(_QWORD *)(i + 288) )
{
v28 = v12++;
if ( *(_DWORD *)(*(_QWORD *)(v26 + 264) + 64LL) != v11 )
v12 = v28;
v26 = i;
if ( !i )
break;
}
}
}
}
else
{
v12 = cocos2d::CCDictionary::count(*(cocos2d::CCDictionary **)(v10 + 864));
v10 = qword_14090BFE0;
}
if ( !v10 )
{
v35 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v35);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v10 = qword_14090BFE0;
}
v13 = *(_DWORD *)(a1 + 588);
if ( v13 )
{
v14 = 0;
v29 = *(_QWORD *)(v10 + 352);
if ( v29 )
{
v30 = *(_QWORD *)(v29 + 56);
if ( v30 )
{
for ( j = *(_QWORD *)(v30 + 288); ; j = *(_QWORD *)(j + 288) )
{
v32 = v14++;
if ( *(_DWORD *)(*(_QWORD *)(v30 + 264) + 64LL) != v13 )
v14 = v32;
v30 = j;
if ( !j )
break;
}
}
}
}
else
{
v14 = cocos2d::CCDictionary::count(*(cocos2d::CCDictionary **)(v10 + 352));
}
v15 = cocos2d::CCString::createWithFormat("%i/%i", v12, v14);
v16 = cocos2d::CCString::getCString(v15);
*(_OWORD *)Block = 0;
v37 = 0;
v38 = 0;
v17 = -1;
do
++v17;
while ( v16[v17] );
sub_14003D230(Block, v16, v17);
v18 = *(_QWORD *)(a1 + 448);
if ( v18 )
{
v19 = Block;
if ( v38 > 0xF )
v19 = (void **)Block[0];
(**(void (__fastcall ***)(__int64, void **))(v18 + 360))(v18 + 360, v19);
}
v20 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 464), *(int *)(a1 + 588));
v21 = v20;
if ( v20 )
{
v22 = Block;
if ( v38 > 0xF )
v22 = (void **)Block[0];
(**((void (__fastcall ***)(__int64, void **))v20 + 45))((__int64)v20 + 360, v22);
}
if ( v12 >= v14 )
{
v23 = *(_QWORD *)(a1 + 448);
if ( v23 )
{
v33 = -256;
v34 = -1;
(**(void (__fastcall ***)(__int64, __int16 *))(v23 + 368))(v23 + 368, &v33);
}
if ( v21 )
{
v33 = -206;
v34 = 50;
(**((void (__fastcall ***)(__int64, __int16 *))v21 + 46))((__int64)v21 + 368, &v33);
}
}
if ( v38 > 0xF )
{
v24 = Block[0];
if ( v38 + 1 >= 0x1000 )
{
v24 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v24 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v24);
}
}
}