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