//
// ParentalOptionsLayer::addToggle from 0x8f25c4 to 0x8f29f4 (1072 bytes)
//
// 5 xrefs:
// > ParentalOptionsLayer::init @ 0x8f6d30
// > ParentalOptionsLayer::init @ 0x8f6d54
// > ParentalOptionsLayer::init @ 0x8f6d78
// > ParentalOptionsLayer::init @ 0x8f6d9c
// > ??> @ 0xfd4c8
//
// 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:56:59 +0000
//
__int64 __fastcall ParentalOptionsLayer::addToggle(
ParentalOptionsLayer *this,
char *a2,
char *a3,
unsigned int a4,
char *a5)
{
int v9; // w1
int v11; // w2
__int64 v13; // x1
GameManager *v14; // x0
unsigned int v15; // w24
GameManager *v16; // x0
size_t v17; // x0
char *v18; // x1
cocos2d::CCDictionary *v19; // x22
cocos2d::CCObject *v20; // x0
cocos2d::CCObject *v21; // x25
size_t v22; // x0
CCMenuItemToggler *v23; // x26
cocos2d::CCObject *v24; // x20
size_t v25; // x0
char *v26; // x1
__int64 v27; // x27
cocos2d::CCObject *v28; // x25
size_t v29; // x0
const char *v30; // x1
__int64 v31; // x21
cocos2d::CCObject *v32; // x21
void (__fastcall *v33)(cocos2d::CCObject *, __int64 *); // x19
__int64 v34; // x24
unsigned __int8 GameVariable; // [xsp+97h] [xbp+67h]
cocos2d::CCNode *v37; // [xsp+98h] [xbp+68h]
char *v38; // [xsp+98h] [xbp+68h]
float v39; // [xsp+A0h] [xbp+70h] BYREF
float v40; // [xsp+A8h] [xbp+78h] BYREF
__int64 v41; // [xsp+B0h] [xbp+80h] BYREF
__int64 v42[2]; // [xsp+B8h] [xbp+88h] BYREF
void *v43; // [xsp+C8h] [xbp+98h]
__int64 v44; // [xsp+D0h] [xbp+A0h] BYREF
__int64 v45; // [xsp+D8h] [xbp+A8h]
void *v46; // [xsp+E0h] [xbp+B0h]
__int64 v47; // [xsp+E8h] [xbp+B8h]
v9 = *((_DWORD *)this + 166);
v11 = *((_DWORD *)this + 167);
*((_DWORD *)this + 166) = v9 + 1;
v13 = _stack_chk_guard;
if ( (int)a4 >= v11 )
v11 = a4;
*((_DWORD *)this + 167) = v11;
v47 = v13;
v14 = (GameManager *)atoi(a3);
v15 = (unsigned int)v14;
v16 = (GameManager *)GameManager::sharedState(v14);
GameVariable = GameManager::getGameVariable(v16, a3);
v44 = 0;
v45 = 0;
v46 = nullptr;
v17 = strlen(a3);
v18 = a3;
v19 = *((cocos2d::CCDictionary **)this + 86);
std::string::__init(&v44, v18, v17);
v20 = (cocos2d::CCObject *)cocos2d::CCString::create(&v44);
cocos2d::CCDictionary::setObject(v19, v20, (int)v15);
if ( (v44 & 1) != 0 )
operator delete(v46);
ParentalOptionsLayer::nextPosition(this, (const char *)a4, &v39);
v21 = ParentalOptionsLayer::layerForPage(this, (const char *)a4);
v44 = 0;
v45 = 0;
v46 = nullptr;
v22 = strlen(a2);
std::string::__init(&v44, a2, v22);
v37 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v41, (const cocos2d::CCPoint *)&v39);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v40, 8.0, 0.0);
v23 = GameToolbox::createToggleButton(
(__int64)&v44,
(const char *)ParentalOptionsLayer::onToggle,
0,
GameVariable,
v37,
(const cocos2d::CCPoint *)&v41,
(__int64)this,
(__int64)v21,
0.8,
0.5,
110.0,
&v40,
"bigFont.fnt",
0,
0,
*((cocos2d::CCArray **)this + 91));
if ( (v44 & 1) != 0 )
operator delete(v46);
(*(void (__fastcall **)(CCMenuItemToggler *, _QWORD))(*(_QWORD *)v23 + 72LL))(v23, v15);
CCMenuItemToggler::setSizeMult(v23, 1.0);
ParentalOptionsLayer::incrementCountForPage(this, (const char *)a4);
v24 = ParentalOptionsLayer::objectsForPage(this, (const char *)a4);
cocos2d::CCArray::addObject(v24, v23);
(*(void (__fastcall **)(CCMenuItemToggler *, _QWORD))(*(_QWORD *)v23 + 344LL))(v23, 0);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v21 + 344LL))(v21, 0);
if ( a5 )
{
v42[0] = 0;
v42[1] = 0;
v43 = nullptr;
v25 = strlen(a5);
v26 = a5;
v27 = *((_QWORD *)this + 85);
std::string::__init(v42, v26, v25);
v28 = (cocos2d::CCObject *)cocos2d::CCString::create(v42);
v38 = (char *)ParentalOptionsLayer::infoKey(this, (const char *)v15);
v44 = 0;
v45 = 0;
v46 = nullptr;
v29 = strlen(v38);
std::string::__init(&v44, v38, v29);
cocos2d::CCDictionary::setObject(v27, v28);
if ( (v44 & 1) != 0 )
operator delete(v46);
if ( (v42[0] & 1) != 0 )
operator delete(v43);
v31 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_infoIcon_001.png", v30);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v31 + 160LL))(v31, 0.5);
v32 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
v31,
0,
(__int64)this,
(__int64)ParentalOptionsLayer::onInfo,
0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v32, 2.0);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v32 + 72LL))(v32, v15);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**((_QWORD **)this + 69) + 456LL))(
*((_QWORD *)this + 69),
v32);
v33 = *(void (__fastcall **)(cocos2d::CCObject *, __int64 *))(*(_QWORD *)v32 + 184LL);
v34 = (*(__int64 (__fastcall **)(CCMenuItemToggler *))(*(_QWORD *)v23 + 192LL))(v23);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v40, -18.0, 16.0);
cocos2d::CCPoint::operator+(&v41, v34);
v33(v32, &v41);
cocos2d::CCArray::addObject(v24, v32);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v32 + 344LL))(v32, 0);
}
return _stack_chk_guard;
}