//
// GJGarageLayer::setupSpecialPage from 0x10036d3c0 to 0x10036da77 (1719 bytes)
//
// 1 xrefs:
// > GJGarageLayer::setupPage @ 0x10036cd99
//
// 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
//
void __fastcall GJGarageLayer::setupSpecialPage(GJGarageLayer *a1)
{
cocos2d::CCDirector *v2; // rsi
ListButtonBar *m_iconSelection; // rdi
GameManager *v4; // rax
int v5; // ebx
GameManager *v6; // rax
int active; // eax
cocos2d::CCArray *Items; // rbx
float v9; // xmm4_4
ListButtonBar *v10; // rax
cocos2d::CCSprite *m_cursor1; // rbx
CCMenuItemSpriteExtra *m_currentIcon; // rdi
const cocos2d::CCPoint *v13; // r14
cocos2d::CCSprite *v14; // rdi
cocos2d::CCSprite_vtbl *v15; // rax
__int64 v16; // rsi
GameManager *v17; // rax
int v18; // ebx
GameManager *v19; // rax
int v20; // eax
cocos2d::CCArray *v21; // rbx
float v22; // xmm4_4
ListButtonBar *v23; // rbx
cocos2d::CCSprite *m_cursor2; // rbx
CCMenuItemSpriteExtra *v25; // rdi
const cocos2d::CCPoint *v26; // r14
cocos2d::CCSprite *v27; // rdi
cocos2d::CCSprite_vtbl *v28; // rax
__int64 v29; // rsi
int v30; // edx
int v31; // ecx
int v32; // r8d
int v33; // r9d
const cocos2d::CCPoint *v34; // r14
unsigned int i; // r12d
GameManager *v36; // rax
bool isIconUnlocked; // r14
GameStatsManager *v38; // rax
GJItemIcon *v39; // rbx
GameStatsManager *v40; // rax
bool isItemEnabled; // al
cocos2d::CCSprite *m_player; // r15
__int64 v43; // rax
__int64 v44; // r15
unsigned int v45; // r13d
__int64 v46; // rax
CCMenuItemSpriteExtra *v47; // r15
__int64 v48; // rax
float v49; // xmm1_4
CCMenuItemSpriteExtra_vtbl *v50; // rax
int v51; // r13d
cocos2d::CCSprite *v52; // r14
__int64 v53; // rax
unsigned __int64 v54; // [rsp+0h] [rbp-80h] BYREF
unsigned __int64 v55; // [rsp+8h] [rbp-78h] BYREF
GJGarageLayer *v56; // [rsp+10h] [rbp-70h]
const cocos2d::CCPoint *v57; // [rsp+18h] [rbp-68h]
cocos2d::CCSprite *v58; // [rsp+20h] [rbp-60h]
__int64 v59; // [rsp+28h] [rbp-58h]
int ItemUnlockState; // [rsp+34h] [rbp-4Ch]
float v61; // [rsp+38h] [rbp-48h] BYREF
float v62; // [rsp+40h] [rbp-40h] BYREF
float v63; // [rsp+44h] [rbp-3Ch]
double v64; // [rsp+48h] [rbp-38h] BYREF
float v65; // [rsp+50h] [rbp-30h]
bool v66; // [rsp+57h] [rbp-29h]
double v67; // 0:xmm0_8.8
double v68; // 0:xmm0_8.8
double v69; // 0:xmm0_8.8
cocos2d::CCPoint v70; // 0:xmm0_8.8
v2 = cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v67 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v62);
m_iconSelection = a1->m_iconSelection;
if ( m_iconSelection )
{
((void (__fastcall *)(ListButtonBar *, cocos2d::CCDirector *, double))m_iconSelection->removeMeAndCleanup)(
m_iconSelection,
v2,
v67);
a1->m_iconSelection = nullptr;
}
v4 = GameManager::sharedState();
v5 = GameManager::countForType(v4, Special);
v6 = GameManager::sharedState();
active = GameManager::activeIconForType(v6, Special);
Items = GJGarageLayer::getItems(a1, v5, 0, Special, active);
sub_10028CBE0(&v61, v62 * 0.5, (float)((float)(v63 * 0.5) + -5.0) + -60.0);
v10 = ListButtonBar::create(Items, (cocos2d::CCPoint)1084227584LL, (int)&v61, 12, 5.0, 25.0, 220.0, v9, 3);
a1->m_iconSelection = v10;
BoomScrollLayer::togglePageIndicators(v10->m_scrollLayer, 0);
((void (__fastcall *)(GJGarageLayer *, ListButtonBar *, __int64))a1->addChild_0)(a1, a1->m_iconSelection, 100);
m_cursor1 = a1->m_cursor1;
m_currentIcon = a1->m_currentIcon;
if ( m_currentIcon )
{
v13 = (const cocos2d::CCPoint *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))m_currentIcon->getParent)(m_currentIcon);
((void (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_currentIcon->getPosition)(a1->m_currentIcon);
*(cocos2d::CCPoint *)&v68 = cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v61, v13);
((void (__fastcall *)(cocos2d::CCSprite *, float *, double))m_cursor1->setPosition)(m_cursor1, &v61, v68);
v14 = a1->m_cursor1;
v15 = v14->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v16 = 1;
}
else
{
v15 = m_cursor1->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v14 = a1->m_cursor1;
v16 = 0;
}
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v15->setVisible)(v14, v16);
v17 = GameManager::sharedState();
v18 = GameManager::countForType(v17, ShipFire);
v19 = GameManager::sharedState();
v20 = GameManager::activeIconForType(v19, ShipFire);
v21 = GJGarageLayer::getItems(a1, v18, 0, ShipFire, v20);
sub_10028CBE0(&v61, v62 * 0.5, (float)((float)((float)(v63 * 0.5) + -5.0) + -60.0) + -30.0);
v23 = ListButtonBar::create(v21, (cocos2d::CCPoint)1084227584LL, (int)&v61, 12, 5.0, 25.0, 220.0, v22, 3);
BoomScrollLayer::togglePageIndicators(v23->m_scrollLayer, 0);
((void (__fastcall *)(ListButtonBar *, ListButtonBar *, __int64))a1->m_iconSelection->addChild_0)(
a1->m_iconSelection,
v23,
100);
m_cursor2 = a1->m_cursor2;
v25 = a1->m_currentIcon;
if ( v25 )
{
v26 = (const cocos2d::CCPoint *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v25->getParent)(v25);
((void (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_currentIcon->getPosition)(a1->m_currentIcon);
*(cocos2d::CCPoint *)&v69 = cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v61, v26);
((void (__fastcall *)(cocos2d::CCSprite *, float *, double))m_cursor2->setPosition)(m_cursor2, &v61, v69);
v27 = a1->m_cursor2;
v28 = v27->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v29 = 1;
}
else
{
v28 = m_cursor2->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v27 = a1->m_cursor2;
v29 = 0;
}
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v28->setVisible)(v27, v29);
v59 = 0;
v34 = (const cocos2d::CCPoint *)sub_100792C50(0, v29, v30, v31, v32, v33);
((void (__fastcall *)(ListButtonBar *, const cocos2d::CCPoint *, __int64))a1->m_iconSelection->addChild_0)(
a1->m_iconSelection,
v34,
1000);
sub_10028CBE0(
&v61,
(float)((float)(v62 * 0.5) + -137.5) + -27.5,
(float)((float)((float)(v63 * 0.5) + -5.0) + -60.0) + -30.0);
v56 = a1;
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v64, (const cocos2d::CCPoint *)a1->m_iconSelection);
v57 = v34;
v70 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v55, v34);
v58 = cocos2d::CCSprite::createWithSpriteFrameName("playerSquare_001.png");
for ( i = 18; i != 21; ++i )
{
v36 = GameManager::sharedState();
isIconUnlocked = GameManager::isIconUnlocked(v36, i, Item);
v38 = GameStatsManager::sharedState();
ItemUnlockState = GameStatsManager::getItemUnlockState(v38, i, GJItem);
v39 = GJItemIcon::create(
GJItem,
i,
(cocos2d::ccColor3B)-5263441,
(cocos2d::ccColor3B)-1,
0,
1,
1,
(cocos2d::ccColor3B)-1);
if ( !isIconUnlocked )
goto LABEL_21;
v40 = GameStatsManager::sharedState();
isItemEnabled = GameStatsManager::isItemEnabled(v40, GJItem, i);
if ( !v39->m_isIcon )
{
if ( isItemEnabled )
{
BYTE2(v64) = -1;
LOWORD(v64) = -1;
}
else
{
memset(&v64, 100, 3);
}
m_player = v39->m_player;
((void (__fastcall *)(cocos2d::CCSprite *, double *, double))m_player->setColor)(m_player, &v64, *(double *)&v70);
v43 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))m_player->getChildren)(m_player);
if ( v43 )
{
v44 = v43;
if ( (unsigned int)sub_100720070(v43) )
{
v45 = 0;
do
{
v46 = sub_1007200C0(v44, v45);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v46 + 328LL))(v46, 1);
++v45;
}
while ( v45 < (unsigned int)sub_100720070(v44) );
LABEL_21:
if ( !v39 )
continue;
}
}
}
((void (__fastcall *)(GJItemIcon *, float))v39->setScale)(v39, 0.80000001);
v47 = CCMenuItemSpriteExtra::create(
v39,
nullptr,
v56,
(cocos2d::SEL_MenuHandler)(unsigned __int64)GJGarageLayer::onToggleItem);
v48 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))v58->getContentSize)(v58);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v47->setContentSize)(v47, v48);
v65 = *(float *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v47->getContentSize)(v47) * 0.5;
v49 = *(float *)(((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v47->getContentSize)(v47) + 4) * 0.5;
v66 = isIconUnlocked;
sub_10028CBE0((float *)&v64, v65, v49);
((void (__fastcall *)(GJItemIcon *, double *))v39->setPosition)(v39, &v64);
v50 = v47->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v65 = *(float *)&i;
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v50->setTag)(v47, i);
v47->m_iconType = Item;
(*(void (__fastcall **)(const cocos2d::CCPoint *, CCMenuItemSpriteExtra *))(*(_QWORD *)v57 + 440LL))(v57, v47);
v51 = v59;
v70.y = 0.0;
v70.x = (float)(30 * v59);
sub_10028CBE0((float *)&v54, v70.x, 0.0);
sub_10028CCE0(&v64, &v55, &v54);
((void (__fastcall *)(CCMenuItemSpriteExtra *, double *))v47->setPosition)(v47, &v64);
v59 = (unsigned int)(v51 + 1);
if ( !v66 )
{
GJItemIcon::darkenStoreItem(v39, (cocos2d::ccColor3B)3289650);
if ( ItemUnlockState )
{
v52 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_lockGray_001.png");
((void (__fastcall *)(GJItemIcon *, cocos2d::CCSprite *, __int64))v39->addChild_0)(v39, v52, 10);
v53 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))v39->m_player->getPosition)(v39->m_player);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v52->setPosition)(v52, v53);
v70 = (cocos2d::CCPoint)1065353216LL;
((void (__fastcall *)(cocos2d::CCSprite *, float))v52->setScale)(v52, 1.0);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v52->setOpacity)(v52, 200);
BYTE2(v64) = -81;
LOWORD(v64) = -20561;
((void (__fastcall *)(cocos2d::CCSprite *, double *))v52->setColor)(v52, &v64);
}
}
*(float *)&i = v65;
}
}