//
// ParentalOptionsLayer::addMasterToggle from 0x8f6440 to 0x8f6ac4 (1668 bytes)
//
// 3 xrefs:
// > ParentalOptionsLayer::init @ 0x8f6ce4
// > ParentalOptionsLayer::init @ 0x8f6d0c
// > ??> @ 0x79498
//
// This function is hookable on this platform (idp: arm, 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 12:57:01 +0000
//
__int64 __fastcall ParentalOptionsLayer::addMasterToggle(
ParentalOptionsLayer *this,
char *a2,
char *a3,
const char *a4,
char *a5)
{
cocos2d::CCDirector *v8; // x0
GameManager *v9; // x0
unsigned int v10; // w26
GameManager *v11; // x0
unsigned __int8 GameVariable; // w27
size_t v13; // x0
cocos2d::CCDictionary *v14; // x19
cocos2d::CCObject *v15; // x0
cocos2d::CCObject *v16; // x23
int v17; // w0
__int64 v18; // x25
cocos2d::CCArray *v19; // x0
size_t v20; // x0
CCMenuItemToggler *v21; // x21
size_t v22; // x0
_BOOL4 v23; // w24
__int64 v24; // x24
size_t v25; // x0
__int64 v26; // x23
cocos2d::CCObject *v27; // x24
size_t v28; // x0
const char *v29; // x1
__int64 v30; // x22
cocos2d::CCObject *v31; // x22
void (__fastcall *v32)(cocos2d::CCObject *, _QWORD *); // x20
__int64 v33; // x21
cocos2d::CCArray *v35; // x0
cocos2d::CCNode *v38; // [xsp+B8h] [xbp+88h]
cocos2d::CCArray *v39; // [xsp+C0h] [xbp+90h]
cocos2d::CCArray *v40; // [xsp+C0h] [xbp+90h]
cocos2d::CCArray *v41; // [xsp+C0h] [xbp+90h]
cocos2d::CCArray *v42; // [xsp+C0h] [xbp+90h]
cocos2d::CCArray *v43; // [xsp+C0h] [xbp+90h]
cocos2d::CCArray *v44; // [xsp+C0h] [xbp+90h]
cocos2d::CCObject *v45; // [xsp+C8h] [xbp+98h]
__int64 v46; // [xsp+D0h] [xbp+A0h] BYREF
_BYTE v47[4]; // [xsp+D8h] [xbp+A8h] BYREF
float v48; // [xsp+DCh] [xbp+ACh]
float v49; // [xsp+E0h] [xbp+B0h] BYREF
_QWORD v50[2]; // [xsp+E8h] [xbp+B8h] BYREF
__int64 v51; // [xsp+F8h] [xbp+C8h] BYREF
__int64 v52; // [xsp+100h] [xbp+D0h]
void *v53; // [xsp+108h] [xbp+D8h]
__int64 v54; // [xsp+110h] [xbp+E0h] BYREF
__int64 v55; // [xsp+118h] [xbp+E8h]
void *v56; // [xsp+120h] [xbp+F0h]
v8 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(_stack_chk_guard);
cocos2d::CCDirector::getWinSize(&v46, v8);
v9 = (GameManager *)atoi(a3);
v10 = (unsigned int)v9;
v11 = (GameManager *)GameManager::sharedState(v9);
GameVariable = GameManager::getGameVariable(v11, a3);
v54 = 0;
v55 = 0;
v56 = nullptr;
v13 = strlen(a3);
v14 = *((cocos2d::CCDictionary **)this + 86);
std::string::__init(&v54, a3, v13);
v15 = (cocos2d::CCObject *)cocos2d::CCString::create(&v54);
cocos2d::CCDictionary::setObject(v14, v15, (int)v10);
if ( (v54 & 1) != 0 )
operator delete(v56);
v16 = ParentalOptionsLayer::layerForPage(this, nullptr);
v45 = ParentalOptionsLayer::objectsForPage(this, nullptr);
v17 = ParentalOptionsLayer::countForPage(this, nullptr);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v47,
(float)(*(float *)&v46 * 0.5) + -120.0,
(float)((float)(*((float *)&v46 + 1) * 0.5) + 50.0) - (float)(80 * v17));
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v50, 0.0, 0.0, 80.0, 80.0);
v18 = cocos2d::extension::CCScale9Sprite::create("GJ_square05.png", v50);
v39 = *(cocos2d::CCArray **)(*(_QWORD *)v18 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v50, 340.0, 60.0);
((void (__fastcall *)(__int64, _QWORD *))v39)(v18, v50);
v40 = *(cocos2d::CCArray **)(*(_QWORD *)v18 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, *(float *)&v46 * 0.5, v48);
((void (__fastcall *)(__int64, _QWORD *))v40)(v18, v50);
v19 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(cocos2d::CCObject *, __int64, __int64))(*(_QWORD *)v16 + 464LL))(
v16,
v18,
0xFFFFFFFFLL);
v41 = (cocos2d::CCArray *)cocos2d::CCArray::create(v19);
v54 = 0;
v55 = 0;
v56 = nullptr;
v20 = strlen(a2);
std::string::__init(&v54, a2, v20);
v38 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, (const cocos2d::CCPoint *)v47);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, 8.0, 0.0);
v21 = GameToolbox::createToggleButton(
(__int64)&v54,
(const char *)ParentalOptionsLayer::onMasterToggle,
0,
GameVariable,
v38,
(const cocos2d::CCPoint *)v50,
(__int64)this,
(__int64)v16,
0.9,
0.55,
120.0,
&v49,
"bigFont.fnt",
0,
0,
v41);
if ( (v54 & 1) != 0 )
operator delete(v56);
(*(void (__fastcall **)(CCMenuItemToggler *, _QWORD))(*(_QWORD *)v21 + 72LL))(v21, v10);
CCMenuItemToggler::setSizeMult(v21, 1.2);
*((_BYTE *)v21 + 393) = 1;
ParentalOptionsLayer::incrementCountForPage(this, nullptr);
cocos2d::CCArray::addObject(v45, v21);
v51 = 0;
v52 = 0;
v53 = nullptr;
v22 = strlen(a3);
std::string::__init(&v51, a3, v22);
v54 = 0;
v55 = 0;
v56 = nullptr;
std::string::__init(&v54, "0218", 4u);
v23 = sub_8EDB0C((__int64)&v51, (__int64)&v54);
if ( (v54 & 1) != 0 )
operator delete(v56);
if ( (v51 & 1) != 0 )
{
operator delete(v53);
if ( !v23 )
goto LABEL_9;
}
else if ( !v23 )
{
LABEL_9:
*((_QWORD *)this + 88) = v21;
goto LABEL_10;
}
v35 = *((cocos2d::CCArray **)this + 90);
*((_QWORD *)this + 87) = v21;
cocos2d::CCArray::addObjectsFromArray(v35, v41);
LABEL_10:
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, (const cocos2d::CCPoint *)&algn_155CC59[7]);
v24 = cocos2d::CCLabelBMFont::create(a4, "chatFont.fnt", 0, v50, -1.0);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v24 + 160LL))(v24, 0.6);
v42 = *(cocos2d::CCArray **)(*(_QWORD *)v24 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, 0.0, 0.5);
((void (__fastcall *)(__int64, _QWORD *))v42)(v24, v50);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v16 + 456LL))(v16, v24);
v43 = *(cocos2d::CCArray **)(*(_QWORD *)v24 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, 155.0, 0.0);
cocos2d::CCPoint::operator+(v50, v47);
((void (__fastcall *)(__int64, _QWORD *))v43)(v24, v50);
(*(void (__fastcall **)(CCMenuItemToggler *, _QWORD))(*(_QWORD *)v21 + 344LL))(v21, 0);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v16 + 344LL))(v16, 0);
if ( a5 )
{
v51 = 0;
v52 = 0;
v53 = nullptr;
v25 = strlen(a5);
v26 = *((_QWORD *)this + 85);
std::string::__init(&v51, a5, v25);
v27 = (cocos2d::CCObject *)cocos2d::CCString::create(&v51);
v44 = (cocos2d::CCArray *)ParentalOptionsLayer::infoKey(this, (const char *)v10);
v54 = 0;
v55 = 0;
v56 = nullptr;
v28 = strlen((const char *)v44);
std::string::__init(&v54, v44, v28);
cocos2d::CCDictionary::setObject(v26, v27);
if ( (v54 & 1) != 0 )
{
operator delete(v56);
if ( (v51 & 1) == 0 )
goto LABEL_13;
}
else if ( (v51 & 1) == 0 )
{
LABEL_13:
v30 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_infoIcon_001.png", v29);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v30 + 160LL))(v30, 0.6);
v31 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
v30,
0,
(__int64)this,
(__int64)ParentalOptionsLayer::onInfo,
0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v31, 2.0);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v31 + 72LL))(v31, v10);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**((_QWORD **)this + 69) + 456LL))(
*((_QWORD *)this + 69),
v31);
v32 = *(void (__fastcall **)(cocos2d::CCObject *, _QWORD *))(*(_QWORD *)v31 + 184LL);
v33 = (*(__int64 (__fastcall **)(CCMenuItemToggler *))(*(_QWORD *)v21 + 192LL))(v21);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, -27.0, 16.0);
cocos2d::CCPoint::operator+(v50, v33);
v32(v31, v50);
cocos2d::CCArray::addObject(v45, v31);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v31 + 344LL))(v31, 0);
return _stack_chk_guard;
}
operator delete(v53);
goto LABEL_13;
}
return _stack_chk_guard;
}