//
// GameStatsManager::processOnlineChests from 0x7bd244 to 0x7bd43c (504 bytes)
//
// 2 xrefs:
// > GameStatsManager::removeErrorFromSpecialChests @ 0x7bd47c
// > ??> @ 0xb5da0
//
// 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 GameStatsManager::processOnlineChests(GameStatsManager *a1)
{
unsigned int v2; // w19
cocos2d::CCArray *v3; // x22
cocos2d::CCString *v4; // x0
char *CString; // x0
__int64 v6; // x28
void *v7; // x0
char *v8; // x0
unsigned int *v9; // x1
int v10; // w2
unsigned int *v11; // x1
int v12; // w2
std::string v13; // [xsp+68h] [xbp+68h] BYREF
__int64 v14; // [xsp+70h] [xbp+70h] BYREF
v2 = 0;
v3 = cocos2d::CCDictionary::allKeys(a1->m_wraithChests);
if ( (unsigned int)cocos2d::CCArray::count(v3) )
{
do
{
v4 = cocos2d::CCArray::stringAtIndex(v3, v2);
CString = (char *)cocos2d::CCString::getCString(v4);
sub_D153B8((int)&v13, CString);
v6 = cocos2d::CCDictionary::objectForKey(a1->m_miscChests, &v13);
sub_D18D28(&v14);
GameStatsManager::linkSpecialChestUnlocks(a1, v6, (cocos2d::CCString *)&v14);
v7 = (void *)(v14 - 24);
if ( (__int64 *)(v14 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(v14 - 8);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *(_DWORD *)(v14 - 8);
*(_DWORD *)(v14 - 8) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v7);
}
v8 = (char *)v13.m_data.m_data - 24;
if ( (__int64 *)v13.m_data.m_data - 3 == &qword_124B6B0 )
goto LABEL_4;
if ( &pthread_create )
{
v9 = (unsigned int *)((char *)v13.m_data.m_data - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *((_DWORD *)v13.m_data.m_data - 2);
*((_DWORD *)v13.m_data.m_data - 2) = v10 - 1;
}
if ( v10 > 0 )
{
LABEL_4:
++v2;
}
else
{
++v2;
operator delete(v8);
}
}
while ( v2 < (unsigned int)cocos2d::CCArray::count(v3) );
}
}