//
// GJGarageLayer::getItems from 0x14037f150 to 0x14037f41f (719 bytes)
//
// 3 xrefs:
// > GJGarageLayer::setupPage @ 0x14037eacf
// > GJGarageLayer::getItems_1 @ 0x14037f130
// > ??> @ 0x1409228a4
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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:31:04 +0000
//
// Hidden C++ exception states: #wind=4
__int64 __fastcall GJGarageLayer::getItems(__int64 a1, int a2, int a3, unsigned int a4, int a5)
{
__int64 v8; // rcx
unsigned int v9; // r13d
__int64 v10; // rcx
__int64 v11; // r14
int v12; // ecx
int v13; // r12d
unsigned int v14; // esi
__int64 v15; // rcx
char isIconUnlocked; // r15
__int64 *BrowserItem; // r14
__int64 *v18; // rax
__int64 *v19; // rdi
__int64 v20; // rbx
__int64 v21; // rax
__int64 v22; // rbx
float v23; // xmm6_4
float *v24; // rax
__int64 v25; // rax
cocos2d::CCArray *v26; // rbx
struct cocos2d::CCSprite *v28; // [rsp+30h] [rbp-98h]
void *v29; // [rsp+38h] [rbp-90h]
void *v30; // [rsp+40h] [rbp-88h]
char v31[40]; // [rsp+48h] [rbp-80h] BYREF
void *v32; // [rsp+D0h] [rbp+8h]
cocos2d::CCArray *v33; // [rsp+D0h] [rbp+8h]
unsigned int v34; // [rsp+E8h] [rbp+20h] BYREF
v34 = a4;
*(_DWORD *)sub_14010ECC0((__int64 *)(a1 + 520), (int *)&v34) = a3;
if ( !qword_14090BFD0 )
{
v32 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v32);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
}
v9 = GameManager::iconTypeToUnlockType(v8, v34);
v11 = cocos2d::CCArray::create(v10);
v33 = (cocos2d::CCArray *)v11;
v28 = cocos2d::CCSprite::createWithSpriteFrameName("playerSquare_001.png");
*(_QWORD *)(a1 + 552) = 0;
v12 = 36 * a3;
v13 = 36 * a3 + 36;
if ( a2 < v13 )
v13 = a2;
v14 = v12 + 1;
if ( v12 + 1 <= v13 )
{
while ( 1 )
{
v15 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v29 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v29);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v15 = qword_14090BFD0;
}
isIconUnlocked = GameManager::isIconUnlocked(v15, v14, v34);
BrowserItem = (__int64 *)GJItemIcon::createBrowserItem(v9, v14);
if ( BrowserItem )
break;
v26 = v33;
LABEL_19:
if ( (int)++v14 > v13 )
return (__int64)v26;
}
GJItemIcon::scaleForType(v9);
(*(void (__fastcall **)(__int64 *))(*BrowserItem + 160))(BrowserItem);
v30 = operator new(0x208u);
v18 = (__int64 *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v30);
v19 = v18;
if ( v18 )
{
if ( CCMenuItemSpriteExtra::init(v18, BrowserItem, 0, a1, (__int64)GJGarageLayer::onSelect) )
{
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v19);
LABEL_14:
v20 = *v19;
v21 = (*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v28 + 320LL))(v28);
(*(void (__fastcall **)(__int64 *, __int64))(v20 + 312))(v19, v21);
v22 = *BrowserItem;
v23 = *(float *)((*(__int64 (__fastcall **)(__int64 *))(*v19 + 320))(v19) + 4) * 0.5;
v24 = (float *)(*(__int64 (__fastcall **)(__int64 *))(*v19 + 320))(v19);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v31, *v24 * 0.5, v23);
(*(void (__fastcall **)(__int64 *, __int64))(v22 + 184))(BrowserItem, v25);
(*(void (__fastcall **)(__int64 *, _QWORD))(*v19 + 64))(v19, v14);
*((_DWORD *)v19 + 128) = v34;
v26 = v33;
cocos2d::CCArray::addObject(v33, (struct cocos2d::CCObject *)v19);
if ( v14 == a5 )
*(_QWORD *)(a1 + 552) = v19;
if ( !isIconUnlocked )
GJItemIcon::changeToLockedState(BrowserItem);
goto LABEL_19;
}
(*(void (__fastcall **)(__int64 *, __int64))(*v19 + 8))(v19, 1);
}
v19 = nullptr;
goto LABEL_14;
}
return v11;
}