//
// GameStatsManager::removeErrorFromSpecialChests from 0x100076d30 to 0x100076ea0 (368 bytes)
//
// 2 xrefs:
// > GameStatsManager::recountSpecialStats @ 0x100075db4
// > GameStatsManager::dataLoaded @ 0x10008e6e0
//
// 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::removeErrorFromSpecialChests(GameStatsManager *a1)
{
double v1; // xmm0_8
GameStatsManager *v2; // r14
cocos2d::CCArray *v3; // rbx
unsigned int v4; // r15d
cocos2d::CCString *v5; // rax
const char *CString; // r12
size_t v7; // rax
size_t v8; // r13
char *v9; // rbx
__int64 v10; // rax
size_t v11; // r14
cocos2d::CCArray *v12; // [rsp+0h] [rbp-50h]
_QWORD __dst[2]; // [rsp+10h] [rbp-40h] BYREF
void *__p; // [rsp+20h] [rbp-30h]
v2 = a1;
GameStatsManager::processOnlineChests(a1);
v3 = cocos2d::CCDictionary::allKeys(a1->m_miscChests);
if ( (unsigned int)sub_100720070(v3) )
{
v4 = 0;
v12 = v3;
while ( 1 )
{
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 )
break;
LOBYTE(__dst[0]) = 2 * v7;
v9 = (char *)__dst + 1;
if ( v7 )
goto LABEL_11;
LABEL_12:
v9[v8] = 0;
if ( !cocos2d::CCDictionary::objectForKey_1(v2->m_allSpecialChests, __dst)
&& !cocos2d::CCDictionary::objectForKey_1(v2->m_wraithChests, __dst) )
{
cocos2d::CCDictionary::removeObjectForKey_1(v2->m_miscChests, __dst);
}
v3 = v12;
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
if ( ++v4 >= (unsigned int)sub_100720070(v12) )
return;
}
v10 = v7 | 7;
v11 = 26;
if ( (v8 | 7) != 0x17 )
v11 = v10 + 1;
v9 = (char *)operator new(v11);
__p = v9;
__dst[0] = v11 + 1;
__dst[1] = v8;
v2 = a1;
LABEL_11:
memmove(v9, CString, v8);
goto LABEL_12;
}
}