{"type": "func", "start": 6443132352, "end": 6443132613, "name": "cocos2d::CCTextureAtlas::initWithTexture", "pseudocode": "// \n// cocos2d::CCTextureAtlas::initWithTexture from 0x1800a65c0 to 0x1800a66c5 (261 bytes)\n// \n// 8 xrefs:\n// > cocos2d::CCAtlasNode::initWithTexture @ 0x180001c8a\n// > cocos2d::CCParticleBatchNode::initWithTexture @ 0x180061740\n// > cocos2d::CCSpriteBatchNode::initWithTexture @ 0x18008e6c4\n// > cocos2d::CCTextureAtlas::create @ 0x1800a61dc\n// > cocos2d::CCTextureAtlas::createWithTexture @ 0x1800a62b4\n// > cocos2d::CCTextureAtlas::initWithFile @ 0x1800a65a8\n// > <???> @ 0x1801438a8\n// > <???> @ 0x1801b7d1c\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\nchar __fastcall cocos2d::CCTextureAtlas::initWithTexture(\n        cocos2d::CCTextureAtlas *this,\n        struct cocos2d::CCTexture2D *a2,\n        unsigned int a3)\n{\n  GLushort *v4; // rax\n  cocos2d::ccV3F_C4B_T2F_Quad *m_pQuads; // rcx\n  GLushort *m_pIndices; // rcx\n  cocos2d::CCTexture2D *m_pTexture; // rcx\n\n  this->m_uCapacity = a3;\n  this->m_uTotalQuads = 0;\n  this->m_uMaxQuads = 0;\n  this->m_pTexture = a2;\n  if ( a2 )\n    cocos2d::CCObject::retain(a2);\n  this->m_pQuads = (cocos2d::ccV3F_C4B_T2F_Quad *)malloc(96LL * this->m_uCapacity);\n  v4 = (GLushort *)malloc(12LL * this->m_uCapacity);\n  m_pQuads = this->m_pQuads;\n  this->m_pIndices = v4;\n  if ( m_pQuads && v4 || !this->m_uCapacity )\n  {\n    memset(m_pQuads, 0, 96LL * this->m_uCapacity);\n    memset(this->m_pIndices, 0, 12LL * this->m_uCapacity);\n    cocos2d::CCTextureAtlas::setupIndices(this);\n    _glewGenBuffers(2, this->m_pBuffersVBO);\n    cocos2d::CCTextureAtlas::mapBuffers(this);\n    this->m_bDirty = 1;\n    return 1;\n  }\n  else\n  {\n    if ( m_pQuads )\n    {\n      free(m_pQuads);\n      this->m_pQuads = nullptr;\n    }\n    m_pIndices = this->m_pIndices;\n    if ( m_pIndices )\n    {\n      free(m_pIndices);\n      this->m_pIndices = nullptr;\n    }\n    m_pTexture = this->m_pTexture;\n    if ( m_pTexture )\n    {\n      cocos2d::CCObject::release(m_pTexture);\n      this->m_pTexture = nullptr;\n    }\n    return 0;\n  }\n}", "assembly": "; \n; cocos2d::CCTextureAtlas::initWithTexture from 0x1800a65c0 to 0x1800a66c5 (261 bytes)\n; \n; 8 xrefs:\n; > cocos2d::CCAtlasNode::initWithTexture @ 0x180001c8a\n; > cocos2d::CCParticleBatchNode::initWithTexture @ 0x180061740\n; > cocos2d::CCSpriteBatchNode::initWithTexture @ 0x18008e6c4\n; > cocos2d::CCTextureAtlas::create @ 0x1800a61dc\n; > cocos2d::CCTextureAtlas::createWithTexture @ 0x1800a62b4\n; > cocos2d::CCTextureAtlas::initWithFile @ 0x1800a65a8\n; > <???> @ 0x1801438a8\n; > <???> @ 0x1801b7d1c\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, 0x1800a65c0\npush    rdi                                                            ; +0x5, 0x1800a65c5\nsub     rsp, 20h                                                       ; +0x6, 0x1800a65c6\nxor     edi, edi                                                       ; +0xa, 0x1800a65ca\nmov     [rcx+50h], r8d                                                 ; +0xc, 0x1800a65cc\nmov     [rcx+4Ch], edi                                                 ; +0x10, 0x1800a65d0\nmov     rbx, rcx                                                       ; +0x13, 0x1800a65d3\nmov     [rcx+68h], edi                                                 ; +0x16, 0x1800a65d6\nmov     [rcx+58h], rdx                                                 ; +0x19, 0x1800a65d9\ntest    rdx, rdx                                                       ; +0x1d, 0x1800a65dd\njz      short loc_1800A65EA                                            ; +0x20, 0x1800a65e0\nmov     rcx, rdx; this                                                 ; +0x22, 0x1800a65e2\ncall    ?retain@CCObject@cocos2d@@QEAAXXZ; cocos2d::CCObject::retain(void) ; +0x25, 0x1800a65e5\nmov     eax, [rbx+50h]                                                 ; +0x2a, 0x1800a65ea\nlea     rcx, [rax+rax*2]                                               ; +0x2d, 0x1800a65ed\nshl     rcx, 5; Size                                                   ; +0x31, 0x1800a65f1\ncall    cs:__imp_malloc                                                ; +0x35, 0x1800a65f5\nmov     [rbx+60h], rax                                                 ; +0x3b, 0x1800a65fb\nmov     eax, [rbx+50h]                                                 ; +0x3f, 0x1800a65ff\nlea     ecx, [rax+rax*2]                                               ; +0x42, 0x1800a6602\nadd     ecx, ecx                                                       ; +0x45, 0x1800a6605\nadd     rcx, rcx; Size                                                 ; +0x47, 0x1800a6607\ncall    cs:__imp_malloc                                                ; +0x4a, 0x1800a660a\nmov     rcx, [rbx+60h]; void *                                         ; +0x50, 0x1800a6610\nmov     [rbx+38h], rax                                                 ; +0x54, 0x1800a6614\ntest    rcx, rcx                                                       ; +0x58, 0x1800a6618\njz      short loc_1800A6622                                            ; +0x5b, 0x1800a661b\ntest    rax, rax                                                       ; +0x5d, 0x1800a661d\njnz     short loc_1800A6668                                            ; +0x60, 0x1800a6620\ncmp     [rbx+50h], edi                                                 ; +0x62, 0x1800a6622\njbe     short loc_1800A6668                                            ; +0x65, 0x1800a6625\ntest    rcx, rcx                                                       ; +0x67, 0x1800a6627\njz      short loc_1800A6636                                            ; +0x6a, 0x1800a662a\ncall    cs:__imp_free                                                  ; +0x6c, 0x1800a662c\nmov     [rbx+60h], rdi                                                 ; +0x72, 0x1800a6632\nmov     rcx, [rbx+38h]; Block                                          ; +0x76, 0x1800a6636\ntest    rcx, rcx                                                       ; +0x7a, 0x1800a663a\njz      short loc_1800A6649                                            ; +0x7d, 0x1800a663d\ncall    cs:__imp_free                                                  ; +0x7f, 0x1800a663f\nmov     [rbx+38h], rdi                                                 ; +0x85, 0x1800a6645\nmov     rcx, [rbx+58h]; this                                           ; +0x89, 0x1800a6649\ntest    rcx, rcx                                                       ; +0x8d, 0x1800a664d\njz      short loc_1800A665B                                            ; +0x90, 0x1800a6650\ncall    ?release@CCObject@cocos2d@@QEAAXXZ; cocos2d::CCObject::release(void) ; +0x92, 0x1800a6652\nmov     [rbx+58h], rdi                                                 ; +0x97, 0x1800a6657\nxor     al, al                                                         ; +0x9b, 0x1800a665b\nmov     rbx, [rsp+28h+arg_0]                                           ; +0x9d, 0x1800a665d\nadd     rsp, 20h                                                       ; +0xa2, 0x1800a6662\npop     rdi                                                            ; +0xa6, 0x1800a6666\nretn                                                                   ; +0xa7, 0x1800a6667\nmov     eax, [rbx+50h]                                                 ; +0xa8, 0x1800a6668\nxor     edx, edx; Val                                                  ; +0xab, 0x1800a666b\nlea     r8, [rax+rax*2]                                                ; +0xad, 0x1800a666d\nshl     r8, 5; Size                                                    ; +0xb1, 0x1800a6671\ncall    memset                                                         ; +0xb5, 0x1800a6675\nmov     eax, [rbx+50h]                                                 ; +0xba, 0x1800a667a\nxor     edx, edx; Val                                                  ; +0xbd, 0x1800a667d\nlea     ecx, [rax+rax*2]                                               ; +0xbf, 0x1800a667f\nlea     r8d, [rcx+rcx]                                                 ; +0xc2, 0x1800a6682\nmov     rcx, [rbx+38h]; void *                                         ; +0xc6, 0x1800a6686\nadd     r8, r8; Size                                                   ; +0xca, 0x1800a668a\ncall    memset                                                         ; +0xcd, 0x1800a668d\nmov     rcx, rbx; this                                                 ; +0xd2, 0x1800a6692\ncall    ?setupIndices@CCTextureAtlas@cocos2d@@AEAAXXZ; cocos2d::CCTextureAtlas::setupIndices(void) ; +0xd5, 0x1800a6695\nmov     rax, cs:__glewGenBuffers                                       ; +0xda, 0x1800a669a\nlea     rdx, [rbx+40h]                                                 ; +0xe1, 0x1800a66a1\nmov     ecx, 2                                                         ; +0xe5, 0x1800a66a5\ncall    qword ptr [rax]                                                ; +0xea, 0x1800a66aa\nmov     rcx, rbx; this                                                 ; +0xec, 0x1800a66ac\ncall    ?mapBuffers@CCTextureAtlas@cocos2d@@AEAAXXZ; cocos2d::CCTextureAtlas::mapBuffers(void) ; +0xef, 0x1800a66af\nmov     byte ptr [rbx+48h], 1                                          ; +0xf4, 0x1800a66b4\nmov     al, 1                                                          ; +0xf8, 0x1800a66b8\nmov     rbx, [rsp+28h+arg_0]                                           ; +0xfa, 0x1800a66ba\nadd     rsp, 20h                                                       ; +0xff, 0x1800a66bf\npop     rdi                                                            ; +0x103, 0x1800a66c3\nretn                                                                   ; +0x104, 0x1800a66c4", "xrefs": ["cocos2d::CCAtlasNode::initWithTexture @ 0x180001c8a", "cocos2d::CCParticleBatchNode::initWithTexture @ 0x180061740", "cocos2d::CCSpriteBatchNode::initWithTexture @ 0x18008e6c4", "cocos2d::CCTextureAtlas::create @ 0x1800a61dc", "cocos2d::CCTextureAtlas::createWithTexture @ 0x1800a62b4", "cocos2d::CCTextureAtlas::initWithFile @ 0x1800a65a8", "<???> @ 0x1801438a8", "<???> @ 0x1801b7d1c"], "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"}