{"type": "func", "start": 6443143504, "end": 6443144224, "name": "cocos2d::CCTexture2D::initWithData", "pseudocode": "// \n// cocos2d::CCTexture2D::initWithData from 0x1800a9150 to 0x1800a9420 (720 bytes)\n// \n// 6 xrefs:\n// > cocos2d::CCGridBase::initWithSize @ 0x180023aff\n// > cocos2d::CCRenderTexture::initWithWidthAndHeight @ 0x18006218d\n// > cocos2d::CCRenderTexture::initWithWidthAndHeight @ 0x1800622aa\n// > cocos2d::CCTexture2D::initPremultipliedATextureWithImage @ 0x1800a908f\n// > <???> @ 0x18014cf68\n// > <???> @ 0x1801c1efc\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:16 +0000\n// \n\nchar __fastcall cocos2d::CCTexture2D::initWithData(\n        __int64 a1,\n        const GLvoid *a2,\n        int a3,\n        GLsizei a4,\n        int height,\n        __int64 a6)\n{\n  __int64 v6; // rbp\n  int v10; // eax\n  unsigned int v11; // eax\n  GLint v12; // edx\n  cocos2d *v13; // rcx\n  float v14; // xmm1_4\n  __int64 v15; // rbx\n  cocos2d::CCShaderCache *v16; // rax\n  struct cocos2d::CCGLProgram *v17; // rax\n\n  v6 = a3;\n  if ( a3 == 1 )\n    v10 = 24;\n  else\n    v10 = cocos2d::CCTexture2D::bitsPerPixelForFormat(a1, a3);\n  v11 = (unsigned int)(a4 * v10) >> 3;\n  if ( (v11 & 7) != 0 )\n  {\n    if ( (v11 & 3) != 0 )\n    {\n      v12 = 2;\n      if ( (v11 & 1) != 0 )\n        v12 = 1;\n    }\n    else\n    {\n      v12 = 4;\n    }\n  }\n  else\n  {\n    v12 = 8;\n  }\n  glPixelStorei(0xCF5u, v12);\n  v13 = (cocos2d *)*(unsigned int *)(a1 + 72);\n  if ( (_DWORD)v13 )\n  {\n    cocos2d::ccGLDeleteTexture(v13);\n    *(_DWORD *)(a1 + 72) = 0;\n  }\n  glGenTextures(1, (GLuint *)(a1 + 72));\n  cocos2d::ccGLBindTexture2D((cocos2d *)*(unsigned int *)(a1 + 72));\n  glTexParameteri(0xDE1u, 0x2801u, 9729);\n  glTexParameteri(0xDE1u, 0x2800u, 9729);\n  glTexParameteri(0xDE1u, 0x2802u, 33071);\n  glTexParameteri(0xDE1u, 0x2803u, 33071);\n  switch ( v6 )\n  {\n    case 0LL:\n      glTexImage2D(0xDE1u, 0, 6408, a4, height, 0, 0x1908u, 0x1401u, a2);\n      break;\n    case 1LL:\n      glTexImage2D(0xDE1u, 0, 6407, a4, height, 0, 0x1907u, 0x1401u, a2);\n      break;\n    case 2LL:\n      glTexImage2D(0xDE1u, 0, 6407, a4, height, 0, 0x1907u, 0x8363u, a2);\n      break;\n    case 3LL:\n      glTexImage2D(0xDE1u, 0, 6406, a4, height, 0, 0x1906u, 0x1401u, a2);\n      break;\n    case 4LL:\n      glTexImage2D(0xDE1u, 0, 6409, a4, height, 0, 0x1909u, 0x1401u, a2);\n      break;\n    case 5LL:\n      glTexImage2D(0xDE1u, 0, 6410, a4, height, 0, 0x190Au, 0x1401u, a2);\n      break;\n    case 6LL:\n      glTexImage2D(0xDE1u, 0, 6408, a4, height, 0, 0x1908u, 0x8033u, a2);\n      break;\n    case 7LL:\n      glTexImage2D(0xDE1u, 0, 6408, a4, height, 0, 0x1908u, 0x8034u, a2);\n      break;\n    default:\n      break;\n  }\n  cocos2d::CCSize::operator=((_DWORD *)(a1 + 84), (_DWORD *)a6);\n  *(_DWORD *)(a1 + 64) = a4;\n  *(_DWORD *)(a1 + 68) = height;\n  *(_DWORD *)(a1 + 60) = v6;\n  *(float *)(a1 + 76) = *(float *)a6 / (float)a4;\n  v14 = *(float *)(a6 + 4);\n  v15 = *(_QWORD *)a1;\n  *(_WORD *)(a1 + 92) = 0;\n  *(float *)(a1 + 80) = v14 / (float)height;\n  v16 = cocos2d::CCShaderCache::sharedShaderCache();\n  v17 = cocos2d::CCShaderCache::programForKey(v16, \"ShaderPositionTexture\");\n  (*(void (__fastcall **)(__int64, struct cocos2d::CCGLProgram *))(v15 + 152))(a1, v17);\n  return 1;\n}", "assembly": "; \n; cocos2d::CCTexture2D::initWithData from 0x1800a9150 to 0x1800a9420 (720 bytes)\n; \n; 6 xrefs:\n; > cocos2d::CCGridBase::initWithSize @ 0x180023aff\n; > cocos2d::CCRenderTexture::initWithWidthAndHeight @ 0x18006218d\n; > cocos2d::CCRenderTexture::initWithWidthAndHeight @ 0x1800622aa\n; > cocos2d::CCTexture2D::initPremultipliedATextureWithImage @ 0x1800a908f\n; > <???> @ 0x18014cf68\n; > <???> @ 0x1801c1efc\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:16 +0000\n; \nmov     [rsp+arg_0], rbx                                               ; +0x0, 0x1800a9150\nmov     [rsp+arg_8], rbp                                               ; +0x5, 0x1800a9155\nmov     [rsp+arg_10], rsi                                              ; +0xa, 0x1800a915a\npush    rdi                                                            ; +0xf, 0x1800a915f\npush    r14                                                            ; +0x10, 0x1800a9160\npush    r15                                                            ; +0x12, 0x1800a9162\nsub     rsp, 50h                                                       ; +0x14, 0x1800a9164\nmovsxd  rbp, r8d                                                       ; +0x18, 0x1800a9168\nmov     rbx, rdx                                                       ; +0x1b, 0x1800a916b\nmov     edi, r9d                                                       ; +0x1e, 0x1800a916e\nmov     r14, rcx                                                       ; +0x21, 0x1800a9171\ncmp     ebp, 1                                                         ; +0x24, 0x1800a9174\njnz     short loc_1800A9180                                            ; +0x27, 0x1800a9177\nmov     eax, 18h                                                       ; +0x29, 0x1800a9179\njmp     short loc_1800A9187                                            ; +0x2e, 0x1800a917e\nmov     edx, ebp                                                       ; +0x30, 0x1800a9180\ncall    ?bitsPerPixelForFormat@CCTexture2D@cocos2d@@QEAAIW4CCTexture2DPixelFormat@2@@Z; cocos2d::CCTexture2D::bitsPerPixelForFormat(cocos2d::CCTexture2DPixelFormat) ; +0x32, 0x1800a9182\nimul    eax, edi                                                       ; +0x37, 0x1800a9187\nshr     eax, 3                                                         ; +0x3a, 0x1800a918a\ntest    al, 7                                                          ; +0x3d, 0x1800a918d\njnz     short loc_1800A9198                                            ; +0x3f, 0x1800a918f\nmov     edx, 8                                                         ; +0x41, 0x1800a9191\njmp     short loc_1800A91B1                                            ; +0x46, 0x1800a9196\ntest    al, 3                                                          ; +0x48, 0x1800a9198\njnz     short loc_1800A91A3                                            ; +0x4a, 0x1800a919a\nmov     edx, 4                                                         ; +0x4c, 0x1800a919c\njmp     short loc_1800A91B1                                            ; +0x51, 0x1800a91a1\nmov     edx, 2                                                         ; +0x53, 0x1800a91a3\ntest    al, 1                                                          ; +0x58, 0x1800a91a8\njz      short loc_1800A91B1                                            ; +0x5a, 0x1800a91aa\nmov     edx, 1; param                                                  ; +0x5c, 0x1800a91ac\nmov     ecx, 0CF5h; pname                                              ; +0x61, 0x1800a91b1\ncall    cs:glPixelStorei                                               ; +0x66, 0x1800a91b6\nmov     ecx, [r14+48h]; this                                           ; +0x6c, 0x1800a91bc\nxor     r15d, r15d                                                     ; +0x70, 0x1800a91c0\ntest    ecx, ecx                                                       ; +0x73, 0x1800a91c3\njz      short loc_1800A91D0                                            ; +0x75, 0x1800a91c5\ncall    ?ccGLDeleteTexture@cocos2d@@YAXI@Z; cocos2d::ccGLDeleteTexture(uint) ; +0x77, 0x1800a91c7\nmov     [r14+48h], r15d                                                ; +0x7c, 0x1800a91cc\nlea     rdx, [r14+48h]; textures                                       ; +0x80, 0x1800a91d0\nmov     ecx, 1; n                                                      ; +0x84, 0x1800a91d4\ncall    cs:glGenTextures                                               ; +0x89, 0x1800a91d9\nmov     ecx, [r14+48h]; this                                           ; +0x8f, 0x1800a91df\ncall    ?ccGLBindTexture2D@cocos2d@@YAXI@Z; cocos2d::ccGLBindTexture2D(uint) ; +0x93, 0x1800a91e3\nmov     edx, 2801h; pname                                              ; +0x98, 0x1800a91e8\nmov     ecx, 0DE1h; target                                             ; +0x9d, 0x1800a91ed\nmov     r8d, 2601h; param                                              ; +0xa2, 0x1800a91f2\ncall    cs:glTexParameteri                                             ; +0xa8, 0x1800a91f8\nmov     edx, 2800h; pname                                              ; +0xae, 0x1800a91fe\nmov     ecx, 0DE1h; target                                             ; +0xb3, 0x1800a9203\nmov     r8d, 2601h; param                                              ; +0xb8, 0x1800a9208\ncall    cs:glTexParameteri                                             ; +0xbe, 0x1800a920e\nmov     edx, 2802h; pname                                              ; +0xc4, 0x1800a9214\nmov     ecx, 0DE1h; target                                             ; +0xc9, 0x1800a9219\nmov     r8d, 812Fh; param                                              ; +0xce, 0x1800a921e\ncall    cs:glTexParameteri                                             ; +0xd4, 0x1800a9224\nmov     edx, 2803h; pname                                              ; +0xda, 0x1800a922a\nmov     ecx, 0DE1h; target                                             ; +0xdf, 0x1800a922f\nmov     r8d, 812Fh; param                                              ; +0xe4, 0x1800a9234\ncall    cs:glTexParameteri                                             ; +0xea, 0x1800a923a\nmov     esi, [rsp+68h+arg_20]                                          ; +0xf0, 0x1800a9240\ncmp     ebp, 7; switch 8 cases                                         ; +0xf7, 0x1800a9247\nja      def_1800A9262; jumptable 00000001800A9262 default case         ; +0xfa, 0x1800a924a\nlea     r8, cs:180000000h                                              ; +0x100, 0x1800a9250\nmov     edx, ds:(jpt_1800A9262 - 180000000h)[r8+rbp*4]                 ; +0x107, 0x1800a9257\nadd     rdx, r8                                                        ; +0x10f, 0x1800a925f\njmp     rdx; switch jump                                               ; +0x112, 0x1800a9262\nmov     [rsp+68h+pixels], rbx; jumptable 00000001800A9262 case 0       ; +0x114, 0x1800a9264\nmov     r8d, 1908h                                                     ; +0x119, 0x1800a9269\nmov     [rsp+68h+type], 1401h                                          ; +0x11f, 0x1800a926f\nmov     [rsp+68h+format], 1908h                                        ; +0x127, 0x1800a9277\njmp     loc_1800A9353                                                  ; +0x12f, 0x1800a927f\nmov     [rsp+68h+pixels], rbx; jumptable 00000001800A9262 case 1       ; +0x134, 0x1800a9284\nmov     r8d, 1907h                                                     ; +0x139, 0x1800a9289\nmov     [rsp+68h+type], 1401h                                          ; +0x13f, 0x1800a928f\nmov     [rsp+68h+format], 1907h                                        ; +0x147, 0x1800a9297\njmp     loc_1800A9353                                                  ; +0x14f, 0x1800a929f\nmov     [rsp+68h+pixels], rbx; jumptable 00000001800A9262 case 6       ; +0x154, 0x1800a92a4\nmov     r8d, 1908h                                                     ; +0x159, 0x1800a92a9\nmov     [rsp+68h+type], 8033h                                          ; +0x15f, 0x1800a92af\nmov     [rsp+68h+format], 1908h                                        ; +0x167, 0x1800a92b7\njmp     loc_1800A9353                                                  ; +0x16f, 0x1800a92bf\nmov     [rsp+68h+pixels], rbx; jumptable 00000001800A9262 case 7       ; +0x174, 0x1800a92c4\nmov     r8d, 1908h                                                     ; +0x179, 0x1800a92c9\nmov     [rsp+68h+type], 8034h                                          ; +0x17f, 0x1800a92cf\nmov     [rsp+68h+format], 1908h                                        ; +0x187, 0x1800a92d7\njmp     short loc_1800A9353                                            ; +0x18f, 0x1800a92df\nmov     [rsp+68h+pixels], rbx; jumptable 00000001800A9262 case 2       ; +0x191, 0x1800a92e1\nmov     r8d, 1907h                                                     ; +0x196, 0x1800a92e6\nmov     [rsp+68h+type], 8363h                                          ; +0x19c, 0x1800a92ec\nmov     [rsp+68h+format], 1907h                                        ; +0x1a4, 0x1800a92f4\njmp     short loc_1800A9353                                            ; +0x1ac, 0x1800a92fc\nmov     [rsp+68h+pixels], rbx; jumptable 00000001800A9262 case 5       ; +0x1ae, 0x1800a92fe\nmov     r8d, 190Ah                                                     ; +0x1b3, 0x1800a9303\nmov     [rsp+68h+type], 1401h                                          ; +0x1b9, 0x1800a9309\nmov     [rsp+68h+format], 190Ah                                        ; +0x1c1, 0x1800a9311\njmp     short loc_1800A9353                                            ; +0x1c9, 0x1800a9319\nmov     [rsp+68h+pixels], rbx; jumptable 00000001800A9262 case 3       ; +0x1cb, 0x1800a931b\nmov     r8d, 1906h                                                     ; +0x1d0, 0x1800a9320\nmov     [rsp+68h+type], 1401h                                          ; +0x1d6, 0x1800a9326\nmov     [rsp+68h+format], 1906h                                        ; +0x1de, 0x1800a932e\njmp     short loc_1800A9353                                            ; +0x1e6, 0x1800a9336\nmov     [rsp+68h+pixels], rbx; jumptable 00000001800A9262 case 4       ; +0x1e8, 0x1800a9338\nmov     r8d, 1909h; internalformat                                     ; +0x1ed, 0x1800a933d\nmov     [rsp+68h+type], 1401h; type                                    ; +0x1f3, 0x1800a9343\nmov     [rsp+68h+format], 1909h; format                                ; +0x1fb, 0x1800a934b\nmov     [rsp+68h+border], r15d; border                                 ; +0x203, 0x1800a9353\nmov     r9d, edi; width                                                ; +0x208, 0x1800a9358\nxor     edx, edx; level                                                ; +0x20b, 0x1800a935b\nmov     [rsp+68h+height], esi; height                                  ; +0x20d, 0x1800a935d\nmov     ecx, 0DE1h; target                                             ; +0x211, 0x1800a9361\ncall    cs:glTexImage2D                                                ; +0x216, 0x1800a9366\nmov     rbx, [rsp+68h+arg_28]; jumptable 00000001800A9262 default case ; +0x21c, 0x1800a936c\nlea     rcx, [r14+54h]                                                 ; +0x224, 0x1800a9374\nmov     rdx, rbx                                                       ; +0x228, 0x1800a9378\ncall    ??4CCSize@cocos2d@@QEAAAEAV01@AEBVCCPoint@1@@Z; cocos2d::CCSize::operator=(cocos2d::CCPoint const &) ; +0x22b, 0x1800a937b\nxorps   xmm0, xmm0                                                     ; +0x230, 0x1800a9380\nmov     [r14+40h], edi                                                 ; +0x233, 0x1800a9383\ncvtsi2ss xmm0, rdi                                                     ; +0x237, 0x1800a9387\nmov     [r14+44h], esi                                                 ; +0x23c, 0x1800a938c\nmov     [r14+3Ch], ebp                                                 ; +0x240, 0x1800a9390\nmovss   xmm1, dword ptr [rbx]                                          ; +0x244, 0x1800a9394\ndivss   xmm1, xmm0                                                     ; +0x248, 0x1800a9398\nxorps   xmm0, xmm0                                                     ; +0x24c, 0x1800a939c\nmovss   dword ptr [r14+4Ch], xmm1                                      ; +0x24f, 0x1800a939f\nmovss   xmm1, dword ptr [rbx+4]                                        ; +0x255, 0x1800a93a5\nmov     rbx, [r14]                                                     ; +0x25a, 0x1800a93aa\ncvtsi2ss xmm0, rsi                                                     ; +0x25d, 0x1800a93ad\nmov     [r14+5Ch], r15w                                                ; +0x262, 0x1800a93b2\ndivss   xmm1, xmm0                                                     ; +0x267, 0x1800a93b7\nmovss   dword ptr [r14+50h], xmm1                                      ; +0x26b, 0x1800a93bb\ncall    ?sharedShaderCache@CCShaderCache@cocos2d@@SAPEAV12@XZ; cocos2d::CCShaderCache::sharedShaderCache(void) ; +0x271, 0x1800a93c1\nmov     rcx, rax; this                                                 ; +0x276, 0x1800a93c6\nlea     rdx, aShaderposition_2; \"ShaderPositionTexture\"                ; +0x279, 0x1800a93c9\ncall    ?programForKey@CCShaderCache@cocos2d@@QEAAPEAVCCGLProgram@2@PEBD@Z; cocos2d::CCShaderCache::programForKey(char const *) ; +0x280, 0x1800a93d0\nmov     rdx, rax                                                       ; +0x285, 0x1800a93d5\nmov     rcx, r14                                                       ; +0x288, 0x1800a93d8\ncall    qword ptr [rbx+98h]                                            ; +0x28b, 0x1800a93db\nmov     rbx, [rsp+68h+arg_0]                                           ; +0x291, 0x1800a93e1\nmov     al, 1                                                          ; +0x296, 0x1800a93e6\nmov     rbp, [rsp+68h+arg_8]                                           ; +0x298, 0x1800a93e8\nmov     rsi, [rsp+68h+arg_10]                                          ; +0x29d, 0x1800a93ed\nadd     rsp, 50h                                                       ; +0x2a5, 0x1800a93f5\npop     r15                                                            ; +0x2a9, 0x1800a93f9\npop     r14                                                            ; +0x2ab, 0x1800a93fb\npop     rdi                                                            ; +0x2ad, 0x1800a93fd\nretn                                                                   ; +0x2ae, 0x1800a93fe\nalign 20h                                                              ; +0x2af, 0x1800a93ff\ndd offset loc_1800A9264 - 180000000h; jump table for switch statement  ; +0x2b0, 0x1800a9400", "xrefs": ["cocos2d::CCGridBase::initWithSize @ 0x180023aff", "cocos2d::CCRenderTexture::initWithWidthAndHeight @ 0x18006218d", "cocos2d::CCRenderTexture::initWithWidthAndHeight @ 0x1800622aa", "cocos2d::CCTexture2D::initPremultipliedATextureWithImage @ 0x1800a908f", "<???> @ 0x18014cf68", "<???> @ 0x1801c1efc"], "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"}