//
// MoreOptionsLayer::addToggle from 0x10079cb50 to 0x10079d08e (1342 bytes)
//
// 56 xrefs:
// > MoreOptionsLayer::init @ 0x10079ba35
// > MoreOptionsLayer::init @ 0x10079ba52
// > MoreOptionsLayer::init @ 0x10079ba6f
// > MoreOptionsLayer::init @ 0x10079ba8c
// > MoreOptionsLayer::init @ 0x10079baa9
// > MoreOptionsLayer::init @ 0x10079bac6
// > MoreOptionsLayer::init @ 0x10079bae3
// > MoreOptionsLayer::init @ 0x10079bb00
// > MoreOptionsLayer::init @ 0x10079bb1d
// > MoreOptionsLayer::init @ 0x10079bb6b
// > MoreOptionsLayer::init @ 0x10079bb88
// > MoreOptionsLayer::init @ 0x10079bba5
// > MoreOptionsLayer::init @ 0x10079bbc2
// > MoreOptionsLayer::init @ 0x10079bbdf
// > MoreOptionsLayer::init @ 0x10079bbfc
// > MoreOptionsLayer::init @ 0x10079bc19
// > MoreOptionsLayer::init @ 0x10079bc36
// > MoreOptionsLayer::init @ 0x10079bc53
// > MoreOptionsLayer::init @ 0x10079bc70
// > MoreOptionsLayer::init @ 0x10079bc8d
// > MoreOptionsLayer::init @ 0x10079bcaa
// > MoreOptionsLayer::init @ 0x10079bcc7
// > MoreOptionsLayer::init @ 0x10079bce4
// > MoreOptionsLayer::init @ 0x10079bd01
// > MoreOptionsLayer::init @ 0x10079bd1e
// > MoreOptionsLayer::init @ 0x10079bd6c
// > MoreOptionsLayer::init @ 0x10079bd89
// > MoreOptionsLayer::init @ 0x10079bda6
// > MoreOptionsLayer::init @ 0x10079bdc3
// > MoreOptionsLayer::init @ 0x10079bde0
// > MoreOptionsLayer::init @ 0x10079bdfd
// > MoreOptionsLayer::init @ 0x10079be1a
// > MoreOptionsLayer::init @ 0x10079be37
// > MoreOptionsLayer::init @ 0x10079be85
// > MoreOptionsLayer::init @ 0x10079bea2
// > MoreOptionsLayer::init @ 0x10079bebf
// > MoreOptionsLayer::init @ 0x10079bedc
// > MoreOptionsLayer::init @ 0x10079bef9
// > MoreOptionsLayer::init @ 0x10079bf16
// > MoreOptionsLayer::init @ 0x10079bf33
// > MoreOptionsLayer::init @ 0x10079bf50
// > MoreOptionsLayer::init @ 0x10079bf9e
// > MoreOptionsLayer::init @ 0x10079bfbb
// > MoreOptionsLayer::init @ 0x10079bfd8
// > MoreOptionsLayer::init @ 0x10079bff5
// > MoreOptionsLayer::init @ 0x10079c012
// > MoreOptionsLayer::init @ 0x10079c060
// > MoreOptionsLayer::init @ 0x10079c07d
// > MoreOptionsLayer::init @ 0x10079c09a
// > MoreOptionsLayer::init @ 0x10079c0b7
// > MoreOptionsLayer::init @ 0x10079c0d4
// > MoreOptionsLayer::init @ 0x10079c0f1
// > MoreOptionsLayer::init @ 0x10079c10e
// > MoreOptionsLayer::init @ 0x10079c12b
// > MoreOptionsLayer::init @ 0x10079c148
// > MoreOptionsLayer::init @ 0x10079c165
//
// 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)
{
cocos2d::CCPoint Position; // xmm0_8
MoreOptionsLayer *v6; // rbx
int m_toggleCount; // eax
int x; // r13d
int m_pageCount; // eax
GameManager *v10; // rax
bool GameVariable; // r12
size_t v12; // rax
size_t v13; // r15
char *v14; // r12
size_t v15; // rbx
cocos2d::CCObject *v16; // rax
cocos2d::CCLayer *v17; // r14
size_t v18; // rax
size_t v19; // r15
char *v20; // r12
size_t v21; // rbx
const cocos2d::CCPoint *m_buttonMenu; // r15
CCMenuItemToggler *v23; // r12
cocos2d::CCArray *v24; // r15
char *v25; // r13
size_t v26; // rax
size_t v27; // r14
char *v28; // r15
size_t v29; // rbx
cocos2d::CCObject *v30; // rbx
cocos2d::CCString *v31; // rax
size_t v32; // rax
size_t v33; // r13
char *v34; // r15
char *v35; // rsi
size_t v36; // r14
char *v37; // rax
cocos2d::CCSprite *v38; // rbx
cocos2d::CCNode *v39; // rdi
MoreOptionsLayer *v40; // rbx
CCMenuItemSpriteExtra *v41; // r14
unsigned __int64 *v42; // rbx
char v43; // [rsp+0h] [rbp-E0h]
double v44; // [rsp+40h] [rbp-A0h] BYREF
_QWORD v45[2]; // [rsp+48h] [rbp-98h] BYREF
void *v46; // [rsp+58h] [rbp-88h]
unsigned __int64 v47[2]; // [rsp+60h] [rbp-80h] BYREF
void *v48; // [rsp+70h] [rbp-70h]
MoreOptionsLayer *v49; // [rsp+78h] [rbp-68h]
cocos2d::CCDictionary *m_objects; // [rsp+80h] [rbp-60h]
char *__s; // [rsp+88h] [rbp-58h]
char *CString; // [rsp+90h] [rbp-50h]
size_t __dst; // [rsp+98h] [rbp-48h] BYREF
size_t v54; // [rsp+A0h] [rbp-40h]
void *__p; // [rsp+A8h] [rbp-38h]
unsigned int v56; // [rsp+B0h] [rbp-30h]
bool v57; // [rsp+B7h] [rbp-29h]
CString = (char *)a4;
__s = (char *)a2;
v6 = a1;
m_toggleCount = a1->m_toggleCount;
a1->m_toggleCount = m_toggleCount + 1;
x = 0;
if ( m_toggleCount >= 10 )
{
Position.x = (float)(m_toggleCount / 0xAu);
x = (int)Position.x;
}
m_pageCount = a1->m_pageCount;
if ( m_pageCount <= x )
m_pageCount = x;
a1->m_pageCount = m_pageCount;
v56 = atoi(a3);
v10 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v10, a3);
m_objects = a1->m_objects;
v12 = strlen(a3);
if ( v12 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_48;
v13 = v12;
v57 = GameVariable;
v49 = a1;
if ( v12 >= 0x17 )
{
v15 = 26;
if ( (v12 | 7) != 0x17 )
v15 = (v12 | 7) + 1;
v14 = (char *)operator new(v15);
__p = v14;
__dst = v15 + 1;
v6 = v49;
v54 = v13;
goto LABEL_12;
}
LOBYTE(__dst) = 2 * v12;
v14 = (char *)&__dst + 1;
if ( v12 )
LABEL_12:
memcpy(v14, a3, v13);
v14[v13] = 0;
v16 = (cocos2d::CCObject *)sub_1007AB360(&__dst);
cocos2d::CCDictionary::setObject(m_objects, v16, (int)v56);
if ( (__dst & 1) != 0 )
operator delete(__p);
Position = MoreOptionsLayer::nextPosition((MoreOptionsLayer *)&v44, (int)v6);
v17 = MoreOptionsLayer::layerForPage(v6, x);
v18 = strlen(__s);
if ( v18 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_48;
v19 = v18;
if ( v18 >= 0x17 )
{
v21 = 26;
if ( (v18 | 7) != 0x17 )
v21 = (v18 | 7) + 1;
v20 = (char *)operator new(v21);
v46 = v20;
v45[0] = v21 + 1;
v6 = v49;
v45[1] = v19;
goto LABEL_22;
}
LOBYTE(v45[0]) = 2 * v18;
v20 = (char *)v45 + 1;
if ( v18 )
LABEL_22:
memcpy(v20, __s, v19);
v20[v19] = 0;
m_buttonMenu = (const cocos2d::CCPoint *)v6->m_buttonMenu;
sub_10028CC60(&__dst, &v44);
sub_10028CBE0((float *)v47, 8.0, 0.0);
v23 = GameToolbox::createToggleButton(
(__int64)v45,
(unsigned __int64)MoreOptionsLayer::onToggle,
0,
v57,
m_buttonMenu,
&__dst,
0.80000001,
0.40000001,
130.0,
v6,
v17,
(float *)v47,
"bigFont.fnt",
0,
0,
0);
if ( (v45[0] & 1) != 0 )
operator delete(v46);
((void (__fastcall *)(CCMenuItemToggler *, _QWORD))v23->setTag)(v23, v56);
Position = (cocos2d::CCPoint)1065353216LL;
CCMenuItemToggler::setSizeMult(v23, 1.0);
MoreOptionsLayer::incrementCountForPage(v6, x);
v24 = MoreOptionsLayer::objectsForPage(v6, x);
sub_10071FCD0((__int64)v24, v23);
((void (__fastcall *)(CCMenuItemToggler *, _QWORD))v23->setVisible)(v23, 0);
((void (__fastcall *)(cocos2d::CCLayer *, _QWORD))v17->setVisible)(v17, 0);
v25 = CString;
if ( CString )
{
__s = (char *)v6->m_variables;
v26 = strlen(CString);
if ( v26 < 0xFFFFFFFFFFFFFFF8LL )
{
v27 = v26;
m_objects = (cocos2d::CCDictionary *)v24;
if ( v26 >= 0x17 )
{
v29 = 26;
if ( (v26 | 7) != 0x17 )
v29 = (v26 | 7) + 1;
v28 = (char *)operator new(v29);
__p = v28;
__dst = v29 + 1;
v54 = v27;
}
else
{
LOBYTE(__dst) = 2 * v26;
v28 = (char *)&__dst + 1;
if ( !v26 )
{
LABEL_34:
v28[v27] = 0;
v30 = (cocos2d::CCObject *)sub_1007AB360(&__dst);
v31 = (cocos2d::CCString *)sub_1007AB580("info_%i", v43);
CString = (char *)cocos2d::CCString::getCString(v31);
v32 = strlen(CString);
if ( v32 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(COERCE_DOUBLE(1065353216));
v33 = v32;
if ( v32 >= 0x17 )
{
v36 = 26;
if ( (v32 | 7) != 0x17 )
v36 = (v32 | 7) + 1;
v37 = (char *)operator new(v36);
v35 = CString;
v34 = v37;
v48 = v37;
v47[0] = v36 | 1;
v47[1] = v33;
}
else
{
LOBYTE(v47[0]) = 2 * v32;
v34 = (char *)v47 + 1;
v35 = CString;
if ( !v32 )
goto LABEL_42;
}
memmove(v34, v35, v33);
LABEL_42:
v34[v33] = 0;
cocos2d::CCDictionary::setObject_1((__int64)__s, v30, (char *)v47);
if ( (v47[0] & 1) != 0 )
operator delete(v48);
if ( (__dst & 1) != 0 )
operator delete(__p);
v38 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v38->setScale)(v38, 0.5);
v39 = v38;
v40 = v49;
v41 = CCMenuItemSpriteExtra::create(
v39,
nullptr,
v49,
(cocos2d::SEL_MenuHandler)(unsigned __int64)MoreOptionsLayer::onInfo);
CCMenuItemSpriteExtra::setSizeMult(v41, 2.0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v41->setTag)(v41, v56);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v40->m_buttonMenu->addChild)(
v40->m_buttonMenu,
v41);
v42 = (unsigned __int64 *)((__int64 (__fastcall *)(CCMenuItemToggler *))v23->getPosition)(v23);
sub_10028CBE0((float *)v47, -18.0, 16.0);
sub_10028CCE0((double *)&__dst, v42, v47);
((void (__fastcall *)(CCMenuItemSpriteExtra *, size_t *))v41->setPosition)(v41, &__dst);
sub_10071FCD0((__int64)m_objects, v41);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v41->setVisible)(v41, 0);
return;
}
}
memcpy(v28, v25, v27);
goto LABEL_34;
}
LABEL_48:
sub_100006BF0(*(double *)&Position);
}
}