//
// GJOptionsLayer::onToggle from 0xa24450 to 0xa24584 (308 bytes)
//
// 4 xrefs:
// > ??> @ 0xcc460
// > GJOptionsLayer::addToggleInternal @ 0xa34ed0
// > GameOptionsLayer::setupOptions @ 0xa36254
// > ??> @ 0x1546008
//
// 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:41 +0000
//
__int64 __fastcall GJOptionsLayer::onToggle(GJOptionsLayer *this, cocos2d::CCObject *a2)
{
cocos2d::CCDictionary *v4; // x22
int v5; // w0
GameManager *v6; // x0
cocos2d::CCString *v7; // x22
GameManager *v8; // x23
char *CString; // x0
cocos2d::CCString *v10; // x0
void (__fastcall *v11)(GJOptionsLayer *, __int64 *); // x22
const char *v12; // x0
size_t v13; // x0
cocos2d::CCObject *v15; // x0
__int64 (__fastcall *v16)(cocos2d::CCObject *); // x1
void (__fastcall *v17)(GJOptionsLayer *, _QWORD); // x20
unsigned int v18; // w0
char *v19; // [xsp+48h] [xbp+48h]
__int64 v20[2]; // [xsp+50h] [xbp+50h] BYREF
void *v21; // [xsp+60h] [xbp+60h]
v4 = *((cocos2d::CCDictionary **)this + 131);
v5 = (*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)a2 + 64LL))(a2);
v6 = (GameManager *)cocos2d::CCDictionary::objectForKey(v4, v5);
v7 = v6;
if ( v6 )
{
v8 = (GameManager *)GameManager::sharedState(v6);
CString = (char *)cocos2d::CCString::getCString(v7);
GameManager::toggleGameVariable(v8, CString);
v10 = v7;
v11 = *(void (__fastcall **)(GJOptionsLayer *, __int64 *))(*(_QWORD *)this + 1512LL);
v12 = (const char *)cocos2d::CCString::getCString(v10);
v20[0] = 0;
v19 = (char *)v12;
v20[1] = 0;
v21 = nullptr;
v13 = strlen(v12);
std::string::__init(v20, v19, v13);
v11(this, v20);
if ( (v20[0] & 1) != 0 )
operator delete(v21);
}
else
{
v15 = a2;
v16 = *(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)a2 + 64LL);
v17 = *(void (__fastcall **)(GJOptionsLayer *, _QWORD))(*(_QWORD *)this + 1520LL);
v18 = v16(v15);
v17(this, v18);
}
return _stack_chk_guard;
}