//
// GJGarageLayer::setupPage from 0x50f1a4 to 0x50f5b0 (1036 bytes)
//
// 3 xrefs:
// > GJGarageLayer::onArrow @ 0x50f658
// > GJGarageLayer::onNavigate @ 0x50f674
// > GJGarageLayer::selectTab @ 0x50f6d6
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:51:30 +0000
//
int *__fastcall GJGarageLayer::setupPage(int a1, int a2, unsigned int a3)
{
int v5; // r0
GameManager *v6; // r0
int *result; // r0
_DWORD *v8; // r0
GameManager *active; // r4
int v10; // r0
int v11; // r8
float v12; // r0
cocos2d::CCDirector *v13; // r0
cocos2d::CCArray *Items; // r5
int v15; // r0
int v16; // r0
int *v17; // r5
int v18; // r1
int v19; // r3
void (__fastcall *v20)(int *, const char *(__fastcall **)(GJGarageLayer *, cocos2d::CCObject *)); // r10
const cocos2d::CCPoint *v21; // r11
void (*v22)(void); // r3
int v23; // s19
const char *v24; // r1
int v25; // r8
cocos2d::CCObject *v26; // r8
void (__fastcall *v27)(cocos2d::CCObject *, int); // r5
int v28; // r0
signed int i; // r8
int v30; // r11
cocos2d::CCSpriteFrameCache *v31; // r11
void (__fastcall *v32)(cocos2d::CCSpriteFrameCache *, int); // r5
cocos2d::CCSpriteFrameCache *v33; // r0
const char *v34; // r1
int v35; // r0
const cocos2d::CCPoint *v36; // r10
GameManager *v37; // r0
GameManager *v38; // r0
int v39; // r6
int v40; // r8
unsigned int v41; // [sp+34h] [bp-48h] BYREF
float v42; // [sp+38h] [bp-44h] BYREF
float v43; // [sp+3Ch] [bp-40h]
_BYTE v44[8]; // [sp+40h] [bp-3Ch] BYREF
_BYTE v45[8]; // [sp+48h] [bp-34h] BYREF
_BYTE v46[8]; // [sp+50h] [bp-2Ch] BYREF
_DWORD (*v47)(GJGarageLayer *__hidden, cocos2d::CCObject *); // [sp+58h] [bp-24h]
int v48; // [sp+5Ch] [bp-20h]
const char *(__fastcall *v49)(GJGarageLayer *, cocos2d::CCObject *); // [sp+60h] [bp-1Ch] BYREF
int v50; // [sp+64h] [bp-18h]
int v51[3]; // [sp+68h] [bp-14h] BYREF
*(_DWORD *)(a1 + 372) = a3;
v5 = *(_DWORD *)(a1 + 392);
v41 = a3;
v6 = (GameManager *)(*(int (__fastcall **)(int, bool))(*(_DWORD *)v5 + 172))(v5, a3 == 99);
if ( *(_DWORD *)(a1 + 372) == 99 )
return GJGarageLayer::setupSpecialPage((const cocos2d::CCPoint **)a1);
v8 = (_DWORD *)GameManager::sharedState(v6);
active = (GameManager *)GameManager::activeIconForType(v8, v41);
v10 = GameManager::sharedState(active);
v11 = GameManager::countForType(v10, v41);
if ( a2 == -1 )
{
v12 = floorf((float)(((int)active - 1) / 36));
a2 = (int)v12 & ~((int)v12 >> 31);
}
v13 = (cocos2d::CCDirector *)std::map::operator[]((int **)(a1 + 376), (int *)&v41);
*(_DWORD *)v13 = a2;
cocos2d::CCDirector::sharedDirector(v13);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v42);
Items = GJGarageLayer::getItems(a1, v11, a2, v41, (int)active);
v15 = *(_DWORD *)(a1 + 400);
if ( v15 )
{
(*(void (__fastcall **)(int))(*(_DWORD *)v15 + 268))(v15);
*(_DWORD *)(a1 + 400) = 0;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, v42 * 0.5, (float)((float)(v43 * 0.5) - 5.0) - 60.0);
v16 = ListButtonBar::create(
Items,
(const cocos2d::CCPoint *)&v49,
12,
3,
5.0,
5.0,
25.0,
220.0,
(_BYTE *)&dword_0 + 1);
*(_DWORD *)(a1 + 400) = v16;
BoomScrollLayer::togglePageIndicators(*(_DWORD *)(v16 + 264), 0);
(*(void (__fastcall **)(int, _DWORD, int))(*(_DWORD *)a1 + 232))(a1, *(_DWORD *)(a1 + 400), 100);
v17 = *(int **)(a1 + 388);
v18 = *(_DWORD *)(a1 + 396);
v19 = *v17;
if ( v18 )
{
v20 = *(void (__fastcall **)(int *, const char *(__fastcall **)(GJGarageLayer *, cocos2d::CCObject *)))(v19 + 92);
v21 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(_DWORD))(*(_DWORD *)v18 + 256))(*(_DWORD *)(a1 + 396));
(*(void (__fastcall **)(_DWORD))(**(_DWORD **)(a1 + 396) + 96))(*(_DWORD *)(a1 + 396));
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v49, v21);
v20(v17, &v49);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 388) + 172))(*(_DWORD *)(a1 + 388), 1);
}
else
{
(*(void (__fastcall **)(_DWORD, _DWORD))(v19 + 172))(*(_DWORD *)(a1 + 388), 0);
}
(*(void (__fastcall **)(_DWORD, bool))(**(_DWORD **)(a1 + 404) + 528))(*(_DWORD *)(a1 + 404), v11 > 36);
(*(void (__fastcall **)(_DWORD, bool))(**(_DWORD **)(a1 + 404) + 172))(*(_DWORD *)(a1 + 404), v11 > 36);
(*(void (__fastcall **)(_DWORD, bool))(**(_DWORD **)(a1 + 408) + 528))(*(_DWORD *)(a1 + 408), v11 > 36);
(*(void (__fastcall **)(_DWORD, bool))(**(_DWORD **)(a1 + 408) + 172))(*(_DWORD *)(a1 + 408), v11 > 36);
v22 = *(void (**)(void))(**(_DWORD **)(a1 + 412) + 636);
if ( v11 <= 36 )
{
v22();
result = (int *)(*(int (__fastcall **)(_DWORD, bool))(**(_DWORD **)(a1 + 412) + 172))(
*(_DWORD *)(a1 + 412),
v11 > 36);
}
else
{
v22();
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 412) + 172))(*(_DWORD *)(a1 + 412), 1);
(*(void (__fastcall **)(_DWORD))(**(_DWORD **)(a1 + 412) + 288))(*(_DWORD *)(a1 + 412));
v23 = (int)(float)(floorf((float)(v11 / 36)) + 1.0);
while ( (unsigned int)v23 > cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 356)) )
{
v25 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"gj_navDotBtn_on_001.png", v24);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v25 + 80))(v25, 1063675494);
v48 = 0;
v47 = GJGarageLayer::onNavigate;
v26 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(v25, 0, a1, (int)GJGarageLayer::onNavigate, 0);
v27 = *(void (__fastcall **)(cocos2d::CCObject *, int))(*(_DWORD *)v26 + 36);
v28 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 356));
v27(v26, v28);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 356), v26);
CCMenuItemSpriteExtra::setSizeMult((int)v26, 1.1);
}
for ( i = 0; i < v23; ++i )
{
v30 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 356), i);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 412) + 228))(*(_DWORD *)(a1 + 412), v30);
v31 = (cocos2d::CCSpriteFrameCache *)(*(int (__fastcall **)(int))(*(_DWORD *)v30 + 536))(v30);
v32 = *(void (__fastcall **)(cocos2d::CCSpriteFrameCache *, int))(*(_DWORD *)v31 + 580);
v33 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v31);
if ( i == a2 )
v34 = "gj_navDotBtn_on_001.png";
else
v34 = "gj_navDotBtn_off_001.png";
v35 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v33, v34);
v32(v31, v35);
}
result = (int *)cocos2d::CCMenu::alignItemsHorizontallyWithPadding(*(cocos2d::CCMenu **)(a1 + 412), 6.0);
}
if ( v41 == 98 )
{
v36 = (const cocos2d::CCPoint *)cocos2d::CCMenu::create((cocos2d::CCMenu *)result);
(*(void (__fastcall **)(_DWORD, const cocos2d::CCPoint *, int))(**(_DWORD **)(a1 + 400) + 232))(
*(_DWORD *)(a1 + 400),
v36,
1);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v44, 8.0, 0.0);
memset(v51, 0, sizeof(v51));
v37 = (GameManager *)std::string::__init(v51, "Explode", 7u);
v50 = 0;
v49 = GJGarageLayer::onSpecial;
v38 = (GameManager *)GameManager::sharedState(v37);
v39 = (unsigned __int8)GameManager::getGameVariable(v38, "0153") ^ 1;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v45,
(float)(v42 * 0.5) - 165.0,
(float)((float)((float)(v43 * 0.5) - 5.0) - 60.0) - 30.0);
v40 = *(_DWORD *)(a1 + 400);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v46, (const cocos2d::CCPoint *)v44);
GameToolbox::createToggleButton(
(int)v51,
(int)v49,
v50,
v39,
v36,
(int)v45,
v40,
v40,
0.6,
0.5,
80.0,
(int)v46,
"goldFont.fnt",
0,
0,
nullptr);
return (int *)std::string::~string((int)v51);
}
return result;
}