//
// GJOptionsLayer::addToggleInternal from 0x5e15dc to 0x5e1876 (666 bytes)
//
// 2 xrefs:
// > GJOptionsLayer::addGVToggle @ 0x5e18ca
// > GJOptionsLayer::addToggle @ 0x5e208c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:54:16 +0000
//
cocos2d::CCNodeRGBA *__fastcall GJOptionsLayer::addToggleInternal(
GJOptionsLayer *this,
const char *a2,
int a3,
int a4,
const char *a5)
{
const char *v5; // r5
int v9; // r0
int v10; // r1
float v11; // r0
int v12; // r3
int v13; // s15
cocos2d::CCObject *v14; // r0
int v15; // r9
size_t v16; // r0
const cocos2d::CCPoint *v17; // r3
float v18; // s17
float v19; // s16
cocos2d::CCNodeRGBA *ToggleButton; // r10
int v21; // r2
int v22; // r3
cocos2d::CCObject *v23; // r11
size_t v24; // r0
int v25; // r9
cocos2d::CCObject *v26; // r8
size_t v27; // r0
const char *v28; // r1
int v29; // r5
cocos2d::CCObject *v30; // r5
void (__fastcall *v31)(cocos2d::CCObject *, _BYTE *); // r8
int v32; // r9
const cocos2d::CCPoint *v34; // [sp+30h] [bp-5Ch]
const char *v35; // [sp+30h] [bp-5Ch]
int v36; // [sp+3Ch] [bp-50h] BYREF
_BYTE v37[8]; // [sp+44h] [bp-48h] BYREF
_BYTE v38[8]; // [sp+4Ch] [bp-40h] BYREF
_BYTE v39[8]; // [sp+54h] [bp-38h] BYREF
int (__fastcall *v40)(cocos2d::CCDictionary **, cocos2d::CCObject *, int, int); // [sp+5Ch] [bp-30h]
int v41; // [sp+60h] [bp-2Ch]
_DWORD v42[2]; // [sp+64h] [bp-28h] BYREF
int v43[3]; // [sp+6Ch] [bp-20h] BYREF
int v44; // [sp+78h] [bp-14h] BYREF
int v45; // [sp+7Ch] [bp-10h]
int v46; // [sp+80h] [bp-Ch]
v9 = *((_DWORD *)this + 181);
v10 = *((_DWORD *)this + 180);
v36 = a3;
*((_DWORD *)this + 181) = v9 + 1;
v11 = floorf((float)(v9 / v10));
v12 = *((_DWORD *)this + 182);
v13 = LODWORD(v11);
if ( v11 <= 0.0 )
v5 = nullptr;
else
v13 = (int)v11;
if ( v11 > 0.0 )
v5 = (const char *)v13;
if ( v12 < (int)v5 )
*((_DWORD *)this + 182) = v5;
else
*((_DWORD *)this + 182) = v12;
GJOptionsLayer::nextPosition((GJOptionsLayer *)v37, (float *)this, v5);
v14 = GJOptionsLayer::layerForPage(this, v5);
v44 = 0;
v45 = 0;
v46 = 0;
v15 = (int)v14;
v16 = strlen(a2);
std::string::__init(&v44, a2, v16);
v17 = *((const cocos2d::CCPoint **)this + 111);
v41 = 0;
v34 = v17;
v40 = GJOptionsLayer::onToggle;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v42, (const cocos2d::CCPoint *)v37);
v18 = *((float *)this + 183);
v19 = *((float *)this + 184);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39, 8.0, 0.0);
ToggleButton = GameToolbox::createToggleButton(
(int)&v44,
(int)v40,
v41,
a4,
v34,
(int)v42,
(int)this,
v15,
0.8,
v18,
v19,
(int)v39,
"bigFont.fnt",
0,
0,
nullptr);
std::string::~string((int)&v44);
(*(void (__fastcall **)(cocos2d::CCNodeRGBA *, int))(*(_DWORD *)ToggleButton + 36))(ToggleButton, v36);
CCMenuItemToggler::setSizeMult(ToggleButton, 1.0);
*std::unordered_map::operator[]((int)this + 760, (unsigned int *)&v36) = ToggleButton;
GJOptionsLayer::incrementCountForPage(this, v5, v21, v22);
v23 = GJOptionsLayer::objectsForPage(this, v5);
cocos2d::CCArray::addObject(v23, ToggleButton);
(*(void (__fastcall **)(cocos2d::CCNodeRGBA *, _DWORD))(*(_DWORD *)ToggleButton + 172))(ToggleButton, 0);
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v15 + 172))(v15, 0);
if ( a5 && *a5 )
{
memset(v43, 0, sizeof(v43));
v24 = strlen(a5);
v25 = *((_DWORD *)this + 185);
std::string::__init(v43, a5, v24);
v26 = (cocos2d::CCObject *)cocos2d::CCString::create(v43);
v35 = (const char *)GJOptionsLayer::infoKey(this, (const char *)v36);
v44 = 0;
v45 = 0;
v46 = 0;
v27 = strlen(v35);
std::string::__init(&v44, v35, v27);
cocos2d::CCDictionary::setObject(v25, v26);
std::string::~string((int)&v44);
std::string::~string((int)v43);
v29 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_infoIcon_001.png", v28);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v29 + 80))(v29, 1056964608);
v42[0] = GJOptionsLayer::onInfo;
v42[1] = 0;
v30 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(v29, 0, (int)this, (int)GJOptionsLayer::onInfo, 0);
CCMenuItemSpriteExtra::setSizeMult((int)v30, 2.0);
(*(void (__fastcall **)(cocos2d::CCObject *, int))(*(_DWORD *)v30 + 36))(v30, v36);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(**((_DWORD **)this + 111) + 228))(
*((_DWORD *)this + 111),
v30);
v31 = *(void (__fastcall **)(cocos2d::CCObject *, _BYTE *))(*(_DWORD *)v30 + 92);
v32 = (*(int (__fastcall **)(cocos2d::CCNodeRGBA *))(*(_DWORD *)ToggleButton + 96))(ToggleButton);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v38, -18.0, 16.0);
cocos2d::CCPoint::operator+(v39, v32, v38);
v31(v30, v39);
cocos2d::CCArray::addObject(v23, v30);
(*(void (__fastcall **)(cocos2d::CCObject *, _DWORD))(*(_DWORD *)v30 + 172))(v30, 0);
}
return ToggleButton;
}