//
// MoreOptionsLayer::addToggle from 0x1000ee858 to 0x1000eebac (852 bytes)
//
// 51 xrefs:
// > MoreOptionsLayer::init @ 0x1000ed924
// > MoreOptionsLayer::init @ 0x1000ed944
// > MoreOptionsLayer::init @ 0x1000ed964
// > MoreOptionsLayer::init @ 0x1000ed984
// > MoreOptionsLayer::init @ 0x1000ed9a4
// > MoreOptionsLayer::init @ 0x1000ed9c4
// > MoreOptionsLayer::init @ 0x1000eda14
// > MoreOptionsLayer::init @ 0x1000eda34
// > MoreOptionsLayer::init @ 0x1000eda54
// > MoreOptionsLayer::init @ 0x1000eda74
// > MoreOptionsLayer::init @ 0x1000eda94
// > MoreOptionsLayer::init @ 0x1000edab4
// > MoreOptionsLayer::init @ 0x1000edad4
// > MoreOptionsLayer::init @ 0x1000edaf4
// > MoreOptionsLayer::init @ 0x1000edb14
// > MoreOptionsLayer::init @ 0x1000edb34
// > MoreOptionsLayer::init @ 0x1000edb54
// > MoreOptionsLayer::init @ 0x1000edb74
// > MoreOptionsLayer::init @ 0x1000edb94
// > MoreOptionsLayer::init @ 0x1000edbb4
// > MoreOptionsLayer::init @ 0x1000edbd4
// > MoreOptionsLayer::init @ 0x1000edc24
// > MoreOptionsLayer::init @ 0x1000edc44
// > MoreOptionsLayer::init @ 0x1000edc64
// > MoreOptionsLayer::init @ 0x1000edc84
// > MoreOptionsLayer::init @ 0x1000edca4
// > MoreOptionsLayer::init @ 0x1000edcc4
// > MoreOptionsLayer::init @ 0x1000edce4
// > MoreOptionsLayer::init @ 0x1000edd34
// > MoreOptionsLayer::init @ 0x1000edd54
// > MoreOptionsLayer::init @ 0x1000edd74
// > MoreOptionsLayer::init @ 0x1000edd94
// > MoreOptionsLayer::init @ 0x1000eddb4
// > MoreOptionsLayer::init @ 0x1000eddd4
// > MoreOptionsLayer::init @ 0x1000eddf4
// > MoreOptionsLayer::init @ 0x1000ede14
// > MoreOptionsLayer::init @ 0x1000ede34
// > MoreOptionsLayer::init @ 0x1000ede84
// > MoreOptionsLayer::init @ 0x1000edea4
// > MoreOptionsLayer::init @ 0x1000edec4
// > MoreOptionsLayer::init @ 0x1000edee4
// > MoreOptionsLayer::init @ 0x1000edf38
// > MoreOptionsLayer::init @ 0x1000edf58
// > MoreOptionsLayer::init @ 0x1000edf78
// > MoreOptionsLayer::init @ 0x1000edf98
// > MoreOptionsLayer::init @ 0x1000edfb8
// > MoreOptionsLayer::init @ 0x1000edfd8
// > MoreOptionsLayer::init @ 0x1000edff8
// > MoreOptionsLayer::init @ 0x1000ee018
// > MoreOptionsLayer::init @ 0x1000ee038
// > MoreOptionsLayer::init @ 0x1000ee058
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall MoreOptionsLayer::addToggle(MoreOptionsLayer *a1, const char *a2, const char *a3, const char *a4)
{
int m_toggleCount; // w8
int v9; // w23
int m_pageCount; // w8
__int64 v11; // x20
GameManager *v12; // x0
bool GameVariable; // w22
cocos2d::CCDictionary *m_objects; // x26
cocos2d::CCObject *v15; // x0
cocos2d::CCLayer *v16; // x24
cocos2d::CCMenu *m_buttonMenu; // x25
__n128 v18; // q0
__n128 v19; // q1
CCMenuItemToggler *ToggleButton; // x22
cocos2d::CCArray *v21; // x23
__n128 v22; // q0
cocos2d::CCDictionary *m_variables; // x24
__int64 v24; // x21
cocos2d::CCString *v25; // x0
char *CString; // x0
cocos2d::CCSprite *v27; // x21
CCMenuItemSpriteExtra *v28; // x21
float32x2_t *v29; // x19
__n128 v30; // q0
__n128 v31; // q1
double v32; // d0
__n128 v33; // q0
void *v34[2]; // [xsp+20h] [xbp-90h] BYREF
char v35; // [xsp+37h] [xbp-79h]
void *v36[2]; // [xsp+38h] [xbp-78h] BYREF
char v37; // [xsp+4Fh] [xbp-61h]
__int64 v38; // [xsp+50h] [xbp-60h] BYREF
void *__p[2]; // [xsp+58h] [xbp-58h] BYREF
char v40; // [xsp+6Fh] [xbp-41h]
cocos2d::SEL_MenuHandler v41; // 0:x3.16
m_toggleCount = a1->m_toggleCount;
a1->m_toggleCount = m_toggleCount + 1;
if ( m_toggleCount < 10 )
v9 = 0;
else
v9 = (int)(float)(m_toggleCount / 0xAu);
m_pageCount = a1->m_pageCount;
if ( m_pageCount <= v9 )
m_pageCount = v9;
a1->m_pageCount = m_pageCount;
v11 = atoi(a3);
v12 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v12, a3);
m_objects = a1->m_objects;
sub_100009900(__p, (char *)a3);
v15 = (cocos2d::CCObject *)sub_100268E48(__p);
cocos2d::CCDictionary::setObject(m_objects, v15, (int)v11);
if ( v40 < 0 )
operator delete(__p[0]);
MoreOptionsLayer::nextPosition(a1, v9);
v16 = MoreOptionsLayer::layerForPage(a1, v9);
sub_100009900(v36, (char *)a2);
m_buttonMenu = a1->m_buttonMenu;
sub_1000229B8((__int64 *)__p, &v38);
v18.n128_u32[0] = 8.0;
v19.n128_u32[0] = 0;
sub_100022980(v18, v19, v34);
ToggleButton = GameToolbox::createToggleButton(
(const char *)v36,
(void (__cdecl *)(cocos2d::CCObject *))MoreOptionsLayer::onToggle,
0,
GameVariable,
m_buttonMenu,
(cocos2d::CCPoint *)__p,
a1,
v16,
0.8,
0.4,
130.0,
(float *)v34,
"bigFont.fnt",
0,
0,
0);
if ( v37 < 0 )
operator delete(v36[0]);
((void (__fastcall *)(CCMenuItemToggler *, __int64))ToggleButton->setTag)(ToggleButton, v11);
CCMenuItemToggler::setSizeMult(ToggleButton, 1.0);
MoreOptionsLayer::incrementCountForPage(a1, v9);
v21 = MoreOptionsLayer::objectsForPage(a1, v9);
v22 = sub_10024A2D0(v21, ToggleButton);
((void (__fastcall *)(CCMenuItemToggler *, _QWORD, __n128))ToggleButton->setVisible)(ToggleButton, 0, v22);
((void (__fastcall *)(cocos2d::CCLayer *, _QWORD))v16->setVisible)(v16, 0);
if ( a4 )
{
m_variables = a1->m_variables;
sub_100009900(__p, (char *)a4);
v24 = sub_100268E48(__p);
v25 = (cocos2d::CCString *)sub_100268F4C("info_%i", v11);
CString = (char *)cocos2d::CCString::getCString(v25);
sub_100009900(v34, CString);
cocos2d::CCDictionary::setObject_1(m_variables, v24, v34);
if ( v35 < 0 )
operator delete(v34[0]);
if ( v40 < 0 )
operator delete(__p[0]);
v27 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v27->setScale)(v27, 0.5);
v41.ptr = (void (__cdecl *)(cocos2d::CCObject *))MoreOptionsLayer::onInfo;
v41.adj = 0;
v28 = CCMenuItemSpriteExtra::create(v27, nullptr, a1, v41);
CCMenuItemSpriteExtra::setSizeMult(v28, 2.0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v28->setTag)(v28, v11);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v28);
v29 = (float32x2_t *)((__int64 (__fastcall *)(CCMenuItemToggler *))ToggleButton->getPosition)(ToggleButton);
v30.n128_u32[0] = -18.0;
v31.n128_u32[0] = 16.0;
sub_100022980(v30, v31, v34);
*(float32x2_t *)&v32 = sub_1000229DC(v29, (float32x2_t *)v34, (float32x2_t *)__p);
((void (__fastcall *)(CCMenuItemSpriteExtra *, void **, double))v28->setPosition)(v28, __p, v32);
v33 = sub_10024A2D0(v21, v28);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD, __n128))v28->setVisible)(v28, 0, v33);
}
}