//
// GJOptionsLayer::init from 0x4ab530 to 0x4ab784 (596 bytes)
//
// 5 xrefs:
// > EditorOptionsLayer::init @ 0x4ab7b6
// > GJOptionsLayer::create @ 0x4ab7da
// > GameOptionsLayer::init @ 0x4b178e
// > GameLevelOptionsLayer::init @ 0x4b1a94
// > LevelOptionsLayer::init @ 0x573036
//
// 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
//
bool GJOptionsLayer::init(GJOptionsLayer *a1, int a2)
{
_BOOL4 v3; // r8
cocos2d::CCDirector *v4; // r0
cocos2d::CCDictionary *v5; // r0
cocos2d::CCDictionary *v6; // r0
cocos2d::CCMenu *v7; // r0
cocos2d::CCSprite *v8; // r5
CCMenuItemSpriteExtra *v9; // r6
cocos2d::CCMenu *m_buttonMenu; // r11
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
float v12; // s16
cocos2d::CCSprite *v13; // r0
CCMenuItemSpriteExtra *v14; // r0
void (__fastcall *v15)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
cocos2d::CCDirector *v16; // r0
float v17; // r0
cocos2d::CCSprite *v18; // r10
CCMenuItemSpriteExtra *v19; // r0
CCMenuItemSpriteExtra *m_nextButton; // r9
cocos2d::CCMenu *v21; // r11
void (__fastcall *v22)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCDirector *v23; // r0
float v24; // r0
cocos2d::CCMenu *v26; // [sp+Ch] [bp-48h]
CCMenuItemSpriteExtra *m_prevButton; // [sp+14h] [bp-40h]
cocos2d::CCSize v28; // [sp+1Ch] [bp-38h] BYREF
int v29; // [sp+24h] [bp-30h]
int v30; // [sp+28h] [bp-2Ch]
void (*v31)(GJOptionsLayer *, cocos2d::CCObject *); // [sp+2Ch] [bp-28h]
int v32; // [sp+30h] [bp-24h]
void (*v33)(GJOptionsLayer *, cocos2d::CCObject *); // [sp+34h] [bp-20h]
int v34; // [sp+38h] [bp-1Ch]
cocos2d::CCPoint v35; // [sp+3Ch] [bp-18h] BYREF
cocos2d::CCPoint v36; // [sp+44h] [bp-10h] BYREF
v3 = SetupTriggerPopup::init(a1, nullptr, nullptr, 400.0, 280.0, a2);
if ( v3 )
{
a1->m_noElasticity = 1;
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v28, v4);
v5 = cocos2d::CCDictionary::create();
a1->m_variables = v5;
cocos2d::CCObject::retain(v5);
v6 = cocos2d::CCDictionary::create();
a1->m_values = v6;
cocos2d::CCObject::retain(v6);
v7 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v7;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v7, 10);
a1->setupOptions(a1);
v8 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v8->setScale)(v8, 1061997773);
v29 = 660;
v30 = 1;
v9 = CCMenuItemSpriteExtra::create(v8, nullptr, (cocos2d::SEL_MenuHandler)((unsigned int)a1 | 0x29400000000LL));
CCMenuItemSpriteExtra::setSizeMult(v9, 1.5);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v9);
m_buttonMenu = a1->m_buttonMenu;
setPosition = v9->setPosition;
cocos2d::CCPoint::CCPoint(
&v36,
(float)((float)(v28.width * 0.5) - (float)(a1->m_width * 0.5)) + 3.0,
(float)((float)(a1->m_height * 0.5) + (float)(v28.height * 0.5)) - 3.0);
cocos2d::CCNode::convertToNodeSpace(&v35, m_buttonMenu, &v36);
setPosition(v9, &v35);
v12 = v28.height * 0.5;
v13 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v32 = 0;
v31 = GJOptionsLayer::onPrevPage;
v14 = CCMenuItemSpriteExtra::create(
v13,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(GJOptionsLayer::onPrevPage, (unsigned int)a1));
a1->m_prevButton = v14;
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v14);
m_prevButton = a1->m_prevButton;
v15 = m_prevButton->setPosition;
v26 = a1->m_buttonMenu;
v16 = cocos2d::CCDirector::sharedDirector();
v17 = COERCE_FLOAT(cocos2d::CCDirector::getScreenLeft(v16));
cocos2d::CCPoint::CCPoint(&v36, v17 + 20.0, v12);
cocos2d::CCNode::convertToNodeSpace(&v35, v26, &v36);
v15(m_prevButton, &v35);
CCMenuItemSpriteExtra::setSizeMult(a1->m_prevButton, 1.5);
v18 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
cocos2d::CCSprite::setFlipX(v18, 1);
v33 = GJOptionsLayer::onNextPage;
v34 = 0;
v19 = CCMenuItemSpriteExtra::create(
v18,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(GJOptionsLayer::onNextPage, (unsigned int)a1));
a1->m_nextButton = v19;
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v19);
m_nextButton = a1->m_nextButton;
v21 = a1->m_buttonMenu;
v22 = m_nextButton->setPosition;
v23 = cocos2d::CCDirector::sharedDirector();
v24 = COERCE_FLOAT(cocos2d::CCDirector::getScreenRight(v23));
cocos2d::CCPoint::CCPoint(&v36, v24 - 20.0, v12);
cocos2d::CCNode::convertToNodeSpace(&v35, v21, &v36);
v22(m_nextButton, &v35);
CCMenuItemSpriteExtra::setSizeMult(a1->m_nextButton, 1.5);
GJOptionsLayer::goToPage(a1, 0);
}
return v3;
}