//
// CCSpriteWithHue::initShader from 0x1001a36a8 to 0x1001a3834 (396 bytes)
//
// 1 xrefs:
// > CCSpriteWithHue::initWithTexture @ 0x1001a3694
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall CCSpriteWithHue::initShader(CCSpriteWithHue *a1)
{
cocos2d::CCShaderCache *v2; // x20
void **v3; // x1
cocos2d::CCGLProgram *v4; // x0
cocos2d::CCGLProgram *v5; // x20
double v6; // d0
const char *v7; // x21
const char *v8; // x0
cocos2d::CCShaderCache *v9; // x21
void **v10; // x2
void *__p[2]; // [xsp+8h] [xbp-38h] BYREF
char v12; // [xsp+1Fh] [xbp-21h]
v2 = cocos2d::CCShaderCache::sharedShaderCache();
((void (__fastcall *)(void **__return_ptr, CCSpriteWithHue *))a1->getShaderName)(__p, a1);
if ( v12 >= 0 )
v3 = __p;
else
v3 = (void **)__p[0];
v4 = cocos2d::CCShaderCache::programForKey(v2, (const char *)v3);
v5 = v4;
if ( v12 < 0 )
{
operator delete(__p[0]);
if ( v5 )
goto LABEL_14;
}
else if ( v4 )
{
goto LABEL_14;
}
v5 = (cocos2d::CCGLProgram *)operator new(0x78u);
v6 = cocos2d::CCGLProgram::CCGLProgram((__int64)v5);
v7 = off_10084C1B0[0];
v8 = (const char *)((__int64 (__fastcall *)(CCSpriteWithHue *, double))a1->shaderBody)(a1, v6);
cocos2d::CCGLProgram::initWithVertexShaderByteArray(v5, v7, v8);
cocos2d::CCGLProgram::addAttribute(v5, "a_position", 0);
cocos2d::CCGLProgram::addAttribute(v5, "a_color", 1u);
cocos2d::CCGLProgram::addAttribute(v5, "a_texCoord", 2u);
cocos2d::CCGLProgram::link(v5);
cocos2d::CCGLProgram::updateUniforms(v5);
v9 = cocos2d::CCShaderCache::sharedShaderCache();
((void (__fastcall *)(void **__return_ptr, CCSpriteWithHue *))a1->getShaderName)(__p, a1);
if ( v12 >= 0 )
v10 = __p;
else
v10 = (void **)__p[0];
cocos2d::CCShaderCache::addProgram(v9, v5, (const char *)v10);
if ( v12 < 0 )
operator delete(__p[0]);
cocos2d::CCObject::release(v5);
LABEL_14:
((void (__fastcall *)(CCSpriteWithHue *, cocos2d::CCGLProgram *))a1->setShaderProgram)(a1, v5);
CCSpriteWithHue::getUniformLocations(a1);
((void (__fastcall *)(CCSpriteWithHue *))a1->updateColor)(a1);
}