//
// GJOptionsLayer::init from 0x14028fa60 to 0x14028fd94 (820 bytes)
//
// 7 xrefs:
// > EditorPauseLayer::onOptions @ 0x1400dc9b0
// > EditorOptionsLayer::init @ 0x14029105d
// > GameLevelOptionsLayer::create @ 0x1402a0b79
// > LevelOptionsLayer::init @ 0x140324029
// > PauseLayer::onSettings @ 0x14037d669
// > ??> @ 0x1406d1910
// > ??> @ 0x1406d191c
//
// 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)
{
bool result; // al
__int64 v4; // rcx
cocos2d::CCDirector *v5; // rax
__int64 v6; // rcx
cocos2d::CCDictionary *v7; // rax
__int64 v8; // rcx
cocos2d::CCDictionary *v9; // rax
__int64 v10; // rcx
cocos2d::CCMenu *v11; // rax
cocos2d::CCLayer *m_mainLayer; // rcx
struct cocos2d::CCSprite *v13; // rbx
cocos2d::CCNode *v14; // rdi
cocos2d::CCNode_vtbl *v15; // rbx
struct cocos2d::CCPoint v16; // rax
struct cocos2d::CCSprite *v17; // rax
CCMenuItemSpriteExtra *v18; // rax
cocos2d::CCMenu *m_buttonMenu; // rcx
CCMenuItemSpriteExtra_vtbl *v20; // rbx
__int64 v21; // rcx
cocos2d::CCDirector *v22; // rax
float v23; // xmm0_4
struct cocos2d::CCPoint v24; // rax
cocos2d::CCSprite *v25; // rbx
CCMenuItemSpriteExtra *v26; // rax
cocos2d::CCMenu *v27; // rcx
CCMenuItemSpriteExtra_vtbl *v28; // rbx
__int64 v29; // rcx
cocos2d::CCDirector *v30; // rax
float v31; // xmm0_4
struct cocos2d::CCPoint v32; // rax
struct cocos2d::CCPoint v33[2]; // [rsp+30h] [rbp-38h] BYREF
float v34; // [rsp+80h] [rbp+18h]
result = SetupTriggerPopup::init(a1, nullptr, nullptr, 400.0, 280.0, a2);
if ( result )
{
a1->m_noElasticity = 1;
v5 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v4);
cocos2d::CCDirector::getWinSize(v5);
v7 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v6);
a1->m_variables = v7;
cocos2d::CCObject::retain(v7);
v9 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v8);
a1->m_values = v9;
cocos2d::CCObject::retain(v9);
v11 = (cocos2d::CCMenu *)cocos2d::CCMenu::create(v10);
m_mainLayer = a1->m_mainLayer;
a1->m_buttonMenu = v11;
m_mainLayer->addChild_0(m_mainLayer, v11, 10);
a1->setupOptions(a1);
v13 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v13->setScale_0)(v13);
v14 = CCMenuItemSpriteExtra::create(v13, nullptr, a1, (cocos2d::SEL_MenuHandler *)sub_14009BEF0);
v14[1].m_unknown5 = 1069547520;
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v14);
v15 = v14->__vftable;
cocos2d::CCPoint::CCPoint(a1->m_width * 0.5, (float)((float)(v34 * 0.5) - (float)(a1->m_width * 0.5)) + 3.0);
v16 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, v33);
((void (__fastcall *)(cocos2d::CCNode *, struct cocos2d::CCPoint))v15->setPosition_0)(v14, v16);
v17 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v18 = CCMenuItemSpriteExtra::create(v17, nullptr, a1, (cocos2d::SEL_MenuHandler *)GJOptionsLayer::onPrevPage);
m_buttonMenu = a1->m_buttonMenu;
a1->m_prevButton = v18;
m_buttonMenu->addChild_1(m_buttonMenu, v18);
v20 = a1->m_prevButton->__vftable;
v22 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v21);
v23 = cocos2d::CCDirector::getScreenLeft(v22) + 20.0;
cocos2d::CCPoint::CCPoint(v23, v23);
v24 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, v33);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v20->setPosition_0)(a1->m_prevButton, v24);
HIDWORD(a1->m_prevButton->m_pfnSelector.adj) = 1069547520;
v25 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
cocos2d::CCSprite::setFlipX(v25, 1);
v26 = CCMenuItemSpriteExtra::create(v25, nullptr, a1, (cocos2d::SEL_MenuHandler *)GJOptionsLayer::onNextPage);
v27 = a1->m_buttonMenu;
a1->m_nextButton = v26;
v27->addChild_1(v27, v26);
v28 = a1->m_nextButton->__vftable;
v30 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v29);
v31 = cocos2d::CCDirector::getScreenRight(v30) - 20.0;
cocos2d::CCPoint::CCPoint(v31, v31);
v32 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, v33);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v28->setPosition_0)(a1->m_nextButton, v32);
HIDWORD(a1->m_nextButton->m_pfnSelector.adj) = 1069547520;
GJOptionsLayer::goToPage(a1, 0);
return 1;
}
return result;
}