{"type": "func", "start": 4297707184, "end": 4297707486, "name": "GJOptionsLayer::onToggle", "pseudocode": "// \n// GJOptionsLayer::onToggle from 0x10029ceb0 to 0x10029cfde (302 bytes)\n// \n// 2 xrefs:\n// > GJOptionsLayer::addToggleInternal @ 0x10029c848\n// > GameOptionsLayer::setupOptions @ 0x1002b15c0\n// \n// This function is hookable on this platform!\n// \n// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings\n// \n\nvoid __fastcall GJOptionsLayer::onToggle(GJOptionsLayer *a1, cocos2d::CCObject *a2)\n{\n  double v2; // xmm0_8\n  cocos2d::CCDictionary *m_variables; // r15\n  intptr_t v5; // rsi\n  cocos2d::CCObject *v6; // rax\n  cocos2d::CCString *v7; // r15\n  GameManager *v8; // r14\n  const char *CString; // rax\n  const char *v10; // r15\n  size_t v11; // rax\n  size_t v12; // r14\n  char *v13; // r12\n  unsigned int v14; // eax\n  size_t v15; // r13\n  _QWORD __dst[2]; // [rsp+0h] [rbp-40h] BYREF\n  void *__p; // [rsp+10h] [rbp-30h]\n\n  m_variables = a1->m_variables;\n  v5 = ((int (__fastcall *)(cocos2d::CCObject *))a2->getTag)(a2);\n  v6 = cocos2d::CCDictionary::objectForKey(m_variables, v5);\n  if ( !v6 )\n  {\n    v14 = ((__int64 (__fastcall *)(cocos2d::CCObject *))a2->getTag)(a2);\n    ((void (__fastcall *)(GJOptionsLayer *, _QWORD))a1->didToggle)(a1, v14);\n    return;\n  }\n  v7 = (cocos2d::CCString *)v6;\n  v8 = GameManager::sharedState();\n  CString = cocos2d::CCString::getCString(v7);\n  GameManager::toggleGameVariable(v8, CString);\n  v10 = cocos2d::CCString::getCString(v7);\n  v11 = strlen(v10);\n  if ( v11 >= 0xFFFFFFFFFFFFFFF8LL )\n    sub_100006BF0(v2);\n  v12 = v11;\n  if ( v11 >= 0x17 )\n  {\n    v15 = 26;\n    if ( (v11 | 7) != 0x17 )\n      v15 = (v11 | 7) + 1;\n    v13 = (char *)operator new(v15);\n    __p = v13;\n    __dst[0] = v15 + 1;\n    __dst[1] = v12;\n    goto LABEL_10;\n  }\n  LOBYTE(__dst[0]) = 2 * v11;\n  v13 = (char *)__dst + 1;\n  if ( v11 )\nLABEL_10:\n    memmove(v13, v10, v12);\n  v13[v12] = 0;\n  ((void (__fastcall *)(GJOptionsLayer *, _QWORD *))a1->didToggleGV)(a1, __dst);\n  if ( (__dst[0] & 1) != 0 )\n    operator delete(__p);\n}", "assembly": "; \n; GJOptionsLayer::onToggle from 0x10029ceb0 to 0x10029cfde (302 bytes)\n; \n; 2 xrefs:\n; > GJOptionsLayer::addToggleInternal @ 0x10029c848\n; > GameOptionsLayer::setupOptions @ 0x1002b15c0\n; \n; This function is hookable on this platform!\n; \n; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA\n; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings\n; \n\npush    rbp                                                            ; +0x0, 0x10029ceb0\nmov     rbp, rsp                                                       ; +0x1, 0x10029ceb1\npush    r15                                                            ; +0x4, 0x10029ceb4\npush    r14                                                            ; +0x6, 0x10029ceb6\npush    r13                                                            ; +0x8, 0x10029ceb8\npush    r12                                                            ; +0xa, 0x10029ceba\npush    rbx                                                            ; +0xc, 0x10029cebc\nsub     rsp, 18h                                                       ; +0xd, 0x10029cebd\nmov     r14, rsi                                                       ; +0x11, 0x10029cec1\nmov     rbx, rdi                                                       ; +0x14, 0x10029cec4\nmov     r15, [rdi+3D0h]                                                ; +0x17, 0x10029cec7\nmov     rax, [rsi]                                                     ; +0x1e, 0x10029cece\nmov     rdi, rsi                                                       ; +0x21, 0x10029ced1\ncall    qword ptr [rax+40h]                                            ; +0x24, 0x10029ced4\nmovsxd  rsi, eax                                                       ; +0x27, 0x10029ced7\nmov     rdi, r15                                                       ; +0x2a, 0x10029ceda\ncall    cocos2d__CCDictionary__objectForKey                            ; +0x2d, 0x10029cedd\ntest    rax, rax                                                       ; +0x32, 0x10029cee2\njz      short loc_10029CF3D                                            ; +0x35, 0x10029cee5\nmov     r15, rax                                                       ; +0x37, 0x10029cee7\ncall    GameManager__sharedState                                       ; +0x3a, 0x10029ceea\nmov     r14, rax                                                       ; +0x3f, 0x10029ceef\nmov     rdi, r15                                                       ; +0x42, 0x10029cef2\ncall    cocos2d__CCString__getCString                                  ; +0x45, 0x10029cef5\nmov     rdi, r14                                                       ; +0x4a, 0x10029cefa\nmov     rsi, rax                                                       ; +0x4d, 0x10029cefd\ncall    GameManager__toggleGameVariable                                ; +0x50, 0x10029cf00\nmov     rdi, r15                                                       ; +0x55, 0x10029cf05\ncall    cocos2d__CCString__getCString                                  ; +0x58, 0x10029cf08\nmov     r15, rax                                                       ; +0x5d, 0x10029cf0d\nmov     rdi, rax; __s                                                  ; +0x60, 0x10029cf10\ncall    _strlen                                                        ; +0x63, 0x10029cf13\ncmp     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0x68, 0x10029cf18\njnb     loc_10029CFD9                                                  ; +0x6c, 0x10029cf1c\nmov     r14, rax                                                       ; +0x72, 0x10029cf22\ncmp     rax, 17h                                                       ; +0x75, 0x10029cf25\njnb     short loc_10029CF65                                            ; +0x79, 0x10029cf29\nlea     eax, [r14+r14]                                                 ; +0x7b, 0x10029cf2b\nmov     byte ptr [rbp+__dst], al                                       ; +0x7f, 0x10029cf2f\nlea     r12, [rbp+__dst+1]                                             ; +0x82, 0x10029cf32\ntest    r14, r14                                                       ; +0x86, 0x10029cf36\njnz     short loc_10029CF98                                            ; +0x89, 0x10029cf39\njmp     short loc_10029CFA6                                            ; +0x8b, 0x10029cf3b\nmov     rax, [r14]                                                     ; +0x8d, 0x10029cf3d\nmov     rdi, r14                                                       ; +0x90, 0x10029cf40\ncall    qword ptr [rax+40h]                                            ; +0x93, 0x10029cf43\nmov     rcx, [rbx]                                                     ; +0x96, 0x10029cf46\nmov     rcx, [rcx+5D0h]                                                ; +0x99, 0x10029cf49\nmov     rdi, rbx                                                       ; +0xa0, 0x10029cf50\nmov     esi, eax                                                       ; +0xa3, 0x10029cf53\nadd     rsp, 18h                                                       ; +0xa5, 0x10029cf55\npop     rbx                                                            ; +0xa9, 0x10029cf59\npop     r12                                                            ; +0xaa, 0x10029cf5a\npop     r13                                                            ; +0xac, 0x10029cf5c\npop     r14                                                            ; +0xae, 0x10029cf5e\npop     r15                                                            ; +0xb0, 0x10029cf60\npop     rbp                                                            ; +0xb2, 0x10029cf62\njmp     rcx                                                            ; +0xb3, 0x10029cf63\nmov     rax, r14                                                       ; +0xb5, 0x10029cf65\nor      rax, 7                                                         ; +0xb8, 0x10029cf68\nlea     rcx, [rax+1]                                                   ; +0xbc, 0x10029cf6c\ncmp     rax, 17h                                                       ; +0xc0, 0x10029cf70\nmov     r13d, 1Ah                                                      ; +0xc4, 0x10029cf74\ncmovnz  r13, rcx                                                       ; +0xca, 0x10029cf7a\nmov     rdi, r13; __sz                                                 ; +0xce, 0x10029cf7e\ncall    __Znwm; operator new(ulong)                                    ; +0xd1, 0x10029cf81\nmov     r12, rax                                                       ; +0xd6, 0x10029cf86\nmov     [rbp+__p], rax                                                 ; +0xd9, 0x10029cf89\ninc     r13                                                            ; +0xdd, 0x10029cf8d\nmov     [rbp+__dst], r13                                               ; +0xe0, 0x10029cf90\nmov     [rbp+var_38], r14                                              ; +0xe4, 0x10029cf94\nmov     rdi, r12; __dst                                                ; +0xe8, 0x10029cf98\nmov     rsi, r15; __src                                                ; +0xeb, 0x10029cf9b\nmov     rdx, r14; __len                                                ; +0xee, 0x10029cf9e\ncall    _memmove                                                       ; +0xf1, 0x10029cfa1\nmov     byte ptr [r12+r14], 0                                          ; +0xf6, 0x10029cfa6\nmov     rax, [rbx]                                                     ; +0xfb, 0x10029cfab\nlea     rsi, [rbp+__dst]                                               ; +0xfe, 0x10029cfae\nmov     rdi, rbx                                                       ; +0x102, 0x10029cfb2\ncall    qword ptr [rax+5C8h]                                           ; +0x105, 0x10029cfb5\ntest    byte ptr [rbp+__dst], 1                                        ; +0x10b, 0x10029cfbb\njz      short loc_10029CFCA                                            ; +0x10f, 0x10029cfbf\nmov     rdi, [rbp+__p]; __p                                            ; +0x111, 0x10029cfc1\ncall    __ZdlPv; operator delete(void *)                               ; +0x115, 0x10029cfc5\nadd     rsp, 18h                                                       ; +0x11a, 0x10029cfca\npop     rbx                                                            ; +0x11e, 0x10029cfce\npop     r12                                                            ; +0x11f, 0x10029cfcf\npop     r13                                                            ; +0x121, 0x10029cfd1\npop     r14                                                            ; +0x123, 0x10029cfd3\npop     r15                                                            ; +0x125, 0x10029cfd5\npop     rbp                                                            ; +0x127, 0x10029cfd7\nretn                                                                   ; +0x128, 0x10029cfd8\ncall    sub_100006BF0                                                  ; +0x129, 0x10029cfd9", "xrefs": ["GJOptionsLayer::addToggleInternal @ 0x10029c848", "GameOptionsLayer::setupOptions @ 0x1002b15c0"], "is_objc": false, "is_arm32": false, "is_arm64": false, "bida_info": "8.0.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings"}