//
// UIPOptionsLayer::init from 0x8c5e0c to 0x8c635c (1360 bytes)
//
// 2 xrefs:
// > ??> @ 0x3d158
// > ??> @ 0x119f900
//
// 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 UIPOptionsLayer::init(UIPOptionsLayer *a1)
{
bool v2; // w24
void (__fastcall *setColor)(cocos2d::CCLayerColor *__hidden, const cocos2d::ccColor3B *); // x2
cocos2d::CCDirector *v5; // x0
cocos2d::CCMenu *v6; // x0
cocos2d::CCLayer *m_mainLayer; // x3
const char *v8; // x6
cocos2d::CCNode *v9; // x0
CCMenuItemSpriteExtra *v10; // x23
CCMenuItemSpriteExtra_vtbl *v11; // x2
const char *v12; // x6
cocos2d::CCNode *v13; // x0
CCMenuItemSpriteExtra *v14; // x25
CCMenuItemSpriteExtra *v15; // x0
const cocos2d::CCPoint *(__fastcall *getPosition)(cocos2d::CCNode *__hidden); // x1
void (__fastcall *v17)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
__int64 v18; // x26
float v19; // s3
float v20; // s4
void *v21; // x0
float v22; // s8
cocos2d::CCNode *v23; // x0
cocos2d::CCNode_vtbl *v24; // x2
cocos2d::CCSprite *v25; // x27
cocos2d::CCSprite *v26; // x26
cocos2d::CCArray *v27; // x0
cocos2d::CCArray *v28; // x23
GameManager *v29; // x0
long double v30; // q0
float v31; // s8
cocos2d::CCDirector *v32; // x0
float v33; // s0
float v34; // s0
float v35; // s1
unsigned int *v36; // x2
int v37; // w1
int v38; // [xsp+18h] [xbp-18h]
char v39; // [xsp+20h] [xbp-10h]
cocos2d::CCNode *v40[2]; // [xsp+30h] [xbp+0h] BYREF
cocos2d::CCNode *m_buttonMenu; // [xsp+B0h] [xbp+80h]
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+B8h] [xbp+88h]
float v43; // [xsp+D0h] [xbp+A0h]
float v44; // [xsp+D4h] [xbp+A4h]
cocos2d::CCPoint v45; // [xsp+D8h] [xbp+A8h] BYREF
cocos2d::CCPoint v46; // [xsp+E0h] [xbp+B0h] BYREF
cocos2d::CCPoint v47; // [xsp+E8h] [xbp+B8h] BYREF
cocos2d::CCPoint v48; // [xsp+F0h] [xbp+C0h] BYREF
cocos2d::CCPoint v49; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v50; // 0:x2.16
cocos2d::SEL_MenuHandler v51; // 0:x2.16
cocos2d::CCPoint v52; // 0:s0.4,4:s1.4
cocos2d::CCPoint v53; // 0:s1.4,4:s2.4
v2 = SetupTriggerPopup::init(a1, nullptr, nullptr, 400.0, 280.0, 1);
if ( v2 )
{
SetupTriggerPopup::preSetup(a1);
setColor = a1->setColor;
LOWORD(v48.x) = 17459;
BYTE2(v48.x) = -103;
setColor(a1, (const cocos2d::ccColor3B *)&v48);
a1->setOpacity(a1, 0xFFFFFFFFLL);
a1->m_noElasticity = 1;
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
v6 = cocos2d::CCMenu::create();
m_mainLayer = a1->m_mainLayer;
a1->m_buttonMenu = v6;
m_mainLayer->addChild_0(m_mainLayer, v6, 10);
v9 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&qword_28,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_01.png",
v8,
30.0);
v50.adj = 1320;
v50.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v10 = CCMenuItemSpriteExtra::create(v9, nullptr, v50);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v10);
v11 = v10->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
m_buttonMenu = a1->m_buttonMenu;
setPosition = v11->setPosition;
cocos2d::CCPoint::CCPoint(&v47, (float)(v43 * 0.5) + -40.0, v44 - 30.0);
v49 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v47);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, float, float))setPosition)(
v10,
&v48,
v49.x,
v49.y);
v13 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"Reset",
(const char *)&qword_28,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_05.png",
v12,
30.0);
v51.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v51.adj = (size_t)UIPOptionsLayer::onReset;
v14 = CCMenuItemSpriteExtra::create(v13, nullptr, v51);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v14);
v15 = v10;
getPosition = v10->getPosition;
v17 = v14->setPosition;
v18 = (__int64)getPosition(v15);
cocos2d::CCPoint::CCPoint(&v47, 80.0, 0.0);
cocos2d::CCPoint::operator+(&v48, v18, &v47);
v17(v14, &v48);
SetupTriggerPopup::toggleBG(a1, 0);
cocos2d::CCPoint::CCPoint(&v45, v43 * 0.5, v44 - 70.0);
sub_D153B8((int)&v48, "Opacity:");
cocos2d::CCPoint::CCPoint(&v46, 0.0, -75.0);
cocos2d::CCPoint::operator+(&v47, &v45, &v46);
v52.x = 0.8;
v52.y = 0.0;
v38 = 2;
v39 = 0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
-29,
(std::string)&v48,
v52,
1.0,
(unsigned __int8)v40 - 72,
(InputValueType)0,
1,
4,
v19,
v20,
0,
0,
GoldLabel,
1,
v38,
v39);
v21 = (void *)(*(_QWORD *)&v48 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v48 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v36 = (unsigned int *)(*(_QWORD *)&v48 - 8LL);
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = *(_DWORD *)(*(_QWORD *)&v48 - 8LL);
*(_DWORD *)(*(_QWORD *)&v48 - 8LL) = v37 - 1;
}
if ( v37 <= 0 )
operator delete(v21);
}
v22 = GameManager::sharedState()->m_practiceOpacity * 255.0;
v23 = cocos2d::CCNode::create();
v24 = v23->__vftable;
a1->m_practiceNode = v23;
v24->setContentSize(v23, &stru_1242E68);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, a1->m_practiceNode, 9);
v25 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkpointBtn_001.png");
v25->setOpacity(v25, (unsigned int)v22);
a1->m_practiceNode->addChild(a1->m_practiceNode, v25);
v26 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_removeCheckBtn_001.png");
v26->setOpacity(v26, (unsigned int)v22);
v27 = (cocos2d::CCArray *)((__int64 (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSprite *))a1->m_practiceNode->addChild)(
a1->m_practiceNode,
v26);
v28 = (cocos2d::CCArray *)cocos2d::CCArray::create(v27);
cocos2d::CCArray::addObject(v28, v25);
cocos2d::CCArray::addObject(v28, v26);
v29 = GameManager::sharedState();
cocos2d::CCPoint::CCPoint(&v47, &v29->m_practicePos);
*(float *)&v30 = v47.x;
if ( v47.x == 0.0 )
{
*(float *)&v30 = v47.y;
if ( v47.y == 0.0 )
{
v31 = v43 * 0.5;
v32 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenBottom(v32);
cocos2d::CCPoint::CCPoint(&v48, v31, v33 + 40.0);
cocos2d::CCPoint::operator=(&v47, v34, v35);
}
}
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCPoint *, long double))a1->m_practiceNode->setPosition)(
a1->m_practiceNode,
&v47,
v30);
cocos2d::CCPoint::CCPoint(&v48, &stru_1242E70);
GameToolbox::alignItemsHorisontally(v28, 10.0, v53, (unsigned __int8)v40 - 64);
SetupTriggerPopup::postSetup(a1);
}
return v2;
}