//
// GameStatsManager::generateItemUnlockableData from 0x7bc8c4 to 0x7bcd80 (1212 bytes)
//
// 2 xrefs:
// > GameStatsManager::init @ 0x7c58e4
// > ??> @ 0x73788
//
// 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::generateItemUnlockableData(GameStatsManager *a1)
{
cocos2d::CCDictionary *v2; // x0
UnlockType v3; // w21
int v4; // w28
signed int v5; // w19
AchievementManager *v6; // x0
GJUnlockableItem *v7; // x20
int v8; // w22
GameStatsManager *v9; // x0
GameStatsManager *v10; // x0
GameStatsManager *v11; // x0
cocos2d::CCDictionary *m_unlockedItems; // x22
void *v13; // x0
__int64 v14; // x1
void *v15; // x0
unsigned int *v16; // x1
int v17; // w2
unsigned int *v18; // x1
int v19; // w2
int v20; // [xsp+78h] [xbp+78h]
int v21; // [xsp+7Ch] [xbp+7Ch]
__int64 v22; // [xsp+88h] [xbp+88h] BYREF
unsigned __int64 v23; // [xsp+90h] [xbp+90h] BYREF
if ( a1->m_unlockedItems )
return;
v2 = cocos2d::CCDictionary::create();
a1->m_unlockedItems = v2;
v20 = 0;
v3 = 1;
cocos2d::CCObject::retain(v2);
v4 = 485;
v21 = 1;
while ( 2 )
{
v5 = v21;
do
{
v6 = AchievementManager::sharedState();
AchievementManager::achievementForUnlock((__int64)v6, v5, v3, (__int64)&v22);
if ( *(_QWORD *)(v22 - 24) )
{
v7 = GJUnlockableItem::create();
v7->setTag(v7, 1);
v8 = 1;
}
else
{
v8 = 0;
v7 = nullptr;
}
v9 = GameStatsManager::sharedState();
if ( GameStatsManager::getStoreItem(v9, v5) )
{
++v8;
if ( !v7 )
{
v7 = GJUnlockableItem::create();
((void (*)(void))v7->setTag)();
}
}
v10 = GameStatsManager::sharedState();
if ( GameStatsManager::getSecretChestForItem(v10, v5, v3) > 0 )
{
++v8;
if ( !v7 )
{
v7 = GJUnlockableItem::create();
v7->setTag(v7, 2);
}
}
v11 = GameStatsManager::sharedState();
if ( GameStatsManager::getSpecialChestKeyForItem(v11, v5, v3) )
{
if ( !v7 )
{
v7 = GJUnlockableItem::create();
v7->setTag(v7, 3);
}
}
else
{
if ( !v8 && v21 < v5 )
{
v23 = __PAIR64__(v5, v3);
std::_Rb_tree,std::pair,std::_Identity>,std::less>,std::allocator>>::find(
(__int64)&a1->m_wraithIcons,
(int *)&v23);
}
if ( !v7 )
{
v14 = v22;
v15 = (void *)(v22 - 24);
if ( (__int64 *)(v22 - 24) == &qword_124B6B0 )
goto LABEL_18;
LABEL_28:
if ( &pthread_create )
{
v16 = (unsigned int *)(v14 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(_DWORD *)(v14 - 8);
*(_DWORD *)(v14 - 8) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v15);
goto LABEL_18;
}
}
m_unlockedItems = a1->m_unlockedItems;
GameStatsManager::getItemKey(a1, v5, v3, (__int64)&v23);
cocos2d::CCDictionary::setObject((int)m_unlockedItems, v7);
v13 = (void *)(v23 - 24);
if ( (__int64 *)(v23 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v23 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(v23 - 8);
*(_DWORD *)(v23 - 8) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v13);
}
v14 = v22;
v15 = (void *)(v22 - 24);
if ( (__int64 *)(v22 - 24) != &qword_124B6B0 )
goto LABEL_28;
LABEL_18:
++v5;
}
while ( v5 <= v4 );
if ( ++v20 != 15 )
{
switch ( v20 )
{
case 2:
v3 = 5;
v21 = 1;
v4 = 118;
break;
case 3:
v3 = Bird;
v21 = 1;
v4 = 149;
break;
case 4:
v3 = Dart;
v21 = 1;
v4 = 96;
break;
case 5:
v3 = 8;
v21 = 1;
v4 = 68;
break;
case 6:
v3 = 9;
v21 = 1;
v4 = 69;
break;
case 7:
v3 = Streak;
v21 = 1;
v4 = 7;
break;
case 8:
v3 = Death;
v21 = 1;
v4 = 20;
break;
case 9:
v3 = Col1;
v21 = 0;
v4 = 107;
break;
case 10:
v3 = Col2;
v21 = 0;
v4 = 107;
break;
case 11:
v3 = GJItem|0x1;
v21 = 1;
v4 = 43;
break;
case 12:
v3 = GJItem|Col1;
v21 = 1;
v4 = 8;
break;
case 13:
v3 = GJItem|Col2;
v21 = 1;
v4 = 6;
break;
case 14:
v3 = GJItem;
v21 = 1;
v4 = 20;
break;
default:
v3 = 4;
v21 = 1;
v4 = 169;
break;
}
continue;
}
break;
}
}