{"type": "func", "start": 5371594528, "end": 5371594958, "name": "KeybindingsLayer::layerForPage", "pseudocode": "// \n// KeybindingsLayer::layerForPage from 0x1402c0720 to 0x1402c08ce (430 bytes)\n// \n// 3 xrefs:\n// > KeybindingsLayer::addKeyPair @ 0x1402c032d\n// > <???> @ 0x1406d2948\n// > <???> @ 0x1406d2954\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 *KeybindingsLayer::layerForPage(KeybindingsLayer *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    v8->setVisible(v8, 0);\n  }\n  return v8;\n}", "assembly": "; \n; KeybindingsLayer::layerForPage from 0x1402c0720 to 0x1402c08ce (430 bytes)\n; \n; 3 xrefs:\n; > KeybindingsLayer::addKeyPair @ 0x1402c032d\n; > <???> @ 0x1406d2948\n; > <???> @ 0x1406d2954\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, 0x1402c0720\npush    rbp                                                            ; +0x5, 0x1402c0725\npush    rsi                                                            ; +0x6, 0x1402c0726\npush    rdi                                                            ; +0x7, 0x1402c0727\nsub     rsp, 50h                                                       ; +0x8, 0x1402c0728\nmov     rax, cs:__security_cookie                                      ; +0xc, 0x1402c072c\nxor     rax, rsp                                                       ; +0x13, 0x1402c0733\nmov     [rsp+68h+var_28], rax                                          ; +0x16, 0x1402c0736\nmov     ebp, edx                                                       ; +0x1b, 0x1402c073b\nmov     rsi, rcx                                                       ; +0x1d, 0x1402c073d\nlea     rcx, aLayerI; \"layer_%i\"                                       ; +0x20, 0x1402c0740\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0x27, 0x1402c0747\nmov     rcx, rax                                                       ; +0x2d, 0x1402c074d\ncall    cs:?getCString@CCString@cocos2d@@QEBAPEBDXZ; cocos2d::CCString::getCString(void) ; +0x30, 0x1402c0750\nxorps   xmm0, xmm0                                                     ; +0x36, 0x1402c0756\nmovups  xmmword ptr [rsp+68h+Block], xmm0                              ; +0x39, 0x1402c0759\nxorps   xmm1, xmm1                                                     ; +0x3e, 0x1402c075e\nmovdqu  [rsp+68h+var_38], xmm1                                         ; +0x41, 0x1402c0761\nmov     rbx, 0FFFFFFFFFFFFFFFFh                                        ; +0x47, 0x1402c0767\nmov     r8, rbx                                                        ; +0x4e, 0x1402c076e\ninc     r8                                                             ; +0x51, 0x1402c0771\ncmp     byte ptr [rax+r8], 0                                           ; +0x54, 0x1402c0774\njnz     short loc_1402C0771                                            ; +0x59, 0x1402c0779\nmov     rdx, rax                                                       ; +0x5b, 0x1402c077b\nlea     rcx, [rsp+68h+Block]                                           ; +0x5e, 0x1402c077e\ncall    sub_14003A930                                                  ; +0x63, 0x1402c0783\nnop                                                                    ; +0x68, 0x1402c0788\nlea     rdx, [rsp+68h+Block]                                           ; +0x69, 0x1402c0789\nmov     rcx, [rsi+288h]                                                ; +0x6e, 0x1402c078e\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, 0x1402c0795\nmov     rdi, rax                                                       ; +0x7b, 0x1402c079b\nmov     rdx, qword ptr [rsp+68h+var_38+8]                              ; +0x7e, 0x1402c079e\ncmp     rdx, 0Fh                                                       ; +0x83, 0x1402c07a3\njbe     short loc_1402C07DE                                            ; +0x87, 0x1402c07a7\ninc     rdx                                                            ; +0x89, 0x1402c07a9\nmov     rcx, [rsp+68h+Block]; Block                                    ; +0x8c, 0x1402c07ac\nmov     rax, rcx                                                       ; +0x91, 0x1402c07b1\ncmp     rdx, 1000h                                                     ; +0x94, 0x1402c07b4\njb      short loc_1402C07D9                                            ; +0x9b, 0x1402c07bb\nadd     rdx, 27h ; '''                                                 ; +0x9d, 0x1402c07bd\nmov     rcx, [rcx-8]                                                   ; +0xa1, 0x1402c07c1\nsub     rax, rcx                                                       ; +0xa5, 0x1402c07c5\nadd     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0xa8, 0x1402c07c8\ncmp     rax, 1Fh                                                       ; +0xac, 0x1402c07cc\njbe     short loc_1402C07D9                                            ; +0xb0, 0x1402c07d0\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0xb2, 0x1402c07d2\ndb 0CCh                                                                ; +0xb8, 0x1402c07d8\ncall    j_j_free                                                       ; +0xb9, 0x1402c07d9\ntest    rdi, rdi                                                       ; +0xbe, 0x1402c07de\njnz     loc_1402C08AE                                                  ; +0xc1, 0x1402c07e1\ncall    cs:?create@CCLayer@cocos2d@@SAPEAV12@XZ; cocos2d::CCLayer::create(void) ; +0xc7, 0x1402c07e7\nmov     rdi, rax                                                       ; +0xcd, 0x1402c07ed\nmov     rcx, [rsi+240h]                                                ; +0xd0, 0x1402c07f0\nmov     rax, [rcx]                                                     ; +0xd7, 0x1402c07f7\nmov     rdx, rdi                                                       ; +0xda, 0x1402c07fa\ncall    qword ptr [rax+1C0h]                                           ; +0xdd, 0x1402c07fd\nmov     edx, ebp                                                       ; +0xe3, 0x1402c0803\nlea     rcx, aLayerI; \"layer_%i\"                                       ; +0xe5, 0x1402c0805\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0xec, 0x1402c080c\nmov     rcx, rax                                                       ; +0xf2, 0x1402c0812\ncall    cs:?getCString@CCString@cocos2d@@QEBAPEBDXZ; cocos2d::CCString::getCString(void) ; +0xf5, 0x1402c0815\nxorps   xmm0, xmm0                                                     ; +0xfb, 0x1402c081b\nmovups  xmmword ptr [rsp+68h+Block], xmm0                              ; +0xfe, 0x1402c081e\nxorps   xmm1, xmm1                                                     ; +0x103, 0x1402c0823\nmovdqu  [rsp+68h+var_38], xmm1                                         ; +0x106, 0x1402c0826\nnop     dword ptr [rax+00h]                                            ; +0x10c, 0x1402c082c\ninc     rbx                                                            ; +0x110, 0x1402c0830\ncmp     byte ptr [rax+rbx], 0                                          ; +0x113, 0x1402c0833\njnz     short loc_1402C0830                                            ; +0x117, 0x1402c0837\nmov     r8, rbx                                                        ; +0x119, 0x1402c0839\nmov     rdx, rax                                                       ; +0x11c, 0x1402c083c\nlea     rcx, [rsp+68h+Block]                                           ; +0x11f, 0x1402c083f\ncall    sub_14003A930                                                  ; +0x124, 0x1402c0844\nnop                                                                    ; +0x129, 0x1402c0849\nlea     r8, [rsp+68h+Block]                                            ; +0x12a, 0x1402c084a\nmov     rdx, rdi                                                       ; +0x12f, 0x1402c084f\nmov     rcx, [rsi+288h]                                                ; +0x132, 0x1402c0852\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, 0x1402c0859\nnop                                                                    ; +0x13f, 0x1402c085f\nmov     rdx, qword ptr [rsp+68h+var_38+8]                              ; +0x140, 0x1402c0860\ncmp     rdx, 0Fh                                                       ; +0x145, 0x1402c0865\njbe     short loc_1402C08A0                                            ; +0x149, 0x1402c0869\ninc     rdx                                                            ; +0x14b, 0x1402c086b\nmov     rcx, [rsp+68h+Block]; Block                                    ; +0x14e, 0x1402c086e\nmov     rax, rcx                                                       ; +0x153, 0x1402c0873\ncmp     rdx, 1000h                                                     ; +0x156, 0x1402c0876\njb      short loc_1402C089B                                            ; +0x15d, 0x1402c087d\nadd     rdx, 27h ; '''                                                 ; +0x15f, 0x1402c087f\nmov     rcx, [rcx-8]                                                   ; +0x163, 0x1402c0883\nsub     rax, rcx                                                       ; +0x167, 0x1402c0887\nadd     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0x16a, 0x1402c088a\ncmp     rax, 1Fh                                                       ; +0x16e, 0x1402c088e\njbe     short loc_1402C089B                                            ; +0x172, 0x1402c0892\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0x174, 0x1402c0894\ndb 0CCh                                                                ; +0x17a, 0x1402c089a\ncall    j_j_free                                                       ; +0x17b, 0x1402c089b\nmov     rax, [rdi]                                                     ; +0x180, 0x1402c08a0\nxor     edx, edx                                                       ; +0x183, 0x1402c08a3\nmov     rcx, rdi                                                       ; +0x185, 0x1402c08a5\ncall    qword ptr [rax+140h]                                           ; +0x188, 0x1402c08a8\nmov     rax, rdi                                                       ; +0x18e, 0x1402c08ae\nmov     rcx, [rsp+68h+var_28]                                          ; +0x191, 0x1402c08b1\nxor     rcx, rsp; StackCookie                                          ; +0x196, 0x1402c08b6\ncall    __security_check_cookie                                        ; +0x199, 0x1402c08b9\nmov     rbx, [rsp+68h+arg_10]                                          ; +0x19e, 0x1402c08be\nadd     rsp, 50h                                                       ; +0x1a6, 0x1402c08c6\npop     rdi                                                            ; +0x1aa, 0x1402c08ca\npop     rsi                                                            ; +0x1ab, 0x1402c08cb\npop     rbp                                                            ; +0x1ac, 0x1402c08cc\nretn                                                                   ; +0x1ad, 0x1402c08cd", "xrefs": ["KeybindingsLayer::addKeyPair @ 0x1402c032d", "<???> @ 0x1406d2948", "<???> @ 0x1406d2954"], "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"}