//
// GJGarageLayer::setupSpecialPage from 0x140276ac0 to 0x140277165 (1701 bytes)
//
// 2 xrefs:
// > GJGarageLayer::setupPage @ 0x1402760ee
// > ??> @ 0x1406d0f98
//
// 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
//
// Hidden C++ exception states: #wind=5
void GJGarageLayer::setupSpecialPage(GJGarageLayer *a1)
{
float v1; // xmm0_4
cocos2d::CCDirector *v3; // rax
ListButtonBar *m_iconSelection; // rcx
cocos2d::CCArray *Items_1; // rbx
cocos2d::CCPoint v6; // rax
ListButtonBar *v7; // rax
bool v8; // dl
CCMenuItemSpriteExtra *m_currentIcon; // rcx
cocos2d::CCSprite_vtbl *v10; // rsi
CCMenuItemSpriteExtra *v11; // rdi
cocos2d::CCNode *v12; // rax
struct cocos2d::CCPoint v13; // rax
_BOOL8 v14; // rdx
cocos2d::CCArray *v15; // rbx
cocos2d::CCPoint v16; // rax
ListButtonBar *v17; // rbx
bool v18; // dl
CCMenuItemSpriteExtra *v19; // rcx
cocos2d::CCSprite_vtbl *v20; // rsi
CCMenuItemSpriteExtra *v21; // rdi
cocos2d::CCNode *v22; // rax
struct cocos2d::CCPoint v23; // rax
_BOOL8 v24; // rdx
struct cocos2d::CCMenu *v25; // rbx
int v26; // r14d
GameManager *v27; // rcx
bool isIconUnlocked; // r12
GameStatsManager *v29; // rcx
int ItemUnlockState; // r13d
GameStatsManager *v31; // rcx
GJItemIcon *BrowserItem; // rsi
__int64 v33; // rbx
__int64 v34; // rcx
bool v35; // bl
cocos2d::CCString *v36; // rax
float v37; // xmm0_4
float v38; // xmm7_4
CCMenuItemSpriteExtra *v39; // rax
cocos2d::CCObject *v40; // rdi
cocos2d::CCObject_vtbl *v41; // rbx
__int64 v42; // rax
GJItemIcon_vtbl *v43; // rbx
float *v44; // rax
const cocos2d::CCPoint *v45; // rax
float v46; // xmm0_4
int v47; // [rsp+48h] [rbp-C0h]
int v48; // [rsp+48h] [rbp-C0h]
cocos2d::ccColor3B v49[5]; // [rsp+68h] [rbp-A0h] BYREF
float v50; // [rsp+78h] [rbp-90h]
float v51; // [rsp+7Ch] [rbp-8Ch]
struct cocos2d::CCPoint v52; // [rsp+80h] [rbp-88h] BYREF
int v53; // [rsp+88h] [rbp-80h]
struct cocos2d::CCSprite *v54; // [rsp+98h] [rbp-70h]
struct cocos2d::CCMenu *v55; // [rsp+A0h] [rbp-68h]
struct cocos2d::CCPoint v56; // [rsp+A8h] [rbp-60h] BYREF
void *v57; // [rsp+B0h] [rbp-58h]
void *v58; // [rsp+B8h] [rbp-50h]
void *v59; // [rsp+C0h] [rbp-48h]
CCMenuItemSpriteExtra *v60; // [rsp+C8h] [rbp-40h]
_QWORD v61[4]; // [rsp+E0h] [rbp-28h] BYREF
v3 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v3);
m_iconSelection = a1->m_iconSelection;
if ( m_iconSelection )
{
m_iconSelection->removeMeAndCleanup(m_iconSelection);
a1->m_iconSelection = nullptr;
}
Items_1 = GJGarageLayer::getItems_1(a1, Special);
cocos2d::CCPoint::CCPoint(v1, v50 * 0.5);
v7 = ListButtonBar::create(Items_1, v6, 12, 3, 5.0, 5.0, 25.0, 220.0, v47);
a1->m_iconSelection = v7;
BoomScrollLayer::togglePageIndicators(v7->m_scrollLayer, v8);
a1->addChild_0(a1, a1->m_iconSelection, 100);
m_currentIcon = a1->m_currentIcon;
v10 = a1->m_cursor1->__vftable;
if ( m_currentIcon )
{
v11 = a1->m_currentIcon;
m_currentIcon->getPosition_0(m_currentIcon);
v12 = v11->getParent(v11);
v13 = cocos2d::CCNode::convertToWorldSpace(v12, &v52);
((void (__fastcall *)(cocos2d::CCSprite *, struct cocos2d::CCPoint))v10->setPosition_0)(a1->m_cursor1, v13);
LOBYTE(v14) = 1;
a1->m_cursor1->setVisible(a1->m_cursor1, v14);
}
else
{
v10->setVisible(a1->m_cursor1, 0);
}
v15 = GJGarageLayer::getItems_1(a1, ShipFire);
cocos2d::CCPoint::CCPoint(
COERCE_FLOAT(COERCE_UNSIGNED_INT64((float)((float)((float)(v51 * 0.5) - 5.0) - 60.0) - 30.0)),
v50 * 0.5);
v17 = ListButtonBar::create(v15, v16, 12, 3, 5.0, 5.0, 25.0, 220.0, v48);
BoomScrollLayer::togglePageIndicators(v17->m_scrollLayer, v18);
a1->m_iconSelection->addChild_0(a1->m_iconSelection, v17, 100);
v19 = a1->m_currentIcon;
v20 = a1->m_cursor2->__vftable;
if ( v19 )
{
v21 = a1->m_currentIcon;
v19->getPosition_0(v19);
v22 = v21->getParent(v21);
v23 = cocos2d::CCNode::convertToWorldSpace(v22, &v52);
((void (__fastcall *)(cocos2d::CCSprite *, struct cocos2d::CCPoint))v20->setPosition_0)(a1->m_cursor2, v23);
LOBYTE(v24) = 1;
a1->m_cursor2->setVisible(a1->m_cursor2, v24);
}
else
{
v20->setVisible(a1->m_cursor2, 0);
}
v25 = cocos2d::CCMenu::create(nullptr);
v55 = v25;
a1->m_iconSelection->addChild_0(a1->m_iconSelection, v25, 1000);
cocos2d::CCPoint::CCPoint(
COERCE_FLOAT(COERCE_UNSIGNED_INT64((float)((float)((float)(v51 * 0.5) - 5.0) - 60.0) - 30.0)),
(float)((float)(v50 * 0.5) - 137.5) - 27.5);
cocos2d::CCNode::convertToWorldSpace(a1->m_iconSelection, &v52);
cocos2d::CCNode::convertToNodeSpace(v25, &v56);
v54 = cocos2d::CCSprite::createWithSpriteFrameName("playerSquare_001.png");
v26 = 18;
v53 = 0;
do
{
v27 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v57 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v57);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v27 = (GameManager *)qword_1406C2ED8;
}
isIconUnlocked = GameManager::isIconUnlocked(v27, v26, Item);
v29 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v58 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v58);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v29 = (GameStatsManager *)qword_1406C2EE8;
}
ItemUnlockState = GameStatsManager::getItemUnlockState(v29, v26, GJItem);
BrowserItem = GJItemIcon::createBrowserItem(GJItem, v26);
if ( isIconUnlocked )
{
v33 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v59 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v59);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v33 = qword_1406C2EE8;
}
if ( GameStatsManager::isItemUnlocked(v31, GJItem, v26) )
{
GameStatsManager::getItemKey(v34, v61, v26, 0xCu);
v36 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v33 + 888), v61);
v35 = cocos2d::CCString::boolValue(v36);
sub_14003A830((__int64)v61);
}
else
{
v35 = 0;
}
GJItemIcon::toggleEnabledState(BrowserItem, v35);
}
if ( BrowserItem )
{
v37 = GJItemIcon::scaleForType(GJItem);
v38 = v37;
((void (__fastcall *)(GJItemIcon *))BrowserItem->setScale_0)(BrowserItem);
v60 = (CCMenuItemSpriteExtra *)operator new(0x208u);
v39 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v60);
v40 = v39;
if ( v39 )
{
if ( CCMenuItemSpriteExtra::init(
v39,
BrowserItem,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)GJGarageLayer::onToggleItem) )
{
cocos2d::CCObject::autorelease(v40);
goto LABEL_27;
}
((void (__fastcall *)(cocos2d::CCObject *, __int64))v40->~CCObject)(v40, 1);
}
v40 = nullptr;
LABEL_27:
v41 = v40->__vftable;
v42 = (__int64)v54->getContentSize(v54);
((void (__fastcall *)(cocos2d::CCObject *, __int64))v41[4].~CCObject)(v40, v42);
v43 = BrowserItem->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
((__int64 (__fastcall *)(cocos2d::CCObject *))v40->__vftable[4].isEqual)(v40);
v44 = (float *)((__int64 (__fastcall *)(cocos2d::CCObject *))v40->__vftable[4].isEqual)(v40);
cocos2d::CCPoint::CCPoint(v37, *v44 * 0.5);
v43->setPosition_0(BrowserItem, v45);
v40->setTag(v40, v26);
v40[9].m_uID = 100;
v46 = ((float (__fastcall *)(struct cocos2d::CCMenu *, cocos2d::CCObject *))v55->addChild_1)(v55, v40);
LODWORD(v43) = v53;
cocos2d::CCPoint::CCPoint(v46, (float)v53);
cocos2d::CCPoint::operator+(&v56, &v52);
v40->__vftable[2].encodeWithCoder(v40, (DS_Dictionary *)&v52);
v53 = (_DWORD)v43 + 30;
if ( !isIconUnlocked )
{
if ( ItemUnlockState )
{
GJItemIcon::changeToLockedState(BrowserItem, 1.0 / v38);
}
else
{
memset(v49, 50, 3);
GJItemIcon::darkenStoreItem(BrowserItem, v49);
}
}
}
++v26;
}
while ( v26 <= 20 );
}