{"type": "func", "start": 5371594320, "end": 5371594528, "name": "KeybindingsLayer::countForPage", "pseudocode": "// \n// KeybindingsLayer::countForPage from 0x1402c0650 to 0x1402c0720 (208 bytes)\n// \n// 5 xrefs:\n// > KeybindingsLayer::addKeyPair @ 0x1402c037a\n// > KeybindingsLayer::addKeyPair @ 0x1402c0566\n// > ParentalOptionsLayer::addToggle @ 0x14037bbb5\n// > ParentalOptionsLayer::addToggle @ 0x14037bd31\n// > <???> @ 0x1406d2948\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// Merged with: KeybindingsLayer::countForPage, ParentalOptionsLayer::countForPage\n__int64 __fastcall KeybindingsLayer::countForPage(__int64 a1, int a2)\n{\n  cocos2d::CCString *v3; // rax\n  const char *CString; // rax\n  size_t v5; // r8\n  cocos2d::CCString *v6; // rax\n  unsigned int v7; // ebx\n  void *v8; // rcx\n  void *Block[2]; // [rsp+20h] [rbp-38h] BYREF\n  __int128 v11; // [rsp+30h] [rbp-28h]\n\n  v3 = cocos2d::CCString::createWithFormat(\"page_%i\", a2);\n  CString = cocos2d::CCString::getCString(v3);\n  *(_OWORD *)Block = 0;\n  v11 = 0;\n  v5 = -1;\n  do\n    ++v5;\n  while ( CString[v5] );\n  sub_14003A930(Block, CString, v5);\n  v6 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(a1 + 648), Block);\n  v7 = cocos2d::CCString::intValue(v6);\n  if ( *((_QWORD *)&v11 + 1) > 0xFu )\n  {\n    v8 = Block[0];\n    if ( (unsigned __int64)(*((_QWORD *)&v11 + 1) + 1LL) >= 0x1000 )\n    {\n      v8 = *((void **)Block[0] - 1);\n      if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )\n        invalid_parameter_noinfo_noreturn();\n    }\n    j_j_free(v8);\n  }\n  return v7;\n}", "assembly": "; \n; KeybindingsLayer::countForPage from 0x1402c0650 to 0x1402c0720 (208 bytes)\n; \n; 5 xrefs:\n; > KeybindingsLayer::addKeyPair @ 0x1402c037a\n; > KeybindingsLayer::addKeyPair @ 0x1402c0566\n; > ParentalOptionsLayer::addToggle @ 0x14037bbb5\n; > ParentalOptionsLayer::addToggle @ 0x14037bd31\n; > <???> @ 0x1406d2948\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    rbx                                                            ; +0x0, 0x1402c0650\nsub     rsp, 50h                                                       ; +0x2, 0x1402c0652\nmov     rax, cs:__security_cookie                                      ; +0x6, 0x1402c0656\nxor     rax, rsp                                                       ; +0xd, 0x1402c065d\nmov     [rsp+58h+var_18], rax                                          ; +0x10, 0x1402c0660\nmov     rbx, rcx                                                       ; +0x15, 0x1402c0665\nlea     rcx, aPageI; \"page_%i\"                                         ; +0x18, 0x1402c0668\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0x1f, 0x1402c066f\nmov     rcx, rax                                                       ; +0x25, 0x1402c0675\ncall    cs:?getCString@CCString@cocos2d@@QEBAPEBDXZ; cocos2d::CCString::getCString(void) ; +0x28, 0x1402c0678\nxorps   xmm0, xmm0                                                     ; +0x2e, 0x1402c067e\nmovups  xmmword ptr [rsp+58h+Block], xmm0                              ; +0x31, 0x1402c0681\nxorps   xmm1, xmm1                                                     ; +0x36, 0x1402c0686\nmovdqu  [rsp+58h+var_28], xmm1                                         ; +0x39, 0x1402c0689\nmov     r8, 0FFFFFFFFFFFFFFFFh                                         ; +0x3f, 0x1402c068f\ninc     r8                                                             ; +0x46, 0x1402c0696\ncmp     byte ptr [rax+r8], 0                                           ; +0x49, 0x1402c0699\njnz     short loc_1402C0696                                            ; +0x4e, 0x1402c069e\nmov     rdx, rax                                                       ; +0x50, 0x1402c06a0\nlea     rcx, [rsp+58h+Block]                                           ; +0x53, 0x1402c06a3\ncall    sub_14003A930                                                  ; +0x58, 0x1402c06a8\nnop                                                                    ; +0x5d, 0x1402c06ad\nlea     rdx, [rsp+58h+Block]                                           ; +0x5e, 0x1402c06ae\nmov     rcx, [rbx+288h]                                                ; +0x63, 0x1402c06b3\ncall    cs:?valueForKey@CCDictionary@cocos2d@@QEAAPEBVCCString@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z; cocos2d::CCDictionary::valueForKey(std::string const &) ; +0x6a, 0x1402c06ba\nmov     rcx, rax                                                       ; +0x70, 0x1402c06c0\ncall    cs:?intValue@CCString@cocos2d@@QEBAHXZ; cocos2d::CCString::intValue(void) ; +0x73, 0x1402c06c3\nmov     ebx, eax                                                       ; +0x79, 0x1402c06c9\nmov     rdx, qword ptr [rsp+58h+var_28+8]                              ; +0x7b, 0x1402c06cb\ncmp     rdx, 0Fh                                                       ; +0x80, 0x1402c06d0\njbe     short loc_1402C070B                                            ; +0x84, 0x1402c06d4\ninc     rdx                                                            ; +0x86, 0x1402c06d6\nmov     rcx, [rsp+58h+Block]; Block                                    ; +0x89, 0x1402c06d9\nmov     rax, rcx                                                       ; +0x8e, 0x1402c06de\ncmp     rdx, 1000h                                                     ; +0x91, 0x1402c06e1\njb      short loc_1402C0706                                            ; +0x98, 0x1402c06e8\nadd     rdx, 27h ; '''                                                 ; +0x9a, 0x1402c06ea\nmov     rcx, [rcx-8]                                                   ; +0x9e, 0x1402c06ee\nsub     rax, rcx                                                       ; +0xa2, 0x1402c06f2\nadd     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0xa5, 0x1402c06f5\ncmp     rax, 1Fh                                                       ; +0xa9, 0x1402c06f9\njbe     short loc_1402C0706                                            ; +0xad, 0x1402c06fd\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0xaf, 0x1402c06ff\nalign 2                                                                ; +0xb5, 0x1402c0705\ncall    j_j_free                                                       ; +0xb6, 0x1402c0706\nmov     eax, ebx                                                       ; +0xbb, 0x1402c070b\nmov     rcx, [rsp+58h+var_18]                                          ; +0xbd, 0x1402c070d\nxor     rcx, rsp; StackCookie                                          ; +0xc2, 0x1402c0712\ncall    __security_check_cookie                                        ; +0xc5, 0x1402c0715\nadd     rsp, 50h                                                       ; +0xca, 0x1402c071a\npop     rbx                                                            ; +0xce, 0x1402c071e\nretn                                                                   ; +0xcf, 0x1402c071f", "xrefs": ["KeybindingsLayer::addKeyPair @ 0x1402c037a", "KeybindingsLayer::addKeyPair @ 0x1402c0566", "ParentalOptionsLayer::addToggle @ 0x14037bbb5", "ParentalOptionsLayer::addToggle @ 0x14037bd31", "<???> @ 0x1406d2948"], "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"}