//
// ParentalOptionsLayer::addMasterToggle from 0x531dac to 0x532206 (1114 bytes)
//
// 2 xrefs:
// > ParentalOptionsLayer::init @ 0x53239a
// > ParentalOptionsLayer::init @ 0x5323b2
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:52:05 +0000
//
int __fastcall ParentalOptionsLayer::addMasterToggle(
cocos2d::CCArray **this,
const char *a2,
char *a3,
const char *a4,
const char *a5)
{
GameManager *v8; // r0
int GameVariable; // r0
cocos2d::CCDictionary *v10; // r6
size_t v11; // r0
cocos2d::CCObject *v12; // r0
cocos2d::CCObject *v13; // r6
int v14; // r0
int v15; // r11
void (__fastcall *v16)(int, _DWORD *); // r8
void (__fastcall *v17)(int, _DWORD *); // r8
cocos2d::CCArray *v18; // r0
cocos2d::CCArray *v19; // r0
cocos2d::CCArray *v20; // r8
size_t v21; // r0
const cocos2d::CCPoint *v22; // r10
cocos2d::CCNodeRGBA *ToggleButton; // r5
int v24; // r2
size_t v25; // r0
_BOOL4 v26; // r7
int v27; // r11
void (__fastcall *v28)(int, _DWORD *); // r7
void (__fastcall *v29)(int, _DWORD *); // r10
int result; // r0
size_t v31; // r0
int v32; // r11
cocos2d::CCObject *v33; // r10
size_t v34; // r0
const char *v35; // r1
int v36; // r6
cocos2d::CCObject *v37; // r6
void (__fastcall *v38)(cocos2d::CCObject *, _BYTE *); // r9
int v39; // r5
GameManager *v40; // [sp+34h] [bp-78h]
char *v41; // [sp+38h] [bp-74h]
cocos2d::CCObject *v42; // [sp+3Ch] [bp-70h]
int v43; // [sp+40h] [bp-6Ch]
float v45[2]; // [sp+54h] [bp-58h] BYREF
_BYTE v46[4]; // [sp+5Ch] [bp-50h] BYREF
float v47; // [sp+60h] [bp-4Ch]
_BYTE v48[8]; // [sp+64h] [bp-48h] BYREF
_BYTE v49[8]; // [sp+6Ch] [bp-40h] BYREF
unsigned int (__fastcall *v50)(ParentalOptionsLayer *, cocos2d::CCObject *); // [sp+74h] [bp-38h]
int v51; // [sp+78h] [bp-34h]
int v52; // [sp+7Ch] [bp-30h] BYREF
int v53; // [sp+80h] [bp-2Ch]
int v54; // [sp+84h] [bp-28h]
int v55; // [sp+88h] [bp-24h] BYREF
int v56; // [sp+8Ch] [bp-20h]
int v57; // [sp+90h] [bp-1Ch]
_DWORD v58[4]; // [sp+94h] [bp-18h] BYREF
cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)this);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v45);
v40 = (GameManager *)atoi(a3);
v8 = (GameManager *)GameManager::sharedState(v40);
GameVariable = GameManager::getGameVariable(v8, a3);
v55 = 0;
v56 = 0;
v57 = 0;
v10 = *(this + 135);
v43 = GameVariable;
v11 = strlen(a3);
std::string::__init(&v55, a3, v11);
v12 = (cocos2d::CCObject *)cocos2d::CCString::create(&v55);
cocos2d::CCDictionary::setObject(v10, v12, (int)v40);
std::string::~string((int)&v55);
v13 = ParentalOptionsLayer::layerForPage((ParentalOptionsLayer *)this, nullptr);
v42 = ParentalOptionsLayer::objectsForPage((ParentalOptionsLayer *)this, nullptr);
v14 = ParentalOptionsLayer::countForPage((ParentalOptionsLayer *)this, nullptr);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v46,
(float)(v45[0] * 0.5) - 120.0,
(float)((float)(v45[1] * 0.5) + 50.0) - (float)(80 * v14));
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v58, 0.0, 0.0, 80.0, 80.0);
v15 = cocos2d::extension::CCScale9Sprite::create("GJ_square05.png", v58);
v16 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v15 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v58, 340.0, 60.0);
v16(v15, v58);
v17 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v15 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v58, v45[0] * 0.5, v47);
v17(v15, v58);
v18 = (cocos2d::CCArray *)(*(int (__fastcall **)(cocos2d::CCObject *, int, int))(*(_DWORD *)v13 + 232))(v13, v15, -1);
v19 = (cocos2d::CCArray *)cocos2d::CCArray::create(v18);
v55 = 0;
v56 = 0;
v57 = 0;
v20 = v19;
v21 = strlen(a2);
std::string::__init(&v55, a2, v21);
v51 = 0;
v22 = *(this + 111);
v50 = ParentalOptionsLayer::onMasterToggle;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v58, (const cocos2d::CCPoint *)v46);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v49, 8.0, 0.0);
ToggleButton = GameToolbox::createToggleButton(
(int)&v55,
(int)v50,
v51,
v43,
v22,
(int)v58,
(int)this,
(int)v13,
0.9,
0.55,
120.0,
(int)v49,
"bigFont.fnt",
0,
0,
v20);
std::string::~string((int)&v55);
(*(void (__fastcall **)(cocos2d::CCNodeRGBA *, GameManager *))(*(_DWORD *)ToggleButton + 36))(ToggleButton, v40);
CCMenuItemToggler::setSizeMult(ToggleButton, 1.2);
*((_BYTE *)ToggleButton + 309) = 1;
ParentalOptionsLayer::incrementCountForPage((ParentalOptionsLayer *)this, nullptr, v24, 1);
cocos2d::CCArray::addObject(v42, ToggleButton);
v52 = 0;
v53 = 0;
v54 = 0;
v25 = strlen(a3);
std::string::__init(&v52, a3, v25);
v55 = 0;
v56 = 0;
v57 = 0;
std::string::__init(&v55, "0218", 4u);
v26 = sub_52C622((unsigned __int8 *)&v52, (unsigned __int8 *)&v55);
std::string::~string((int)&v55);
std::string::~string((int)&v52);
if ( v26 )
{
*(this + 136) = ToggleButton;
cocos2d::CCArray::addObjectsFromArray(*(this + 139), v20);
}
else
{
*(this + 137) = ToggleButton;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v58, (const cocos2d::CCPoint *)&unk_D2BDF4);
v27 = cocos2d::CCLabelBMFont::create(a4, "chatFont.fnt", -1082130432, 0, v58);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v27 + 80))(v27, 1058642330);
v28 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v27 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v58, 0.0, 0.5);
v28(v27, v58);
(*(void (__fastcall **)(cocos2d::CCObject *, int))(*(_DWORD *)v13 + 228))(v13, v27);
v29 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v27 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v49, 155.0, 0.0);
cocos2d::CCPoint::operator+(v58, v46, v49);
v29(v27, v58);
(*(void (__fastcall **)(cocos2d::CCNodeRGBA *, _DWORD))(*(_DWORD *)ToggleButton + 172))(ToggleButton, 0);
result = (*(int (__fastcall **)(cocos2d::CCObject *, _DWORD))(*(_DWORD *)v13 + 172))(v13, 0);
if ( a5 )
{
v52 = 0;
v53 = 0;
v54 = 0;
v31 = strlen(a5);
v32 = (int)*(this + 134);
std::string::__init(&v52, a5, v31);
v33 = (cocos2d::CCObject *)cocos2d::CCString::create(&v52);
v41 = (char *)ParentalOptionsLayer::infoKey((ParentalOptionsLayer *)this, (const char *)v40);
v55 = 0;
v56 = 0;
v57 = 0;
v34 = strlen(v41);
std::string::__init(&v55, v41, v34);
cocos2d::CCDictionary::setObject(v32, v33);
std::string::~string((int)&v55);
std::string::~string((int)&v52);
v36 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_infoIcon_001.png", v35);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v36 + 80))(v36, 1058642330);
v58[0] = ParentalOptionsLayer::onInfo;
v58[1] = 0;
v37 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(v36, 0, (int)this, (int)ParentalOptionsLayer::onInfo, 0);
CCMenuItemSpriteExtra::setSizeMult((int)v37, 2.0);
(*(void (__fastcall **)(cocos2d::CCObject *, GameManager *))(*(_DWORD *)v37 + 36))(v37, v40);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(*(_DWORD *)*(this + 111) + 228))(*(this + 111), v37);
v38 = *(void (__fastcall **)(cocos2d::CCObject *, _BYTE *))(*(_DWORD *)v37 + 92);
v39 = (*(int (__fastcall **)(cocos2d::CCNodeRGBA *))(*(_DWORD *)ToggleButton + 96))(ToggleButton);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v48, -27.0, 16.0);
cocos2d::CCPoint::operator+(v49, v39, v48);
v38(v37, v49);
cocos2d::CCArray::addObject(v42, v37);
return (*(int (__fastcall **)(cocos2d::CCObject *, _DWORD))(*(_DWORD *)v37 + 172))(v37, 0);
}
return result;
}