//
// GJGarageLayer::getItems from 0x10036da80 to 0x10036dddb (859 bytes)
//
// 4 xrefs:
// > GJGarageLayer::setupPage @ 0x10036ced5
// > GJGarageLayer::setupSpecialPage @ 0x10036d43c
// > GJGarageLayer::setupSpecialPage @ 0x10036d588
// > GJGarageLayer::getItems_1 @ 0x10036de47
//
// 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
//
// local variable allocation has failed, the output may be wrong!
cocos2d::CCArray *__fastcall GJGarageLayer::getItems(GJGarageLayer *a1, int a2, int a3, IconType a4, int a5)
{
IconType v5; // r14d
GJGarageLayer *v7; // r13
std::__tree_end_node *>::pointer left; // rax
std::__compressed_pair *>> *p_pair1; // r12
std::__compressed_pair *>> *v10; // rbx
std::__compressed_pair *>> *v11; // r13
std::__tree_end_node *> *v12; // rax
GameManager *v13; // rdi
int v14; // r12d
int v15; // eax
__int64 v16; // rcx
unsigned int v17; // r12d
int v18; // eax
GameManager *v19; // rax
bool isIconUnlocked; // r13
GJItemIcon *v21; // rax
GJItemIcon *v22; // r15
int v23; // xmm0_4
GJItemIcon_vtbl *v24; // rax
cocos2d::CCObject_vtbl *v25; // rbx
__int64 v26; // rax
__int64 v27; // rax
cocos2d::CCSprite *v28; // rbx
__int64 v29; // rax
float v31; // [rsp+8h] [rbp-78h] BYREF
cocos2d::CCSprite *v32; // [rsp+10h] [rbp-70h]
__int64 v33; // [rsp+18h] [rbp-68h]
cocos2d::CCArray *v34; // [rsp+20h] [rbp-60h]
float v35; // [rsp+2Ch] [rbp-54h]
int v36; // [rsp+30h] [rbp-50h]
IconType v37; // [rsp+34h] [rbp-4Ch]
GJGarageLayer *v38; // [rsp+38h] [rbp-48h]
UnlockType v39; // [rsp+44h] [rbp-3Ch]
__int64 v40; // [rsp+48h] [rbp-38h]
__int16 v41; // [rsp+50h] [rbp-30h] BYREF
char v42; // [rsp+52h] [rbp-2Eh]
float v43; // [rsp+54h] [rbp-2Ch]
v36 = a5;
v5 = a4;
v40 = *(_QWORD *)&a2;
v7 = a1;
left = a1->m_iconPages.__tree_.__pair1_.__value_.__left_;
v38 = a1;
if ( left )
{
while ( 1 )
{
while ( 1 )
{
v10 = (std::__compressed_pair *>> *)left;
if ( *((_DWORD *)left + 7) <= a4 )
break;
left = *(std::__tree_end_node *>::pointer *)left;
p_pair1 = v10;
if ( !v10->__value_.__left_ )
goto LABEL_8;
}
if ( *((_DWORD *)left + 7) >= a4 )
break;
left = *((std::__tree_end_node *>::pointer *)left + 1);
if ( !left )
{
p_pair1 = v10 + 1;
goto LABEL_8;
}
}
}
else
{
p_pair1 = &a1->m_iconPages.__tree_.__pair1_;
v10 = &a1->m_iconPages.__tree_.__pair1_;
LABEL_8:
v11 = v10;
v10 = (std::__compressed_pair *>> *)operator new(0x28u);
HIDWORD(v10[3].__value_.__left_) = v5;
LODWORD(v10[4].__value_.__left_) = 0;
*(_OWORD *)&v10->__value_.__left_ = 0;
v10[2].__value_.__left_ = (std::__tree_end_node *>::pointer)v11;
v7 = v38;
p_pair1->__value_.__left_ = (std::__tree_end_node *>::pointer)v10;
v12 = (std::__tree_end_node *> *)v7->m_iconPages.__tree_.__begin_node_->__left_;
if ( v12 )
v7->m_iconPages.__tree_.__begin_node_ = v12;
sub_100054DD0((__int64 *)v7->m_iconPages.__tree_.__pair1_.__value_.__left_, (__int64 *)v10);
++v7->m_iconPages.__tree_.__pair3_.__value_;
}
LODWORD(v10[4].__value_.__left_) = a3;
v13 = GameManager::sharedState();
v39 = GameManager::iconTypeToUnlockType(v13, v5);
v34 = (cocos2d::CCArray *)sub_10071F9E0(v13, (unsigned int)v5);
v32 = cocos2d::CCSprite::createWithSpriteFrameName("playerSquare_001.png");
v7->m_currentIcon = nullptr;
v14 = 36 * a3;
v15 = 36 * a3 + 36;
v16 = v40;
if ( v15 < (int)v40 )
v16 = (unsigned int)v15;
v40 = v16;
if ( v14 < (int)v16 )
{
v17 = v14 | 1;
v33 = (unsigned int)(v39 - 1);
v40 = (unsigned int)-(int)v40;
v37 = v5;
do
{
v19 = GameManager::sharedState();
isIconUnlocked = GameManager::isIconUnlocked(v19, v17, v5);
v21 = GJItemIcon::create(
v39,
v17,
(cocos2d::ccColor3B)-5263441,
(cocos2d::ccColor3B)-1,
0,
1,
1,
(cocos2d::ccColor3B)-1);
if ( v21 )
{
v22 = v21;
v23 = 1065353216;
if ( (unsigned int)v33 <= 0xE )
v23 = dword_100819F28[v33];
v24 = v21->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v35 = *(float *)&v23;
((void (__fastcall *)(GJItemIcon *))v24->setScale)(v22);
v25 = (cocos2d::CCObject_vtbl *)CCMenuItemSpriteExtra::create(
v22,
nullptr,
v38,
(cocos2d::SEL_MenuHandler)(unsigned __int64)GJGarageLayer::onSelect);
v26 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))v32->getContentSize)(v32);
(*((void (__fastcall **)(cocos2d::CCObject_vtbl *, __int64))v25->copyWithZone + 38))(v25, v26);
v43 = *(float *)(*((__int64 (__fastcall **)(cocos2d::CCObject_vtbl *))v25->copyWithZone + 39))(v25) * 0.5;
v27 = (*((__int64 (__fastcall **)(cocos2d::CCObject_vtbl *))v25->copyWithZone + 39))(v25);
sub_10028CBE0(&v31, v43, *(float *)(v27 + 4) * 0.5);
((void (__fastcall *)(GJItemIcon *, float *))v22->setPosition)(v22, &v31);
(*((void (__fastcall **)(cocos2d::CCObject_vtbl *, _QWORD))v25->copyWithZone + 9))(v25, v17);
v5 = v37;
LODWORD(v25[6].~CCObject_0) = v37;
sub_10071FCD0(v34, v25);
if ( v36 == v17 )
v38->m_currentIcon = (CCMenuItemSpriteExtra *)v25;
if ( !isIconUnlocked )
{
v43 = 1.0 / v35;
GJItemIcon::darkenStoreItem(v22, (cocos2d::ccColor3B)3289650);
v28 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_lockGray_001.png");
((void (__fastcall *)(GJItemIcon *, cocos2d::CCSprite *, __int64))v22->addChild_0)(v22, v28, 10);
v29 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))v22->m_player->getPosition)(v22->m_player);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v28->setPosition)(v28, v29);
((void (__fastcall *)(cocos2d::CCSprite *, float))v28->setScale)(v28, v43 * 0.80000001);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v28->setOpacity)(v28, 200);
v42 = -81;
v41 = -20561;
((void (__fastcall *)(cocos2d::CCSprite *, __int16 *))v28->setColor)(v28, &v41);
}
}
v18 = v17 + v40 + 1;
++v17;
}
while ( v18 != 1 );
}
return v34;
}