//
// GJOptionsLayer::addGVToggle from 0x14028fda0 to 0x14028fede (318 bytes)
//
// 24 xrefs:
// > EditorOptionsLayer::setupOptions @ 0x1402910b6
// > EditorOptionsLayer::setupOptions @ 0x1402910d3
// > EditorOptionsLayer::setupOptions @ 0x1402910f0
// > EditorOptionsLayer::setupOptions @ 0x14029110d
// > EditorOptionsLayer::setupOptions @ 0x14029112a
// > EditorOptionsLayer::setupOptions @ 0x140291147
// > EditorOptionsLayer::setupOptions @ 0x140291164
// > EditorOptionsLayer::setupOptions @ 0x140291181
// > EditorOptionsLayer::setupOptions @ 0x14029119e
// > EditorOptionsLayer::setupOptions @ 0x1402911bb
// > EditorOptionsLayer::setupOptions @ 0x1402911f8
// > EditorOptionsLayer::setupOptions @ 0x140291215
// > EditorOptionsLayer::setupOptions @ 0x140291232
// > EditorOptionsLayer::setupOptions @ 0x14029124f
// > EditorOptionsLayer::setupOptions @ 0x14029126c
// > EditorOptionsLayer::setupOptions @ 0x140291289
// > EditorOptionsLayer::setupOptions @ 0x1402912a6
// > EditorOptionsLayer::setupOptions @ 0x1402912c3
// > EditorOptionsLayer::setupOptions @ 0x1402912e0
// > EditorOptionsLayer::setupOptions @ 0x1402912fd
// > EditorOptionsLayer::setupOptions @ 0x14029131a
// > EditorOptionsLayer::setupOptions @ 0x140291337
// > EditorOptionsLayer::setupOptions @ 0x140291354
// > ??> @ 0x1406d1928
//
// 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
//
// Hidden C++ exception states: #wind=2
void GJOptionsLayer::addGVToggle(GJOptionsLayer *a1, const char *a2, const char *a3, const char *a4)
{
__int64 v8; // rsi
GameManager *v9; // rcx
bool GameVariable; // al
size_t v11; // r8
struct cocos2d::CCObject *v12; // rax
void *v13; // rcx
void *v14; // [rsp+30h] [rbp-58h]
void *Block[2]; // [rsp+38h] [rbp-50h] BYREF
__int64 v16; // [rsp+48h] [rbp-40h]
unsigned __int64 v17; // [rsp+50h] [rbp-38h]
v8 = atoi(a3);
v9 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v14 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v9 = (GameManager *)qword_1406C2ED8;
}
GameVariable = GameManager::getGameVariable(v9, a3);
GJOptionsLayer::addToggleInternal(a1, a2, v8, GameVariable, a4);
*(_OWORD *)Block = 0;
v16 = 0;
v17 = 0;
v11 = -1;
do
++v11;
while ( a3[v11] );
sub_14003A930(Block, a3, v11);
v12 = (struct cocos2d::CCObject *)cocos2d::CCString::create(Block);
cocos2d::CCDictionary::setObject(a1->m_variables, v12, v8);
if ( v17 > 0xF )
{
v13 = Block[0];
if ( v17 + 1 >= 0x1000 )
{
v13 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v13 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v13);
}
}