//
// GJGarageLayer::setupPage from 0x1003a189c to 0x1003a1e14 (1400 bytes)
//
// 3 xrefs:
// > GJGarageLayer::onArrow @ 0x1003a17ac
// > GJGarageLayer::selectTab @ 0x1003a1880
// > GJGarageLayer::onNavigate @ 0x1003a1e64
//
// This function is hookable on this platform (idp: arm, 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:03:46 +0000
//
void __fastcall GJGarageLayer::setupPage(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v6; // x0
__int64 v7; // x0
__int64 active; // x22
__int64 v9; // x0
__int64 v10; // x21
__int64 v11; // x0
double WinSize; // d0
__int64 Items; // x22
__int64 v14; // x0
_QWORD *v15; // x0
__int64 v16; // x0
__int64 v17; // x22
__int64 v18; // x23
__int64 v19; // x0
void (*v20)(void); // x8
int v21; // w24
void *v22; // x23
void *v23; // x23
__int64 v24; // x0
unsigned int i; // w21
__int64 v26; // x22
__int64 v27; // x22
__int64 v28; // x0
const char *v29; // x1
__int64 v30; // x0
__int64 v31; // x20
_QWORD *v32; // x0
__int64 v33; // x0
int v34; // w0
int v35; // w21
__int64 v36; // x19
__int64 v37; // [xsp+20h] [xbp-90h] BYREF
float32x2_t v38; // [xsp+28h] [xbp-88h] BYREF
void *__p[2]; // [xsp+30h] [xbp-80h] BYREF
char v40; // [xsp+47h] [xbp-69h]
__int64 v41; // [xsp+4Ch] [xbp-64h] BYREF
unsigned int v42; // [xsp+54h] [xbp-5Ch] BYREF
unsigned int *v43; // [xsp+58h] [xbp-58h] BYREF
v42 = a3;
*(_DWORD *)(a1 + 516) = a3;
v6 = (*(__int64 (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 552) + 344LL))(
*(_QWORD *)(a1 + 552),
(_DWORD)a3 == 99);
if ( *(_DWORD *)(a1 + 516) == 99 )
{
GJGarageLayer::setupSpecialPage(a1);
}
else
{
v7 = GameManager::sharedState(v6);
active = GameManager::activeIconForType(v7, a3);
v9 = GameManager::sharedState(active);
v10 = GameManager::countForType(v9, a3);
if ( (_DWORD)a2 == -1 )
a2 = (int)(float)(((int)active - 1) / 36) & (unsigned int)~((int)(float)(((int)active - 1) / 36) >> 31);
v43 = &v42;
*((_DWORD *)sub_1001E71D0(a1 + 520, (int *)&v42, (__int64)&unk_10076DCF5, &v43) + 8) = a2;
v11 = cocos2d::CCDirector::sharedDirector();
WinSize = cocos2d::CCDirector::getWinSize(v11, &v43);
Items = GJGarageLayer::getItems(a1, v10, a2, v42, active, WinSize);
v14 = *(_QWORD *)(a1 + 568);
if ( v14 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v14 + 536LL))(v14);
*(_QWORD *)(a1 + 568) = 0;
}
sub_1000262BC((float *)&v41, *(float *)&v43 * 0.5, (float)((float)(*((float *)&v43 + 1) * 0.5) + -5.0) + -60.0);
v15 = ListButtonBar::create(Items, (double *)&v41, 12, 3, 1, 5.0, 5.0, 25.0, 220.0);
*(_QWORD *)(a1 + 568) = v15;
BoomScrollLayer::togglePageIndicators(v15[40], 0);
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)a1 + 464LL))(a1, *(_QWORD *)(a1 + 568), 100);
v16 = *(_QWORD *)(a1 + 560);
v17 = *(_QWORD *)(a1 + 544);
if ( v16 )
{
v18 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v16 + 512LL))(v16);
v19 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 560) + 192LL))(*(_QWORD *)(a1 + 560));
cocos2d::CCNode::convertToWorldSpace(v18, v19, &v41);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v17 + 184LL))(v17, &v41);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 544) + 344LL))(*(_QWORD *)(a1 + 544), 1);
}
else
{
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)v17 + 344LL))(*(_QWORD *)(a1 + 544), 0);
}
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 576) + 1056LL))(*(_QWORD *)(a1 + 576), (int)v10 > 36);
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 576) + 344LL))(*(_QWORD *)(a1 + 576), (int)v10 > 36);
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 584) + 1056LL))(*(_QWORD *)(a1 + 584), (int)v10 > 36);
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 584) + 344LL))(*(_QWORD *)(a1 + 584), (int)v10 > 36);
v20 = *(void (**)(void))(**(_QWORD **)(a1 + 592) + 1272LL);
if ( (int)v10 < 37 )
{
v20();
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 592) + 344LL))(*(_QWORD *)(a1 + 592), 0);
}
else
{
v20();
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 592) + 344LL))(*(_QWORD *)(a1 + 592), 1);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 592) + 576LL))(*(_QWORD *)(a1 + 592));
v21 = (int)(float)((float)((unsigned int)v10 / 0x24) + 1.0);
while ( (unsigned int)sub_1002E757C(*(_QWORD *)(a1 + 488)) < v21 )
{
v22 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"gj_navDotBtn_on_001.png");
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v22 + 160LL))(v22, 0.9);
v23 = CCMenuItemSpriteExtra::create((__int64)v22, 0, a1, (__int64)GJGarageLayer::onNavigate, 0);
v24 = sub_1002E757C(*(_QWORD *)(a1 + 488));
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v23 + 72LL))(v23, v24);
sub_1002E74E0(*(_QWORD *)(a1 + 488));
CCMenuItemSpriteExtra::setSizeMult((__int64)v23, 1.1);
}
if ( v21 >= 1 )
{
for ( i = 0; i != v21; ++i )
{
v26 = sub_1002E75A0(*(_QWORD *)(a1 + 488), i);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 592) + 456LL))(*(_QWORD *)(a1 + 592), v26);
v27 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v26 + 1072LL))(v26);
v28 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v27);
if ( (_DWORD)a2 == i )
v29 = "gj_navDotBtn_on_001.png";
else
v29 = "gj_navDotBtn_off_001.png";
v30 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v28, v29);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v27 + 1160LL))(v27, v30);
}
}
cocos2d::CCMenu::alignItemsHorizontallyWithPadding(*(_QWORD *)(a1 + 592), 6.0);
}
if ( v42 == 98 )
{
v31 = cocos2d::CCMenu::create();
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 568) + 464LL))(
*(_QWORD *)(a1 + 568),
v31,
1);
sub_1000262BC((float *)&v41, 8.0, 0.0);
v32 = sub_100009900(__p, "Explode");
v33 = GameManager::sharedState(v32);
GameManager::getGameVariable(v33, "0153");
v35 = v34;
sub_1000262BC(
(float *)&v38,
(float)(*(float *)&v43 * 0.5) + -165.0,
(float)((float)((float)(*((float *)&v43 + 1) * 0.5) + -5.0) + -60.0) + -30.0);
v36 = *(_QWORD *)(a1 + 568);
sub_1000262F4(&v37, (double *)&v41);
GameToolbox::createToggleButton(
(__int64 *)__p,
(__int64)sub_1003A259C,
0,
v35 ^ 1u,
v31,
&v38,
v36,
v36,
0.6,
0.5,
80.0,
(float *)&v37,
(__int64)"goldFont.fnt",
0,
0,
0);
if ( v40 < 0 )
operator delete(__p[0]);
}
}
}