//
// GJGarageLayer::setupSpecialPage from 0x796f14 to 0x797470 (1372 bytes)
//
// 2 xrefs:
// > GJGarageLayer::setupPage @ 0x797b48
// > ??> @ 0x4fe90
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void GJGarageLayer::setupSpecialPage(GJGarageLayer *a1)
{
cocos2d::CCDirector *v2; // x0
ListButtonBar *m_iconSelection; // x0
cocos2d::CCArray *Items; // x19
float v5; // s4
float v6; // s5
ListButtonBar *v7; // x0
CCMenuItemSpriteExtra *m_currentIcon; // x1
cocos2d::CCSprite *m_cursor1; // x19
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCNode *v11; // x23
const cocos2d::CCPoint *v12; // x0
cocos2d::CCArray *v13; // x19
float v14; // s4
float v15; // s5
ListButtonBar *v16; // x19
CCMenuItemSpriteExtra *v17; // x1
cocos2d::CCSprite *m_cursor2; // x19
void (__fastcall *v19)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCNode *v20; // x23
const cocos2d::CCPoint *v21; // x0
cocos2d::CCNode *v22; // x25
unsigned int v23; // w19
int v24; // w23
cocos2d::CCSprite *v25; // x26
GameManager *v26; // x0
_BOOL4 isIconUnlocked; // w24
GameStatsManager *v28; // x0
GJItemIcon *BrowserItem; // x22
float v30; // s10
CCMenuItemSpriteExtra *v31; // x28
const cocos2d::CCSize *(__fastcall *getContentSize)(const cocos2d::CCNode *__hidden); // x1
__int64 v33; // x0
const cocos2d::CCSize *(__fastcall *v34)(const cocos2d::CCNode *__hidden); // x1
__int128 v35; // q0
const cocos2d::CCSize *(__fastcall *v36)(const cocos2d::CCNode *__hidden); // x1
__int64 v37; // x0
cocos2d::CCNode_vtbl *v38; // x3
int v39; // w1
GameStatsManager *v40; // x0
bool isItemEnabled; // w0
_QWORD v42[2]; // [xsp+0h] [xbp+0h] BYREF
char *v43; // [xsp+88h] [xbp+88h]
int ItemUnlockState; // [xsp+94h] [xbp+94h]
void (__fastcall *v45)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+98h] [xbp+98h]
cocos2d::CCPoint *v46[2]; // [xsp+A0h] [xbp+A0h]
float v47; // [xsp+B0h] [xbp+B0h]
float v48; // [xsp+B4h] [xbp+B4h]
cocos2d::CCPoint v49; // [xsp+B8h] [xbp+B8h] BYREF
char v50; // [xsp+C0h] [xbp+C0h] BYREF
cocos2d::CCPoint v51; // [xsp+C8h] [xbp+C8h] BYREF
cocos2d::CCPoint v52; // [xsp+D0h] [xbp+D0h] BYREF
cocos2d::CCSize WinSize; // 0:kr00_8.8
cocos2d::CCPoint v54; // 0:kr08_8.8
cocos2d::CCPoint v55; // 0:kr10_8.8
cocos2d::SEL_MenuHandler v56; // 0:x2.16
cocos2d::CCPoint v57; // 0:s0.4,4:s1.4
cocos2d::CCPoint v58; // 0:s0.4,4:s1.4
v2 = cocos2d::CCDirector::sharedDirector();
WinSize = cocos2d::CCDirector::getWinSize(v2);
m_iconSelection = a1->m_iconSelection;
if ( m_iconSelection )
{
((void (__fastcall *)(ListButtonBar *, float, float))m_iconSelection->removeMeAndCleanup)(
m_iconSelection,
WinSize.width,
WinSize.height);
a1->m_iconSelection = nullptr;
}
Items = GJGarageLayer::getItems(a1, Special);
cocos2d::CCPoint::CCPoint(&v52, v47 * 0.5, (float)((float)(v48 * 0.5) + -5.0) - 60.0);
v57.x = 5.0;
v57.y = 5.0;
v7 = ListButtonBar::create(Items, v57, (unsigned int)v42 + 208, 12, 25.0, 220.0, v5, v6, 3);
a1->m_iconSelection = v7;
BoomScrollLayer::togglePageIndicators(v7->m_scrollLayer, 0);
a1->addChild_0(a1, a1->m_iconSelection, 100);
m_currentIcon = a1->m_currentIcon;
if ( m_currentIcon )
{
m_cursor1 = a1->m_cursor1;
setPosition = m_cursor1->setPosition;
v11 = m_currentIcon->getParent(a1->m_currentIcon);
v12 = a1->m_currentIcon->getPosition(a1->m_currentIcon);
v54 = cocos2d::CCNode::convertToWorldSpace(v11, v12);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCPoint *, float, float))setPosition)(
m_cursor1,
&v52,
v54.x,
v54.y);
a1->m_cursor1->setVisible(a1->m_cursor1, 1);
}
else
{
a1->m_cursor1->setVisible(a1->m_cursor1, 0);
}
v13 = GJGarageLayer::getItems(a1, ShipFire);
cocos2d::CCPoint::CCPoint(&v52, v47 * 0.5, (float)((float)((float)(v48 * 0.5) + -5.0) - 60.0) - 30.0);
v58.x = 5.0;
v58.y = 5.0;
v16 = ListButtonBar::create(v13, v58, (unsigned int)v42 + 208, 12, 25.0, 220.0, v14, v15, 3);
BoomScrollLayer::togglePageIndicators(v16->m_scrollLayer, 0);
a1->m_iconSelection->addChild_0(a1->m_iconSelection, v16, 100);
v17 = a1->m_currentIcon;
if ( v17 )
{
m_cursor2 = a1->m_cursor2;
v19 = m_cursor2->setPosition;
v20 = v17->getParent(a1->m_currentIcon);
v21 = a1->m_currentIcon->getPosition(a1->m_currentIcon);
v55 = cocos2d::CCNode::convertToWorldSpace(v20, v21);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCPoint *, float, float))v19)(m_cursor2, &v52, v55.x, v55.y);
a1->m_cursor2->setVisible(a1->m_cursor2, 1);
}
else
{
a1->m_cursor2->setVisible(a1->m_cursor2, 0);
}
v43 = &v50;
v22 = (cocos2d::CCNode *)cocos2d::CCMenu::create(nullptr, (cocos2d::CCMenuItem *)&v50);
v23 = 18;
v24 = 0;
a1->m_iconSelection->addChild_0(a1->m_iconSelection, v22, 1000);
v46[0] = &v49;
cocos2d::CCPoint::CCPoint(
&v49,
(float)((float)(v47 * 0.5) + -137.5) - 27.5,
(float)((float)((float)(v48 * 0.5) + -5.0) - 60.0) - 30.0);
cocos2d::CCNode::convertToWorldSpace(a1->m_iconSelection, v46[0]);
cocos2d::CCNode::convertToNodeSpace(v22, &v52);
v25 = cocos2d::CCSprite::createWithSpriteFrameName("playerSquare_001.png");
do
{
v26 = GameManager::sharedState();
isIconUnlocked = GameManager::isIconUnlocked(v26, v23, Item);
v28 = GameStatsManager::sharedState();
ItemUnlockState = GameStatsManager::getItemUnlockState(v28, v23, GJItem);
BrowserItem = GJItemIcon::createBrowserItem(GJItem, v23);
if ( isIconUnlocked )
{
v40 = GameStatsManager::sharedState();
isItemEnabled = GameStatsManager::isItemEnabled(v40, GJItem, v23);
GJItemIcon::toggleEnabledState(BrowserItem, isItemEnabled);
}
if ( BrowserItem )
{
v30 = GJItemIcon::scaleForType(GJItem);
((void (__fastcall *)(GJItemIcon *))BrowserItem->setScale)(BrowserItem);
v56.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v56.adj = (size_t)GJGarageLayer::onToggleItem;
v31 = CCMenuItemSpriteExtra::create(BrowserItem, nullptr, v56);
getContentSize = v25->getContentSize;
v46[0] = (cocos2d::CCPoint *)v31->setContentSize;
v33 = (__int64)getContentSize(v25);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v46[0])(v31, v33);
v34 = v31->getContentSize;
v45 = BrowserItem->setPosition;
*(float *)&v35 = v34(v31)->width * 0.5;
v36 = v31->getContentSize;
*(_OWORD *)v46 = v35;
v37 = (__int64)v36(v31);
cocos2d::CCPoint::CCPoint(&v52, *(float *)v46, *(float *)(v37 + 4) * 0.5);
v45(BrowserItem, &v52);
v31->setTag(v31, v23);
v38 = v22->__vftable;
v31->m_iconType = Item;
v38->addChild(v22, v31);
v39 = 30 * v24++;
v46[0] = (cocos2d::CCPoint *)v31->setPosition;
cocos2d::CCPoint::CCPoint(&v51, (float)v39, 0.0);
cocos2d::CCPoint::operator+(&v52, v43, &v51);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *))v46[0])(v31, &v52);
if ( !isIconUnlocked )
{
if ( ItemUnlockState )
GJItemIcon::changeToLockedState(BrowserItem, 1.0 / v30);
else
GJItemIcon::darkenStoreItem(BrowserItem, (ShopType)&byte_5);
}
}
++v23;
}
while ( v23 != 21 );
}