//
// GJBaseGameLayer::processItems from 0x100129560 to 0x1001297a4 (580 bytes)
//
// 1 xrefs:
// > PlayLayer::levelComplete @ 0x1000b3d16
//
// 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 GJBaseGameLayer::processItems(GJBaseGameLayer *a1)
{
double v1; // xmm0_8
GJBaseGameLayer *v2; // r15
cocos2d::CCArray *v3; // rbx
unsigned int v4; // r12d
cocos2d::CCString *v5; // rax
const char *CString; // rbx
cocos2d::CCDictionary *m_collectedItems; // r13
size_t v8; // rax
size_t v9; // r12
char *v10; // r14
size_t v11; // r15
int *v12; // rbx
unsigned int v13; // r12d
int v14; // eax
const char *v15; // rbx
GJGameLevel *m_level; // rax
int random; // r14d
int seed; // r15d
GameStatsManager *v19; // rdi
bool hasPendingUserCoin; // al
GameStatsManager *v21; // rax
const char *CoinKey; // rbx
GameStatsManager *v23; // rax
GameStatsManager *v24; // rax
GameStatsManager *v25; // rax
bool hasUserCoin; // al
GameStatsManager *v27; // rax
GameStatsManager *v28; // rax
cocos2d::CCArray *v29; // [rsp+8h] [rbp-58h]
_QWORD __dst[2]; // [rsp+10h] [rbp-50h] BYREF
void *__p; // [rsp+20h] [rbp-40h]
unsigned int v32; // [rsp+2Ch] [rbp-34h]
GJBaseGameLayer *v33; // [rsp+30h] [rbp-30h]
v2 = a1;
v3 = cocos2d::CCDictionary::allKeys(a1->m_collectedItems);
if ( (unsigned int)sub_100720070(v3) )
{
v4 = 0;
v33 = a1;
v29 = v3;
do
{
v32 = v4;
v5 = (cocos2d::CCString *)sub_1007200C0(v3, v4);
CString = cocos2d::CCString::getCString(v5);
m_collectedItems = v2->m_collectedItems;
v8 = strlen(CString);
if ( v8 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v9 = v8;
if ( v8 >= 0x17 )
{
v11 = (v8 | 7) + 1;
if ( (v8 | 7) == 0x17 )
v11 = 26;
v10 = (char *)operator new(v11);
__p = v10;
__dst[0] = v11 + 1;
v2 = v33;
__dst[1] = v9;
}
else
{
LOBYTE(__dst[0]) = 2 * v8;
v10 = (char *)__dst + 1;
if ( !v8 )
goto LABEL_12;
}
memmove(v10, CString, v9);
LABEL_12:
v10[v9] = 0;
v12 = (int *)cocos2d::CCDictionary::objectForKey_1(m_collectedItems, __dst);
v13 = v32;
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
v14 = (*(__int64 (__fastcall **)(int *))(*(_QWORD *)v12 + 1784LL))(v12);
if ( v14 == 22 )
{
CoinKey = GJGameLevel::getCoinKey(v2->m_level, v12[448]);
v23 = GameStatsManager::sharedState();
if ( !GameStatsManager::hasSecretCoin(v23, CoinKey) )
{
v24 = GameStatsManager::sharedState();
GameStatsManager::storeSecretCoin(v24, CoinKey);
v25 = GameStatsManager::sharedState();
GameStatsManager::incrementStat_1(v25, "8");
}
}
else if ( v14 == 31 )
{
v15 = GJGameLevel::getCoinKey(v2->m_level, v12[448]);
m_level = v2->m_level;
random = m_level->m_coinsVerified.random;
seed = m_level->m_coinsVerified.seed;
v19 = GameStatsManager::sharedState();
if ( random == seed )
{
hasPendingUserCoin = GameStatsManager::hasPendingUserCoin(v19, v15);
v2 = v33;
if ( !hasPendingUserCoin )
{
v21 = GameStatsManager::sharedState();
GameStatsManager::storePendingUserCoin(v21, v15);
}
}
else
{
hasUserCoin = GameStatsManager::hasUserCoin(v19, v15);
v2 = v33;
if ( !hasUserCoin )
{
v27 = GameStatsManager::sharedState();
GameStatsManager::storeUserCoin(v27, v15);
v28 = GameStatsManager::sharedState();
GameStatsManager::incrementStat_1(v28, "12");
}
}
}
v4 = v13 + 1;
v3 = v29;
}
while ( v4 < (unsigned int)sub_100720070(v29) );
}
}