//
// GJGarageLayer::setupPage from 0x100356160 to 0x100356794 (1588 bytes)
//
// 3 xrefs:
// > GJGarageLayer::onArrow @ 0x100356019
// > GJGarageLayer::selectTab @ 0x10035614d
// > GJGarageLayer::onNavigate @ 0x1003567d3
//
// This function is hookable on this platform (idp: pc, 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:28:52 +0000
//
void __fastcall GJGarageLayer::setupPage(__int64 a1, int a2, unsigned int a3)
{
unsigned int v3; // r15d
__int64 v6; // rdi
_BOOL8 v7; // rsi
__int64 v8; // rdx
double v9; // xmm0_8
__int64 v10; // rax
__int64 v11; // rdi
__int64 active; // r12
__int64 v13; // rdx
double v14; // xmm0_8
__int64 *v15; // rax
__int64 *v16; // rdi
unsigned __int64 v17; // rsi
unsigned int v18; // r13d
_QWORD *v19; // rax
_QWORD *v20; // r14
_QWORD *v21; // r12
unsigned int v22; // r13d
_QWORD *v23; // r15
__int64 v24; // rax
unsigned int v25; // r14d
__int64 v26; // rax
__int64 Items; // r12
__int64 v28; // rdi
double v29; // xmm0_8
__int64 v30; // rax
__int64 *v31; // r12
__int64 v32; // rdi
__int64 v33; // r13
unsigned int *v34; // rax
__int64 *v35; // rdi
__int64 v36; // rax
__int64 v37; // rsi
int v38; // r14d
_BOOL4 v39; // r12d
__int64 v40; // rdi
void (__fastcall *v41)(__int64, __int64); // rax
int v42; // r14d
char *v43; // r15
void *v44; // r15
unsigned int v45; // eax
int v46; // r13d
unsigned int i; // r12d
__int64 v48; // r15
__int64 v49; // r15
__int64 v50; // rax
const char *v51; // rsi
__int64 v52; // rax
__int64 v53; // rsi
__int64 v54; // rdx
__int64 v55; // rax
unsigned __int8 GameVariable; // r15
__int64 v57; // r12
__int64 v58; // [rsp+38h] [rbp-78h] BYREF
float v59; // [rsp+40h] [rbp-70h] BYREF
__int64 v60; // [rsp+48h] [rbp-68h]
char v61; // [rsp+50h] [rbp-60h] BYREF
char v62[15]; // [rsp+51h] [rbp-5Fh] BYREF
void *__p; // [rsp+60h] [rbp-50h]
__int64 v64; // [rsp+6Ch] [rbp-44h] BYREF
float v65; // [rsp+74h] [rbp-3Ch] BYREF
float v66; // [rsp+78h] [rbp-38h]
int v67; // [rsp+7Ch] [rbp-34h]
unsigned int v68; // [rsp+80h] [rbp-30h]
int v69; // [rsp+84h] [rbp-2Ch]
v3 = a3;
*(_DWORD *)(a1 + 516) = a3;
v6 = *(_QWORD *)(a1 + 552);
v7 = a3 == 99;
(*(void (__fastcall **)(__int64, _BOOL8))(*(_QWORD *)v6 + 344LL))(v6, v7);
if ( *(_DWORD *)(a1 + 516) == 99 )
{
GJGarageLayer::setupSpecialPage(a1);
return;
}
*(_QWORD *)&v9 = GameManager::sharedState(v6, v7, v8).u64[0];
v11 = v10;
active = (unsigned int)GameManager::activeIconForType(v10, v3, v9);
*(_QWORD *)&v14 = GameManager::sharedState(v11, v3, v13).u64[0];
v16 = v15;
v17 = v3;
v18 = GameManager::countForType(v15, v3, v14);
if ( a2 == -1 )
{
a2 = 0;
if ( (int)(float)(((int)active - 1) / 36) > 0 )
a2 = (int)(float)(((int)active - 1) / 36);
}
v60 = active;
v69 = a2;
v19 = *(_QWORD **)(a1 + 528);
v68 = v3;
v67 = v18;
if ( v19 )
{
while ( 1 )
{
while ( 1 )
{
v21 = v19;
if ( *((_DWORD *)v19 + 7) <= (signed int)v3 )
break;
v19 = (_QWORD *)*v19;
v20 = v21;
if ( !*v21 )
goto LABEL_13;
}
if ( *((_DWORD *)v19 + 7) >= (signed int)v3 )
break;
v19 = (_QWORD *)v19[1];
if ( !v19 )
{
v20 = v21 + 1;
goto LABEL_13;
}
}
v25 = v69;
}
else
{
v20 = (_QWORD *)(a1 + 528);
v21 = (_QWORD *)(a1 + 528);
LABEL_13:
v22 = v3;
v23 = v21;
v21 = operator new(0x28u);
*((_DWORD *)v21 + 7) = v22;
*((_DWORD *)v21 + 8) = 0;
*(_OWORD *)v21 = 0;
v21[2] = v23;
*v20 = v21;
v24 = **(_QWORD **)(a1 + 520);
if ( v24 )
*(_QWORD *)(a1 + 520) = v24;
v16 = *(__int64 **)(a1 + 528);
v17 = (unsigned __int64)v21;
sub_10001B680(v16, v21);
++*(_QWORD *)(a1 + 536);
v3 = v68;
v25 = v69;
v18 = v67;
}
*((_DWORD *)v21 + 8) = v25;
v26 = cocos2d::CCDirector::sharedDirector(v16, v17);
cocos2d::CCDirector::getWinSize(&v65, v26);
Items = GJGarageLayer::getItems(a1, v18, v25, v3, v60);
v28 = *(_QWORD *)(a1 + 568);
if ( v28 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v28 + 536LL))(v28);
*(_QWORD *)(a1 + 568) = 0;
}
sub_100278250((float *)&v64, v65 * 0.5, (float)((float)(v66 * 0.5) + -5.0) + -60.0);
HIDWORD(v29) = 0;
v30 = ListButtonBar::create(Items, &v64, 12, 3, 1, 5.0, 5.0, 25.0, 220.0);
*(_QWORD *)(a1 + 568) = v30;
BoomScrollLayer::togglePageIndicators(*(_QWORD *)(v30 + 320), 0);
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)a1 + 464LL))(a1, *(_QWORD *)(a1 + 568), 100);
v31 = *(__int64 **)(a1 + 544);
v32 = *(_QWORD *)(a1 + 560);
if ( v32 )
{
v33 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v32 + 512LL))(v32);
v34 = (unsigned int *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 560) + 192LL))(*(_QWORD *)(a1 + 560));
cocos2d::CCNode::convertToWorldSpace((double *)&v64, v33, v34);
(*(void (__fastcall **)(__int64 *, __int64 *))(*v31 + 184))(v31, &v64);
v35 = *(__int64 **)(a1 + 544);
v36 = *v35;
v37 = 1;
}
else
{
v36 = *v31;
v35 = *(__int64 **)(a1 + 544);
v37 = 0;
}
(*(void (__fastcall **)(__int64 *, __int64))(v36 + 344))(v35, v37);
v38 = v67;
v39 = v67 >= 37;
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 576) + 1056LL))(*(_QWORD *)(a1 + 576), v67 >= 37);
(*(void (__fastcall **)(_QWORD, _BOOL4))(**(_QWORD **)(a1 + 576) + 344LL))(*(_QWORD *)(a1 + 576), v39);
(*(void (__fastcall **)(_QWORD, _BOOL4))(**(_QWORD **)(a1 + 584) + 1056LL))(*(_QWORD *)(a1 + 584), v39);
(*(void (__fastcall **)(_QWORD, _BOOL4))(**(_QWORD **)(a1 + 584) + 344LL))(*(_QWORD *)(a1 + 584), v39);
v40 = *(_QWORD *)(a1 + 592);
v41 = *(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v40 + 1272LL);
if ( v38 < 37 )
{
v41(v40, 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 592) + 344LL))(*(_QWORD *)(a1 + 592), 0);
if ( v3 != 98 )
return;
goto LABEL_33;
}
v41(v40, 1);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 592) + 344LL))(*(_QWORD *)(a1 + 592), 1);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 592) + 576LL))(*(_QWORD *)(a1 + 592));
*(float *)&v29 = (float)(v38 / 0x24u) + 1.0;
v42 = (int)*(float *)&v29;
while ( (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 488)) < v42 )
{
v43 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"gj_navDotBtn_on_001.png", v29);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v43 + 160LL))(v43, 0.89999998);
v44 = CCMenuItemSpriteExtra::create((__int64)v43, 0, a1, (__int64)GJGarageLayer::onNavigate, 0);
v45 = sub_1007FEF90(*(_QWORD *)(a1 + 488));
(*(void (__fastcall **)(void *, _QWORD))(*(_QWORD *)v44 + 72LL))(v44, v45);
sub_1007FEBF0(*(_QWORD *)(a1 + 488), v44);
*(_QWORD *)&v29 = 1066192077;
CCMenuItemSpriteExtra::setSizeMult((__int64)v44, 1.1);
}
v46 = v69;
if ( v42 > 0 )
{
for ( i = 0; i != v42; ++i )
{
v48 = sub_1007FEFE0(*(_QWORD *)(a1 + 488), i);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 592) + 456LL))(*(_QWORD *)(a1 + 592), v48);
v49 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v48 + 1072LL))(v48);
v50 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v51 = "gj_navDotBtn_off_001.png";
if ( v46 == i )
v51 = "gj_navDotBtn_on_001.png";
v52 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v50, v51);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v49 + 1160LL))(v49, v52);
}
}
cocos2d::CCMenu::alignItemsHorizontallyWithPadding(*(_QWORD *)(a1 + 592), 6.0);
if ( v68 == 98 )
{
LABEL_33:
v53 = cocos2d::CCMenu::create();
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 568) + 464LL))(*(_QWORD *)(a1 + 568), v53, 1);
sub_100278250((float *)&v64, 8.0, 0.0);
v61 = 14;
strcpy(v62, "Explode");
GameManager::sharedState(&v64, v53, v54);
GameVariable = GameManager::getGameVariable(v55, "0153");
sub_100278250(&v59, (float)(v65 * 0.5) + -165.0, (float)((float)((float)(0.5 * v66) + -5.0) + -60.0) + -30.0);
v57 = *(_QWORD *)(a1 + 568);
sub_1002782D0(&v58, &v64);
GameToolbox::createToggleButton(
(unsigned int)&v61,
(unsigned int)GJGarageLayer::onSpecial,
0,
GameVariable ^ 1,
v53,
(unsigned int)&v59,
v57,
v57,
(__int64)&v58,
(__int64)"goldFont.fnt",
0,
0,
0);
if ( (v61 & 1) != 0 )
operator delete(__p);
}
}