//
// MoreOptionsLayer::addToggle from 0x8f0820 to 0x8f0c7c (1116 bytes)
//
// 53 xrefs:
// > MoreOptionsLayer::init @ 0x8f7c5c
// > MoreOptionsLayer::init @ 0x8f7c7c
// > MoreOptionsLayer::init @ 0x8f7c9c
// > MoreOptionsLayer::init @ 0x8f7cbc
// > MoreOptionsLayer::init @ 0x8f7cdc
// > MoreOptionsLayer::init @ 0x8f7cfc
// > MoreOptionsLayer::init @ 0x8f7d20
// > MoreOptionsLayer::init @ 0x8f7d40
// > MoreOptionsLayer::init @ 0x8f7d60
// > MoreOptionsLayer::init @ 0x8f7d80
// > MoreOptionsLayer::init @ 0x8f7da0
// > MoreOptionsLayer::init @ 0x8f7dc0
// > MoreOptionsLayer::init @ 0x8f7de0
// > MoreOptionsLayer::init @ 0x8f7e00
// > MoreOptionsLayer::init @ 0x8f7e20
// > MoreOptionsLayer::init @ 0x8f7e40
// > MoreOptionsLayer::init @ 0x8f7e60
// > MoreOptionsLayer::init @ 0x8f7e80
// > MoreOptionsLayer::init @ 0x8f7ea0
// > MoreOptionsLayer::init @ 0x8f7ec0
// > MoreOptionsLayer::init @ 0x8f7ee0
// > MoreOptionsLayer::init @ 0x8f7f04
// > MoreOptionsLayer::init @ 0x8f7f24
// > MoreOptionsLayer::init @ 0x8f7f44
// > MoreOptionsLayer::init @ 0x8f7f64
// > MoreOptionsLayer::init @ 0x8f7f84
// > MoreOptionsLayer::init @ 0x8f7fa4
// > MoreOptionsLayer::init @ 0x8f7fc4
// > MoreOptionsLayer::init @ 0x8f7fe4
// > MoreOptionsLayer::init @ 0x8f800c
// > MoreOptionsLayer::init @ 0x8f802c
// > MoreOptionsLayer::init @ 0x8f804c
// > MoreOptionsLayer::init @ 0x8f806c
// > MoreOptionsLayer::init @ 0x8f808c
// > MoreOptionsLayer::init @ 0x8f80ac
// > MoreOptionsLayer::init @ 0x8f80cc
// > MoreOptionsLayer::init @ 0x8f80ec
// > MoreOptionsLayer::init @ 0x8f810c
// > MoreOptionsLayer::init @ 0x8f8134
// > MoreOptionsLayer::init @ 0x8f8154
// > MoreOptionsLayer::init @ 0x8f8174
// > MoreOptionsLayer::init @ 0x8f8194
// > MoreOptionsLayer::init @ 0x8f81bc
// > MoreOptionsLayer::init @ 0x8f81dc
// > MoreOptionsLayer::init @ 0x8f81fc
// > MoreOptionsLayer::init @ 0x8f821c
// > MoreOptionsLayer::init @ 0x8f823c
// > MoreOptionsLayer::init @ 0x8f825c
// > MoreOptionsLayer::init @ 0x8f827c
// > MoreOptionsLayer::init @ 0x8f829c
// > MoreOptionsLayer::init @ 0x8f82bc
// > MoreOptionsLayer::init @ 0x8f82d8
// > ??> @ 0x74560
//
// 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 MoreOptionsLayer::addToggle(MoreOptionsLayer *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 + 171);
*((_DWORD *)this + 171) = v6 + 1;
v9 = floorf((float)(v6 / 10));
if ( v9 <= 0.0 )
v10 = 0;
else
v10 = (int)v9;
v11 = *((_DWORD *)this + 172);
if ( (int)v10 >= v11 )
v11 = v10;
*((_DWORD *)this + 172) = 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 + 88);
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);
MoreOptionsLayer::nextPosition(this, (const char *)v10, &v37);
v19 = MoreOptionsLayer::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 *)MoreOptionsLayer::onToggle,
0,
GameVariable,
v35,
(const cocos2d::CCPoint *)&v39,
(__int64)this,
(__int64)v19,
0.8,
0.4,
130.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);
MoreOptionsLayer::incrementCountForPage(this, (const char *)v10);
v22 = MoreOptionsLayer::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 + 87);
std::string::__init(v40, v24, v23);
v26 = (cocos2d::CCObject *)cocos2d::CCString::create(v40);
v36 = (char *)MoreOptionsLayer::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)MoreOptionsLayer::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;
}