{"type": "func", "start": 6443156512, "end": 6443157007, "name": "cocos2d::CCTMXLayer::insertTileForGID", "pseudocode": "// \n// cocos2d::CCTMXLayer::insertTileForGID from 0x1800ac420 to 0x1800ac60f (495 bytes)\n// \n// 3 xrefs:\n// > cocos2d::CCTMXLayer::setTileGID @ 0x1800ace81\n// > <???> @ 0x1801438a8\n// > <???> @ 0x1801b810c\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\nstruct cocos2d::CCSprite *__fastcall cocos2d::CCTMXLayer::insertTileForGID(\n        cocos2d::CCTMXLayer *this,\n        unsigned int a2,\n        struct cocos2d::CCPoint *a3)\n{\n  cocos2d::CCDirector *v6; // rax\n  float ContentScaleFactor; // xmm0_4\n  float v8; // xmm8_4\n  cocos2d::CCDirector *v9; // rax\n  float v10; // xmm0_4\n  float v11; // xmm7_4\n  cocos2d::CCDirector *v12; // rax\n  float v13; // xmm0_4\n  float v14; // xmm6_4\n  cocos2d::CCDirector *v15; // rax\n  float v16; // xmm0_4\n  cocos2d::CCRect *v17; // rax\n  __int64 v18; // rdi\n  struct cocos2d::CCRect *v19; // rax\n  cocos2d::CCSprite *v20; // rbp\n  _DWORD *v21; // rax\n  __int64 v22; // rcx\n  __int64 v23; // rbx\n  unsigned int v24; // edx\n  __int64 v25; // rcx\n  cocos2d::CCArray *m_pChildren; // rcx\n  cocos2d::CCArray *v27; // rax\n  cocos2d::ccArray *data; // rcx\n  __int64 num; // rax\n  cocos2d::CCObject **arr; // rcx\n  cocos2d::CCObject **i; // r8\n  cocos2d::CCObject *v32; // rdx\n  unsigned int m_uAutoReleaseCount; // eax\n  struct cocos2d::CCRect v35; // [rsp+30h] [rbp-68h] BYREF\n  cocos2d::CCRect v36; // [rsp+40h] [rbp-58h] BYREF\n  int v37; // [rsp+A0h] [rbp+8h] BYREF\n\n  cocos2d::CCTMXTilesetInfo::rectForGID(*((struct cocos2d::CCRect **)this + 48), (unsigned int)&v35);\n  v6 = cocos2d::CCDirector::sharedDirector();\n  ContentScaleFactor = cocos2d::CCDirector::getContentScaleFactor(v6);\n  v8 = v35.size.height / ContentScaleFactor;\n  v9 = cocos2d::CCDirector::sharedDirector();\n  v10 = cocos2d::CCDirector::getContentScaleFactor(v9);\n  v11 = v35.size.width / v10;\n  v12 = cocos2d::CCDirector::sharedDirector();\n  v13 = cocos2d::CCDirector::getContentScaleFactor(v12);\n  v14 = v35.origin.y / v13;\n  v15 = cocos2d::CCDirector::sharedDirector();\n  v16 = cocos2d::CCDirector::getContentScaleFactor(v15);\n  v17 = cocos2d::CCRect::CCRect(&v36, v35.origin.x / v16, v14, v11, v8);\n  cocos2d::CCRect::operator=((float *)&v35.origin, (float *)&v17->origin);\n  v18 = (unsigned int)(int)(float)((float)(*((float *)this + 90) * a3->y) + a3->x);\n  v19 = cocos2d::CCRect::CCRect(&v36, &v35);\n  v20 = cocos2d::CCTMXLayer::reusedTileWithRect(this, v19);\n  v21 = cocos2d::cc_timeval::operator=(&v37, a3);\n  cocos2d::CCTMXLayer::setupTileSprite(this, v20, (struct cocos2d::CCPoint)v21, a2);\n  v22 = *((_QWORD *)this + 59);\n  v23 = 0;\n  v24 = *(_DWORD *)v22;\n  if ( *(_DWORD *)v22 )\n  {\n    v25 = *(_QWORD *)(v22 + 16);\n    do\n    {\n      if ( (int)v18 < *(_DWORD *)(v25 + 8 * v23) )\n        break;\n      v23 = (unsigned int)(v23 + 1);\n    }\n    while ( (unsigned int)v23 < v24 );\n  }\n  cocos2d::CCSpriteBatchNode::insertQuadFromSprite(this, v20, v23);\n  sub_18009E210(*((int **)this + 59), v18, v23);\n  m_pChildren = this->m_pChildren;\n  if ( m_pChildren )\n  {\n    if ( (unsigned int)cocos2d::CCArray::count(m_pChildren) )\n    {\n      v27 = this->m_pChildren;\n      if ( v27 )\n      {\n        data = v27->data;\n        num = data->num;\n        if ( (_DWORD)num )\n        {\n          arr = data->arr;\n          for ( i = &arr[num - 1]; arr <= i; ++arr )\n          {\n            v32 = *arr;\n            if ( !*arr )\n              break;\n            m_uAutoReleaseCount = v32[6].m_uAutoReleaseCount;\n            if ( m_uAutoReleaseCount >= (unsigned int)v23 )\n              v32[6].m_uAutoReleaseCount = m_uAutoReleaseCount + 1;\n          }\n        }\n      }\n    }\n  }\n  *(_DWORD *)(*((_QWORD *)this + 47) + 4 * v18) = a2;\n  return v20;\n}", "assembly": "; \n; cocos2d::CCTMXLayer::insertTileForGID from 0x1800ac420 to 0x1800ac60f (495 bytes)\n; \n; 3 xrefs:\n; > cocos2d::CCTMXLayer::setTileGID @ 0x1800ace81\n; > <???> @ 0x1801438a8\n; > <???> @ 0x1801b810c\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_8], rbx                                               ; +0x0, 0x1800ac420\nmov     [rsp+arg_10], rbp                                              ; +0x5, 0x1800ac425\npush    rsi                                                            ; +0xa, 0x1800ac42a\npush    rdi                                                            ; +0xb, 0x1800ac42b\npush    r14                                                            ; +0xc, 0x1800ac42c\nsub     rsp, 80h                                                       ; +0xe, 0x1800ac42e\nmovaps  [rsp+98h+var_28], xmm6                                         ; +0x15, 0x1800ac435\nmov     rbx, r8                                                        ; +0x1a, 0x1800ac43a\nmov     r8d, edx                                                       ; +0x1d, 0x1800ac43d\nmovaps  [rsp+98h+var_38], xmm7                                         ; +0x20, 0x1800ac440\nmov     r14d, edx                                                      ; +0x25, 0x1800ac445\nmovaps  [rsp+98h+var_48], xmm8                                         ; +0x28, 0x1800ac448\nmov     rsi, rcx                                                       ; +0x2e, 0x1800ac44e\nlea     rdx, [rsp+98h+var_68]                                          ; +0x31, 0x1800ac451\nmov     rcx, [rcx+180h]                                                ; +0x36, 0x1800ac456\ncall    ?rectForGID@CCTMXTilesetInfo@cocos2d@@QEAA?AVCCRect@2@I@Z; cocos2d::CCTMXTilesetInfo::rectForGID(uint) ; +0x3d, 0x1800ac45d\ncall    ?sharedDirector@CCDirector@cocos2d@@SAPEAV12@XZ; cocos2d::CCDirector::sharedDirector(void) ; +0x42, 0x1800ac462\nmov     rcx, rax; this                                                 ; +0x47, 0x1800ac467\ncall    ?getContentScaleFactor@CCDirector@cocos2d@@QEAAMXZ; cocos2d::CCDirector::getContentScaleFactor(void) ; +0x4a, 0x1800ac46a\nmovss   xmm8, [rsp+98h+var_5C]                                         ; +0x4f, 0x1800ac46f\ndivss   xmm8, xmm0                                                     ; +0x56, 0x1800ac476\ncall    ?sharedDirector@CCDirector@cocos2d@@SAPEAV12@XZ; cocos2d::CCDirector::sharedDirector(void) ; +0x5b, 0x1800ac47b\nmov     rcx, rax; this                                                 ; +0x60, 0x1800ac480\ncall    ?getContentScaleFactor@CCDirector@cocos2d@@QEAAMXZ; cocos2d::CCDirector::getContentScaleFactor(void) ; +0x63, 0x1800ac483\nmovss   xmm7, [rsp+98h+var_60]                                         ; +0x68, 0x1800ac488\ndivss   xmm7, xmm0                                                     ; +0x6e, 0x1800ac48e\ncall    ?sharedDirector@CCDirector@cocos2d@@SAPEAV12@XZ; cocos2d::CCDirector::sharedDirector(void) ; +0x72, 0x1800ac492\nmov     rcx, rax; this                                                 ; +0x77, 0x1800ac497\ncall    ?getContentScaleFactor@CCDirector@cocos2d@@QEAAMXZ; cocos2d::CCDirector::getContentScaleFactor(void) ; +0x7a, 0x1800ac49a\nmovss   xmm6, [rsp+98h+var_64]                                         ; +0x7f, 0x1800ac49f\ndivss   xmm6, xmm0                                                     ; +0x85, 0x1800ac4a5\ncall    ?sharedDirector@CCDirector@cocos2d@@SAPEAV12@XZ; cocos2d::CCDirector::sharedDirector(void) ; +0x89, 0x1800ac4a9\nmov     rcx, rax; this                                                 ; +0x8e, 0x1800ac4ae\ncall    ?getContentScaleFactor@CCDirector@cocos2d@@QEAAMXZ; cocos2d::CCDirector::getContentScaleFactor(void) ; +0x91, 0x1800ac4b1\nlea     rcx, [rsp+98h+var_58]; this                                    ; +0x96, 0x1800ac4b6\nmovss   xmm1, [rsp+98h+var_68]                                         ; +0x9b, 0x1800ac4bb\nmovaps  xmm3, xmm7; float                                              ; +0xa1, 0x1800ac4c1\ndivss   xmm1, xmm0; float                                              ; +0xa4, 0x1800ac4c4\nmovaps  xmm2, xmm6; float                                              ; +0xa8, 0x1800ac4c8\nmovss   [rsp+98h+var_78], xmm8; float                                  ; +0xab, 0x1800ac4cb\ncall    ??0CCRect@cocos2d@@QEAA@MMMM@Z; cocos2d::CCRect::CCRect(float,float,float,float) ; +0xb2, 0x1800ac4d2\nmov     rdx, rax                                                       ; +0xb7, 0x1800ac4d7\nlea     rcx, [rsp+98h+var_68]                                          ; +0xba, 0x1800ac4da\ncall    ??4CCRect@cocos2d@@QEAAAEAV01@AEBV01@@Z; cocos2d::CCRect::operator=(cocos2d::CCRect const &) ; +0xbf, 0x1800ac4df\nmovss   xmm0, dword ptr [rsi+168h]                                     ; +0xc4, 0x1800ac4e4\nlea     rdx, [rsp+98h+var_68]; struct cocos2d::CCRect *                ; +0xcc, 0x1800ac4ec\nmulss   xmm0, dword ptr [rbx+4]                                        ; +0xd1, 0x1800ac4f1\nlea     rcx, [rsp+98h+var_58]; this                                    ; +0xd6, 0x1800ac4f6\naddss   xmm0, dword ptr [rbx]                                          ; +0xdb, 0x1800ac4fb\ncvttss2si rdi, xmm0                                                    ; +0xdf, 0x1800ac4ff\ncall    ??0CCRect@cocos2d@@QEAA@AEBV01@@Z; cocos2d::CCRect::CCRect(cocos2d::CCRect const &) ; +0xe4, 0x1800ac504\nmov     rdx, rax                                                       ; +0xe9, 0x1800ac509\nmov     rcx, rsi                                                       ; +0xec, 0x1800ac50c\ncall    ?reusedTileWithRect@CCTMXLayer@cocos2d@@AEAAPEAVCCSprite@2@VCCRect@2@@Z; cocos2d::CCTMXLayer::reusedTileWithRect(cocos2d::CCRect) ; +0xef, 0x1800ac50f\nmov     rdx, rbx                                                       ; +0xf4, 0x1800ac514\nlea     rcx, [rsp+98h+arg_0]                                           ; +0xf7, 0x1800ac517\nmov     rbp, rax                                                       ; +0xff, 0x1800ac51f\ncall    ??4cc_timeval@cocos2d@@QEAAAEAU01@$$QEAU01@@Z; cocos2d::cc_timeval::operator=(cocos2d::cc_timeval &&) ; +0x102, 0x1800ac522\nmov     r8, rax                                                        ; +0x107, 0x1800ac527\nmov     r9d, r14d                                                      ; +0x10a, 0x1800ac52a\nmov     rdx, rbp                                                       ; +0x10d, 0x1800ac52d\nmov     rcx, rsi                                                       ; +0x110, 0x1800ac530\ncall    ?setupTileSprite@CCTMXLayer@cocos2d@@AEAAXPEAVCCSprite@2@VCCPoint@2@I@Z; cocos2d::CCTMXLayer::setupTileSprite(cocos2d::CCSprite *,cocos2d::CCPoint,uint) ; +0x113, 0x1800ac533\nmov     rcx, [rsi+1D8h]                                                ; +0x118, 0x1800ac538\nxor     ebx, ebx                                                       ; +0x11f, 0x1800ac53f\nmov     edx, [rcx]                                                     ; +0x121, 0x1800ac541\ntest    edx, edx                                                       ; +0x123, 0x1800ac543\njz      short loc_1800AC55B                                            ; +0x125, 0x1800ac545\nmov     rcx, [rcx+10h]                                                 ; +0x127, 0x1800ac547\nnop     dword ptr [rax+rax+00h]                                        ; +0x12b, 0x1800ac54b\ncmp     edi, [rcx+rbx*8]                                               ; +0x130, 0x1800ac550\njl      short loc_1800AC55B                                            ; +0x133, 0x1800ac553\ninc     ebx                                                            ; +0x135, 0x1800ac555\ncmp     ebx, edx                                                       ; +0x137, 0x1800ac557\njb      short loc_1800AC550                                            ; +0x139, 0x1800ac559\nmov     r8d, ebx; unsigned int                                         ; +0x13b, 0x1800ac55b\nmov     rdx, rbp; struct cocos2d::CCSprite *                           ; +0x13e, 0x1800ac55e\nmov     rcx, rsi; this                                                 ; +0x141, 0x1800ac561\ncall    ?insertQuadFromSprite@CCSpriteBatchNode@cocos2d@@IEAAXPEAVCCSprite@2@I@Z; cocos2d::CCSpriteBatchNode::insertQuadFromSprite(cocos2d::CCSprite *,uint) ; +0x144, 0x1800ac564\nmov     rcx, [rsi+1D8h]                                                ; +0x149, 0x1800ac569\nmov     r8d, ebx                                                       ; +0x150, 0x1800ac570\nmov     rdx, rdi                                                       ; +0x153, 0x1800ac573\ncall    sub_18009E210                                                  ; +0x156, 0x1800ac576\nmov     rcx, [rsi+0D0h]; this                                          ; +0x15b, 0x1800ac57b\ntest    rcx, rcx                                                       ; +0x162, 0x1800ac582\njz      short loc_1800AC5DA                                            ; +0x165, 0x1800ac585\ncall    ?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x167, 0x1800ac587\ntest    eax, eax                                                       ; +0x16c, 0x1800ac58c\njz      short loc_1800AC5DA                                            ; +0x16e, 0x1800ac58e\nmov     rax, [rsi+0D0h]                                                ; +0x170, 0x1800ac590\ntest    rax, rax                                                       ; +0x177, 0x1800ac597\njz      short loc_1800AC5DA                                            ; +0x17a, 0x1800ac59a\nmov     rcx, [rax+38h]                                                 ; +0x17c, 0x1800ac59c\nmov     eax, [rcx]                                                     ; +0x180, 0x1800ac5a0\ntest    eax, eax                                                       ; +0x182, 0x1800ac5a2\njz      short loc_1800AC5DA                                            ; +0x184, 0x1800ac5a4\nmov     rcx, [rcx+10h]                                                 ; +0x186, 0x1800ac5a6\nlea     r8, [rax-1]                                                    ; +0x18a, 0x1800ac5aa\nlea     r8, [rcx+r8*8]                                                 ; +0x18e, 0x1800ac5ae\ncmp     rcx, r8                                                        ; +0x192, 0x1800ac5b2\nja      short loc_1800AC5DA                                            ; +0x195, 0x1800ac5b5\nmov     rdx, [rcx]                                                     ; +0x197, 0x1800ac5b7\ntest    rdx, rdx                                                       ; +0x19a, 0x1800ac5ba\njz      short loc_1800AC5DA                                            ; +0x19d, 0x1800ac5bd\nmov     eax, [rdx+168h]                                                ; +0x19f, 0x1800ac5bf\ncmp     eax, ebx                                                       ; +0x1a5, 0x1800ac5c5\njb      short loc_1800AC5D1                                            ; +0x1a7, 0x1800ac5c7\ninc     eax                                                            ; +0x1a9, 0x1800ac5c9\nmov     [rdx+168h], eax                                                ; +0x1ab, 0x1800ac5cb\nadd     rcx, 8                                                         ; +0x1b1, 0x1800ac5d1\ncmp     rcx, r8                                                        ; +0x1b5, 0x1800ac5d5\njbe     short loc_1800AC5B7                                            ; +0x1b8, 0x1800ac5d8\nmov     rax, [rsi+178h]                                                ; +0x1ba, 0x1800ac5da\nlea     r11, [rsp+98h+var_18]                                          ; +0x1c1, 0x1800ac5e1\nmov     rbx, [r11+28h]                                                 ; +0x1c9, 0x1800ac5e9\nmovaps  xmm6, [rsp+98h+var_28]                                         ; +0x1cd, 0x1800ac5ed\nmovaps  xmm7, [rsp+98h+var_38]                                         ; +0x1d2, 0x1800ac5f2\nmovaps  xmm8, xmmword ptr [r11-30h]                                    ; +0x1d7, 0x1800ac5f7\nmov     [rax+rdi*4], r14d                                              ; +0x1dc, 0x1800ac5fc\nmov     rax, rbp                                                       ; +0x1e0, 0x1800ac600\nmov     rbp, [r11+30h]                                                 ; +0x1e3, 0x1800ac603\nmov     rsp, r11                                                       ; +0x1e7, 0x1800ac607\npop     r14                                                            ; +0x1ea, 0x1800ac60a\npop     rdi                                                            ; +0x1ec, 0x1800ac60c\npop     rsi                                                            ; +0x1ed, 0x1800ac60d\nretn                                                                   ; +0x1ee, 0x1800ac60e", "xrefs": ["cocos2d::CCTMXLayer::setTileGID @ 0x1800ace81", "<???> @ 0x1801438a8", "<???> @ 0x1801b810c"], "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"}