{"type": "func", "start": 4298472240, "end": 4298472587, "name": "GJGarageLayer::onToggleItem", "pseudocode": "// \n// GJGarageLayer::onToggleItem from 0x100357b30 to 0x100357c8b (347 bytes)\n// \n// 1 xrefs:\n// > GJGarageLayer::setupSpecialPage @ 0x100356cd6\n// \n// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n// \n// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n// Generated at Fri, 27 Nov 2026 12:28:52 +0000\n// \n\n__int64 __fastcall GJGarageLayer::onToggleItem(__int64 a1, _DWORD *a2)\n{\n  __int64 v2; // rax\n  unsigned int v4; // r14d\n  unsigned int v5; // r13d\n  __int64 v6; // rdx\n  double v7; // xmm0_8\n  __int64 v8; // rax\n  __int64 v9; // rdi\n  unsigned int v10; // r15d\n  __int64 v11; // rdx\n  double v12; // xmm0_8\n  __int64 v13; // rax\n  __int64 v14; // rax\n  unsigned __int8 isItemEnabled; // r12\n  __int64 v16; // rax\n  __int64 result; // rax\n  __int64 v18; // rbx\n  __int64 v19; // rbx\n  unsigned int v20; // r14d\n  __int64 v21; // rax\n  _DWORD v22[11]; // [rsp+0h] [rbp-2Ch] BYREF\n\n  v22[0] = HIDWORD(v2);\n  v4 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)a2 + 64LL))(a2);\n  v5 = a2[124];\n  *(_QWORD *)&v7 = GameManager::sharedState(a2, a2, v6).u64[0];\n  v9 = v8;\n  v10 = GameManager::iconTypeToUnlockType(v8, v5, v7);\n  *(_QWORD *)&v12 = GameManager::sharedState(v9, v5, v11).u64[0];\n  if ( !(unsigned __int8)GameManager::isIconUnlocked(v13, v4, v5, v12) )\n    return (*(__int64 (__fastcall **)(__int64, _QWORD, _QWORD))(*(_QWORD *)a1 + 1184LL))(a1, v4, v10);\n  v14 = GameStatsManager::sharedState();\n  isItemEnabled = GameStatsManager::isItemEnabled(v14, v10, v4);\n  v16 = GameStatsManager::sharedState();\n  GameStatsManager::toggleEnableItem(v16, v10, v4, isItemEnabled ^ 1);\n  result = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)a2 + 1072LL))(a2);\n  if ( !*(_BYTE *)(result + 620) )\n  {\n    v18 = *(_QWORD *)(result + 600);\n    if ( isItemEnabled )\n    {\n      memset(v22, 100, 3);\n    }\n    else\n    {\n      BYTE2(v22[0]) = -1;\n      LOWORD(v22[0]) = -1;\n    }\n    (*(void (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)v18 + 960LL))(v18, v22);\n    result = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v18 + 488LL))(v18);\n    if ( result )\n    {\n      v19 = result;\n      result = sub_1007FEF90(result);\n      if ( (_DWORD)result )\n      {\n        v20 = 0;\n        do\n        {\n          v21 = sub_1007FEFE0(v19, v20);\n          (*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v21 + 344LL))(v21, 1);\n          ++v20;\n          result = sub_1007FEF90(v19);\n        }\n        while ( v20 < (unsigned int)result );\n      }\n    }\n  }\n  return result;\n}", "assembly": "; \n; GJGarageLayer::onToggleItem from 0x100357b30 to 0x100357c8b (347 bytes)\n; \n; 1 xrefs:\n; > GJGarageLayer::setupSpecialPage @ 0x100356cd6\n; \n; This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n; \n; Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n; Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n; Generated at Fri, 27 Nov 2026 12:28:52 +0000\n; \npush    rbp                                                            ; +0x0, 0x100357b30\nmov     rbp, rsp                                                       ; +0x1, 0x100357b31\npush    r15                                                            ; +0x4, 0x100357b34\npush    r14                                                            ; +0x6, 0x100357b36\npush    r13                                                            ; +0x8, 0x100357b38\npush    r12                                                            ; +0xa, 0x100357b3a\npush    rbx                                                            ; +0xc, 0x100357b3c\npush    rax                                                            ; +0xd, 0x100357b3d\nmov     rbx, rsi                                                       ; +0xe, 0x100357b3e\nmov     r12, rdi                                                       ; +0x11, 0x100357b41\nmov     rax, [rsi]                                                     ; +0x14, 0x100357b44\nmov     rdi, rsi                                                       ; +0x17, 0x100357b47\ncall    qword ptr [rax+40h]                                            ; +0x1a, 0x100357b4a\nmov     r14d, eax                                                      ; +0x1d, 0x100357b4d\nmov     r13d, [rbx+1F0h]                                               ; +0x20, 0x100357b50\ncall    GameManager__sharedState                                       ; +0x27, 0x100357b57\nmov     rdi, rax                                                       ; +0x2c, 0x100357b5c\nmov     esi, r13d                                                      ; +0x2f, 0x100357b5f\ncall    GameManager__iconTypeToUnlockType                              ; +0x32, 0x100357b62\nmov     r15d, eax                                                      ; +0x37, 0x100357b67\ncall    GameManager__sharedState                                       ; +0x3a, 0x100357b6a\nmov     rdi, rax                                                       ; +0x3f, 0x100357b6f\nmov     esi, r14d                                                      ; +0x42, 0x100357b72\nmov     edx, r13d                                                      ; +0x45, 0x100357b75\ncall    GameManager__isIconUnlocked                                    ; +0x48, 0x100357b78\ntest    al, al                                                         ; +0x4d, 0x100357b7d\njz      short loc_100357BE6                                            ; +0x4f, 0x100357b7f\ncall    GameStatsManager__sharedState                                  ; +0x51, 0x100357b81\nmov     rdi, rax                                                       ; +0x56, 0x100357b86\nmov     esi, r15d                                                      ; +0x59, 0x100357b89\nmov     edx, r14d                                                      ; +0x5c, 0x100357b8c\ncall    GameStatsManager__isItemEnabled                                ; +0x5f, 0x100357b8f\nmov     r12d, eax                                                      ; +0x64, 0x100357b94\nmov     r13d, eax                                                      ; +0x67, 0x100357b97\nxor     r13b, 1                                                        ; +0x6a, 0x100357b9a\ncall    GameStatsManager__sharedState                                  ; +0x6e, 0x100357b9e\nmovzx   ecx, r13b                                                      ; +0x73, 0x100357ba3\nmov     rdi, rax                                                       ; +0x77, 0x100357ba7\nmov     esi, r15d                                                      ; +0x7a, 0x100357baa\nmov     edx, r14d                                                      ; +0x7d, 0x100357bad\ncall    GameStatsManager__toggleEnableItem                             ; +0x80, 0x100357bb0\nmov     rax, [rbx]                                                     ; +0x85, 0x100357bb5\nmov     rdi, rbx                                                       ; +0x88, 0x100357bb8\ncall    qword ptr [rax+430h]                                           ; +0x8b, 0x100357bbb\ncmp     byte ptr [rax+26Ch], 0                                         ; +0x91, 0x100357bc1\njnz     loc_100357C7C                                                  ; +0x98, 0x100357bc8\nmov     rbx, [rax+258h]                                                ; +0x9e, 0x100357bce\ntest    r12b, r12b                                                     ; +0xa5, 0x100357bd5\njz      short loc_100357C0A                                            ; +0xa8, 0x100357bd8\nmov     [rbp+var_2A], 64h ; 'd'                                        ; +0xaa, 0x100357bda\nmov     [rbp+var_2C], 6464h                                            ; +0xae, 0x100357bde\njmp     short loc_100357C14                                            ; +0xb4, 0x100357be4\nmov     rax, [r12]                                                     ; +0xb6, 0x100357be6\nmov     rax, [rax+4A0h]                                                ; +0xba, 0x100357bea\nmov     rdi, r12                                                       ; +0xc1, 0x100357bf1\nmov     esi, r14d                                                      ; +0xc4, 0x100357bf4\nmov     edx, r15d                                                      ; +0xc7, 0x100357bf7\nadd     rsp, 8                                                         ; +0xca, 0x100357bfa\npop     rbx                                                            ; +0xce, 0x100357bfe\npop     r12                                                            ; +0xcf, 0x100357bff\npop     r13                                                            ; +0xd1, 0x100357c01\npop     r14                                                            ; +0xd3, 0x100357c03\npop     r15                                                            ; +0xd5, 0x100357c05\npop     rbp                                                            ; +0xd7, 0x100357c07\njmp     rax                                                            ; +0xd8, 0x100357c08\nmov     [rbp+var_2A], 0FFh                                             ; +0xda, 0x100357c0a\nmov     [rbp+var_2C], 0FFFFh                                           ; +0xde, 0x100357c0e\nmov     rax, [rbx]                                                     ; +0xe4, 0x100357c14\nlea     rsi, [rbp+var_2C]                                              ; +0xe7, 0x100357c17\nmov     rdi, rbx                                                       ; +0xeb, 0x100357c1b\ncall    qword ptr [rax+3C0h]                                           ; +0xee, 0x100357c1e\nmov     rax, [rbx]                                                     ; +0xf4, 0x100357c24\nmov     rdi, rbx                                                       ; +0xf7, 0x100357c27\ncall    qword ptr [rax+1E8h]                                           ; +0xfa, 0x100357c2a\ntest    rax, rax                                                       ; +0x100, 0x100357c30\njz      short loc_100357C7C                                            ; +0x103, 0x100357c33\nmov     rbx, rax                                                       ; +0x105, 0x100357c35\nmov     rdi, rax                                                       ; +0x108, 0x100357c38\ncall    sub_1007FEF90                                                  ; +0x10b, 0x100357c3b\ntest    eax, eax                                                       ; +0x110, 0x100357c40\njz      short loc_100357C7C                                            ; +0x112, 0x100357c42\nxor     r14d, r14d                                                     ; +0x114, 0x100357c44\nnop     word ptr [rax+rax+00000000h]                                   ; +0x117, 0x100357c47\nmov     rdi, rbx                                                       ; +0x120, 0x100357c50\nmov     esi, r14d                                                      ; +0x123, 0x100357c53\ncall    sub_1007FEFE0                                                  ; +0x126, 0x100357c56\nmov     rcx, [rax]                                                     ; +0x12b, 0x100357c5b\nmov     rdi, rax                                                       ; +0x12e, 0x100357c5e\nmov     esi, 1                                                         ; +0x131, 0x100357c61\ncall    qword ptr [rcx+158h]                                           ; +0x136, 0x100357c66\ninc     r14d                                                           ; +0x13c, 0x100357c6c\nmov     rdi, rbx                                                       ; +0x13f, 0x100357c6f\ncall    sub_1007FEF90                                                  ; +0x142, 0x100357c72\ncmp     r14d, eax                                                      ; +0x147, 0x100357c77\njb      short loc_100357C50                                            ; +0x14a, 0x100357c7a\nadd     rsp, 8                                                         ; +0x14c, 0x100357c7c\npop     rbx                                                            ; +0x150, 0x100357c80\npop     r12                                                            ; +0x151, 0x100357c81\npop     r13                                                            ; +0x153, 0x100357c83\npop     r14                                                            ; +0x155, 0x100357c85\npop     r15                                                            ; +0x157, 0x100357c87\npop     rbp                                                            ; +0x159, 0x100357c89\nretn                                                                   ; +0x15a, 0x100357c8a", "xrefs": ["GJGarageLayer::setupSpecialPage @ 0x100356cd6"], "is_objc": false, "is_32_bit": false, "is_64_bit": true, "idp_name": "pc", "bida_info": "8.3.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings"}