{"type": "func", "start": 4302057728, "end": 4302058160, "name": "CCSpriteWithHue::initShader", "pseudocode": "// \n// CCSpriteWithHue::initShader from 0x1006c3100 to 0x1006c32b0 (432 bytes)\n// \n// 3 xrefs:\n// > sub_1006C2EB0 @ 0x1006c2f3f\n// > CCSpriteWithHue::initWithTexture @ 0x1006c30c5\n// > sub_1006C40B0 @ 0x1006c413f\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 12:35:32 +0000\n// \n\n__int64 __fastcall CCSpriteWithHue::initShader(_DWORD *a1)\n{\n  __int64 v1; // r14\n  const char *v2; // rsi\n  GLuint *v3; // r14\n  char *v4; // r15\n  __int64 v5; // rax\n  __int64 v6; // r15\n  const char *v7; // rdx\n  __int64 v8; // rax\n  __int64 v9; // rax\n  __int64 v10; // rax\n  char v12; // [rsp+0h] [rbp-30h] BYREF\n  _BYTE v13[15]; // [rsp+1h] [rbp-2Fh] BYREF\n  void *__p; // [rsp+10h] [rbp-20h]\n\n  v1 = cocos2d::CCShaderCache::sharedShaderCache();\n  (*(void (__fastcall **)(char *, _DWORD *))(*(_QWORD *)a1 + 1240LL))(&v12, a1);\n  if ( (v12 & 1) != 0 )\n    v2 = (const char *)__p;\n  else\n    v2 = v13;\n  v3 = (GLuint *)cocos2d::CCShaderCache::programForKey(v1, v2);\n  if ( (v12 & 1) != 0 )\n    operator delete(__p);\n  if ( !v3 )\n  {\n    v3 = (GLuint *)operator new(0x78u);\n    cocos2d::CCGLProgram::CCGLProgram((__int64)v3);\n    v4 = off_100BDEAC0[0];\n    v5 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)a1 + 1248LL))(a1);\n    cocos2d::CCGLProgram::initWithVertexShaderByteArray((__int64)v3, (__int64)v4, v5);\n    cocos2d::CCGLProgram::addAttribute((__int64)v3, \"a_position\", 0);\n    cocos2d::CCGLProgram::addAttribute((__int64)v3, \"a_color\", 1u);\n    cocos2d::CCGLProgram::addAttribute((__int64)v3, \"a_texCoord\", 2u);\n    cocos2d::CCGLProgram::link(v3);\n    cocos2d::CCGLProgram::updateUniforms((__int64)v3);\n    v6 = cocos2d::CCShaderCache::sharedShaderCache();\n    (*(void (__fastcall **)(char *, _DWORD *))(*(_QWORD *)a1 + 1240LL))(&v12, a1);\n    if ( (v12 & 1) != 0 )\n      v7 = (const char *)__p;\n    else\n      v7 = v13;\n    cocos2d::CCShaderCache::addProgram(v6, (__int64)v3, v7);\n    if ( (v12 & 1) != 0 )\n      operator delete(__p);\n    cocos2d::CCObject::release(v3);\n  }\n  (*(void (__fastcall **)(_DWORD *, GLuint *))(*(_QWORD *)a1 + 664LL))(a1, v3);\n  v8 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)a1 + 656LL))(a1);\n  a1[162] = glGetUniformLocation(*(_DWORD *)(v8 + 56), \"u_hue\");\n  v9 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)a1 + 656LL))(a1);\n  a1[163] = glGetUniformLocation(*(_DWORD *)(v9 + 56), \"u_alpha\");\n  v10 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)a1 + 656LL))(a1);\n  a1[164] = glGetUniformLocation(*(_DWORD *)(v10 + 56), \"u_lum\");\n  return (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)a1 + 1256LL))(a1);\n}", "assembly": "; \n; CCSpriteWithHue::initShader from 0x1006c3100 to 0x1006c32b0 (432 bytes)\n; \n; 3 xrefs:\n; > sub_1006C2EB0 @ 0x1006c2f3f\n; > CCSpriteWithHue::initWithTexture @ 0x1006c30c5\n; > sub_1006C40B0 @ 0x1006c413f\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 12:35:32 +0000\n; \npush    rbp                                                            ; +0x0, 0x1006c3100\nmov     rbp, rsp                                                       ; +0x1, 0x1006c3101\npush    r15                                                            ; +0x4, 0x1006c3104\npush    r14                                                            ; +0x6, 0x1006c3106\npush    rbx                                                            ; +0x8, 0x1006c3108\nsub     rsp, 18h                                                       ; +0x9, 0x1006c3109\nmov     rbx, rdi                                                       ; +0xd, 0x1006c310d\ncall    cocos2d__CCShaderCache__sharedShaderCache                      ; +0x10, 0x1006c3110\nmov     r14, rax                                                       ; +0x15, 0x1006c3115\nmov     rax, [rbx]                                                     ; +0x18, 0x1006c3118\nlea     rdi, [rbp+var_30]                                              ; +0x1b, 0x1006c311b\nmov     rsi, rbx                                                       ; +0x1f, 0x1006c311f\ncall    qword ptr [rax+4D8h]                                           ; +0x22, 0x1006c3122\ntest    [rbp+var_30], 1                                                ; +0x28, 0x1006c3128\njz      short loc_1006C3134                                            ; +0x2c, 0x1006c312c\nmov     rsi, [rbp+__p]                                                 ; +0x2e, 0x1006c312e\njmp     short loc_1006C3138                                            ; +0x32, 0x1006c3132\nlea     rsi, [rbp+var_2F]                                              ; +0x34, 0x1006c3134\nmov     rdi, r14                                                       ; +0x38, 0x1006c3138\ncall    cocos2d__CCShaderCache__programForKey                          ; +0x3b, 0x1006c313b\nmov     r14, rax                                                       ; +0x40, 0x1006c3140\ntest    [rbp+var_30], 1                                                ; +0x43, 0x1006c3143\njz      short loc_1006C3152                                            ; +0x47, 0x1006c3147\nmov     rdi, [rbp+__p]; __p                                            ; +0x49, 0x1006c3149\ncall    __ZdlPv; operator delete(void *)                               ; +0x4d, 0x1006c314d\ntest    r14, r14                                                       ; +0x52, 0x1006c3152\njnz     loc_1006C3227                                                  ; +0x55, 0x1006c3155\nmov     edi, 78h ; 'x'; __sz                                           ; +0x5b, 0x1006c315b\ncall    __Znwm; operator new(ulong)                                    ; +0x60, 0x1006c3160\nmov     r14, rax                                                       ; +0x65, 0x1006c3165\nmov     rdi, rax                                                       ; +0x68, 0x1006c3168\ncall    cocos2d__CCGLProgram__CCGLProgram                              ; +0x6b, 0x1006c316b\nlea     rax, off_100BDEAC0; \"\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\nattribute v\"... ; +0x70, 0x1006c3170\nmov     r15, [rax]                                                     ; +0x77, 0x1006c3177\nmov     rax, [rbx]                                                     ; +0x7a, 0x1006c317a\nmov     rdi, rbx                                                       ; +0x7d, 0x1006c317d\ncall    qword ptr [rax+4E0h]                                           ; +0x80, 0x1006c3180\nmov     rdi, r14                                                       ; +0x86, 0x1006c3186\nmov     rsi, r15                                                       ; +0x89, 0x1006c3189\nmov     rdx, rax                                                       ; +0x8c, 0x1006c318c\ncall    cocos2d__CCGLProgram__initWithVertexShaderByteArray            ; +0x8f, 0x1006c318f\nlea     rsi, aAPosition; \"a_position\"                                  ; +0x94, 0x1006c3194\nmov     rdi, r14                                                       ; +0x9b, 0x1006c319b\nxor     edx, edx                                                       ; +0x9e, 0x1006c319e\ncall    cocos2d__CCGLProgram__addAttribute                             ; +0xa0, 0x1006c31a0\nlea     rsi, aAColor; \"a_color\"                                        ; +0xa5, 0x1006c31a5\nmov     rdi, r14                                                       ; +0xac, 0x1006c31ac\nmov     edx, 1                                                         ; +0xaf, 0x1006c31af\ncall    cocos2d__CCGLProgram__addAttribute                             ; +0xb4, 0x1006c31b4\nlea     rsi, aATexcoord; \"a_texCoord\"                                  ; +0xb9, 0x1006c31b9\nmov     rdi, r14                                                       ; +0xc0, 0x1006c31c0\nmov     edx, 2                                                         ; +0xc3, 0x1006c31c3\ncall    cocos2d__CCGLProgram__addAttribute                             ; +0xc8, 0x1006c31c8\nmov     rdi, r14                                                       ; +0xcd, 0x1006c31cd\ncall    cocos2d__CCGLProgram__link                                     ; +0xd0, 0x1006c31d0\nmov     rdi, r14                                                       ; +0xd5, 0x1006c31d5\ncall    cocos2d__CCGLProgram__updateUniforms                           ; +0xd8, 0x1006c31d8\ncall    cocos2d__CCShaderCache__sharedShaderCache                      ; +0xdd, 0x1006c31dd\nmov     r15, rax                                                       ; +0xe2, 0x1006c31e2\nmov     rax, [rbx]                                                     ; +0xe5, 0x1006c31e5\nlea     rdi, [rbp+var_30]                                              ; +0xe8, 0x1006c31e8\nmov     rsi, rbx                                                       ; +0xec, 0x1006c31ec\ncall    qword ptr [rax+4D8h]                                           ; +0xef, 0x1006c31ef\ntest    [rbp+var_30], 1                                                ; +0xf5, 0x1006c31f5\njz      short loc_1006C3201                                            ; +0xf9, 0x1006c31f9\nmov     rdx, [rbp+__p]                                                 ; +0xfb, 0x1006c31fb\njmp     short loc_1006C3205                                            ; +0xff, 0x1006c31ff\nlea     rdx, [rbp+var_2F]                                              ; +0x101, 0x1006c3201\nmov     rdi, r15                                                       ; +0x105, 0x1006c3205\nmov     rsi, r14                                                       ; +0x108, 0x1006c3208\ncall    cocos2d__CCShaderCache__addProgram                             ; +0x10b, 0x1006c320b\ntest    [rbp+var_30], 1                                                ; +0x110, 0x1006c3210\njz      short loc_1006C321F                                            ; +0x114, 0x1006c3214\nmov     rdi, [rbp+__p]; __p                                            ; +0x116, 0x1006c3216\ncall    __ZdlPv; operator delete(void *)                               ; +0x11a, 0x1006c321a\nmov     rdi, r14                                                       ; +0x11f, 0x1006c321f\ncall    cocos2d__CCObject__release                                     ; +0x122, 0x1006c3222\nmov     rax, [rbx]                                                     ; +0x127, 0x1006c3227\nmov     rdi, rbx                                                       ; +0x12a, 0x1006c322a\nmov     rsi, r14                                                       ; +0x12d, 0x1006c322d\ncall    qword ptr [rax+298h]                                           ; +0x130, 0x1006c3230\nmov     rax, [rbx]                                                     ; +0x136, 0x1006c3236\nmov     rdi, rbx                                                       ; +0x139, 0x1006c3239\ncall    qword ptr [rax+290h]                                           ; +0x13c, 0x1006c323c\nmov     edi, [rax+38h]; program                                        ; +0x142, 0x1006c3242\nlea     rsi, aUHue; \"u_hue\"                                            ; +0x145, 0x1006c3245\ncall    _glGetUniformLocation                                          ; +0x14c, 0x1006c324c\nmov     [rbx+288h], eax                                                ; +0x151, 0x1006c3251\nmov     rax, [rbx]                                                     ; +0x157, 0x1006c3257\nmov     rdi, rbx                                                       ; +0x15a, 0x1006c325a\ncall    qword ptr [rax+290h]                                           ; +0x15d, 0x1006c325d\nmov     edi, [rax+38h]; program                                        ; +0x163, 0x1006c3263\nlea     rsi, aUAlpha; \"u_alpha\"                                        ; +0x166, 0x1006c3266\ncall    _glGetUniformLocation                                          ; +0x16d, 0x1006c326d\nmov     [rbx+28Ch], eax                                                ; +0x172, 0x1006c3272\nmov     rax, [rbx]                                                     ; +0x178, 0x1006c3278\nmov     rdi, rbx                                                       ; +0x17b, 0x1006c327b\ncall    qword ptr [rax+290h]                                           ; +0x17e, 0x1006c327e\nmov     edi, [rax+38h]; program                                        ; +0x184, 0x1006c3284\nlea     rsi, aULum; \"u_lum\"                                            ; +0x187, 0x1006c3287\ncall    _glGetUniformLocation                                          ; +0x18e, 0x1006c328e\nmov     [rbx+290h], eax                                                ; +0x193, 0x1006c3293\nmov     rax, [rbx]                                                     ; +0x199, 0x1006c3299\nmov     rdi, rbx                                                       ; +0x19c, 0x1006c329c\ncall    qword ptr [rax+4E8h]                                           ; +0x19f, 0x1006c329f\nadd     rsp, 18h                                                       ; +0x1a5, 0x1006c32a5\npop     rbx                                                            ; +0x1a9, 0x1006c32a9\npop     r14                                                            ; +0x1aa, 0x1006c32aa\npop     r15                                                            ; +0x1ac, 0x1006c32ac\npop     rbp                                                            ; +0x1ae, 0x1006c32ae\nretn                                                                   ; +0x1af, 0x1006c32af", "xrefs": ["sub_1006C2EB0 @ 0x1006c2f3f", "CCSpriteWithHue::initWithTexture @ 0x1006c30c5", "sub_1006C40B0 @ 0x1006c413f"], "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"}