{"type": "func", "start": 9210048, "end": 9210536, "name": "GJOptionsLayer::layerForPage", "pseudocode": "// \n// GJOptionsLayer::layerForPage from 0x8c88c0 to 0x8c8aa8 (488 bytes)\n// \n// 3 xrefs:\n// > GJOptionsLayer::addToggleInternal @ 0x8dad14\n// > GameOptionsLayer::setupOptions @ 0x8dc1c0\n// > <???> @ 0x87300\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\ncocos2d::CCLayer *GJOptionsLayer::layerForPage(GJOptionsLayer *a1, int a2)\n{\n  cocos2d::CCDictionary *m_values; // x20\n  char *v5; // x0\n  cocos2d::CCLayer *v6; // x20\n  char *v7; // x0\n  unsigned int *v9; // x1\n  int v10; // w2\n  cocos2d::CCDictionary *v11; // x26\n  char *v12; // x0\n  char *v13; // x21\n  unsigned int *v14; // x1\n  int v15; // w0\n  std::string v16; // [xsp+60h] [xbp+60h] BYREF\n\n  m_values = a1->m_values;\n  v5 = (char *)GJOptionsLayer::layerKey(a1, a2);\n  sub_D153B8((int)&v16, v5);\n  v6 = (cocos2d::CCLayer *)cocos2d::CCDictionary::objectForKey(m_values, &v16);\n  v7 = (char *)v16.m_data.m_data - 24;\n  if ( (__int64 *)v16.m_data.m_data - 3 == &qword_124B6B0 )\n    goto LABEL_2;\n  if ( &pthread_create )\n  {\n    v9 = (unsigned int *)((char *)v16.m_data.m_data - 8);\n    do\n      v10 = __ldaxr(v9);\n    while ( __stlxr(v10 - 1, v9) );\n  }\n  else\n  {\n    v10 = *((_DWORD *)v16.m_data.m_data - 2);\n    *((_DWORD *)v16.m_data.m_data - 2) = v10 - 1;\n  }\n  if ( v10 > 0 )\n  {\nLABEL_2:\n    if ( v6 )\n      return v6;\n  }\n  else\n  {\n    operator delete(v7);\n    if ( v6 )\n      return v6;\n  }\n  v6 = cocos2d::CCLayer::create();\n  a1->m_mainLayer->addChild(a1->m_mainLayer, v6);\n  v11 = a1->m_values;\n  v12 = (char *)GJOptionsLayer::layerKey(a1, a2);\n  sub_D153B8((int)&v16, v12);\n  cocos2d::CCDictionary::setObject((int)v11, v6);\n  v13 = (char *)v16.m_data.m_data - 24;\n  if ( (__int64 *)v16.m_data.m_data - 3 != &qword_124B6B0 )\n  {\n    if ( &pthread_create )\n    {\n      v14 = (unsigned int *)((char *)v16.m_data.m_data - 8);\n      do\n        v15 = __ldaxr(v14);\n      while ( __stlxr(v15 - 1, v14) );\n    }\n    else\n    {\n      v15 = *((_DWORD *)v16.m_data.m_data - 2);\n      *((_DWORD *)v16.m_data.m_data - 2) = v15 - 1;\n    }\n    if ( v15 <= 0 )\n      operator delete(v13);\n  }\n  return v6;\n}", "assembly": "; \n; GJOptionsLayer::layerForPage from 0x8c88c0 to 0x8c8aa8 (488 bytes)\n; \n; 3 xrefs:\n; > GJOptionsLayer::addToggleInternal @ 0x8dad14\n; > GameOptionsLayer::setupOptions @ 0x8dc1c0\n; > <???> @ 0x87300\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\nSTP             X29, X30, [SP,#var_70]!                                ; +0x0, 0x8c88c0\nMOV             X29, SP                                                ; +0x4, 0x8c88c4\nSTP             X19, X20, [SP,#0x70+var_60]                            ; +0x8, 0x8c88c8\nADRP            X19, #__stack_chk_guard_ptr@PAGE                       ; +0xc, 0x8c88cc\nLDR             X20, [X0,#0x3E0]                                       ; +0x10, 0x8c88d0\nSTP             X23, X24, [SP,#0x70+var_40]                            ; +0x14, 0x8c88d4\nSTP             X21, X22, [SP,#0x70+var_50]                            ; +0x18, 0x8c88d8\nLDR             X2, [X19,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x1c, 0x8c88dc\nADD             X21, X29, #0x70+var_10                                 ; +0x20, 0x8c88e0\nSTP             X25, X26, [SP,#0x70+var_30]                            ; +0x24, 0x8c88e4\nMOV             X23, X0                                                ; +0x28, 0x8c88e8\nMOV             W25, W1                                                ; +0x2c, 0x8c88ec\nLDR             X2, [X2]                                               ; +0x30, 0x8c88f0\nADD             X24, X29, #0x70+var_20                                 ; +0x34, 0x8c88f4\nSTR             X2, [X29,#0x70+var_8]                                  ; +0x38, 0x8c88f8\nBL              _ZN14GJOptionsLayer8layerKeyEi; GJOptionsLayer::layerKey(int) ; +0x3c, 0x8c88fc\nMOV             X1, X0; char *                                         ; +0x40, 0x8c8900\nMOV             X2, X24                                                ; +0x44, 0x8c8904\nMOV             X0, X21; int                                           ; +0x48, 0x8c8908\nBL              sub_D153B8                                             ; +0x4c, 0x8c890c\nMOV             X0, X20                                                ; +0x50, 0x8c8910\nMOV             X1, X21                                                ; +0x54, 0x8c8914\nBL              _ZN7cocos2d12CCDictionary12objectForKeyERKSs; cocos2d::CCDictionary::objectForKey(std::string const&) ; +0x58, 0x8c8918\nADRP            X22, #off_122EFE8@PAGE                                 ; +0x5c, 0x8c891c\nLDR             X1, [X29,#0x70+var_10]                                 ; +0x60, 0x8c8920\nMOV             X20, X0                                                ; +0x64, 0x8c8924\nSUB             X0, X1, #0x18; p                                       ; +0x68, 0x8c8928\nLDR             X2, [X22,#off_122EFE8@PAGEOFF]; qword_124B6B0          ; +0x6c, 0x8c892c\nCMP             X0, X2                                                 ; +0x70, 0x8c8930\nB.NE            loc_8C896C                                             ; +0x74, 0x8c8934\nCBZ             X20, loc_8C89A0                                        ; +0x78, 0x8c8938\nLDR             X19, [X19,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x7c, 0x8c893c\nMOV             X0, X20                                                ; +0x80, 0x8c8940\nLDR             X2, [X29,#0x70+var_8]                                  ; +0x84, 0x8c8944\nLDR             X1, [X19]                                              ; +0x88, 0x8c8948\nCMP             X2, X1                                                 ; +0x8c, 0x8c894c\nB.NE            loc_8C8A5C                                             ; +0x90, 0x8c8950\nLDP             X19, X20, [SP,#0x70+var_60]                            ; +0x94, 0x8c8954\nLDP             X21, X22, [SP,#0x70+var_50]                            ; +0x98, 0x8c8958\nLDP             X23, X24, [SP,#0x70+var_40]                            ; +0x9c, 0x8c895c\nLDP             X25, X26, [SP,#0x70+var_30]                            ; +0xa0, 0x8c8960\nLDP             X29, X30, [SP+0x70+var_70],#0x70                       ; +0xa4, 0x8c8964\nRET                                                                    ; +0xa8, 0x8c8968\nADRP            X2, #pthread_create_ptr_0@PAGE                         ; +0xac, 0x8c896c\nLDR             X2, [X2,#pthread_create_ptr_0@PAGEOFF]; pthread_create ; +0xb0, 0x8c8970\nCBZ             X2, loc_8C8A3C                                         ; +0xb4, 0x8c8974\nSUB             X1, X1, #8                                             ; +0xb8, 0x8c8978\nLDAXR           W2, [X1]                                               ; +0xbc, 0x8c897c\nSUB             W3, W2, #1                                             ; +0xc0, 0x8c8980\nSTLXR           W4, W3, [X1]                                           ; +0xc4, 0x8c8984\nCBNZ            W4, loc_8C897C                                         ; +0xc8, 0x8c8988\nCMP             W2, WZR                                                ; +0xcc, 0x8c898c\nB.GT            loc_8C8938                                             ; +0xd0, 0x8c8990\nADD             X1, X29, #0x70+var_18                                  ; +0xd4, 0x8c8994\nBL              j__ZdlPv; operator delete(void *)                      ; +0xd8, 0x8c8998\nCBNZ            X20, loc_8C893C                                        ; +0xdc, 0x8c899c\nBL              _ZN7cocos2d7CCLayer6createEv; cocos2d::CCLayer::create(void) ; +0xe0, 0x8c89a0\nMOV             X1, X0                                                 ; +0xe4, 0x8c89a4\nLDR             X2, [X23,#0x240]                                       ; +0xe8, 0x8c89a8\nMOV             X20, X0                                                ; +0xec, 0x8c89ac\nMOV             X0, X2                                                 ; +0xf0, 0x8c89b0\nLDR             X2, [X2]                                               ; +0xf4, 0x8c89b4\nLDR             X2, [X2,#0x1B8]                                        ; +0xf8, 0x8c89b8\nBLR             X2                                                     ; +0xfc, 0x8c89bc\nLDR             X26, [X23,#0x3E0]                                      ; +0x100, 0x8c89c0\nMOV             W1, W25; int                                           ; +0x104, 0x8c89c4\nMOV             X0, X23; this                                          ; +0x108, 0x8c89c8\nBL              _ZN14GJOptionsLayer8layerKeyEi; GJOptionsLayer::layerKey(int) ; +0x10c, 0x8c89cc\nMOV             X1, X0; char *                                         ; +0x110, 0x8c89d0\nMOV             X2, X24                                                ; +0x114, 0x8c89d4\nMOV             X0, X21; int                                           ; +0x118, 0x8c89d8\nBL              sub_D153B8                                             ; +0x11c, 0x8c89dc\nMOV             X0, X26; int                                           ; +0x120, 0x8c89e0\nMOV             X1, X20; this                                          ; +0x124, 0x8c89e4\nMOV             X2, X21                                                ; +0x128, 0x8c89e8\nBL              _ZN7cocos2d12CCDictionary9setObjectEPNS_8CCObjectERKSs; cocos2d::CCDictionary::setObject(cocos2d::CCObject *,std::string const&) ; +0x12c, 0x8c89ec\nLDR             X1, [X29,#0x70+var_10]                                 ; +0x130, 0x8c89f0\nLDR             X22, [X22,#off_122EFE8@PAGEOFF]; qword_124B6B0         ; +0x134, 0x8c89f4\nSUB             X21, X1, #0x18                                         ; +0x138, 0x8c89f8\nCMP             X21, X22                                               ; +0x13c, 0x8c89fc\nB.EQ            loc_8C893C                                             ; +0x140, 0x8c8a00\nADRP            X0, #pthread_create_ptr_0@PAGE                         ; +0x144, 0x8c8a04\nLDR             X0, [X0,#pthread_create_ptr_0@PAGEOFF]; pthread_create ; +0x148, 0x8c8a08\nCBZ             X0, loc_8C8A4C                                         ; +0x14c, 0x8c8a0c\nSUB             X1, X1, #8                                             ; +0x150, 0x8c8a10\nLDAXR           W0, [X1]                                               ; +0x154, 0x8c8a14\nSUB             W2, W0, #1                                             ; +0x158, 0x8c8a18\nSTLXR           W3, W2, [X1]                                           ; +0x15c, 0x8c8a1c\nCBNZ            W3, loc_8C8A14                                         ; +0x160, 0x8c8a20\nCMP             W0, WZR                                                ; +0x164, 0x8c8a24\nB.GT            loc_8C893C                                             ; +0x168, 0x8c8a28\nMOV             X0, X21; p                                             ; +0x16c, 0x8c8a2c\nADD             X1, X29, #0x70+var_18                                  ; +0x170, 0x8c8a30\nBL              j__ZdlPv; operator delete(void *)                      ; +0x174, 0x8c8a34\nB               loc_8C893C                                             ; +0x178, 0x8c8a38\nLDUR            W2, [X1,#-8]                                           ; +0x17c, 0x8c8a3c\nSUB             W3, W2, #1                                             ; +0x180, 0x8c8a40\nSTUR            W3, [X1,#-8]                                           ; +0x184, 0x8c8a44\nB               loc_8C898C                                             ; +0x188, 0x8c8a48\nLDUR            W0, [X1,#-8]                                           ; +0x18c, 0x8c8a4c\nSUB             W2, W0, #1                                             ; +0x190, 0x8c8a50\nSTUR            W2, [X1,#-8]                                           ; +0x194, 0x8c8a54\nB               loc_8C8A24                                             ; +0x198, 0x8c8a58\nBL              .__stack_chk_fail                                      ; +0x19c, 0x8c8a5c\nMOV             X19, X0                                                ; +0x1a0, 0x8c8a60\nLDR             X0, [X29,#0x70+var_10]                                 ; +0x1a4, 0x8c8a64\nLDR             X22, [X22,#0xFE8]                                      ; +0x1a8, 0x8c8a68\nSUB             X0, X0, #0x18                                          ; +0x1ac, 0x8c8a6c\nCMP             X0, X22                                                ; +0x1b0, 0x8c8a70\nB.NE            loc_8C8A9C                                             ; +0x1b4, 0x8c8a74\nMOV             X0, X19                                                ; +0x1b8, 0x8c8a78\nBL              _Unwind_Resume                                         ; +0x1bc, 0x8c8a7c\nADRP            X1, #off_122EFE8@PAGE                                  ; +0x1c0, 0x8c8a80\nMOV             X19, X0                                                ; +0x1c4, 0x8c8a84\nLDR             X0, [X29,#0x70+var_10]                                 ; +0x1c8, 0x8c8a88\nLDR             X1, [X1,#off_122EFE8@PAGEOFF]; qword_124B6B0           ; +0x1cc, 0x8c8a8c\nSUB             X0, X0, #0x18                                          ; +0x1d0, 0x8c8a90\nCMP             X0, X1                                                 ; +0x1d4, 0x8c8a94\nB.EQ            loc_8C8A78                                             ; +0x1d8, 0x8c8a98\nADD             X1, X29, #0x70+var_18                                  ; +0x1dc, 0x8c8a9c\nBL              sub_4DC698                                             ; +0x1e0, 0x8c8aa0\nB               loc_8C8A78                                             ; +0x1e4, 0x8c8aa4", "xrefs": ["GJOptionsLayer::addToggleInternal @ 0x8dad14", "GameOptionsLayer::setupOptions @ 0x8dc1c0", "<???> @ 0x87300"], "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"}