//
// GameStatsManager::processOnlineChests from 0x10008ea70 to 0x10008ebeb (379 bytes)
//
// 1 xrefs:
// > GameStatsManager::removeErrorFromSpecialChests @ 0x100076d44
//
// 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 GameStatsManager::processOnlineChests(GameStatsManager *a1)
{
double v1; // xmm0_8
GameStatsManager *v2; // r14
cocos2d::CCArray *v3; // rbx
unsigned int v4; // r15d
cocos2d::CCString *v5; // rax
const char *CString; // r13
size_t v7; // rax
size_t v8; // r12
char *v9; // rbx
__int64 v10; // rax
size_t v11; // r14
__int64 v12; // r12
cocos2d::CCArray *v13; // [rsp+0h] [rbp-70h]
std::string v14; // [rsp+10h] [rbp-60h] BYREF
__int128 __dst; // [rsp+30h] [rbp-40h] BYREF
void *v16; // [rsp+40h] [rbp-30h]
v2 = a1;
v3 = cocos2d::CCDictionary::allKeys(a1->m_wraithChests);
if ( (unsigned int)sub_100720070(v3) )
{
v4 = 0;
v13 = v3;
do
{
v5 = cocos2d::CCArray::stringAtIndex(v3, v4);
CString = cocos2d::CCString::getCString(v5);
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v8 = v7;
if ( v7 >= 0x17 )
{
v10 = v7 | 7;
v11 = 26;
if ( (v8 | 7) != 0x17 )
v11 = v10 + 1;
v9 = (char *)operator new(v11);
v16 = v9;
*(_QWORD *)&__dst = v11 + 1;
*((_QWORD *)&__dst + 1) = v8;
v2 = a1;
}
else
{
LOBYTE(__dst) = 2 * v7;
v9 = (char *)&__dst + 1;
if ( !v7 )
goto LABEL_12;
}
memmove(v9, CString, v8);
LABEL_12:
v9[v8] = 0;
v3 = v13;
v12 = cocos2d::CCDictionary::objectForKey_1(v2->m_miscChests, &__dst);
if ( (__dst & 1) != 0 )
{
sub_100006B70(&v14, v16, *((unsigned __int64 *)&__dst + 1), v1);
}
else
{
v14.__r_.__value_.__r.__words[2] = (std::string::size_type)v16;
v1 = *(double *)&__dst;
*(_OWORD *)&v14.__r_.__value_.__l.0 = __dst;
}
GameStatsManager::linkSpecialChestUnlocks((__int64)v2, v12, &v14, v1);
if ( (*(_BYTE *)&v14.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v14.__r_.__value_.__l.__data_);
if ( (__dst & 1) != 0 )
operator delete(v16);
++v4;
}
while ( v4 < (unsigned int)sub_100720070(v13) );
}
}