//
// GJOptionsLayer::addGVToggle from 0x8db1e0 to 0x8db330 (336 bytes)
//
// 24 xrefs:
// > EditorOptionsLayer::setupOptions @ 0x8db39c
// > EditorOptionsLayer::setupOptions @ 0x8db3c8
// > EditorOptionsLayer::setupOptions @ 0x8db3f8
// > EditorOptionsLayer::setupOptions @ 0x8db420
// > EditorOptionsLayer::setupOptions @ 0x8db440
// > EditorOptionsLayer::setupOptions @ 0x8db460
// > EditorOptionsLayer::setupOptions @ 0x8db480
// > EditorOptionsLayer::setupOptions @ 0x8db4a0
// > EditorOptionsLayer::setupOptions @ 0x8db4c0
// > EditorOptionsLayer::setupOptions @ 0x8db4e0
// > EditorOptionsLayer::setupOptions @ 0x8db508
// > EditorOptionsLayer::setupOptions @ 0x8db528
// > EditorOptionsLayer::setupOptions @ 0x8db548
// > EditorOptionsLayer::setupOptions @ 0x8db568
// > EditorOptionsLayer::setupOptions @ 0x8db588
// > EditorOptionsLayer::setupOptions @ 0x8db5a8
// > EditorOptionsLayer::setupOptions @ 0x8db5c8
// > EditorOptionsLayer::setupOptions @ 0x8db5e8
// > EditorOptionsLayer::setupOptions @ 0x8db608
// > EditorOptionsLayer::setupOptions @ 0x8db628
// > EditorOptionsLayer::setupOptions @ 0x8db648
// > EditorOptionsLayer::setupOptions @ 0x8db668
// > EditorOptionsLayer::setupOptions @ 0x8db688
// > ??> @ 0x6bb80
//
// 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 GJOptionsLayer::addGVToggle(GJOptionsLayer *a1, const char *a2, const char *a3, const char *a4)
{
int v7; // w22
GameManager *v8; // x0
bool GameVariable; // w0
char *v10; // x1
cocos2d::CCDictionary *m_variables; // x21
const std::string *v12; // x1
cocos2d::CCObject *v13; // x0
void *v14; // x0
unsigned int *v15; // x2
int v16; // w1
__int64 v18; // [xsp+60h] [xbp+60h] BYREF
v7 = atoi(a3);
v8 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v8, a3);
GJOptionsLayer::addToggleInternal(a1, a2, v7, GameVariable, a4);
v10 = (char *)a3;
m_variables = a1->m_variables;
sub_D153B8((int)&v18, v10);
v13 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v18, v12);
cocos2d::CCDictionary::setObject(m_variables, v13, v7);
v14 = (void *)(v18 - 24);
if ( (__int64 *)(v18 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)(v18 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *(_DWORD *)(v18 - 8);
*(_DWORD *)(v18 - 8) = v16 - 1;
}
if ( v16 <= 0 )
operator delete(v14);
}
}