//
// CCSpriteWithHue::initShader from 0x3f2f40 to 0x3f3054 (276 bytes)
//
// 1 xrefs:
// > CCSpriteWithHue::initWithTexture @ 0x3f30bc
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:47:15 +0000
//
int __fastcall CCSpriteWithHue::initShader(CCSpriteWithHue *this, int a2, char *a3, int a4)
{
cocos2d::CCShaderCache *v5; // r4
char *v6; // r1
cocos2d::CCGLProgram *v7; // r4
const char *v8; // r8
const char *v9; // r0
cocos2d::CCShaderCache *updated; // r0
cocos2d::CCShaderCache *v11; // r8
char *v12; // r2
_DWORD v14[2]; // [sp+0h] [bp-10h] BYREF
char *v15; // [sp+8h] [bp-8h]
int v16; // [sp+Ch] [bp-4h]
v14[0] = this;
v14[1] = a2;
v15 = a3;
v16 = a4;
v5 = (cocos2d::CCShaderCache *)cocos2d::CCShaderCache::sharedShaderCache(this);
(*(void (__fastcall **)(_DWORD *, CCSpriteWithHue *))(*(_DWORD *)this + 620))(v14, this);
if ( (v14[0] & 1) != 0 )
v6 = v15;
else
v6 = (char *)v14 + 1;
v7 = (cocos2d::CCGLProgram *)cocos2d::CCShaderCache::programForKey(v5, v6);
std::string::~string((int)v14);
if ( !v7 )
{
v7 = (cocos2d::CCGLProgram *)operator new(0x68u);
cocos2d::CCGLProgram::CCGLProgram(v7);
v8 = cocos2d::ccPositionTextureColor_vert[0];
v9 = (const char *)(*(int (__fastcall **)(CCSpriteWithHue *))(*(_DWORD *)this + 624))(this);
cocos2d::CCGLProgram::initWithVertexShaderByteArray(v7, v8, v9);
cocos2d::CCGLProgram::addAttribute(v7, "a_position", 0);
cocos2d::CCGLProgram::addAttribute(v7, "a_color", 1u);
cocos2d::CCGLProgram::addAttribute(v7, "a_texCoord", 2u);
cocos2d::CCGLProgram::link(v7);
updated = (cocos2d::CCShaderCache *)cocos2d::CCGLProgram::updateUniforms(v7);
v11 = (cocos2d::CCShaderCache *)cocos2d::CCShaderCache::sharedShaderCache(updated);
(*(void (__fastcall **)(_DWORD *, CCSpriteWithHue *))(*(_DWORD *)this + 620))(v14, this);
if ( (v14[0] & 1) != 0 )
v12 = v15;
else
v12 = (char *)v14 + 1;
cocos2d::CCShaderCache::addProgram(v11, v7, v12);
std::string::~string((int)v14);
cocos2d::CCObject::release(v7);
}
(*(void (__fastcall **)(CCSpriteWithHue *, cocos2d::CCGLProgram *))(*(_DWORD *)this + 332))(this, v7);
CCSpriteWithHue::getUniformLocations(this);
return (*(int (__fastcall **)(CCSpriteWithHue *))(*(_DWORD *)this + 628))(this);
}