//
// GameStatsManager::generateItemUnlockableData from 0x52b744 to 0x52b948 (516 bytes)
//
// 1 xrefs:
// > GameStatsManager::init @ 0x52b9aa
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:52:00 +0000
//
cocos2d::CCDictionary *__fastcall GameStatsManager::generateItemUnlockableData(cocos2d::CCDictionary *this)
{
int v1; // r10
cocos2d::CCObject *v2; // r0
int v3; // r11
int v4; // r4
int v5; // r6
int v6; // r5
int i; // r9
int v8; // r0
int *v9; // r0
int v10; // r7
int *v11; // r8
GameStatsManager *v12; // r0
GJUnlockableItem *StoreItem; // r0
int *v14; // r0
int v15; // r2
int v16; // r1
int v17; // r0
GJUnlockableItem *SecretChestForItem; // r0
int v19; // r0
GJUnlockableItem *SpecialChestKeyForItem; // r0
int v21; // [sp+8h] [bp-34h]
int v22; // [sp+8h] [bp-34h]
_DWORD v23[2]; // [sp+14h] [bp-28h] BYREF
int v24[3]; // [sp+1Ch] [bp-20h] BYREF
_BYTE v25[12]; // [sp+28h] [bp-14h] BYREF
v1 = (int)this;
if ( *((_DWORD *)this + 132) )
return this;
v2 = (cocos2d::CCObject *)cocos2d::CCDictionary::create(this);
v3 = 0;
v4 = 1;
v5 = 485;
v6 = 1;
*(_DWORD *)(v1 + 528) = v2;
this = (cocos2d::CCDictionary *)cocos2d::CCObject::retain(v2);
while ( 2 )
{
for ( i = v6; i <= v5; ++i )
{
v8 = AchievementManager::sharedState(this);
v9 = AchievementManager::achievementForUnlock(v24, v8, i, v4);
if ( (v24[0] & 1) != 0 )
v10 = v24[1];
else
v10 = (int)LOBYTE(v24[0]) >> 1;
if ( v10 )
{
v11 = GJUnlockableItem::create((GJUnlockableItem *)v9);
v9 = (int *)(*(int (__fastcall **)(int *, int))(*v11 + 36))(v11, 1);
v10 = 1;
}
else
{
v11 = nullptr;
}
v12 = (GameStatsManager *)GameStatsManager::sharedState((GameStatsManager *)v9);
StoreItem = (GJUnlockableItem *)GameStatsManager::getStoreItem(v12, i, v4);
v21 = (int)StoreItem;
if ( StoreItem )
{
++v10;
if ( !v11 )
{
v14 = GJUnlockableItem::create(StoreItem);
v11 = v14;
v15 = *(_DWORD *)(v21 + 312);
switch ( v15 )
{
case 1:
v16 = 5;
break;
case 2:
v16 = 6;
break;
case 3:
v16 = 7;
break;
case 4:
v16 = 8;
break;
default:
v16 = 4;
break;
}
StoreItem = (GJUnlockableItem *)(*(int (__fastcall **)(int *, int))(*v14 + 36))(v14, v16);
}
}
v17 = GameStatsManager::sharedState(StoreItem);
SecretChestForItem = (GJUnlockableItem *)GameStatsManager::getSecretChestForItem(v17, i, v4);
if ( (int)SecretChestForItem > 0 )
{
++v10;
if ( !v11 )
{
v11 = GJUnlockableItem::create(SecretChestForItem);
SecretChestForItem = (GJUnlockableItem *)(*(int (__fastcall **)(int *, int))(*v11 + 36))(v11, 2);
}
}
v19 = GameStatsManager::sharedState(SecretChestForItem);
SpecialChestKeyForItem = (GJUnlockableItem *)GameStatsManager::getSpecialChestKeyForItem(v19, i, v4);
if ( SpecialChestKeyForItem )
{
if ( !v11 )
{
v11 = GJUnlockableItem::create(SpecialChestKeyForItem);
(*(void (__fastcall **)(int *, int))(*v11 + 36))(v11, 3);
}
LABEL_33:
v22 = *(_DWORD *)(v1 + 528);
GameStatsManager::getItemKey((GameStatsManager *)v25, v1, i, v4);
cocos2d::CCDictionary::setObject(v22, (cocos2d::CCObject *)v11);
std::string::~string((int)v25);
goto LABEL_34;
}
if ( !v10 && i > v6 )
{
v23[0] = v4;
v23[1] = i;
std::__tree>::__count_unique>((_DWORD *)(v1 + 556), v23);
}
if ( v11 )
goto LABEL_33;
LABEL_34:
this = (cocos2d::CCDictionary *)std::string::~string((int)v24);
}
if ( ++v3 != 15 )
{
switch ( v3 )
{
case 2:
v4 = 5;
v6 = 1;
v5 = 118;
continue;
case 3:
v4 = 6;
v6 = 1;
v5 = 149;
continue;
case 4:
v4 = 7;
v6 = 1;
v5 = 96;
continue;
case 5:
v4 = 8;
v6 = 1;
v5 = 68;
continue;
case 6:
v4 = 9;
v6 = 1;
v5 = 69;
continue;
case 7:
v4 = 10;
v6 = 1;
v5 = 7;
continue;
case 8:
v4 = 11;
goto LABEL_51;
case 9:
v4 = 2;
goto LABEL_46;
case 10:
v4 = 3;
LABEL_46:
v6 = 0;
v5 = 107;
break;
case 11:
v4 = 13;
v6 = 1;
v5 = 43;
break;
case 12:
v4 = 14;
v6 = 1;
v5 = 8;
break;
case 13:
v4 = 15;
v6 = 1;
v5 = 6;
break;
case 14:
v4 = 12;
LABEL_51:
v6 = 1;
v5 = 20;
break;
default:
v4 = 4;
v6 = 1;
v5 = 169;
break;
}
continue;
}
return this;
}
}