//
// GameSettingsLayer::addToggle from 0x1402c6720 to 0x1402c6d62 (1602 bytes)
//
// 104 xrefs:
// > GameSettingsLayer::buildTabContent @ 0x1402c2eaa
// > GameSettingsLayer::buildTabContent @ 0x1402c2efd
// > GameSettingsLayer::buildTabContent @ 0x1402c2f50
// > GameSettingsLayer::buildTabContent @ 0x1402c2fa3
// > GameSettingsLayer::buildTabContent @ 0x1402c2ff6
// > GameSettingsLayer::buildTabContent @ 0x1402c3049
// > GameSettingsLayer::buildTabContent @ 0x1402c309c
// > GameSettingsLayer::buildTabContent @ 0x1402c30ef
// > GameSettingsLayer::buildTabContent @ 0x1402c3142
// > GameSettingsLayer::buildTabContent @ 0x1402c315f
// > GameSettingsLayer::buildTabContent @ 0x1402c31ae
// > GameSettingsLayer::buildTabContent @ 0x1402c31fd
// > GameSettingsLayer::buildTabContent @ 0x1402c3280
// > GameSettingsLayer::buildTabContent @ 0x1402c32d3
// > GameSettingsLayer::buildTabContent @ 0x1402c3326
// > GameSettingsLayer::buildTabContent @ 0x1402c3379
// > GameSettingsLayer::buildTabContent @ 0x1402c33cc
// > GameSettingsLayer::buildTabContent @ 0x1402c341f
// > GameSettingsLayer::buildTabContent @ 0x1402c3472
// > GameSettingsLayer::buildTabContent @ 0x1402c34c5
// > GameSettingsLayer::buildTabContent @ 0x1402c3518
// > GameSettingsLayer::buildTabContent @ 0x1402c356b
// > GameSettingsLayer::buildTabContent @ 0x1402c35be
// > GameSettingsLayer::buildTabContent @ 0x1402c3611
// > GameSettingsLayer::buildTabContent @ 0x1402c3664
// > GameSettingsLayer::buildTabContent @ 0x1402c36b7
// > GameSettingsLayer::buildTabContent @ 0x1402c370a
// > GameSettingsLayer::buildTabContent @ 0x1402c375d
// > GameSettingsLayer::buildTabContent @ 0x1402c37b0
// > GameSettingsLayer::buildTabContent @ 0x1402c3803
// > GameSettingsLayer::buildTabContent @ 0x1402c3856
// > GameSettingsLayer::buildTabContent @ 0x1402c38a9
// > GameSettingsLayer::buildTabContent @ 0x1402c38fc
// > GameSettingsLayer::buildTabContent @ 0x1402c397c
// > GameSettingsLayer::buildTabContent @ 0x1402c39cf
// > GameSettingsLayer::buildTabContent @ 0x1402c3a22
// > GameSettingsLayer::buildTabContent @ 0x1402c3a75
// > GameSettingsLayer::buildTabContent @ 0x1402c3ac8
// > GameSettingsLayer::buildTabContent @ 0x1402c3b1b
// > GameSettingsLayer::buildTabContent @ 0x1402c3b6e
// > GameSettingsLayer::buildTabContent @ 0x1402c3bc1
// > GameSettingsLayer::buildTabContent @ 0x1402c3c14
// > GameSettingsLayer::buildTabContent @ 0x1402c3c67
// > GameSettingsLayer::buildTabContent @ 0x1402c3cba
// > GameSettingsLayer::buildTabContent @ 0x1402c3d09
// > GameSettingsLayer::buildTabContent @ 0x1402c3d92
// > GameSettingsLayer::buildTabContent @ 0x1402c3de5
// > GameSettingsLayer::buildTabContent @ 0x1402c3e38
// > GameSettingsLayer::buildTabContent @ 0x1402c3e8b
// > GameSettingsLayer::buildTabContent @ 0x1402c3ede
// > GameSettingsLayer::buildTabContent @ 0x1402c3f31
// > GameSettingsLayer::buildTabContent @ 0x1402c3f84
// > GameSettingsLayer::buildTabContent @ 0x1402c3fd7
// > GameSettingsLayer::buildTabContent @ 0x1402c402a
// > GameSettingsLayer::buildTabContent @ 0x1402c407d
// > GameSettingsLayer::buildTabContent @ 0x1402c4138
// > GameSettingsLayer::buildTabContent @ 0x1402c418f
// > GameSettingsLayer::buildTabContent @ 0x1402c41e6
// > GameSettingsLayer::buildTabContent @ 0x1402c423d
// > GameSettingsLayer::buildTabContent @ 0x1402c4294
// > GameSettingsLayer::buildTabContent @ 0x1402c42eb
// > GameSettingsLayer::buildTabContent @ 0x1402c4342
// > GameSettingsLayer::buildTabContent @ 0x1402c4399
// > GameSettingsLayer::buildTabContent @ 0x1402c43f0
// > GameSettingsLayer::buildTabContent @ 0x1402c4447
// > GameSettingsLayer::buildTabContent @ 0x1402c449e
// > GameSettingsLayer::buildTabContent @ 0x1402c44f5
// > GameSettingsLayer::buildTabContent @ 0x1402c454c
// > GameSettingsLayer::buildTabContent @ 0x1402c45a3
// > GameSettingsLayer::buildTabContent @ 0x1402c45fa
// > GameSettingsLayer::buildTabContent @ 0x1402c4651
// > GameSettingsLayer::buildTabContent @ 0x1402c46a8
// > GameSettingsLayer::buildTabContent @ 0x1402c46ff
// > GameSettingsLayer::buildTabContent @ 0x1402c4756
// > GameSettingsLayer::buildTabContent @ 0x1402c47ad
// > GameSettingsLayer::buildTabContent @ 0x1402c4840
// > GameSettingsLayer::buildTabContent @ 0x1402c4897
// > GameSettingsLayer::buildTabContent @ 0x1402c48ee
// > GameSettingsLayer::buildTabContent @ 0x1402c4945
// > GameSettingsLayer::buildTabContent @ 0x1402c499c
// > GameSettingsLayer::buildTabContent @ 0x1402c49f3
// > GameSettingsLayer::buildTabContent @ 0x1402c4a4a
// > GameSettingsLayer::buildTabContent @ 0x1402c4acb
// > GameSettingsLayer::buildTabContent @ 0x1402c4b22
// > GameSettingsLayer::buildTabContent @ 0x1402c4b79
// > GameSettingsLayer::buildTabContent @ 0x1402c4bd0
// > GameSettingsLayer::buildTabContent @ 0x1402c4c27
// > GameSettingsLayer::buildTabContent @ 0x1402c4c7d
// > GameSettingsLayer::buildTabContent @ 0x1402c4cd3
// > GameSettingsLayer::buildTabContent @ 0x1402c4d29
// > GameSettingsLayer::buildTabContent @ 0x1402c4d7f
// > GameSettingsLayer::buildTabContent @ 0x1402c4dd5
// > GameSettingsLayer::buildTabContent @ 0x1402c4e2b
// > GameSettingsLayer::buildTabContent @ 0x1402c4e81
// > GameSettingsLayer::buildTabContent @ 0x1402c4ed7
// > GameSettingsLayer::buildTabContent @ 0x1402c4f2d
// > GameSettingsLayer::buildTabContent @ 0x1402c4f83
// > GameSettingsLayer::buildTabContent @ 0x1402c4fd9
// > GameSettingsLayer::buildTabContent @ 0x1402c502f
// > GameSettingsLayer::buildTabContent @ 0x1402c5085
// > GameSettingsLayer::buildTabContent @ 0x1402c50db
// > GameSettingsLayer::buildTabContent @ 0x1402c5132
// > GameSettingsLayer::buildTabContent @ 0x1402c51d9
// > ??> @ 0x14091dbd0
//
// This function is hookable on this platform (idp: pc, 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 11:29:22 +0000
//
// Hidden C++ exception states: #wind=3
struct cocos2d::CCObject *__fastcall GameSettingsLayer::addToggle(
__int64 a1,
_BYTE *a2,
unsigned int a3,
_BYTE *a4,
char a5)
{
__int64 v8; // r9
__int64 v9; // r8
int v10; // edi
struct cocos2d::CCObject *v11; // r13
int v12; // esi
__int64 v13; // r8
__int64 v14; // rcx
__int64 v15; // rbx
unsigned int v16; // edi
_BYTE *v17; // rdx
int v18; // edi
__int64 v19; // rax
const struct cocos2d::CCPoint *v20; // rdx
float v21; // xmm0_4
size_t v22; // rsi
size_t v23; // r8
__int64 v24; // rax
__int64 v25; // rbx
int v26; // edi
__int64 v27; // rbx
int v28; // eax
cocos2d::CCArray *ToggleValueControlAdvanced; // rdi
struct cocos2d::CCObject *v30; // rbx
__int64 v31; // rdx
unsigned int *v32; // rax
__int64 v33; // rcx
_QWORD *v34; // rbx
_QWORD *i; // rdi
__int64 v36; // rax
size_t v37; // r8
__int128 *v38; // rdx
__int128 *v39; // r9
__int128 *v40; // rax
__int64 v41; // rax
struct cocos2d::CCObject *v42; // rdi
__int64 v43; // rax
__int64 v44; // rbx
struct cocos2d::CCObject *v45; // rsi
__int64 v46; // rax
cocos2d::CCArray *PageContainer; // rax
cocos2d::CCArray *GroupContainer; // rax
__int64 v49; // rdx
__int64 v50; // r8
int v51; // eax
cocos2d::CCArray *v52; // rbx
__int64 v53; // rax
__int64 v54; // rax
__int64 v56; // [rsp+50h] [rbp-B0h]
unsigned int v57; // [rsp+60h] [rbp-A0h] BYREF
struct cocos2d::CCObject *v58; // [rsp+68h] [rbp-98h] BYREF
__int128 *v59; // [rsp+70h] [rbp-90h] BYREF
unsigned int v60; // [rsp+78h] [rbp-88h] BYREF
__int64 v61; // [rsp+80h] [rbp-80h]
__int64 v62; // [rsp+88h] [rbp-78h]
cocos2d::CCArray *v63; // [rsp+90h] [rbp-70h] BYREF
int v64; // [rsp+98h] [rbp-68h]
_BYTE v65[4]; // [rsp+A0h] [rbp-60h] BYREF
float v66; // [rsp+A4h] [rbp-5Ch]
__int128 v67; // [rsp+A8h] [rbp-58h] BYREF
__int64 v68; // [rsp+B8h] [rbp-48h]
__int64 v69; // [rsp+C0h] [rbp-40h]
__int128 v70; // [rsp+C8h] [rbp-38h] BYREF
__int64 v71; // [rsp+D8h] [rbp-28h]
__int64 v72; // [rsp+E0h] [rbp-20h]
char v73[8]; // [rsp+E8h] [rbp-18h] BYREF
char v74[8]; // [rsp+F0h] [rbp-10h] BYREF
char v75[32]; // [rsp+F8h] [rbp-8h] BYREF
__int128 v76; // [rsp+118h] [rbp+18h] BYREF
__int128 v77; // [rsp+128h] [rbp+28h]
v60 = a3;
v8 = *(int *)(a1 + 1052);
if ( (int)v8 < 0 )
return nullptr;
v9 = *(_QWORD *)(a1 + 1000);
v61 = v9;
if ( (int)v8 >= (int)((*(_QWORD *)(a1 + 1008) - v9) / 88) )
return nullptr;
v62 = 88 * v8;
v10 = *(_DWORD *)(88 * v8 + v9 + 76);
v11 = nullptr;
v12 = 0;
if ( v10 / 12 >= 0 )
v12 = v10 / 12;
v64 = v12;
v13 = *(_QWORD *)(a1 + 1024);
v14 = *(_QWORD *)(a1 + 1032) - v13;
if ( (int)v8 >= (int)(v14 / 24) || v12 < 0 )
{
v57 = 0;
}
else
{
v15 = v13 + 24 * v8;
v14 = *(_QWORD *)v15;
if ( (int)((__int64)(*(_QWORD *)(v15 + 8) - *(_QWORD *)v15) >> 2) <= v12 )
{
do
{
v16 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 896));
v57 = v16;
SetupTriggerPopup::getPageContainer(a1, v16);
v17 = *(_BYTE **)(v15 + 8);
if ( v17 == *(_BYTE **)(v15 + 16) )
{
sub_140069B30((const void **)v15, v17, &v57);
}
else
{
*(_DWORD *)v17 = v16;
*(_QWORD *)(v15 + 8) += 4LL;
}
v14 = *(_QWORD *)v15;
}
while ( (int)((__int64)(*(_QWORD *)(v15 + 8) - *(_QWORD *)v15) >> 2) <= v12 );
v10 = *(_DWORD *)(v62 + v61 + 76);
}
v57 = *(_DWORD *)(v14 + 4LL * v12);
}
v18 = v10 % 12;
v19 = cocos2d::CCDirector::sharedDirector(v14);
cocos2d::CCDirector::getWinSize(v19, &v58);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v63,
(float)(*(float *)&v58 * 0.5) - 160.0,
(float)(*((float *)&v58 + 1) * 0.5) + 75.0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, (float)(*(float *)&v58 * 0.5) + 32.0, *((float *)&v63 + 1));
v20 = (const struct cocos2d::CCPoint *)&v63;
if ( (((_BYTE)v18 + 1) & 1) == 0 )
v20 = (const struct cocos2d::CCPoint *)&v59;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, v20);
if ( v18 + 1 > 2 )
{
v21 = floorf((float)v18 * 0.5);
v66 = v66 - (float)((float)(int)v21 * 37.0);
}
v59 = &v67;
v67 = 0;
v68 = 0;
v69 = 0;
v22 = -1;
v23 = -1;
do
++v23;
while ( a2[v23] );
sub_14003D230(&v67, a2, v23);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, 8.0, 0.0);
v25 = v24;
v26 = *(_DWORD *)(v62 + v61 + 64);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v74, (const struct cocos2d::CCPoint *)v65);
v56 = v25;
v27 = (int)v60;
ToggleValueControlAdvanced = (cocos2d::CCArray *)SetupTriggerPopup::createToggleValueControlAdvanced(
a1,
v60,
(unsigned int)&v67,
v28,
0,
v57,
v26,
1060320051,
1051931443,
1140457472,
v56);
v63 = ToggleValueControlAdvanced;
v30 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 752), v27);
v58 = v30;
if ( v30 )
{
if ( (*(float (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 1168LL))(a1, v60) == 0.0 )
v31 = 0;
else
LOBYTE(v31) = 1;
CCMenuItemToggler::toggle((__int64)v30, v31);
}
if ( ToggleValueControlAdvanced )
{
v32 = *((unsigned int **)ToggleValueControlAdvanced + 7);
v33 = *v32;
if ( (_DWORD)v33 )
{
v34 = *((_QWORD **)v32 + 2);
for ( i = &v34[v33 - 1]; v34 <= i; ++v34 )
{
if ( !*v34 )
break;
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)*v34 + 336LL))(*v34, 0);
}
v30 = v58;
}
}
if ( !a4 )
goto LABEL_50;
v36 = -1;
do
++v36;
while ( a4[v36] );
if ( v36 && v30 )
{
v76 = 0;
v77 = 0;
v37 = -1;
do
++v37;
while ( a2[v37] );
sub_14003D230(&v76, a2, v37);
v38 = &v76;
if ( *((_QWORD *)&v77 + 1) > 0xFu )
v38 = (__int128 *)v76;
v39 = (__int128 *)((char *)v38 + v77);
v40 = &v76;
if ( *((_QWORD *)&v77 + 1) > 0xFu )
v40 = (__int128 *)v76;
for ( ; v40 != v39; v40 = (__int128 *)((char *)v40 + 1) )
{
if ( *(_BYTE *)v40 == 10 )
*(_BYTE *)v40 = 32;
}
v59 = &v70;
v70 = 0;
v71 = 0;
v72 = 0;
do
++v22;
while ( a4[v22] );
sub_14003D230(&v70, a4, v22);
v41 = sub_14003F4F0((__int64)v75, (__int64)&v76);
v42 = (struct cocos2d::CCObject *)InfoAlertButton::create(v41, &v70);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v42);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v60, -17.0, 15.0);
v44 = v43;
v45 = v58;
v46 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v58 + 200LL))(v58);
cocos2d::CCPoint::operator+(v46, &v59, v44);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int128 **))(*(_QWORD *)v42 + 184LL))(v42, &v59);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v42 + 336LL))(v42, 0);
PageContainer = (cocos2d::CCArray *)SetupTriggerPopup::getPageContainer(a1, v57);
cocos2d::CCArray::addObject(PageContainer, v42);
GroupContainer = (cocos2d::CCArray *)SetupTriggerPopup::getGroupContainer(a1, *(unsigned int *)(v62 + v61 + 64));
cocos2d::CCArray::addObject(GroupContainer, v42);
sub_14003D310((__int64)&v76);
}
else
{
LABEL_50:
v45 = v58;
}
v49 = v61;
v50 = v62;
++*(_DWORD *)(v62 + v61 + 76);
v51 = *(_DWORD *)(v50 + v49 + 72);
if ( v51 <= v64 + 1 )
v51 = v64 + 1;
*(_DWORD *)(v50 + v49 + 72) = v51;
if ( a5 )
{
v52 = v63;
if ( cocos2d::CCArray::count(v63) > 1 )
v11 = cocos2d::CCArray::objectAtIndex(v52, 1u);
LOWORD(v57) = -26986;
BYTE2(v57) = -106;
*((_BYTE *)v45 + 393) = 1;
v53 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)v45 + 47) + 952LL))(*((_QWORD *)v45 + 47));
(**(void (__fastcall ***)(__int64, unsigned int *))(v53 + 320))(v53 + 320, &v57);
v54 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)v45 + 48) + 952LL))(*((_QWORD *)v45 + 48));
(**(void (__fastcall ***)(__int64, unsigned int *))(v54 + 320))(v54 + 320, &v57);
if ( v11 )
(**((void (__fastcall ***)(__int64, unsigned int *))v11 + 46))((__int64)v11 + 368, &v57);
}
return v45;
}