//
// GJGarageLayer::getItems from 0x100305660 to 0x10030588c (556 bytes)
//
// 2 xrefs:
// > GJGarageLayer::setupPage @ 0x100304ca0
// > GJGarageLayer::getItems_1 @ 0x1003058fc
//
// 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
//
cocos2d::CCArray *__fastcall GJGarageLayer::getItems(GJGarageLayer *a1, int a2, int a3, IconType a4, int a5)
{
GameManager *v9; // x0
UnlockType v10; // w21
cocos2d::CCArray *v11; // x22
cocos2d::CCSprite *v12; // x0
int v13; // w8
int v14; // w9
cocos2d::CCSprite *v15; // x23
__int64 v16; // x24
int v17; // w25
GameManager *v18; // x0
bool isIconUnlocked; // w26
GJItemIcon *v20; // x0
GJItemIcon *v21; // x27
float v22; // s8
CCMenuItemSpriteExtra *v23; // x28
__int64 v24; // x0
float v25; // s9
__n128 v26; // q1
__n128 v27; // q0
IconType v29; // [xsp+0h] [xbp-80h] BYREF
IconType *v30; // [xsp+8h] [xbp-78h] BYREF
cocos2d::SEL_MenuHandler v31; // 0:x3.16
v29 = a4;
v30 = &v29;
*((_DWORD *)sub_1001A6048((__int64)&a1->m_iconPages, (int *)&v29, (__int64)&unk_100644D9D, (unsigned int **)&v30) + 8) = a3;
v9 = GameManager::sharedState();
v10 = GameManager::iconTypeToUnlockType(v9, v29);
v11 = (cocos2d::CCArray *)sub_10024A15C();
v12 = cocos2d::CCSprite::createWithSpriteFrameName("playerSquare_001.png");
a1->m_currentIcon = nullptr;
v13 = 36 * a3;
v14 = 36 * a3 + 36;
if ( v14 >= a2 )
v14 = a2;
if ( v14 > 36 * a3 )
{
v15 = v12;
v16 = v13 | 1u;
v17 = v14 - v13;
do
{
v18 = GameManager::sharedState();
isIconUnlocked = GameManager::isIconUnlocked(v18, v16, v29);
v20 = GJItemIcon::create(
v10,
v16,
(cocos2d::ccColor3B)-5263441,
(cocos2d::ccColor3B)-1,
0,
1,
1,
(cocos2d::ccColor3B)-1);
if ( v20 )
{
v21 = v20;
v22 = GJItemIcon::scaleForType(v10);
((void (__fastcall *)(GJItemIcon *))v21->setScale)(v21);
v31.ptr = (void (__cdecl *)(cocos2d::CCObject *))GJGarageLayer::onSelect;
v31.adj = 0;
v23 = CCMenuItemSpriteExtra::create(v21, nullptr, a1, v31);
v24 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))v15->getContentSize)(v15);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v23->setContentSize)(v23, v24);
v25 = *(float *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v23->getContentSize)(v23) * 0.5;
v26.n128_f32[0] = *(float *)(((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v23->getContentSize)(v23) + 4)
* 0.5;
v27.n128_f32[0] = v25;
sub_100022980(v27, v26, &v30);
((void (__fastcall *)(GJItemIcon *, IconType **))v21->setPosition)(v21, &v30);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v23->setTag)(v23, v16);
v23->m_iconType = v29;
sub_10024A2D0((__int64)v11);
if ( a5 == (_DWORD)v16 )
a1->m_currentIcon = v23;
if ( !isIconUnlocked )
GJItemIcon::changeToLockedState(v21, 1.0 / v22);
}
v16 = (unsigned int)(v16 + 1);
--v17;
}
while ( v17 );
}
return v11;
}