{"type": "func", "start": 6443032832, "end": 6443033166, "name": "cocos2d::CCSpriteBatchNode::atlasIndexForChild", "pseudocode": "// \n// cocos2d::CCSpriteBatchNode::atlasIndexForChild from 0x18008e100 to 0x18008e24e (334 bytes)\n// \n// 4 xrefs:\n// > cocos2d::CCSpriteBatchNode::insertChild @ 0x18008e95e\n// > cocos2d::CCSpriteBatchNode::insertChild @ 0x18008ea0a\n// > <???> @ 0x1801438a8\n// > <???> @ 0x1801b5f88\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__int64 __fastcall cocos2d::CCSpriteBatchNode::atlasIndexForChild(\n        cocos2d::CCSpriteBatchNode *this,\n        struct cocos2d::CCSprite *a2,\n        int a3)\n{\n  __int64 v6; // rax\n  cocos2d::CCArray *v7; // r15\n  int v8; // r14d\n  struct cocos2d::CCSprite *v9; // rbx\n  cocos2d::CCSpriteBatchNode *v10; // r12\n  __int64 result; // rax\n  unsigned int v12; // eax\n  unsigned int v13; // ecx\n  cocos2d::CCArray *v14; // rax\n  cocos2d::CCArray *v15; // rdi\n  struct cocos2d::CCSprite *Object; // rax\n\n  v6 = ((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getParent)(a2);\n  v7 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v6 + 464LL))(v6);\n  v8 = cocos2d::CCArray::indexOfObject(v7, a2);\n  v9 = nullptr;\n  v10 = (cocos2d::CCSpriteBatchNode *)((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getParent)(a2);\n  if ( (unsigned int)(v8 - 1) <= 0xFFFFFFFD )\n    v9 = (struct cocos2d::CCSprite *)cocos2d::CCArray::stringAtIndex(v7, v8 - 1);\n  if ( v10 == this )\n  {\n    if ( !v8 )\n      return 0;\n    v12 = cocos2d::CCSpriteBatchNode::highestAtlasIndexInChild(this, v9);\n    return v12 + 1;\n  }\n  if ( v8 )\n  {\n    if ( (((int (__fastcall *)(struct cocos2d::CCSprite *))v9->getZOrder)(v9) >= 0 || a3 >= 0)\n      && (((int (__fastcall *)(struct cocos2d::CCSprite *))v9->getZOrder)(v9) < 0 || a3 < 0) )\n    {\n      v12 = *(_DWORD *)(((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getParent)(a2) + 360);\n      return v12 + 1;\n    }\n    v14 = (cocos2d::CCArray *)((__int64 (__fastcall *)(struct cocos2d::CCSprite *))v9->getChildren)(v9);\n    v15 = v14;\n    if ( v14 && (unsigned int)cocos2d::CCArray::count(v14) )\n    {\n      Object = (struct cocos2d::CCSprite *)cocos2d::CCArray::lastObject(v15);\n      return cocos2d::CCSpriteBatchNode::highestAtlasIndexInChild(this, Object) + 1;\n    }\n    else\n    {\n      return v9->m_uAtlasIndex + 1;\n    }\n  }\n  else\n  {\n    v13 = *(_DWORD *)(((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getParent)(a2) + 360);\n    result = v13 + 1;\n    if ( a3 < 0 )\n      return v13;\n  }\n  return result;\n}", "assembly": "; \n; cocos2d::CCSpriteBatchNode::atlasIndexForChild from 0x18008e100 to 0x18008e24e (334 bytes)\n; \n; 4 xrefs:\n; > cocos2d::CCSpriteBatchNode::insertChild @ 0x18008e95e\n; > cocos2d::CCSpriteBatchNode::insertChild @ 0x18008ea0a\n; > <???> @ 0x1801438a8\n; > <???> @ 0x1801b5f88\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_0], rbx                                               ; +0x0, 0x18008e100\nmov     [rsp+arg_8], rbp                                               ; +0x5, 0x18008e105\nmov     [rsp+arg_10], rsi                                              ; +0xa, 0x18008e10a\nmov     [rsp+arg_18], rdi                                              ; +0xf, 0x18008e10f\npush    r12                                                            ; +0x14, 0x18008e114\npush    r14                                                            ; +0x16, 0x18008e116\npush    r15                                                            ; +0x18, 0x18008e118\nsub     rsp, 20h                                                       ; +0x1a, 0x18008e11a\nmov     rax, [rdx]                                                     ; +0x1e, 0x18008e11e\nmov     rbp, rcx                                                       ; +0x21, 0x18008e121\nmov     rcx, rdx                                                       ; +0x24, 0x18008e124\nmov     esi, r8d                                                       ; +0x27, 0x18008e127\nmov     rdi, rdx                                                       ; +0x2a, 0x18008e12a\ncall    qword ptr [rax+1E8h]                                           ; +0x2d, 0x18008e12d\nmov     rcx, rax                                                       ; +0x33, 0x18008e133\nmov     r9, [rax]                                                      ; +0x36, 0x18008e136\ncall    qword ptr [r9+1D0h]                                            ; +0x39, 0x18008e139\nmov     rcx, rax; this                                                 ; +0x40, 0x18008e140\nmov     rdx, rdi; struct cocos2d::CCObject *                           ; +0x43, 0x18008e143\nmov     r15, rax                                                       ; +0x46, 0x18008e146\ncall    ?indexOfObject@CCArray@cocos2d@@QEBAIPEAVCCObject@2@@Z; cocos2d::CCArray::indexOfObject(cocos2d::CCObject *) ; +0x49, 0x18008e149\nmov     rdx, [rdi]                                                     ; +0x4e, 0x18008e14e\nmov     rcx, rdi                                                       ; +0x51, 0x18008e151\nmov     r14d, eax                                                      ; +0x54, 0x18008e154\ncall    qword ptr [rdx+1E8h]                                           ; +0x57, 0x18008e157\nlea     edx, [r14-1]; unsigned int                                     ; +0x5d, 0x18008e15d\nxor     ebx, ebx                                                       ; +0x61, 0x18008e161\nmov     r12, rax                                                       ; +0x63, 0x18008e163\ncmp     edx, 0FFFFFFFDh                                                ; +0x66, 0x18008e166\nja      short loc_18008E176                                            ; +0x69, 0x18008e169\nmov     rcx, r15; this                                                 ; +0x6b, 0x18008e16b\ncall    ?stringAtIndex@CCArray@cocos2d@@QEAAPEAVCCString@2@I@Z; cocos2d::CCArray::stringAtIndex(uint) ; +0x6e, 0x18008e16e\nmov     rbx, rax                                                       ; +0x73, 0x18008e173\ncmp     r12, rbp                                                       ; +0x76, 0x18008e176\njnz     short loc_18008E197                                            ; +0x79, 0x18008e179\ntest    r14d, r14d                                                     ; +0x7b, 0x18008e17b\njnz     short loc_18008E187                                            ; +0x7e, 0x18008e17e\nxor     eax, eax                                                       ; +0x80, 0x18008e180\njmp     loc_18008E22F                                                  ; +0x82, 0x18008e182\nmov     rdx, rbx; struct cocos2d::CCSprite *                           ; +0x87, 0x18008e187\nmov     rcx, rbp; this                                                 ; +0x8a, 0x18008e18a\ncall    ?highestAtlasIndexInChild@CCSpriteBatchNode@cocos2d@@QEAAIPEAVCCSprite@2@@Z; cocos2d::CCSpriteBatchNode::highestAtlasIndexInChild(cocos2d::CCSprite *) ; +0x8d, 0x18008e18d\njmp     loc_18008E22D                                                  ; +0x92, 0x18008e192\ntest    r14d, r14d                                                     ; +0x97, 0x18008e197\njnz     short loc_18008E1B8                                            ; +0x9a, 0x18008e19a\nmov     rax, [rdi]                                                     ; +0x9c, 0x18008e19c\nmov     rcx, rdi                                                       ; +0x9f, 0x18008e19f\ncall    qword ptr [rax+1E8h]                                           ; +0xa2, 0x18008e1a2\ntest    esi, esi                                                       ; +0xa8, 0x18008e1a8\nmov     ecx, [rax+168h]                                                ; +0xaa, 0x18008e1aa\nlea     eax, [rcx+1]                                                   ; +0xb0, 0x18008e1b0\ncmovs   eax, ecx                                                       ; +0xb3, 0x18008e1b3\njmp     short loc_18008E22F                                            ; +0xb6, 0x18008e1b6\nmov     rax, [rbx]                                                     ; +0xb8, 0x18008e1b8\nmov     rcx, rbx                                                       ; +0xbb, 0x18008e1bb\ncall    qword ptr [rax+60h]                                            ; +0xbe, 0x18008e1be\ntest    eax, eax                                                       ; +0xc1, 0x18008e1c1\njns     short loc_18008E1C9                                            ; +0xc3, 0x18008e1c3\ntest    esi, esi                                                       ; +0xc5, 0x18008e1c5\njs      short loc_18008E1DA                                            ; +0xc7, 0x18008e1c7\nmov     rax, [rbx]                                                     ; +0xc9, 0x18008e1c9\nmov     rcx, rbx                                                       ; +0xcc, 0x18008e1cc\ncall    qword ptr [rax+60h]                                            ; +0xcf, 0x18008e1cf\ntest    eax, eax                                                       ; +0xd2, 0x18008e1d2\njs      short loc_18008E21B                                            ; +0xd4, 0x18008e1d4\ntest    esi, esi                                                       ; +0xd6, 0x18008e1d6\njs      short loc_18008E21B                                            ; +0xd8, 0x18008e1d8\nmov     rax, [rbx]                                                     ; +0xda, 0x18008e1da\nmov     rcx, rbx                                                       ; +0xdd, 0x18008e1dd\ncall    qword ptr [rax+1D0h]                                           ; +0xe0, 0x18008e1e0\nmov     rdi, rax                                                       ; +0xe6, 0x18008e1e6\ntest    rax, rax                                                       ; +0xe9, 0x18008e1e9\njz      short loc_18008E211                                            ; +0xec, 0x18008e1ec\nmov     rcx, rax; this                                                 ; +0xee, 0x18008e1ee\ncall    ?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0xf1, 0x18008e1f1\ntest    eax, eax                                                       ; +0xf6, 0x18008e1f6\njz      short loc_18008E211                                            ; +0xf8, 0x18008e1f8\nmov     rcx, rdi; this                                                 ; +0xfa, 0x18008e1fa\ncall    ?lastObject@CCArray@cocos2d@@QEAAPEAVCCObject@2@XZ; cocos2d::CCArray::lastObject(void) ; +0xfd, 0x18008e1fd\nmov     rdx, rax; struct cocos2d::CCSprite *                           ; +0x102, 0x18008e202\nmov     rcx, rbp; this                                                 ; +0x105, 0x18008e205\ncall    ?highestAtlasIndexInChild@CCSpriteBatchNode@cocos2d@@QEAAIPEAVCCSprite@2@@Z; cocos2d::CCSpriteBatchNode::highestAtlasIndexInChild(cocos2d::CCSprite *) ; +0x108, 0x18008e208\ninc     eax                                                            ; +0x10d, 0x18008e20d\njmp     short loc_18008E22F                                            ; +0x10f, 0x18008e20f\nmov     eax, [rbx+168h]                                                ; +0x111, 0x18008e211\ninc     eax                                                            ; +0x117, 0x18008e217\njmp     short loc_18008E22F                                            ; +0x119, 0x18008e219\nmov     rax, [rdi]                                                     ; +0x11b, 0x18008e21b\nmov     rcx, rdi                                                       ; +0x11e, 0x18008e21e\ncall    qword ptr [rax+1E8h]                                           ; +0x121, 0x18008e221\nmov     eax, [rax+168h]                                                ; +0x127, 0x18008e227\ninc     eax                                                            ; +0x12d, 0x18008e22d\nmov     rbx, [rsp+38h+arg_0]                                           ; +0x12f, 0x18008e22f\nmov     rbp, [rsp+38h+arg_8]                                           ; +0x134, 0x18008e234\nmov     rsi, [rsp+38h+arg_10]                                          ; +0x139, 0x18008e239\nmov     rdi, [rsp+38h+arg_18]                                          ; +0x13e, 0x18008e23e\nadd     rsp, 20h                                                       ; +0x143, 0x18008e243\npop     r15                                                            ; +0x147, 0x18008e247\npop     r14                                                            ; +0x149, 0x18008e249\npop     r12                                                            ; +0x14b, 0x18008e24b\nretn                                                                   ; +0x14d, 0x18008e24d", "xrefs": ["cocos2d::CCSpriteBatchNode::insertChild @ 0x18008e95e", "cocos2d::CCSpriteBatchNode::insertChild @ 0x18008ea0a", "<???> @ 0x1801438a8", "<???> @ 0x1801b5f88"], "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"}