{"type": "func", "start": 5371398016, "end": 5371398432, "name": "GJOptionsLayer::layerForPage", "pseudocode": "// \n// GJOptionsLayer::layerForPage from 0x140290780 to 0x140290920 (416 bytes)\n// \n// 4 xrefs:\n// > GJOptionsLayer::addToggleInternal @ 0x14028ff75\n// > GameOptionsLayer::setupOptions @ 0x14029f691\n// > <???> @ 0x1406d1964\n// > <???> @ 0x1406d1970\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\n// Hidden C++ exception states: #wind=1\ncocos2d::CCLayer *GJOptionsLayer::layerForPage(GJOptionsLayer *a1, int a2)\n{\n  cocos2d::CCString *v4; // rax\n  const char *CString; // rax\n  size_t v6; // rbx\n  size_t v7; // r8\n  cocos2d::CCLayer *v8; // rdi\n  void *v9; // rcx\n  cocos2d::CCString *v10; // rax\n  const char *v11; // rax\n  void *v12; // rcx\n  void *Block[2]; // [rsp+20h] [rbp-48h] BYREF\n  __int128 v15; // [rsp+30h] [rbp-38h]\n\n  v4 = cocos2d::CCString::createWithFormat(\"layer_%i\", a2);\n  CString = cocos2d::CCString::getCString(v4);\n  *(_OWORD *)Block = 0;\n  v15 = 0;\n  v6 = -1;\n  v7 = -1;\n  do\n    ++v7;\n  while ( CString[v7] );\n  sub_14003A930(Block, CString, v7);\n  v8 = (cocos2d::CCLayer *)cocos2d::CCDictionary::objectForKey(a1->m_values, Block);\n  if ( *((_QWORD *)&v15 + 1) > 0xFu )\n  {\n    v9 = Block[0];\n    if ( (unsigned __int64)(*((_QWORD *)&v15 + 1) + 1LL) >= 0x1000 )\n    {\n      v9 = *((void **)Block[0] - 1);\n      if ( (unsigned __int64)((char *)Block[0] - (char *)v9 - 8) > 0x1F )\n        invalid_parameter_noinfo_noreturn();\n    }\n    j_j_free(v9);\n  }\n  if ( !v8 )\n  {\n    v8 = (cocos2d::CCLayer *)cocos2d::CCLayer::create();\n    a1->m_mainLayer->addChild_1(a1->m_mainLayer, v8);\n    v10 = cocos2d::CCString::createWithFormat(\"layer_%i\", a2);\n    v11 = cocos2d::CCString::getCString(v10);\n    *(_OWORD *)Block = 0;\n    v15 = 0;\n    do\n      ++v6;\n    while ( v11[v6] );\n    sub_14003A930(Block, v11, v6);\n    cocos2d::CCDictionary::setObject(a1->m_values, v8, Block);\n    if ( *((_QWORD *)&v15 + 1) > 0xFu )\n    {\n      v12 = Block[0];\n      if ( (unsigned __int64)(*((_QWORD *)&v15 + 1) + 1LL) >= 0x1000 )\n      {\n        v12 = *((void **)Block[0] - 1);\n        if ( (unsigned __int64)((char *)Block[0] - (char *)v12 - 8) > 0x1F )\n          invalid_parameter_noinfo_noreturn();\n      }\n      j_j_free(v12);\n    }\n  }\n  return v8;\n}", "assembly": "; \n; GJOptionsLayer::layerForPage from 0x140290780 to 0x140290920 (416 bytes)\n; \n; 4 xrefs:\n; > GJOptionsLayer::addToggleInternal @ 0x14028ff75\n; > GameOptionsLayer::setupOptions @ 0x14029f691\n; > <???> @ 0x1406d1964\n; > <???> @ 0x1406d1970\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\nmov     [rsp+arg_10], rbx                                              ; +0x0, 0x140290780\npush    rbp                                                            ; +0x5, 0x140290785\npush    rsi                                                            ; +0x6, 0x140290786\npush    rdi                                                            ; +0x7, 0x140290787\nsub     rsp, 50h                                                       ; +0x8, 0x140290788\nmov     rax, cs:__security_cookie                                      ; +0xc, 0x14029078c\nxor     rax, rsp                                                       ; +0x13, 0x140290793\nmov     [rsp+68h+var_28], rax                                          ; +0x16, 0x140290796\nmov     ebp, edx                                                       ; +0x1b, 0x14029079b\nmov     rsi, rcx                                                       ; +0x1d, 0x14029079d\nlea     rcx, aLayerI; \"layer_%i\"                                       ; +0x20, 0x1402907a0\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0x27, 0x1402907a7\nmov     rcx, rax                                                       ; +0x2d, 0x1402907ad\ncall    cs:?getCString@CCString@cocos2d@@QEBAPEBDXZ; cocos2d::CCString::getCString(void) ; +0x30, 0x1402907b0\nxorps   xmm0, xmm0                                                     ; +0x36, 0x1402907b6\nmovups  xmmword ptr [rsp+68h+Block], xmm0                              ; +0x39, 0x1402907b9\nxorps   xmm1, xmm1                                                     ; +0x3e, 0x1402907be\nmovdqu  [rsp+68h+var_38], xmm1                                         ; +0x41, 0x1402907c1\nmov     rbx, 0FFFFFFFFFFFFFFFFh                                        ; +0x47, 0x1402907c7\nmov     r8, rbx                                                        ; +0x4e, 0x1402907ce\ninc     r8                                                             ; +0x51, 0x1402907d1\ncmp     byte ptr [rax+r8], 0                                           ; +0x54, 0x1402907d4\njnz     short loc_1402907D1                                            ; +0x59, 0x1402907d9\nmov     rdx, rax                                                       ; +0x5b, 0x1402907db\nlea     rcx, [rsp+68h+Block]                                           ; +0x5e, 0x1402907de\ncall    sub_14003A930                                                  ; +0x63, 0x1402907e3\nnop                                                                    ; +0x68, 0x1402907e8\nlea     rdx, [rsp+68h+Block]                                           ; +0x69, 0x1402907e9\nmov     rcx, [rsi+3C8h]                                                ; +0x6e, 0x1402907ee\ncall    cs:?objectForKey@CCDictionary@cocos2d@@QEAAPEAVCCObject@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z; cocos2d::CCDictionary::objectForKey(std::string const &) ; +0x75, 0x1402907f5\nmov     rdi, rax                                                       ; +0x7b, 0x1402907fb\nmov     rdx, qword ptr [rsp+68h+var_38+8]                              ; +0x7e, 0x1402907fe\ncmp     rdx, 0Fh                                                       ; +0x83, 0x140290803\njbe     short loc_14029083E                                            ; +0x87, 0x140290807\ninc     rdx                                                            ; +0x89, 0x140290809\nmov     rcx, [rsp+68h+Block]; Block                                    ; +0x8c, 0x14029080c\nmov     rax, rcx                                                       ; +0x91, 0x140290811\ncmp     rdx, 1000h                                                     ; +0x94, 0x140290814\njb      short loc_140290839                                            ; +0x9b, 0x14029081b\nadd     rdx, 27h ; '''                                                 ; +0x9d, 0x14029081d\nmov     rcx, [rcx-8]                                                   ; +0xa1, 0x140290821\nsub     rax, rcx                                                       ; +0xa5, 0x140290825\nadd     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0xa8, 0x140290828\ncmp     rax, 1Fh                                                       ; +0xac, 0x14029082c\njbe     short loc_140290839                                            ; +0xb0, 0x140290830\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0xb2, 0x140290832\ndb 0CCh                                                                ; +0xb8, 0x140290838\ncall    j_j_free                                                       ; +0xb9, 0x140290839\ntest    rdi, rdi                                                       ; +0xbe, 0x14029083e\njnz     loc_140290900                                                  ; +0xc1, 0x140290841\ncall    cs:?create@CCLayer@cocos2d@@SAPEAV12@XZ; cocos2d::CCLayer::create(void) ; +0xc7, 0x140290847\nmov     rdi, rax                                                       ; +0xcd, 0x14029084d\nmov     rcx, [rsi+240h]                                                ; +0xd0, 0x140290850\nmov     rax, [rcx]                                                     ; +0xd7, 0x140290857\nmov     rdx, rdi                                                       ; +0xda, 0x14029085a\ncall    qword ptr [rax+1C0h]                                           ; +0xdd, 0x14029085d\nmov     edx, ebp                                                       ; +0xe3, 0x140290863\nlea     rcx, aLayerI; \"layer_%i\"                                       ; +0xe5, 0x140290865\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0xec, 0x14029086c\nmov     rcx, rax                                                       ; +0xf2, 0x140290872\ncall    cs:?getCString@CCString@cocos2d@@QEBAPEBDXZ; cocos2d::CCString::getCString(void) ; +0xf5, 0x140290875\nxorps   xmm0, xmm0                                                     ; +0xfb, 0x14029087b\nmovups  xmmword ptr [rsp+68h+Block], xmm0                              ; +0xfe, 0x14029087e\nxorps   xmm1, xmm1                                                     ; +0x103, 0x140290883\nmovdqu  [rsp+68h+var_38], xmm1                                         ; +0x106, 0x140290886\nnop     dword ptr [rax+00h]                                            ; +0x10c, 0x14029088c\ninc     rbx                                                            ; +0x110, 0x140290890\ncmp     byte ptr [rax+rbx], 0                                          ; +0x113, 0x140290893\njnz     short loc_140290890                                            ; +0x117, 0x140290897\nmov     r8, rbx                                                        ; +0x119, 0x140290899\nmov     rdx, rax                                                       ; +0x11c, 0x14029089c\nlea     rcx, [rsp+68h+Block]                                           ; +0x11f, 0x14029089f\ncall    sub_14003A930                                                  ; +0x124, 0x1402908a4\nnop                                                                    ; +0x129, 0x1402908a9\nlea     r8, [rsp+68h+Block]                                            ; +0x12a, 0x1402908aa\nmov     rdx, rdi                                                       ; +0x12f, 0x1402908af\nmov     rcx, [rsi+3C8h]                                                ; +0x132, 0x1402908b2\ncall    cs:?setObject@CCDictionary@cocos2d@@QEAAXPEAVCCObject@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z; cocos2d::CCDictionary::setObject(cocos2d::CCObject *,std::string const &) ; +0x139, 0x1402908b9\nnop                                                                    ; +0x13f, 0x1402908bf\nmov     rdx, qword ptr [rsp+68h+var_38+8]                              ; +0x140, 0x1402908c0\ncmp     rdx, 0Fh                                                       ; +0x145, 0x1402908c5\njbe     short loc_140290900                                            ; +0x149, 0x1402908c9\ninc     rdx                                                            ; +0x14b, 0x1402908cb\nmov     rcx, [rsp+68h+Block]; Block                                    ; +0x14e, 0x1402908ce\nmov     rax, rcx                                                       ; +0x153, 0x1402908d3\ncmp     rdx, 1000h                                                     ; +0x156, 0x1402908d6\njb      short loc_1402908FB                                            ; +0x15d, 0x1402908dd\nadd     rdx, 27h ; '''                                                 ; +0x15f, 0x1402908df\nmov     rcx, [rcx-8]                                                   ; +0x163, 0x1402908e3\nsub     rax, rcx                                                       ; +0x167, 0x1402908e7\nadd     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0x16a, 0x1402908ea\ncmp     rax, 1Fh                                                       ; +0x16e, 0x1402908ee\njbe     short loc_1402908FB                                            ; +0x172, 0x1402908f2\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0x174, 0x1402908f4\ndb 0CCh                                                                ; +0x17a, 0x1402908fa\ncall    j_j_free                                                       ; +0x17b, 0x1402908fb\nmov     rax, rdi                                                       ; +0x180, 0x140290900\nmov     rcx, [rsp+68h+var_28]                                          ; +0x183, 0x140290903\nxor     rcx, rsp; StackCookie                                          ; +0x188, 0x140290908\ncall    __security_check_cookie                                        ; +0x18b, 0x14029090b\nmov     rbx, [rsp+68h+arg_10]                                          ; +0x190, 0x140290910\nadd     rsp, 50h                                                       ; +0x198, 0x140290918\npop     rdi                                                            ; +0x19c, 0x14029091c\npop     rsi                                                            ; +0x19d, 0x14029091d\npop     rbp                                                            ; +0x19e, 0x14029091e\nretn                                                                   ; +0x19f, 0x14029091f", "xrefs": ["GJOptionsLayer::addToggleInternal @ 0x14028ff75", "GameOptionsLayer::setupOptions @ 0x14029f691", "<???> @ 0x1406d1964", "<???> @ 0x1406d1970"], "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"}