//
// GJOptionsLayer::addToggleInternal from 0xa34dec to 0xa35200 (1044 bytes)
//
// 3 xrefs:
// > GJOptionsLayer::addGVToggle @ 0xa3526c
// > GJOptionsLayer::addToggle @ 0xa35cfc
// > ??> @ 0xd4ab8
//
// 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:59:49 +0000
//
CCMenuItemToggler *__fastcall GJOptionsLayer::addToggleInternal(
GJOptionsLayer *this,
char *a2,
int a3,
unsigned __int8 a4,
char *a5)
{
int v7; // w0
int v9; // w2
float v10; // s0
unsigned int v11; // w19
signed int v12; // w2
cocos2d::CCObject *v13; // x21
size_t v14; // x0
cocos2d::CCNode *v15; // x27
float v16; // s9
float v17; // s8
CCMenuItemToggler *v18; // x22
cocos2d::CCObject *v19; // x27
size_t v21; // x0
__int64 v22; // x21
cocos2d::CCObject *v23; // x19
size_t v24; // x0
const char *v25; // x1
__int64 v26; // x19
cocos2d::CCObject *v27; // x19
void (__fastcall *v28)(cocos2d::CCObject *, __int64 *); // x20
__int64 v29; // x21
char *v31; // [xsp+A0h] [xbp+70h]
int v32; // [xsp+ACh] [xbp+7Ch] BYREF
float v33; // [xsp+B0h] [xbp+80h] BYREF
float v34; // [xsp+B8h] [xbp+88h] BYREF
__int64 v35; // [xsp+C0h] [xbp+90h] BYREF
__int64 v36[2]; // [xsp+C8h] [xbp+98h] BYREF
void *v37; // [xsp+D8h] [xbp+A8h]
__int64 v38; // [xsp+E0h] [xbp+B0h] BYREF
__int64 v39; // [xsp+E8h] [xbp+B8h]
void *v40; // [xsp+F0h] [xbp+C0h]
v32 = a3;
v7 = *((_DWORD *)this + 256);
v9 = *((_DWORD *)this + 255);
*((_DWORD *)this + 256) = v7 + 1;
v10 = floorf((float)(v7 / v9));
if ( v10 <= 0.0 )
v11 = 0;
else
v11 = (int)v10;
v12 = *((_DWORD *)this + 257);
if ( (int)v11 >= v12 )
v12 = v11;
*((_DWORD *)this + 257) = v12;
GJOptionsLayer::nextPosition(this, (const char *)v11, &v33);
v13 = GJOptionsLayer::layerForPage(this, (const char *)v11);
v38 = 0;
v39 = 0;
v40 = nullptr;
v14 = strlen(a2);
std::string::__init(&v38, a2, v14);
v15 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v35, (const cocos2d::CCPoint *)&v33);
v16 = *((float *)this + 258);
v17 = *((float *)this + 259);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v34, 8.0, 0.0);
v18 = GameToolbox::createToggleButton(
(__int64)&v38,
(const char *)GJOptionsLayer::onToggle,
0,
a4,
v15,
(const cocos2d::CCPoint *)&v35,
(__int64)this,
(__int64)v13,
0.8,
v16,
v17,
&v34,
"bigFont.fnt",
0,
0,
nullptr);
if ( (v38 & 1) != 0 )
operator delete(v40);
(*(void (__fastcall **)(CCMenuItemToggler *, _QWORD))(*(_QWORD *)v18 + 72LL))(v18, (unsigned int)v32);
CCMenuItemToggler::setSizeMult(v18, 1.0);
*(_QWORD *)std::unordered_map::operator[]((__int64)this + 1080, &v32) = v18;
GJOptionsLayer::incrementCountForPage(this, (const char *)v11);
v19 = GJOptionsLayer::objectsForPage(this, (const char *)v11);
cocos2d::CCArray::addObject(v19, v18);
(*(void (__fastcall **)(CCMenuItemToggler *, _QWORD))(*(_QWORD *)v18 + 344LL))(v18, 0);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v13 + 344LL))(v13, 0);
if ( a5 && *a5 )
{
v36[0] = 0;
v36[1] = 0;
v37 = nullptr;
v21 = strlen(a5);
v22 = *((_QWORD *)this + 130);
std::string::__init(v36, a5, v21);
v23 = (cocos2d::CCObject *)cocos2d::CCString::create(v36);
v31 = (char *)GJOptionsLayer::infoKey(this, (const char *)(unsigned int)v32);
v38 = 0;
v39 = 0;
v40 = nullptr;
v24 = strlen(v31);
std::string::__init(&v38, v31, v24);
cocos2d::CCDictionary::setObject(v22, v23);
if ( (v38 & 1) != 0 )
{
operator delete(v40);
if ( (v36[0] & 1) == 0 )
goto LABEL_12;
}
else if ( (v36[0] & 1) == 0 )
{
LABEL_12:
v26 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_infoIcon_001.png", v25);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v26 + 160LL))(v26, 0.5);
v27 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
v26,
0,
(__int64)this,
(__int64)GJOptionsLayer::onInfo,
0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v27, 2.0);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v27 + 72LL))(v27, (unsigned int)v32);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**((_QWORD **)this + 69) + 456LL))(
*((_QWORD *)this + 69),
v27);
v28 = *(void (__fastcall **)(cocos2d::CCObject *, __int64 *))(*(_QWORD *)v27 + 184LL);
v29 = (*(__int64 (__fastcall **)(CCMenuItemToggler *))(*(_QWORD *)v18 + 192LL))(v18);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v34, -18.0, 16.0);
cocos2d::CCPoint::operator+(&v35, v29);
v28(v27, &v35);
cocos2d::CCArray::addObject(v19, v27);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v27 + 344LL))(v27, 0);
return v18;
}
operator delete(v37);
goto LABEL_12;
}
return v18;
}