//
// ShaderLayer::preChromaticShader from 0x9f553c to 0x9f5650 (276 bytes)
//
// 2 xrefs:
// > ShaderLayer::performCalculations @ 0x9f7c88
// > ??> @ 0x42078
//
// 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 ShaderLayer::preChromaticShader(ShaderLayer *a1)
{
GJBaseGameLayer *m_gameLayer; // x0
float v3; // s10
float m_scaleFactor; // s2
float v5; // s8
float v6; // s9
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;
}
if ( a1->m_state.m_chromaticRelative && (m_gameLayer = a1->m_gameLayer) != nullptr )
v3 = fabsf(m_gameLayer->m_objectLayer->getScale(m_gameLayer->m_objectLayer));
else
v3 = 1.0;
m_scaleFactor = a1->m_scaleFactor;
v5 = (float)(m_scaleFactor / 1.2019) / a1->m_targetTextureSize.height;
v6 = (float)(m_scaleFactor / 1.2019) / a1->m_targetTextureSize.width;
v7 = a1->m_sprite->getShaderProgram(a1->m_sprite);
cocos2d::CCGLProgram::setUniformLocationWith1f(
v7,
a1->m_chromaticXOffUniform,
v3 * (float)((float)(v6 * a1->m_state.m_chromaticTargetX) * a1->m_state.m_textureScaleX));
v8 = a1->m_sprite->getShaderProgram(a1->m_sprite);
cocos2d::CCGLProgram::setUniformLocationWith1f(
v8,
a1->m_chromaticYOffUniform,
v3 * (float)((float)(v5 * a1->m_state.m_chromaticTargetY) * a1->m_state.m_textureScaleY));
}