//
// ShaderLayer::preChromaticShader from 0x100271150 to 0x10027125c (268 bytes)
//
// 1 xrefs:
// > ShaderLayer::performCalculations @ 0x100273148
//
// 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 ShaderLayer::preChromaticShader(ShaderLayer *a1)
{
float v2; // s8
GJBaseGameLayer *m_gameLayer; // x8
float v4; // s0
float v5; // s9
float v6; // s10
cocos2d::CCGLProgram *v7; // x0
cocos2d::CCGLProgram *v8; // x0
if ( a1->m_state.m_chromaticTargetX != 0.0
|| a1->m_state.m_chromaticTargetY != 0.0
|| cocos2d::CCNode::getActionByTag(a1, 1)
|| cocos2d::CCNode::getActionByTag(a1, 2) )
{
a1->m_state.m_usesShaders = 1;
}
v2 = 1.0;
if ( a1->m_state.m_chromaticRelative )
{
m_gameLayer = a1->m_gameLayer;
if ( m_gameLayer )
v2 = fabsf(((float (__fastcall *)(cocos2d::CCLayer *))m_gameLayer->m_objectLayer->getScale)(m_gameLayer->m_objectLayer));
}
v4 = a1->m_scaleFactor / *(float *)&dword_10086D7F0;
v5 = v4 / a1->m_targetTextureSize.width;
v6 = v4 / a1->m_targetTextureSize.height;
v7 = (cocos2d::CCGLProgram *)((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_sprite->getShaderProgram)(a1->m_sprite);
cocos2d::CCGLProgram::setUniformLocationWith1f(
v7,
a1->m_chromaticXOffUniform,
v2 * (float)((float)(v5 * a1->m_state.m_chromaticTargetX) * a1->m_state.m_textureScaleX));
v8 = (cocos2d::CCGLProgram *)((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_sprite->getShaderProgram)(a1->m_sprite);
cocos2d::CCGLProgram::setUniformLocationWith1f(
v8,
a1->m_chromaticYOffUniform,
v2 * (float)((float)(v6 * a1->m_state.m_chromaticTargetY) * a1->m_state.m_textureScaleY));
}