{"type": "func", "start": 6443170848, "end": 6443171343, "name": "cocos2d::CCTMXLayer::insertTileForGID", "pseudocode": "// \n// cocos2d::CCTMXLayer::insertTileForGID from 0x1800afc20 to 0x1800afe0f (495 bytes)\n// \n// 3 xrefs:\n// > cocos2d::CCTMXLayer::setTileGID @ 0x1800b06e1\n// > <???> @ 0x18014cf68\n// > <???> @ 0x1801c23d0\n// \n// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n// \n// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n// Generated at Fri, 27 Nov 2026 11:22:19 +0000\n// \n\nstruct cocos2d::CCSprite *__fastcall cocos2d::CCTMXLayer::insertTileForGID(\n        cocos2d::CCTMXLayer *this,\n        unsigned int a2,\n        const 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  cocos2d::CCRect *v19; // rax\n  struct 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 *v26; // rcx\n  __int64 v27; // rax\n  unsigned int *v28; // rcx\n  __int64 v29; // rax\n  __int64 *v30; // rcx\n  __int64 *i; // r8\n  __int64 v32; // rdx\n  unsigned int v33; // eax\n  float v35[4]; // [rsp+30h] [rbp-68h] BYREF\n  _BYTE v36[16]; // [rsp+40h] [rbp-58h] BYREF\n  int v37; // [rsp+A0h] [rbp+8h] BYREF\n\n  cocos2d::CCTMXTilesetInfo::rectForGID(*((_QWORD *)this + 48), v35, a2);\n  v6 = cocos2d::CCDirector::sharedDirector();\n  ContentScaleFactor = cocos2d::CCDirector::getContentScaleFactor(v6);\n  v8 = v35[3] / ContentScaleFactor;\n  v9 = cocos2d::CCDirector::sharedDirector();\n  v10 = cocos2d::CCDirector::getContentScaleFactor(v9);\n  v11 = v35[2] / v10;\n  v12 = cocos2d::CCDirector::sharedDirector();\n  v13 = cocos2d::CCDirector::getContentScaleFactor(v12);\n  v14 = v35[1] / v13;\n  v15 = cocos2d::CCDirector::sharedDirector();\n  v16 = cocos2d::CCDirector::getContentScaleFactor(v15);\n  v17 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)v36, v35[0] / v16, v14, v11, v8);\n  cocos2d::CCRect::operator=((__int64)v35, (__int64)v17);\n  v18 = (unsigned int)(int)(float)((float)(*((float *)this + 90) * *((float *)a3 + 1)) + *(float *)a3);\n  v19 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)v36, (const struct cocos2d::CCRect *)v35);\n  v20 = (struct cocos2d::CCSprite *)cocos2d::CCTMXLayer::reusedTileWithRect(this, v19);\n  v21 = cocos2d::cc_timeval::operator=(&v37, a3);\n  cocos2d::CCTMXLayer::setupTileSprite(this, v20, 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_1800A1EA0(*((int **)this + 59), v18, v23);\n  v26 = *((cocos2d::CCArray **)this + 26);\n  if ( v26 )\n  {\n    if ( (unsigned int)cocos2d::CCArray::count(v26) )\n    {\n      v27 = *((_QWORD *)this + 26);\n      if ( v27 )\n      {\n        v28 = *(unsigned int **)(v27 + 56);\n        v29 = *v28;\n        if ( (_DWORD)v29 )\n        {\n          v30 = *((__int64 **)v28 + 2);\n          for ( i = &v30[v29 - 1]; v30 <= i; ++v30 )\n          {\n            v32 = *v30;\n            if ( !*v30 )\n              break;\n            v33 = *(_DWORD *)(v32 + 360);\n            if ( v33 >= (unsigned int)v23 )\n              *(_DWORD *)(v32 + 360) = v33 + 1;\n          }\n        }\n      }\n    }\n  }\n  *(_DWORD *)(*((_QWORD *)this + 47) + 4 * v18) = a2;\n  return v20;\n}", "assembly": "; \n; cocos2d::CCTMXLayer::insertTileForGID from 0x1800afc20 to 0x1800afe0f (495 bytes)\n; \n; 3 xrefs:\n; > cocos2d::CCTMXLayer::setTileGID @ 0x1800b06e1\n; > <???> @ 0x18014cf68\n; > <???> @ 0x1801c23d0\n; \n; This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n; \n; Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n; Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n; Generated at Fri, 27 Nov 2026 11:22:19 +0000\n; \nmov     [rsp+arg_8], rbx                                               ; +0x0, 0x1800afc20\nmov     [rsp+arg_10], rbp                                              ; +0x5, 0x1800afc25\npush    rsi                                                            ; +0xa, 0x1800afc2a\npush    rdi                                                            ; +0xb, 0x1800afc2b\npush    r14                                                            ; +0xc, 0x1800afc2c\nsub     rsp, 80h                                                       ; +0xe, 0x1800afc2e\nmovaps  [rsp+98h+var_28], xmm6                                         ; +0x15, 0x1800afc35\nmov     rbx, r8                                                        ; +0x1a, 0x1800afc3a\nmov     r8d, edx                                                       ; +0x1d, 0x1800afc3d\nmovaps  [rsp+98h+var_38], xmm7                                         ; +0x20, 0x1800afc40\nmov     r14d, edx                                                      ; +0x25, 0x1800afc45\nmovaps  [rsp+98h+var_48], xmm8                                         ; +0x28, 0x1800afc48\nmov     rsi, rcx                                                       ; +0x2e, 0x1800afc4e\nlea     rdx, [rsp+98h+var_68]                                          ; +0x31, 0x1800afc51\nmov     rcx, [rcx+180h]                                                ; +0x36, 0x1800afc56\ncall    ?rectForGID@CCTMXTilesetInfo@cocos2d@@QEAA?AVCCRect@2@I@Z; cocos2d::CCTMXTilesetInfo::rectForGID(uint) ; +0x3d, 0x1800afc5d\ncall    ?sharedDirector@CCDirector@cocos2d@@SAPEAV12@XZ; cocos2d::CCDirector::sharedDirector(void) ; +0x42, 0x1800afc62\nmov     rcx, rax; this                                                 ; +0x47, 0x1800afc67\ncall    ?getContentScaleFactor@CCDirector@cocos2d@@QEAAMXZ; cocos2d::CCDirector::getContentScaleFactor(void) ; +0x4a, 0x1800afc6a\nmovss   xmm8, [rsp+98h+var_5C]                                         ; +0x4f, 0x1800afc6f\ndivss   xmm8, xmm0                                                     ; +0x56, 0x1800afc76\ncall    ?sharedDirector@CCDirector@cocos2d@@SAPEAV12@XZ; cocos2d::CCDirector::sharedDirector(void) ; +0x5b, 0x1800afc7b\nmov     rcx, rax; this                                                 ; +0x60, 0x1800afc80\ncall    ?getContentScaleFactor@CCDirector@cocos2d@@QEAAMXZ; cocos2d::CCDirector::getContentScaleFactor(void) ; +0x63, 0x1800afc83\nmovss   xmm7, [rsp+98h+var_60]                                         ; +0x68, 0x1800afc88\ndivss   xmm7, xmm0                                                     ; +0x6e, 0x1800afc8e\ncall    ?sharedDirector@CCDirector@cocos2d@@SAPEAV12@XZ; cocos2d::CCDirector::sharedDirector(void) ; +0x72, 0x1800afc92\nmov     rcx, rax; this                                                 ; +0x77, 0x1800afc97\ncall    ?getContentScaleFactor@CCDirector@cocos2d@@QEAAMXZ; cocos2d::CCDirector::getContentScaleFactor(void) ; +0x7a, 0x1800afc9a\nmovss   xmm6, [rsp+98h+var_64]                                         ; +0x7f, 0x1800afc9f\ndivss   xmm6, xmm0                                                     ; +0x85, 0x1800afca5\ncall    ?sharedDirector@CCDirector@cocos2d@@SAPEAV12@XZ; cocos2d::CCDirector::sharedDirector(void) ; +0x89, 0x1800afca9\nmov     rcx, rax; this                                                 ; +0x8e, 0x1800afcae\ncall    ?getContentScaleFactor@CCDirector@cocos2d@@QEAAMXZ; cocos2d::CCDirector::getContentScaleFactor(void) ; +0x91, 0x1800afcb1\nlea     rcx, [rsp+98h+var_58]; this                                    ; +0x96, 0x1800afcb6\nmovss   xmm1, [rsp+98h+var_68]                                         ; +0x9b, 0x1800afcbb\nmovaps  xmm3, xmm7; float                                              ; +0xa1, 0x1800afcc1\ndivss   xmm1, xmm0; float                                              ; +0xa4, 0x1800afcc4\nmovaps  xmm2, xmm6; float                                              ; +0xa8, 0x1800afcc8\nmovss   [rsp+98h+var_78], xmm8; float                                  ; +0xab, 0x1800afccb\ncall    ??0CCRect@cocos2d@@QEAA@MMMM@Z; cocos2d::CCRect::CCRect(float,float,float,float) ; +0xb2, 0x1800afcd2\nmov     rdx, rax                                                       ; +0xb7, 0x1800afcd7\nlea     rcx, [rsp+98h+var_68]                                          ; +0xba, 0x1800afcda\ncall    ??4CCRect@cocos2d@@QEAAAEAV01@AEBV01@@Z; cocos2d::CCRect::operator=(cocos2d::CCRect const &) ; +0xbf, 0x1800afcdf\nmovss   xmm0, dword ptr [rsi+168h]                                     ; +0xc4, 0x1800afce4\nlea     rdx, [rsp+98h+var_68]; struct cocos2d::CCRect *                ; +0xcc, 0x1800afcec\nmulss   xmm0, dword ptr [rbx+4]                                        ; +0xd1, 0x1800afcf1\nlea     rcx, [rsp+98h+var_58]; this                                    ; +0xd6, 0x1800afcf6\naddss   xmm0, dword ptr [rbx]                                          ; +0xdb, 0x1800afcfb\ncvttss2si rdi, xmm0                                                    ; +0xdf, 0x1800afcff\ncall    ??0CCRect@cocos2d@@QEAA@AEBV01@@Z; cocos2d::CCRect::CCRect(cocos2d::CCRect const &) ; +0xe4, 0x1800afd04\nmov     rdx, rax                                                       ; +0xe9, 0x1800afd09\nmov     rcx, rsi                                                       ; +0xec, 0x1800afd0c\ncall    ?reusedTileWithRect@CCTMXLayer@cocos2d@@AEAAPEAVCCSprite@2@VCCRect@2@@Z; cocos2d::CCTMXLayer::reusedTileWithRect(cocos2d::CCRect) ; +0xef, 0x1800afd0f\nmov     rdx, rbx                                                       ; +0xf4, 0x1800afd14\nlea     rcx, [rsp+98h+arg_0]                                           ; +0xf7, 0x1800afd17\nmov     rbp, rax                                                       ; +0xff, 0x1800afd1f\ncall    ??4cc_timeval@cocos2d@@QEAAAEAU01@$$QEAU01@@Z; cocos2d::cc_timeval::operator=(cocos2d::cc_timeval &&) ; +0x102, 0x1800afd22\nmov     r8, rax                                                        ; +0x107, 0x1800afd27\nmov     r9d, r14d                                                      ; +0x10a, 0x1800afd2a\nmov     rdx, rbp                                                       ; +0x10d, 0x1800afd2d\nmov     rcx, rsi                                                       ; +0x110, 0x1800afd30\ncall    ?setupTileSprite@CCTMXLayer@cocos2d@@AEAAXPEAVCCSprite@2@VCCPoint@2@I@Z; cocos2d::CCTMXLayer::setupTileSprite(cocos2d::CCSprite *,cocos2d::CCPoint,uint) ; +0x113, 0x1800afd33\nmov     rcx, [rsi+1D8h]                                                ; +0x118, 0x1800afd38\nxor     ebx, ebx                                                       ; +0x11f, 0x1800afd3f\nmov     edx, [rcx]                                                     ; +0x121, 0x1800afd41\ntest    edx, edx                                                       ; +0x123, 0x1800afd43\njz      short loc_1800AFD5B                                            ; +0x125, 0x1800afd45\nmov     rcx, [rcx+10h]                                                 ; +0x127, 0x1800afd47\nnop     dword ptr [rax+rax+00h]                                        ; +0x12b, 0x1800afd4b\ncmp     edi, [rcx+rbx*8]                                               ; +0x130, 0x1800afd50\njl      short loc_1800AFD5B                                            ; +0x133, 0x1800afd53\ninc     ebx                                                            ; +0x135, 0x1800afd55\ncmp     ebx, edx                                                       ; +0x137, 0x1800afd57\njb      short loc_1800AFD50                                            ; +0x139, 0x1800afd59\nmov     r8d, ebx; unsigned int                                         ; +0x13b, 0x1800afd5b\nmov     rdx, rbp; struct cocos2d::CCSprite *                           ; +0x13e, 0x1800afd5e\nmov     rcx, rsi; this                                                 ; +0x141, 0x1800afd61\ncall    ?insertQuadFromSprite@CCSpriteBatchNode@cocos2d@@IEAAXPEAVCCSprite@2@I@Z; cocos2d::CCSpriteBatchNode::insertQuadFromSprite(cocos2d::CCSprite *,uint) ; +0x144, 0x1800afd64\nmov     rcx, [rsi+1D8h]                                                ; +0x149, 0x1800afd69\nmov     r8d, ebx                                                       ; +0x150, 0x1800afd70\nmov     rdx, rdi                                                       ; +0x153, 0x1800afd73\ncall    sub_1800A1EA0                                                  ; +0x156, 0x1800afd76\nmov     rcx, [rsi+0D0h]; this                                          ; +0x15b, 0x1800afd7b\ntest    rcx, rcx                                                       ; +0x162, 0x1800afd82\njz      short loc_1800AFDDA                                            ; +0x165, 0x1800afd85\ncall    ?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x167, 0x1800afd87\ntest    eax, eax                                                       ; +0x16c, 0x1800afd8c\njz      short loc_1800AFDDA                                            ; +0x16e, 0x1800afd8e\nmov     rax, [rsi+0D0h]                                                ; +0x170, 0x1800afd90\ntest    rax, rax                                                       ; +0x177, 0x1800afd97\njz      short loc_1800AFDDA                                            ; +0x17a, 0x1800afd9a\nmov     rcx, [rax+38h]                                                 ; +0x17c, 0x1800afd9c\nmov     eax, [rcx]                                                     ; +0x180, 0x1800afda0\ntest    eax, eax                                                       ; +0x182, 0x1800afda2\njz      short loc_1800AFDDA                                            ; +0x184, 0x1800afda4\nmov     rcx, [rcx+10h]                                                 ; +0x186, 0x1800afda6\nlea     r8, [rax-1]                                                    ; +0x18a, 0x1800afdaa\nlea     r8, [rcx+r8*8]                                                 ; +0x18e, 0x1800afdae\ncmp     rcx, r8                                                        ; +0x192, 0x1800afdb2\nja      short loc_1800AFDDA                                            ; +0x195, 0x1800afdb5\nmov     rdx, [rcx]                                                     ; +0x197, 0x1800afdb7\ntest    rdx, rdx                                                       ; +0x19a, 0x1800afdba\njz      short loc_1800AFDDA                                            ; +0x19d, 0x1800afdbd\nmov     eax, [rdx+168h]                                                ; +0x19f, 0x1800afdbf\ncmp     eax, ebx                                                       ; +0x1a5, 0x1800afdc5\njb      short loc_1800AFDD1                                            ; +0x1a7, 0x1800afdc7\ninc     eax                                                            ; +0x1a9, 0x1800afdc9\nmov     [rdx+168h], eax                                                ; +0x1ab, 0x1800afdcb\nadd     rcx, 8                                                         ; +0x1b1, 0x1800afdd1\ncmp     rcx, r8                                                        ; +0x1b5, 0x1800afdd5\njbe     short loc_1800AFDB7                                            ; +0x1b8, 0x1800afdd8\nmov     rax, [rsi+178h]                                                ; +0x1ba, 0x1800afdda\nlea     r11, [rsp+98h+var_18]                                          ; +0x1c1, 0x1800afde1\nmov     rbx, [r11+28h]                                                 ; +0x1c9, 0x1800afde9\nmovaps  xmm6, [rsp+98h+var_28]                                         ; +0x1cd, 0x1800afded\nmovaps  xmm7, [rsp+98h+var_38]                                         ; +0x1d2, 0x1800afdf2\nmovaps  xmm8, xmmword ptr [r11-30h]                                    ; +0x1d7, 0x1800afdf7\nmov     [rax+rdi*4], r14d                                              ; +0x1dc, 0x1800afdfc\nmov     rax, rbp                                                       ; +0x1e0, 0x1800afe00\nmov     rbp, [r11+30h]                                                 ; +0x1e3, 0x1800afe03\nmov     rsp, r11                                                       ; +0x1e7, 0x1800afe07\npop     r14                                                            ; +0x1ea, 0x1800afe0a\npop     rdi                                                            ; +0x1ec, 0x1800afe0c\npop     rsi                                                            ; +0x1ed, 0x1800afe0d\nretn                                                                   ; +0x1ee, 0x1800afe0e", "xrefs": ["cocos2d::CCTMXLayer::setTileGID @ 0x1800b06e1", "<???> @ 0x18014cf68", "<???> @ 0x1801c23d0"], "is_objc": false, "is_32_bit": false, "is_64_bit": true, "idp_name": "pc", "bida_info": "8.3.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings"}