//
// GJGarageLayer::setupPage from 0x14037e970 to 0x14037f081 (1809 bytes)
//
// 4 xrefs:
// > GJGarageLayer::onArrow @ 0x14037e843
// > GJGarageLayer::onNavigate @ 0x14037e873
// > GJGarageLayer::selectTab @ 0x14037e95e
// > ??> @ 0x14092288c
//
// 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 11:31:04 +0000
//
// Hidden C++ exception states: #wind=5
void __fastcall GJGarageLayer::setupPage(__int64 a1, __int64 a2, int a3)
{
int v3; // r12d
_DWORD *v5; // rcx
__int64 v6; // rcx
int active; // ebx
int v8; // r9d
int v9; // r15d
int v10; // eax
__int64 v11; // rcx
__int64 v12; // rax
int Items; // ebx
__int64 v14; // rcx
const struct cocos2d::CCPoint *v15; // rax
cocos2d::CCNode *v16; // rax
__int64 v17; // rdi
cocos2d::CCArray *v18; // rcx
unsigned int v19; // ebx
struct cocos2d::CCObject *v20; // rax
__int64 v21; // rdx
__int64 v22; // rsi
__int64 v23; // rbx
__int64 v24; // rdi
__int64 v25; // rax
__int64 v26; // rax
__int64 v27; // rdx
__int64 v28; // rdx
__int64 *v29; // rcx
__int64 v30; // r8
__int64 *v31; // rcx
__int64 v32; // rdx
unsigned int v33; // r15d
__int64 *v34; // rbx
__int64 *v35; // rax
__int64 *v36; // rdi
__int64 v37; // rbx
unsigned int v38; // eax
signed int i; // edi
struct cocos2d::CCObject *v40; // rbx
_QWORD *v41; // rbx
void (__fastcall *v42)(_QWORD *, struct cocos2d::CCSpriteFrame *); // rsi
__int64 v43; // rdx
cocos2d::CCSpriteFrameCache *v44; // rcx
const char *v45; // rdx
struct cocos2d::CCSpriteFrame *v46; // rax
__int64 v47; // rcx
__int64 v48; // r15
__int64 v49; // rcx
bool GameVariable; // si
float *v51; // rax
float *v52; // rbx
__int64 v53; // rdi
__int64 v54; // rax
void *v55; // [rsp+90h] [rbp-41h]
char v56[8]; // [rsp+98h] [rbp-39h] BYREF
char v57[8]; // [rsp+A0h] [rbp-31h] BYREF
char v58[8]; // [rsp+A8h] [rbp-29h] BYREF
__int64 v59; // [rsp+B0h] [rbp-21h]
__int64 v60; // [rsp+B8h] [rbp-19h]
__int64 v61; // [rsp+C0h] [rbp-11h]
float v62; // [rsp+138h] [rbp+67h] BYREF
float v63; // [rsp+13Ch] [rbp+6Bh]
int v64; // [rsp+148h] [rbp+77h] BYREF
void *v65; // [rsp+150h] [rbp+7Fh] BYREF
v64 = a3;
v3 = a2;
*(_DWORD *)(a1 + 516) = a3;
LOBYTE(a2) = a3 == 99;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 544) + 336LL))(*(_QWORD *)(a1 + 544), a2);
if ( *(_DWORD *)(a1 + 516) == 99 )
{
GJGarageLayer::setupSpecialPage(a1);
return;
}
v5 = (_DWORD *)qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v65 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v65);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v5 = (_DWORD *)qword_14090BFD0;
}
active = GameManager::activeIconForType(v5, v64);
if ( !v6 )
{
v65 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v65);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v8 = v64;
}
v9 = GameManager::countForType(v6, v8);
if ( v3 == -1 )
{
v10 = (int)floorf((float)((active - 1) / 36));
v3 = 0;
if ( v10 > 0 )
v3 = v10;
}
*(_DWORD *)sub_14010ECC0((__int64 *)(a1 + 520), &v64) = v3;
v12 = cocos2d::CCDirector::sharedDirector(v11);
cocos2d::CCDirector::getWinSize(v12, &v62);
Items = GJGarageLayer::getItems(a1, v9, v3, v64, active);
v14 = *(_QWORD *)(a1 + 560);
if ( v14 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v14 + 528LL))(v14);
*(_QWORD *)(a1 + 560) = 0;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v65, v62 * 0.5, (float)((float)(v63 * 0.5) - 5.0) - 60.0);
v16 = ListButtonBar::create(Items, v15, 12, 3, 1084227584, 1084227584, 1103626240, 1130102784);
*(_QWORD *)(a1 + 560) = v16;
v17 = *((_QWORD *)v16 + 40);
v18 = *(cocos2d::CCArray **)(v17 + 416);
if ( v18 )
{
v19 = 0;
if ( cocos2d::CCArray::count(v18) )
{
do
{
v20 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v17 + 416), v19);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v20 + 336LL))(v20, 0);
++v19;
}
while ( v19 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v17 + 416)) );
}
}
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)a1 + 456LL))(a1, *(_QWORD *)(a1 + 560), 100);
v21 = *(_QWORD *)(a1 + 552);
v22 = **(_QWORD **)(a1 + 536);
if ( v21 )
{
v23 = (*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)v21 + 200LL))(*(_QWORD *)(a1 + 552));
v24 = *(_QWORD *)(a1 + 536);
v25 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 552) + 504LL))(*(_QWORD *)(a1 + 552));
cocos2d::CCNode::convertToWorldSpace(v25, &v65, v23);
(*(void (__fastcall **)(__int64, __int64))(v22 + 184))(v24, v26);
LOBYTE(v27) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 536) + 336LL))(*(_QWORD *)(a1 + 536), v27);
}
else
{
(*(void (**)(void))(v22 + 336))();
}
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 568) + 936LL))(*(_QWORD *)(a1 + 568), v9 > 36);
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 568) + 336LL))(*(_QWORD *)(a1 + 568), v9 > 36);
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 576) + 936LL))(*(_QWORD *)(a1 + 576), v9 > 36);
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 576) + 336LL))(*(_QWORD *)(a1 + 576), v9 > 36);
v29 = *(__int64 **)(a1 + 584);
v30 = *v29;
if ( v9 <= 36 )
{
(*(void (__fastcall **)(__int64 *, _QWORD))(v30 + 1040))(v29, 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 584) + 336LL))(*(_QWORD *)(a1 + 584), 0);
}
else
{
LOBYTE(v28) = 1;
(*(void (__fastcall **)(__int64 *, __int64))(v30 + 1040))(v29, v28);
v31 = *(__int64 **)(a1 + 584);
v32 = *v31;
LOBYTE(v32) = 1;
(*(void (__fastcall **)(__int64 *, __int64))(*v31 + 336))(v31, v32);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 584) + 568LL))(*(_QWORD *)(a1 + 584));
v33 = (int)(float)(floorf((float)(v9 / 36)) + 1.0);
if ( v33 > cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 488)) )
{
while ( 1 )
{
v34 = (__int64 *)cocos2d::CCSprite::createWithSpriteFrameName("gj_navDotBtn_on_001.png");
(*(void (__fastcall **)(__int64 *))(*v34 + 160))(v34);
v65 = operator new(0x208u);
v35 = (__int64 *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v65);
v36 = v35;
if ( !v35 )
goto LABEL_24;
if ( !CCMenuItemSpriteExtra::init(v35, v34, 0, a1, (__int64)GJGarageLayer::onNavigate) )
break;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v36);
LABEL_25:
v37 = *v36;
v38 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 488));
(*(void (__fastcall **)(__int64 *, _QWORD))(v37 + 64))(v36, v38);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 488), (struct cocos2d::CCObject *)v36);
*((_DWORD *)v36 + 93) = 1066192077;
if ( v33 <= cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 488)) )
goto LABEL_26;
}
(*(void (__fastcall **)(__int64 *, __int64))(*v36 + 8))(v36, 1);
LABEL_24:
v36 = nullptr;
goto LABEL_25;
}
LABEL_26:
for ( i = 0; i < (int)v33; ++i )
{
v40 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 488), i);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v40);
v41 = (_QWORD *)(*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v40 + 952LL))(v40);
v42 = *(void (__fastcall **)(_QWORD *, struct cocos2d::CCSpriteFrame *))(*v41 + 1008LL);
v44 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(*v41, v43);
v45 = "gj_navDotBtn_on_001.png";
if ( i != v3 )
v45 = "gj_navDotBtn_off_001.png";
v46 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v44, v45);
v42(v41, v46);
}
cocos2d::CCMenu::alignItemsHorizontallyWithPadding(*(cocos2d::CCMenu **)(a1 + 584), 6.0);
}
if ( v64 == 98 )
{
v48 = cocos2d::CCMenu::create(v47);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 560) + 456LL))(*(_QWORD *)(a1 + 560), v48, 1);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v65, 8.0, 0.0);
v49 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v55 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v49 = qword_14090BFD0;
}
GameVariable = GameManager::getGameVariable(v49, "0153");
v59 = 0;
v60 = 7;
v61 = 15;
strcpy(v58, "Explode");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v56, (const struct cocos2d::CCPoint *)&v65);
v52 = v51;
v53 = *(_QWORD *)(a1 + 560);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v57,
(float)(v62 * 0.5) - 165.0,
(float)((float)((float)(v63 * 0.5) - 5.0) - 60.0) - 30.0);
GameToolbox::createToggleButton(
v58,
(__int64)GJGarageLayer::onSpecial,
!GameVariable,
v48,
v54,
v53,
v53,
0.60000002,
0.5,
80.0,
v52,
"goldFont.fnt",
0,
0,
nullptr);
}
}