//
// GJGarageLayer::setupSpecialPage from 0x14037f420 to 0x14037fb57 (1847 bytes)
//
// 2 xrefs:
// > GJGarageLayer::setupPage @ 0x14037e9cf
// > ??> @ 0x1409228b0
//
// 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
__int64 __fastcall GJGarageLayer::setupSpecialPage(__int64 a1)
{
__int64 v2; // rax
__int64 v3; // rcx
int Items_1; // ebx
const struct cocos2d::CCPoint *v5; // rax
cocos2d::CCNode *v6; // rax
__int64 v7; // rdi
cocos2d::CCArray *v8; // rcx
unsigned int v9; // ebx
struct cocos2d::CCObject *v10; // rax
__int64 v11; // rcx
__int64 v12; // rsi
__int64 v13; // rbx
__int64 v14; // rdi
__int64 v15; // rax
__int64 v16; // rax
__int64 v17; // rdx
int v18; // ebx
const struct cocos2d::CCPoint *v19; // rax
cocos2d::CCNode *v20; // rsi
__int64 v21; // rdi
cocos2d::CCArray *v22; // rcx
unsigned int v23; // ebx
struct cocos2d::CCObject *v24; // rax
__int64 v25; // rcx
__int64 v26; // rsi
__int64 v27; // rbx
__int64 v28; // rdi
__int64 v29; // rax
__int64 v30; // rax
__int64 v31; // rdx
struct cocos2d::CCMenu *v32; // rbx
__int64 v33; // rax
int v34; // r14d
__int64 v35; // rcx
char isIconUnlocked; // r12
__int64 v37; // rcx
int ItemUnlockState; // r13d
__int64 result; // rax
__int64 v40; // rcx
__int64 *v41; // rsi
__int64 v42; // rbx
__int64 v43; // rcx
bool v44; // bl
cocos2d::CCString *v45; // rax
__int64 *v46; // rax
__int64 *v47; // rdi
__int64 v48; // rbx
__int64 v49; // rax
__int64 v50; // rbx
float v51; // xmm6_4
float *v52; // rax
__int64 v53; // rax
__int64 v54; // rax
_WORD v55[8]; // [rsp+68h] [rbp-A0h] BYREF
float v56; // [rsp+78h] [rbp-90h] BYREF
float v57; // [rsp+7Ch] [rbp-8Ch]
char v58[8]; // [rsp+80h] [rbp-88h] BYREF
int v59; // [rsp+88h] [rbp-80h]
char v60[8]; // [rsp+90h] [rbp-78h] BYREF
struct cocos2d::CCSprite *v61; // [rsp+98h] [rbp-70h]
struct cocos2d::CCMenu *v62; // [rsp+A0h] [rbp-68h]
char v63[8]; // [rsp+A8h] [rbp-60h] BYREF
void *v64; // [rsp+B0h] [rbp-58h]
void *v65; // [rsp+B8h] [rbp-50h]
void *v66; // [rsp+C0h] [rbp-48h]
void *v67; // [rsp+C8h] [rbp-40h]
char v68[8]; // [rsp+D0h] [rbp-38h] BYREF
char v69[8]; // [rsp+D8h] [rbp-30h] BYREF
_QWORD v70[4]; // [rsp+E0h] [rbp-28h] BYREF
v2 = cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v2, &v56);
v3 = *(_QWORD *)(a1 + 560);
if ( v3 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v3 + 528LL))(v3);
*(_QWORD *)(a1 + 560) = 0;
}
Items_1 = GJGarageLayer::getItems_1(a1, 99);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v58, v56 * 0.5, (float)((float)(v57 * 0.5) - 5.0) - 60.0);
v6 = ListButtonBar::create(Items_1, v5, 12, 3, 1084227584, 1084227584, 1103626240, 1130102784);
*(_QWORD *)(a1 + 560) = v6;
v7 = *((_QWORD *)v6 + 40);
v8 = *(cocos2d::CCArray **)(v7 + 416);
if ( v8 )
{
v9 = 0;
if ( cocos2d::CCArray::count(v8) )
{
do
{
v10 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v7 + 416), v9);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v10 + 336LL))(v10, 0);
++v9;
}
while ( v9 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v7 + 416)) );
}
}
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)a1 + 456LL))(a1, *(_QWORD *)(a1 + 560), 100);
v11 = *(_QWORD *)(a1 + 552);
v12 = **(_QWORD **)(a1 + 536);
if ( v11 )
{
v13 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v11 + 200LL))(v11);
v14 = *(_QWORD *)(a1 + 536);
v15 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 552) + 504LL))(*(_QWORD *)(a1 + 552));
cocos2d::CCNode::convertToWorldSpace(v15, v58, v13);
(*(void (__fastcall **)(__int64, __int64))(v12 + 184))(v14, v16);
LOBYTE(v17) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 536) + 336LL))(*(_QWORD *)(a1 + 536), v17);
}
else
{
(*(void (__fastcall **)(_QWORD, _QWORD))(v12 + 336))(*(_QWORD *)(a1 + 536), 0);
}
v18 = GJGarageLayer::getItems_1(a1, 101);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v58,
v56 * 0.5,
(float)((float)((float)(v57 * 0.5) - 5.0) - 60.0) - 30.0);
v20 = ListButtonBar::create(v18, v19, 12, 3, 1084227584, 1084227584, 1103626240, 1130102784);
v21 = *((_QWORD *)v20 + 40);
v22 = *(cocos2d::CCArray **)(v21 + 416);
if ( v22 )
{
v23 = 0;
if ( cocos2d::CCArray::count(v22) )
{
do
{
v24 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v21 + 416), v23);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v24 + 336LL))(v24, 0);
++v23;
}
while ( v23 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v21 + 416)) );
}
}
(*(void (__fastcall **)(_QWORD, cocos2d::CCNode *, __int64))(**(_QWORD **)(a1 + 560) + 456LL))(
*(_QWORD *)(a1 + 560),
v20,
100);
v25 = *(_QWORD *)(a1 + 552);
v26 = **(_QWORD **)(a1 + 544);
if ( v25 )
{
v27 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v25 + 200LL))(v25);
v28 = *(_QWORD *)(a1 + 544);
v29 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 552) + 504LL))(*(_QWORD *)(a1 + 552));
cocos2d::CCNode::convertToWorldSpace(v29, v58, v27);
(*(void (__fastcall **)(__int64, __int64))(v26 + 184))(v28, v30);
LOBYTE(v31) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 544) + 336LL))(*(_QWORD *)(a1 + 544), v31);
}
else
{
(*(void (__fastcall **)(_QWORD, _QWORD))(v26 + 336))(*(_QWORD *)(a1 + 544), 0);
}
v32 = cocos2d::CCMenu::create(nullptr);
v62 = v32;
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCMenu *, __int64))(**(_QWORD **)(a1 + 560) + 456LL))(
*(_QWORD *)(a1 + 560),
v32,
1000);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v60,
(float)((float)(v56 * 0.5) - 137.5) - 27.5,
(float)((float)((float)(v57 * 0.5) - 5.0) - 60.0) - 30.0);
cocos2d::CCNode::convertToWorldSpace(*(_QWORD *)(a1 + 560), v58, v60);
cocos2d::CCNode::convertToNodeSpace(v32, v63, v33);
v61 = cocos2d::CCSprite::createWithSpriteFrameName("playerSquare_001.png");
v34 = 18;
v59 = 0;
do
{
v35 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v64 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v64);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v35 = qword_14090BFD0;
}
isIconUnlocked = GameManager::isIconUnlocked(v35, v34, 0x64u);
v37 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v65 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v65);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v37 = qword_14090BFE0;
}
ItemUnlockState = GameStatsManager::getItemUnlockState(v37, v34, 12);
result = GJItemIcon::createBrowserItem(12, (unsigned int)v34);
v41 = (__int64 *)result;
if ( isIconUnlocked )
{
v42 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v66 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v66);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v42 = qword_14090BFE0;
}
if ( (unsigned __int8)GameStatsManager::isItemUnlocked(v40, 0xCu, v34) )
{
GameStatsManager::getItemKey(v43, v70, v34, 0xCu);
v45 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v42 + 896), v70);
v44 = cocos2d::CCString::boolValue(v45);
sub_14003D310((__int64)v70);
}
else
{
v44 = 0;
}
result = GJItemIcon::toggleEnabledState(v41, v44);
}
if ( v41 )
{
(*(void (__fastcall **)(__int64 *))(*v41 + 160))(v41);
v67 = operator new(0x208u);
v46 = (__int64 *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v67);
v47 = v46;
if ( v46 )
{
if ( CCMenuItemSpriteExtra::init(v46, v41, 0, a1, (__int64)GJGarageLayer::onToggleItem) )
{
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v47);
goto LABEL_33;
}
(*(void (__fastcall **)(__int64 *, __int64))(*v47 + 8))(v47, 1);
}
v47 = nullptr;
LABEL_33:
v48 = *v47;
v49 = (*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v61 + 320LL))(v61);
(*(void (__fastcall **)(__int64 *, __int64))(v48 + 312))(v47, v49);
v50 = *v41;
v51 = *(float *)((*(__int64 (__fastcall **)(__int64 *))(*v47 + 320))(v47) + 4) * 0.5;
v52 = (float *)(*(__int64 (__fastcall **)(__int64 *))(*v47 + 320))(v47);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, *v52 * 0.5, v51);
(*(void (__fastcall **)(__int64 *, __int64))(v50 + 184))(v41, v53);
(*(void (__fastcall **)(__int64 *, _QWORD))(*v47 + 64))(v47, (unsigned int)v34);
*((_DWORD *)v47 + 128) = 100;
(*(void (__fastcall **)(struct cocos2d::CCMenu *, __int64 *))(*(_QWORD *)v62 + 464LL))(v62, v47);
LODWORD(v50) = v59;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v69, (float)v59, 0.0);
cocos2d::CCPoint::operator+(v63, v58, v54);
result = (*(__int64 (__fastcall **)(__int64 *, char *))(*v47 + 184))(v47, v58);
v59 = v50 + 30;
if ( !isIconUnlocked )
{
if ( ItemUnlockState )
{
result = GJItemIcon::changeToLockedState(v41);
}
else
{
memset(v55, 50, 3);
result = GJItemIcon::darkenStoreItem(v41, v55);
}
}
}
++v34;
}
while ( v34 <= 20 );
return result;
}