//
// GameStatsManager::processOnlineChests from 0x1402f8240 to 0x1402f8443 (515 bytes)
//
// 2 xrefs:
// > GameStatsManager::removeErrorFromSpecialChests @ 0x1402f8471
// > ??> @ 0x14091e194
//
// 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:30:04 +0000
//
// Hidden C++ exception states: #wind=1
unsigned int __fastcall GameStatsManager::processOnlineChests(__int64 a1)
{
cocos2d::CCArray *v2; // r15
unsigned int v3; // esi
unsigned int result; // eax
cocos2d::CCString *v5; // rax
const char *CString; // rax
size_t v7; // r8
__int64 v8; // rcx
__int64 v9; // r14
void **v10; // rbp
unsigned __int64 v11; // rdi
unsigned __int64 v12; // rbx
void *v13; // rcx
__int128 v14; // [rsp+30h] [rbp-78h] BYREF
unsigned __int64 v15; // [rsp+40h] [rbp-68h]
__int64 v16; // [rsp+48h] [rbp-60h]
void *Src[2]; // [rsp+58h] [rbp-50h] BYREF
unsigned __int64 v18; // [rsp+68h] [rbp-40h]
unsigned __int64 v19; // [rsp+70h] [rbp-38h]
v2 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(a1 + 904));
v3 = 0;
result = cocos2d::CCArray::count(v2);
if ( result )
{
do
{
v5 = cocos2d::CCArray::stringAtIndex(v2, v3);
CString = cocos2d::CCString::getCString(v5);
*(_OWORD *)Src = 0;
v18 = 0;
v19 = 0;
v7 = -1;
do
++v7;
while ( CString[v7] );
sub_14003D230(Src, CString, v7);
v9 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 888), Src);
v14 = 0;
v15 = 0;
v16 = 0;
v10 = Src;
if ( v19 > 0xF )
v10 = (void **)Src[0];
v11 = v18;
if ( v18 > 0x7FFFFFFFFFFFFFFFLL )
sub_140009D90(v8);
if ( v18 > 0xF )
{
v12 = v18 | 0xF;
if ( (v18 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
if ( v12 < 0x16 )
v12 = 22;
}
else
{
v12 = 0x7FFFFFFFFFFFFFFFLL;
}
*(_QWORD *)&v14 = sub_14003D460(v12 + 1);
v15 = v11;
v16 = v12;
memcpy((void *)v14, v10, v11 + 1);
}
else
{
v15 = v18;
v16 = 15;
v14 = *(_OWORD *)v10;
}
GameStatsManager::linkSpecialChestUnlocks(a1, v9, (void **)&v14);
if ( v19 > 0xF )
{
v13 = Src[0];
if ( v19 + 1 >= 0x1000 )
{
v13 = *((void **)Src[0] - 1);
if ( (unsigned __int64)((char *)Src[0] - (char *)v13 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v13);
}
++v3;
result = cocos2d::CCArray::count(v2);
}
while ( v3 < result );
}
return result;
}