//
// GJGarageLayer::setupPage from 0x8c052c to 0x8c0b60 (1588 bytes)
//
// 4 xrefs:
// > GJGarageLayer::onArrow @ 0x8c0c34
// > GJGarageLayer::onNavigate @ 0x8c0ca4
// > GJGarageLayer::selectTab @ 0x8c0d70
// > ??> @ 0x87460
//
// 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 12:56:30 +0000
//
__int64 __fastcall GJGarageLayer::setupPage(__int64 a1, int a2, unsigned int a3)
{
bool v3; // zf
__int64 v6; // x2
__int64 v8; // x1
GameManager *v9; // x0
_DWORD *v10; // x0
GameManager *active; // x0
unsigned int v12; // w21
__int64 v13; // x0
int v14; // w20
cocos2d::CCDirector *v15; // x0
cocos2d::CCDirector *v16; // x0
cocos2d::CCArray *Items; // x21
__int64 v18; // x0
__int64 v19; // x0
__int64 v20; // x1
__int64 v21; // x21
void (__fastcall *v22)(__int64, unsigned int **); // x22
cocos2d::CCNode *v23; // x25
const cocos2d::CCPoint *v24; // x0
__int64 v25; // x2
cocos2d::CCMenu *v26; // x0
int v28; // w22
__int64 v29; // x20
cocos2d::CCObject *v30; // x20
void (__fastcall *v31)(cocos2d::CCObject *, _QWORD); // x28
unsigned int v32; // w0
const char *v33; // x1
unsigned int v34; // w20
__int64 v35; // x21
cocos2d::CCSpriteFrameCache **v36; // x21
void (__fastcall *v37)(cocos2d::CCSpriteFrameCache **, __int64); // x28
cocos2d::CCSpriteFrameCache *v38; // x0
__int64 v39; // x0
cocos2d::CCNode *v40; // x22
GameManager *v41; // x0
GameManager *v42; // x0
unsigned __int8 v43; // w20
__int64 v44; // x19
unsigned int v45; // [xsp+BCh] [xbp+8Ch] BYREF
cocos2d::CCMenu *v46; // [xsp+C0h] [xbp+90h] BYREF
_BYTE v47[8]; // [xsp+C8h] [xbp+98h] BYREF
_BYTE v48[8]; // [xsp+D0h] [xbp+A0h] BYREF
unsigned int *v49; // [xsp+D8h] [xbp+A8h] BYREF
__int64 v50[2]; // [xsp+E0h] [xbp+B0h] BYREF
void *v51; // [xsp+F0h] [xbp+C0h]
v3 = a3 == 99;
v45 = a3;
v6 = *(_QWORD *)(a1 + 552);
v8 = v3;
*(_DWORD *)(a1 + 516) = a3;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v6 + 344LL))(v6, v8);
v9 = (GameManager *)*(unsigned int *)(a1 + 516);
if ( (_DWORD)v9 == 99 )
{
GJGarageLayer::setupSpecialPage((GJGarageLayer *)a1);
return _stack_chk_guard;
}
v10 = (_DWORD *)GameManager::sharedState(v9);
active = (GameManager *)GameManager::activeIconForType(v10, v45);
v12 = (unsigned int)active;
v13 = GameManager::sharedState(active);
v14 = GameManager::countForType(v13, v45);
if ( a2 == -1 )
{
a2 = vcvtms_s32_f32((float)((int)(v12 - 1) / 36));
if ( a2 < 0 )
a2 = 0;
}
v49 = &v45;
v15 = (cocos2d::CCDirector *)std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::__emplace_unique_key_args,std::tuple<>>(
(__int64 **)(a1 + 520),
(int *)&v45,
(__int64)&unk_114CA08,
&v49);
*((_DWORD *)v15 + 8) = a2;
v16 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v15);
cocos2d::CCDirector::getWinSize(&v46, v16);
Items = GJGarageLayer::getItems(a1, v14, a2, v45, v12);
v18 = *(_QWORD *)(a1 + 568);
if ( v18 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v18 + 536LL))(v18);
*(_QWORD *)(a1 + 568) = 0;
}
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v49,
*(float *)&v46 * 0.5,
(float)((float)(*((float *)&v46 + 1) * 0.5) + -5.0) - 60.0);
v19 = ListButtonBar::create(Items, (const cocos2d::CCPoint *)&v49, 12, 3, 1u, 5.0, 5.0, 25.0, 220.0);
*(_QWORD *)(a1 + 568) = v19;
BoomScrollLayer::togglePageIndicators(*(BoomScrollLayer **)(v19 + 320), 0);
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)a1 + 464LL))(a1, *(_QWORD *)(a1 + 568), 100);
v20 = *(_QWORD *)(a1 + 560);
if ( v20 )
{
v21 = *(_QWORD *)(a1 + 544);
v22 = *(void (__fastcall **)(__int64, unsigned int **))(*(_QWORD *)v21 + 184LL);
v23 = (cocos2d::CCNode *)(*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)v20 + 512LL))(*(_QWORD *)(a1 + 560));
v24 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 560) + 192LL))(*(_QWORD *)(a1 + 560));
cocos2d::CCNode::convertToWorldSpace((__int64 *)&v49, v23, v24);
v22(v21, &v49);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 544) + 344LL))(*(_QWORD *)(a1 + 544), 1);
}
else
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 544) + 344LL))(*(_QWORD *)(a1 + 544), 0);
}
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 576) + 1056LL))(*(_QWORD *)(a1 + 576), v14 > 36);
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 576) + 344LL))(*(_QWORD *)(a1 + 576), v14 > 36);
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 584) + 1056LL))(*(_QWORD *)(a1 + 584), v14 > 36);
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 584) + 344LL))(*(_QWORD *)(a1 + 584), v14 > 36);
v25 = *(_QWORD *)(a1 + 592);
if ( v14 <= 36 )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)v25 + 1272LL))(*(_QWORD *)(a1 + 592), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 592) + 344LL))(*(_QWORD *)(a1 + 592), 0);
v26 = (cocos2d::CCMenu *)v45;
if ( v45 != 98 )
return _stack_chk_guard;
goto LABEL_21;
}
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)v25 + 1272LL))(*(_QWORD *)(a1 + 592), 1);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 592) + 344LL))(*(_QWORD *)(a1 + 592), 1);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 592) + 576LL))(*(_QWORD *)(a1 + 592));
v28 = (int)(float)(floorf((float)(v14 / 36)) + 1.0);
while ( (unsigned int)cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 488)) < v28 )
{
v29 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"gj_navDotBtn_on_001.png", v33);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v29 + 160LL))(v29, 0.9);
v30 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(v29, 0, a1, (__int64)GJGarageLayer::onNavigate, 0);
v31 = *(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v30 + 72LL);
v32 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 488));
v31(v30, v32);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 488), v30);
CCMenuItemSpriteExtra::setSizeMult((__int64)v30, 1.1);
}
v34 = 0;
if ( v28 > 0 )
{
do
{
v35 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 488), v34);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 592) + 456LL))(*(_QWORD *)(a1 + 592), v35);
v36 = (cocos2d::CCSpriteFrameCache **)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v35 + 1072LL))(v35);
v37 = *((void (__fastcall **)(cocos2d::CCSpriteFrameCache **, __int64))*v36 + 145);
v38 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(*v36);
if ( v34 == a2 )
v39 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v38, "gj_navDotBtn_on_001.png");
else
v39 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v38, "gj_navDotBtn_off_001.png");
v37(v36, v39);
++v34;
}
while ( v34 != v28 );
}
cocos2d::CCMenu::alignItemsHorizontallyWithPadding(*(cocos2d::CCMenu **)(a1 + 592), 6.0);
v26 = (cocos2d::CCMenu *)v45;
if ( v45 == 98 )
{
LABEL_21:
v40 = (cocos2d::CCNode *)cocos2d::CCMenu::create(v26);
(*(void (__fastcall **)(_QWORD, cocos2d::CCNode *, __int64))(**(_QWORD **)(a1 + 568) + 464LL))(
*(_QWORD *)(a1 + 568),
v40,
1);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v47, 8.0, 0.0);
v50[0] = 0;
v50[1] = 0;
v51 = nullptr;
v41 = (GameManager *)std::string::__init(v50, "Explode", 7u);
v42 = (GameManager *)GameManager::sharedState(v41);
v43 = GameManager::getGameVariable(v42, "0153") ^ 1;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v48,
(float)(*(float *)&v46 * 0.5) + -165.0,
(float)((float)((float)(*((float *)&v46 + 1) * 0.5) + -5.0) - 60.0) - 30.0);
v44 = *(_QWORD *)(a1 + 568);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, (const cocos2d::CCPoint *)v47);
GameToolbox::createToggleButton(
(__int64)v50,
(const char *)GJGarageLayer::onSpecial,
0,
v43,
v40,
(const cocos2d::CCPoint *)v48,
v44,
v44,
0.6,
0.5,
80.0,
(float *)&v49,
"goldFont.fnt",
0,
0,
nullptr);
if ( (v50[0] & 1) != 0 )
operator delete(v51);
}
return _stack_chk_guard;
}