//
// MoreOptionsLayer::addToggle from 0x422e94 to 0x423114 (640 bytes)
//
// 51 xrefs:
// > MoreOptionsLayer::init @ 0x4235ce
// > MoreOptionsLayer::init @ 0x4235e0
// > MoreOptionsLayer::init @ 0x4235f2
// > MoreOptionsLayer::init @ 0x423604
// > MoreOptionsLayer::init @ 0x423616
// > MoreOptionsLayer::init @ 0x423628
// > MoreOptionsLayer::init @ 0x42363e
// > MoreOptionsLayer::init @ 0x423650
// > MoreOptionsLayer::init @ 0x423662
// > MoreOptionsLayer::init @ 0x423674
// > MoreOptionsLayer::init @ 0x423686
// > MoreOptionsLayer::init @ 0x423698
// > MoreOptionsLayer::init @ 0x4236aa
// > MoreOptionsLayer::init @ 0x4236bc
// > MoreOptionsLayer::init @ 0x4236ce
// > MoreOptionsLayer::init @ 0x4236e0
// > MoreOptionsLayer::init @ 0x4236f2
// > MoreOptionsLayer::init @ 0x423704
// > MoreOptionsLayer::init @ 0x423716
// > MoreOptionsLayer::init @ 0x423728
// > MoreOptionsLayer::init @ 0x42373a
// > MoreOptionsLayer::init @ 0x423752
// > MoreOptionsLayer::init @ 0x423764
// > MoreOptionsLayer::init @ 0x423776
// > MoreOptionsLayer::init @ 0x423788
// > MoreOptionsLayer::init @ 0x423906
// > MoreOptionsLayer::init @ 0x42391e
// > MoreOptionsLayer::init @ 0x423936
// > MoreOptionsLayer::init @ 0x423954
// > MoreOptionsLayer::init @ 0x42396c
// > MoreOptionsLayer::init @ 0x423984
// > MoreOptionsLayer::init @ 0x42399c
// > MoreOptionsLayer::init @ 0x4239b4
// > MoreOptionsLayer::init @ 0x4239cc
// > MoreOptionsLayer::init @ 0x4239e4
// > MoreOptionsLayer::init @ 0x4239fc
// > MoreOptionsLayer::init @ 0x423a14
// > MoreOptionsLayer::init @ 0x423a32
// > MoreOptionsLayer::init @ 0x423a4a
// > MoreOptionsLayer::init @ 0x423a62
// > MoreOptionsLayer::init @ 0x423a7a
// > MoreOptionsLayer::init @ 0x423a98
// > MoreOptionsLayer::init @ 0x423ab0
// > MoreOptionsLayer::init @ 0x423ac8
// > MoreOptionsLayer::init @ 0x423ae0
// > MoreOptionsLayer::init @ 0x423af8
// > MoreOptionsLayer::init @ 0x423b10
// > MoreOptionsLayer::init @ 0x423b28
// > MoreOptionsLayer::init @ 0x423b40
// > MoreOptionsLayer::init @ 0x423b58
// > MoreOptionsLayer::init @ 0x423b70
//
// 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 MoreOptionsLayer::addToggle(MoreOptionsLayer *a1, const char *a2, const char *a3, const char *a4)
{
int v4; // r10
int m_toggleCount; // r0
float v9; // r0
int m_pageCount; // r3
int v11; // s15
GameManager *v12; // r0
bool GameVariable; // r0
cocos2d::CCDictionary *m_objects; // r7
bool v15; // r6
const std::string *v16; // r1
cocos2d::CCObject *v17; // r0
cocos2d::CCLayer *v18; // r9
cocos2d::CCMenu *m_buttonMenu; // r8
CCMenuItemToggler *v20; // r6
cocos2d::CCArray *v21; // r11
const std::string *v22; // r1
cocos2d::CCObject *v23; // r10
char *v24; // r0
cocos2d::CCSprite *v25; // r5
CCMenuItemSpriteExtra *v26; // r5
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r4
int v28; // r6
intptr_t v29; // [sp+34h] [bp-48h]
cocos2d::CCDictionary *m_variables; // [sp+40h] [bp-3Ch]
cocos2d::CCPoint v32; // [sp+4Ch] [bp-30h] BYREF
cocos2d::CCPoint v33; // [sp+54h] [bp-28h] BYREF
cocos2d::CCPoint v34; // [sp+5Ch] [bp-20h] BYREF
void (*v35)(MoreOptionsLayer *, cocos2d::CCObject *); // [sp+64h] [bp-18h]
unsigned int v36; // [sp+68h] [bp-14h]
cocos2d::CCPoint v37; // [sp+6Ch] [bp-10h] BYREF
m_toggleCount = a1->m_toggleCount;
a1->m_toggleCount = m_toggleCount + 1;
v9 = floorf((float)(m_toggleCount / 10));
m_pageCount = a1->m_pageCount;
v11 = LODWORD(v9);
if ( v9 <= 0.0 )
v4 = 0;
else
v11 = (int)v9;
if ( v9 > 0.0 )
v4 = v11;
if ( m_pageCount < v4 )
a1->m_pageCount = v4;
else
a1->m_pageCount = m_pageCount;
v29 = atoi(a3);
v12 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v12, a3);
m_objects = a1->m_objects;
v15 = GameVariable;
sub_776584((int)&v37, (char *)a3);
v17 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v37, v16);
cocos2d::CCDictionary::setObject(m_objects, v17, v29);
sub_774008(&v37);
MoreOptionsLayer::nextPosition(&v32, a1, v4);
v18 = MoreOptionsLayer::layerForPage(a1, v4);
sub_776584((int)&v33, (char *)a2);
m_buttonMenu = a1->m_buttonMenu;
v35 = MoreOptionsLayer::onToggle;
v36 = 0;
cocos2d::CCPoint::CCPoint(&v37, &v32);
cocos2d::CCPoint::CCPoint(&v34, 8.0, 0.0);
v20 = GameToolbox::createToggleButton(
(int)&v33,
(unsigned int)v35,
v36,
v15,
m_buttonMenu,
&v37,
a1,
v18,
0.8,
0.4,
130.0,
(int)&v34,
(int)"bigFont.fnt",
0,
0,
nullptr);
sub_774008(&v33);
v20->setTag(v20, v29);
CCMenuItemToggler::setSizeMult(v20, 1.0);
MoreOptionsLayer::incrementCountForPage(a1, v4);
v21 = MoreOptionsLayer::objectsForPage(a1, v4);
cocos2d::CCArray::addObject(v21, v20);
v20->setVisible(v20, 0);
v18->setVisible(v18, 0);
if ( a4 )
{
m_variables = a1->m_variables;
sub_776584((int)&v34, (char *)a4);
v23 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v34, v22);
v24 = (char *)MoreOptionsLayer::infoKey(a1, v29);
sub_776584((int)&v37, v24);
cocos2d::CCDictionary::setObject((int)m_variables, v23);
sub_774008(&v37);
sub_774008(&v34);
v25 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v25->setScale)(v25, 1056964608);
LODWORD(v37.x) = MoreOptionsLayer::onInfo;
v37.y = 0.0;
v26 = CCMenuItemSpriteExtra::create(
v25,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(MoreOptionsLayer::onInfo, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v26, 2.0);
v26->setTag(v26, v29);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v26);
setPosition = v26->setPosition;
v28 = (int)v20->getPosition(v20);
cocos2d::CCPoint::CCPoint(&v33, -18.0, 16.0);
cocos2d::CCPoint::operator+(&v34, v28, &v33);
setPosition(v26, &v34);
cocos2d::CCArray::addObject(v21, v26);
v26->setVisible(v26, 0);
}
}