//
// GameStatsManager::generateItemUnlockableData from 0x10032b7f8 to 0x10032b9d4 (476 bytes)
//
// 1 xrefs:
// > GameStatsManager::init @ 0x1003256a8
//
// 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::generateItemUnlockableData(GameStatsManager *a1)
{
cocos2d::CCDictionary *v2; // x0
__int64 i; // x24
__int64 v4; // x20
int v5; // w25
__int64 v6; // x21
AchievementManager *v7; // x0
unsigned __int64 v8; // x8
GJUnlockableItem *v9; // x22
GameStatsManager *v10; // x0
GJStoreItem *StoreItem; // x23
GJUnlockableItem *v12; // x0
ShopType m_shopType; // w8
unsigned int v14; // w10
unsigned __int32 v15; // w8
__int64 v16; // x1
GameStatsManager *v17; // x0
GameStatsManager *v18; // x0
cocos2d::CCString *SpecialChestKeyForItem; // x0
cocos2d::CCDictionary *m_unlockedItems; // x23
void *__p[2]; // [xsp+0h] [xbp-80h] BYREF
char v22; // [xsp+17h] [xbp-69h]
void *v23[2]; // [xsp+18h] [xbp-68h] BYREF
unsigned __int8 v24; // [xsp+2Fh] [xbp-51h]
if ( !a1->m_unlockedItems )
{
v2 = cocos2d::CCDictionary::create();
a1->m_unlockedItems = v2;
cocos2d::CCObject::retain(v2);
for ( i = 0; i != 15; ++i )
{
v4 = dword_10064538C[i];
v5 = dword_1006453C8[i];
v6 = dword_100645404[i];
do
{
v7 = AchievementManager::sharedState();
AchievementManager::achievementForUnlock((__int64)v7, v6, v4, v23);
v8 = v24;
if ( (v24 & 0x80u) != 0 )
v8 = (unsigned __int64)v23[1];
if ( v8 )
{
v9 = GJUnlockableItem::create();
((void (__fastcall *)(GJUnlockableItem *, __int64))v9->setTag)(v9, 1);
}
else
{
v9 = nullptr;
}
v10 = GameStatsManager::sharedState();
StoreItem = GameStatsManager::getStoreItem(v10, v6, v4);
if ( StoreItem && !v9 )
{
v12 = GJUnlockableItem::create();
v9 = v12;
m_shopType = StoreItem->m_shopType;
v14 = m_shopType - 1;
v15 = m_shopType + 4;
if ( v14 >= 4 )
v16 = 4;
else
v16 = v15;
((void (__fastcall *)(GJUnlockableItem *, __int64))v12->setTag)(v12, v16);
}
v17 = GameStatsManager::sharedState();
if ( GameStatsManager::getSecretChestForItem(v17, v6, (UnlockType)v4) >= 1 && !v9 )
{
v9 = GJUnlockableItem::create();
((void (__fastcall *)(GJUnlockableItem *, __int64))v9->setTag)(v9, 2);
}
v18 = GameStatsManager::sharedState();
SpecialChestKeyForItem = GameStatsManager::getSpecialChestKeyForItem(v18, v6, (UnlockType)v4);
if ( SpecialChestKeyForItem )
{
if ( !v9 )
{
v9 = GJUnlockableItem::create();
SpecialChestKeyForItem = (cocos2d::CCString *)((__int64 (__fastcall *)(GJUnlockableItem *, __int64))v9->setTag)(
v9,
3);
}
}
else if ( !v9 )
{
goto LABEL_24;
}
m_unlockedItems = a1->m_unlockedItems;
GameStatsManager::getItemKey(__p, SpecialChestKeyForItem, v6, v4);
cocos2d::CCDictionary::setObject_1(m_unlockedItems, v9, __p);
if ( v22 < 0 )
operator delete(__p[0]);
LABEL_24:
if ( (char)v24 < 0 )
operator delete(v23[0]);
v6 = (unsigned int)(v6 + 1);
}
while ( v5 != (_DWORD)v6 );
}
}
}